Permalink
Browse files

Cosmetics

  • Loading branch information...
1 parent 695710f commit 2117bcfbd551a7eba794f09c8d3d90b2488cfc33 @poiru poiru committed Jun 23, 2012
Showing with 17 additions and 4 deletions.
  1. +17 −4 Library/Dialog.cpp
View
@@ -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 result = DefSubclassProc(hWnd, uMsg, wParam, lParam);
+
switch (uMsg)
{
case WM_PAINT:
{
- LRESULT result = DefSubclassProc(hWnd, uMsg, wParam, lParam);
-
// Draw arrow on top of the button
RECT 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);
DrawFrameControl(dc, &arrowRect, DFC_MENU, drawFlags);
ReleaseDC(hWnd, dc);
+ }
+ break;
- return result;
+ 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:
RemoveWindowSubclass(hWnd, MenuButtonProc, uIdSubclass);
break;
}
- return DefSubclassProc(hWnd, uMsg, wParam, lParam);
+ return result;
}
/*

0 comments on commit 2117bcf

Please sign in to comment.