[3/3] comdlg32: Show open dropdown menu on button press.
Vincent Povirk
madewokherd at gmail.com
Thu Aug 27 11:38:35 CDT 2015
-------------- next part --------------
From c07889c75a8f75fe94eedeecb838ed9701600806 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Mon, 24 Aug 2015 14:51:10 -0500
Subject: [PATCH 3/3] comdlg32: Show open dropdown menu on button press.
---
dlls/comdlg32/itemdlg.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c
index 342d5fa..8a52d71 100644
--- a/dlls/comdlg32/itemdlg.c
+++ b/dlls/comdlg32/itemdlg.c
@@ -1822,6 +1822,25 @@ static void update_control_text(FileDialogImpl *This)
}
}
+static LRESULT CALLBACK dropdown_subclass_proc(HWND hwnd, UINT umessage, WPARAM wparam, LPARAM lparam)
+{
+ static const WCHAR prop_this[] = {'i','t','e','m','d','l','g','_','T','h','i','s',0};
+ static const WCHAR prop_oldwndproc[] = {'i','t','e','m','d','l','g','_','o','l','d','w','n','d','p','r','o','c',0};
+
+ if (umessage == WM_LBUTTONDOWN)
+ {
+ FileDialogImpl *This = (FileDialogImpl*)GetPropW(hwnd, prop_this);
+
+ SendMessageW(hwnd, BM_SETCHECK, BST_CHECKED, 0);
+ show_opendropdown(This);
+ SendMessageW(hwnd, BM_SETCHECK, BST_UNCHECKED, 0);
+
+ return 0;
+ }
+
+ return CallWindowProcW((WNDPROC)GetPropW(hwnd, prop_oldwndproc), hwnd, umessage, wparam, lparam);
+}
+
static LRESULT on_wm_initdialog(HWND hwnd, LPARAM lParam)
{
FileDialogImpl *This = (FileDialogImpl*)lParam;
@@ -1883,6 +1902,8 @@ static LRESULT on_wm_initdialog(HWND hwnd, LPARAM lParam)
LOGFONTW lfw, lfw_marlett;
HFONT dialog_font;
static const WCHAR marlett[] = {'M','a','r','l','e','t','t',0};
+ static const WCHAR prop_this[] = {'i','t','e','m','d','l','g','_','T','h','i','s',0};
+ static const WCHAR prop_oldwndproc[] = {'i','t','e','m','d','l','g','_','o','l','d','w','n','d','p','r','o','c',0};
dropdown_hwnd = GetDlgItem(This->dlg_hwnd, psh1);
@@ -1899,6 +1920,11 @@ static LRESULT on_wm_initdialog(HWND hwnd, LPARAM lParam)
This->hfont_opendropdown = CreateFontIndirectW(&lfw_marlett);
SendMessageW(dropdown_hwnd, WM_SETFONT, (LPARAM)This->hfont_opendropdown, 0);
+
+ /* Subclass button so we can handle LBUTTONDOWN */
+ SetPropW(dropdown_hwnd, prop_this, (HANDLE)This);
+ SetPropW(dropdown_hwnd, prop_oldwndproc,
+ (HANDLE)SetWindowLongPtrW(dropdown_hwnd, GWLP_WNDPROC, (LONG_PTR)dropdown_subclass_proc));
}
ctrl_container_reparent(This, This->dlg_hwnd);
--
2.1.4
More information about the wine-patches
mailing list