Cosmetics

This commit is contained in:
Birunthan Mohanathas 2012-06-23 22:17:16 +03:00
parent 695710fdbd
commit 2117bcfbd5

View File

@ -91,12 +91,12 @@ void CDialog::SetMenuButton(HWND button)
LRESULT CALLBACK CDialog::MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) LRESULT CALLBACK CDialog::MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{ {
LRESULT result = DefSubclassProc(hWnd, uMsg, wParam, lParam);
switch (uMsg) switch (uMsg)
{ {
case WM_PAINT: case WM_PAINT:
{ {
LRESULT result = DefSubclassProc(hWnd, uMsg, wParam, lParam);
// Draw arrow on top of the button // Draw arrow on top of the button
RECT buttonRect; RECT buttonRect;
GetClientRect(hWnd, &buttonRect); GetClientRect(hWnd, &buttonRect);
@ -109,17 +109,30 @@ LRESULT CALLBACK CDialog::MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
DWORD drawFlags = DFCS_TRANSPARENT | DFCS_MENUARROWDOWN | (IsWindowEnabled(hWnd) ? 0 : DFCS_INACTIVE); DWORD drawFlags = DFCS_TRANSPARENT | DFCS_MENUARROWDOWN | (IsWindowEnabled(hWnd) ? 0 : DFCS_INACTIVE);
DrawFrameControl(dc, &arrowRect, DFC_MENU, drawFlags); DrawFrameControl(dc, &arrowRect, DFC_MENU, drawFlags);
ReleaseDC(hWnd, dc); ReleaseDC(hWnd, dc);
return result;
} }
break; break;
case WM_GETTEXT:
{
// Append 3 spaces to the button text to move text to the left so
// that it looks better with BS_CENTER.
WCHAR* str = (WCHAR*)lParam + result;
str[0] = str[1] = str[2] = L' ';
str[3] = '\0';
result += 3;
}
break;
case WM_GETTEXTLENGTH:
result += 3;
break;
case WM_NCDESTROY: case WM_NCDESTROY:
RemoveWindowSubclass(hWnd, MenuButtonProc, uIdSubclass); RemoveWindowSubclass(hWnd, MenuButtonProc, uIdSubclass);
break; break;
} }
return DefSubclassProc(hWnd, uMsg, wParam, lParam); return result;
} }
/* /*