Additional change to 876fe70

Menu arrows now display on XP as well.
This commit is contained in:
Birunthan Mohanathas 2012-06-17 16:31:16 +03:00
parent f6dee2a657
commit 1d38698c7a
3 changed files with 45 additions and 26 deletions

View File

@ -79,16 +79,50 @@ void CDialog::SetDialogFont(HWND window)
EnumChildWindows(window, SetFontProc, (WPARAM)m_Font);
}
/*
** Callback for EnumChildWindows().
**
*/
BOOL CALLBACK CDialog::SetFontProc(HWND hWnd, LPARAM lParam)
{
SendMessage(hWnd, WM_SETFONT, (WPARAM)lParam, 0);
return TRUE;
}
/*
** Subclass button control to draw arrow on the right.
**
*/
void CDialog::SetMenuButton(HWND button)
{
SetWindowSubclass(button, MenuButtonProc, NULL, NULL);
}
LRESULT CALLBACK CDialog::MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{
switch (uMsg)
{
case WM_PAINT:
{
DefSubclassProc(hWnd, uMsg, wParam, lParam);
// Draw arrow on top of the button
HDC dc = GetDC(hWnd);
RECT buttonRect;
GetClientRect(hWnd, &buttonRect);
int arrowX = buttonRect.right - 18;
int arroyY = buttonRect.top + 4;
RECT arrowRect = { arrowX, arroyY, arrowX + 14, arroyY + 14 };
const WORD DFCS_MENUARROWDOWN = 0x0010; // Undocumented
DWORD drawFlags = DFCS_TRANSPARENT | DFCS_MENUARROWDOWN | (IsWindowEnabled(hWnd) ? 0 : DFCS_INACTIVE);
DrawFrameControl(dc, &arrowRect, DFC_MENU, drawFlags);
ReleaseDC(hWnd, dc);
return 0;
}
break;
}
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
}
/*
** Constructor.
**

View File

@ -59,12 +59,15 @@ protected:
void SetDialogFont(HWND window);
void SetDialogFont() { SetDialogFont(m_Window); }
static void SetMenuButton(HWND button);
HWND m_Window;
HFONT m_Font;
HFONT m_FontBold;
private:
static BOOL CALLBACK SetFontProc(HWND hWnd, LPARAM lParam);
static LRESULT CALLBACK MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData);
static HWND c_ActiveDialogWindow;
static HWND c_ActiveTabWindow;

View File

@ -334,11 +334,10 @@ void CDialogManage::CTabSkins::Initialize()
bsi.size.cy = 14;
HWND item = GetDlgItem(m_Window, IDC_MANAGESKINS_ACTIVESKINS_BUTTON);
if (CSystem::GetOSPlatform() >= OSPLATFORM_VISTA)
{
Button_SetStyle(item, BS_SPLITBUTTON, TRUE);
Button_SetSplitInfo(item, &bsi);
}
CDialog::SetMenuButton(item);
item = GetDlgItem(m_Window, IDC_MANAGESKINS_DISPLAYMONITOR_BUTTON);
CDialog::SetMenuButton(item);
// Load folder/.ini icons from shell32
HIMAGELIST hImageList = ImageList_Create(16, 16, ILC_COLOR32, 2, 10);
@ -359,13 +358,6 @@ void CDialogManage::CTabSkins::Initialize()
SetWindowLongPtr(item, GWL_EXSTYLE, GetWindowLongPtr(item, GWL_EXSTYLE) &~ WS_EX_CLIENTEDGE);
SetWindowPos(item, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER);
item = GetDlgItem(m_Window, IDC_MANAGESKINS_DISPLAYMONITOR_BUTTON);
if (CSystem::GetOSPlatform() >= OSPLATFORM_VISTA)
{
Button_SetStyle(item, BS_SPLITBUTTON, TRUE);
Button_SetSplitInfo(item, &bsi);
}
item = GetDlgItem(m_Window, IDC_MANAGESKINS_TRANSPARENCY_COMBOBOX);
ComboBox_AddString(item, L"0%");
ComboBox_AddString(item, L"10%");
@ -1308,16 +1300,6 @@ INT_PTR CDialogManage::CTabSkins::OnNotify(WPARAM wParam, LPARAM lParam)
}
break;
case BCN_DROPDOWN:
{
NMHDR* hdr = &((NMBCDROPDOWN*)lParam)->hdr;
// Unpush the drop-down button part and simulate click
Button_SetDropDownState(hdr->hwndFrom, FALSE);
SendMessage(hdr->hwndFrom, BM_CLICK, 0, 0);
}
break;
default:
return FALSE;
}