aboutsummaryrefslogtreecommitdiff
path: root/c/episodelistview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c/episodelistview.cpp')
-rw-r--r--c/episodelistview.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp
index c22b109..3ecaab1 100644
--- a/c/episodelistview.cpp
+++ b/c/episodelistview.cpp
@@ -12,23 +12,23 @@
#include "win.h"
EpisodeListView::EpisodeListView(const HWND hWndParent)
- : ListView(hWndParent, (HMENU)IDC_EPISODELISTVIEW, 0)
+ : ListView(hWndParent, reinterpret_cast<HMENU>(IDC_EPISODELISTVIEW), 0)
{
LVCOLUMN lvc;
lvc.mask = LVCF_WIDTH|LVCF_TEXT|LVCF_SUBITEM;
lvc.iSubItem = ELVSIEPISODE;
- lvc.pszText = (wchar_t*)L"#";
+ lvc.pszText = const_cast<wchar_t*>(L"#");
lvc.cx = Dpi(42);
ListView_InsertColumn(hWnd, ELVSIEPISODE, &lvc);
lvc.iSubItem = ELVSITITLE;
- lvc.pszText = (wchar_t*)L"Title";
+ lvc.pszText = const_cast<wchar_t*>(L"Title");
lvc.cx = 500;
ListView_InsertColumn(hWnd, ELVSITITLE, &lvc);
lvc.iSubItem = ELVSIRATING;
- lvc.pszText = (wchar_t*)L"/";
+ lvc.pszText = const_cast<wchar_t*>(L"/");
lvc.cx = Dpi(30);
ListView_InsertColumn(hWnd, ELVSIRATING, &lvc);
@@ -45,7 +45,7 @@ void EpisodeListView::EnsureFocusVisible()
LRESULT EpisodeListView::HandleNotify(const LPARAM lParam)
{
- const NMLISTVIEW* const nm = (NMLISTVIEW*)lParam;
+ const NMLISTVIEW* const nm = reinterpret_cast<NMLISTVIEW*>(lParam);
switch (nm->hdr.code) {
case LVN_ITEMCHANGED: /* Select/focus episode. */
@@ -67,7 +67,7 @@ LRESULT EpisodeListView::HandleNotify(const LPARAM lParam)
}
case LVN_KEYDOWN: /* Navigate episodes by keyboard. */
{
- const NMLVKEYDOWN *const nm = (NMLVKEYDOWN*)lParam;
+ const NMLVKEYDOWN *const nm = reinterpret_cast<NMLVKEYDOWN*>(lParam);
switch (nm->wVKey) {
case VK_LEFT:
SelectUnwatched(-1);
@@ -80,7 +80,7 @@ LRESULT EpisodeListView::HandleNotify(const LPARAM lParam)
}
case NM_CUSTOMDRAW: /* Make unwatched episodes bold. */
{
- const NMLVCUSTOMDRAW* const nm = (NMLVCUSTOMDRAW*)lParam;
+ const NMLVCUSTOMDRAW* const nm = reinterpret_cast<NMLVCUSTOMDRAW*>(lParam);
switch (nm->nmcd.dwDrawStage) {
case CDDS_PREPAINT:
return CDRF_NOTIFYITEMDRAW;
@@ -119,7 +119,7 @@ LRESULT EpisodeListView::HandleNotify(const LPARAM lParam)
const DWORD pos = GetMessagePos();
Require(TrackPopupMenu(g_hMenuPopup, TPM_RIGHTBUTTON,
LOWORD(pos), HIWORD(pos), 0,
- m_hWndParent, (const RECT*)NULL));
+ m_hWndParent, nullptr));
break;
}
}
@@ -129,7 +129,7 @@ LRESULT EpisodeListView::HandleNotify(const LPARAM lParam)
void EpisodeListView::Redraw()
{
- RedrawWindow(hWnd, NULL, NULL,
+ RedrawWindow(hWnd, nullptr, nullptr,
RDW_ERASE|RDW_FRAME|RDW_INVALIDATE|RDW_ALLCHILDREN);
}
@@ -230,17 +230,17 @@ void EpisodeListView::ShowFocus()
void EpisodeListView::Sort()
{
- ListView_SortItemsEx(hWnd, EpisodeListView::SortProc, (LPARAM)this);
+ ListView_SortItemsEx(hWnd, EpisodeListView::SortProc, reinterpret_cast<LPARAM>(this));
}
int CALLBACK EpisodeListView::SortProc(const LPARAM iItem1, const LPARAM iItem2, const LPARAM extra)
{
- EpisodeListView* const elv = (EpisodeListView*)extra;
+ EpisodeListView* const elv = reinterpret_cast<EpisodeListView*>(extra);
- LVITEM lvi1 = {LVIF_PARAM, (int)iItem1};
+ LVITEM lvi1 = {LVIF_PARAM, static_cast<int>(iItem1)};
if (!ListView_GetItem(elv->hWnd, &lvi1)) return 0;
- LVITEM lvi2 = {LVIF_PARAM, (int)iItem2};
+ LVITEM lvi2 = {LVIF_PARAM, static_cast<int>(iItem2)};
if (!ListView_GetItem(elv->hWnd, &lvi2)) return 0;
/* abs(m_iSortCol) is the 1-based index of the column to sort by.
@@ -395,7 +395,7 @@ void EpisodeListView::Update()
extern HWND g_hWndStatus;
wchar_t disp[16];
swprintf_s(disp, sizeof(disp)/sizeof(*disp), L"%d", cItem);
- SendMessage(g_hWndStatus, SB_SETTEXT, MAKEWPARAM(1,0), (LPARAM)disp);
+ SendMessage(g_hWndStatus, SB_SETTEXT, MAKEWPARAM(1,0), reinterpret_cast<LPARAM>(disp));
SendMessage(hWnd, WM_SETREDRAW, TRUE, 0);
}
@@ -411,7 +411,7 @@ void EpisodeListView::UpdateItem(const int iItem, const LPARAM lParam)
r: int rating;
if (!Pl("episode_data","episode_rating",lParam,&rating)) {
- ListView_SetItemText(hWnd, iItem, ELVSIRATING, (wchar_t*)L"");
+ ListView_SetItemText(hWnd, iItem, ELVSIRATING, const_cast<wchar_t*>(L""));
return;
}
@@ -432,8 +432,8 @@ LRESULT CALLBACK EpisodeListView::WndProc(const HWND hWnd, const UINT uMsg,
* handled by the NM_RETURN case in HandleNotify. */
const LRESULT lResult = CallWindowProc(m_proc0, hWnd, uMsg, wParam, lParam);
- if (lParam && ((MSG*)lParam)->message == WM_KEYDOWN
- && ((MSG*)lParam)->wParam == VK_RETURN)
+ MSG* const msg = reinterpret_cast<MSG*>(lParam);
+ if (lParam && msg->message == WM_KEYDOWN && msg->wParam == VK_RETURN)
return DLGC_WANTMESSAGE;
return lResult;
}