diff --git a/Library/Dialog.cpp b/Library/Dialog.cpp index 4d74c8dc..01c213ab 100644 --- a/Library/Dialog.cpp +++ b/Library/Dialog.cpp @@ -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. ** diff --git a/Library/Dialog.h b/Library/Dialog.h index 4f227e8e..9981bcf8 100644 --- a/Library/Dialog.h +++ b/Library/Dialog.h @@ -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; diff --git a/Library/DialogManage.cpp b/Library/DialogManage.cpp index b6fe5516..fee04fd3 100644 --- a/Library/DialogManage.cpp +++ b/Library/DialogManage.cpp @@ -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; }