From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Sun, 7 Jan 2007 19:44:14 +0000 (+0000)
Subject: added EVT_TASKBAR_CLICK and use it to show taskbar icon menu on right button release... 
X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/9fcf8144d92ca5e0df8a148c520c7b33c0cf4901

added EVT_TASKBAR_CLICK and use it to show taskbar icon menu on right button release, not press, under MSW (bug 1623761)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44138 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---

diff --git a/docs/changes.txt b/docs/changes.txt
index 2d6c52227f..6352793634 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -103,6 +103,7 @@ All:
 wxMSW:
 
 - Fixed compilation with Borland C++ in Unicode mode but without MSLU
+- Show taskbar icon menu on right button release, not press
 
 wxGTK:
 
diff --git a/docs/latex/wx/taskbar.tex b/docs/latex/wx/taskbar.tex
index ddfd3c7a4f..ce5a5dfe37 100644
--- a/docs/latex/wx/taskbar.tex
+++ b/docs/latex/wx/taskbar.tex
@@ -51,6 +51,10 @@ wxEVT\_TASKBAR\_RIGHT\_UP event.}
 wxEVT\_TASKBAR\_LEFT\_DCLICK event.}
 \twocolitem{{\bf EVT\_TASKBAR\_RIGHT\_DCLICK(func)}}{Process a
 wxEVT\_TASKBAR\_RIGHT\_DCLICK event.}
+\twocolitem{{\bf EVT\_TASKBAR\_CLICK(func)}}{This is a synonym for either
+EVT\_TASKBAR\_RIGHT\_DOWN or UP depending on the platform, use this event macro
+to catch the event which should result in the menu being displayed on the
+current platform.}
 \end{twocollist}%
 
 \latexignore{\rtfignore{\wxheading{Members}}}
diff --git a/include/wx/taskbar.h b/include/wx/taskbar.h
index 1992d92eb9..c7763b3b83 100644
--- a/include/wx/taskbar.h
+++ b/include/wx/taskbar.h
@@ -109,8 +109,16 @@ END_DECLARE_EVENT_TYPES()
 #define EVT_TASKBAR_LEFT_DCLICK(fn)  wx__DECLARE_TASKBAREVT(LEFT_DCLICK, fn)
 #define EVT_TASKBAR_RIGHT_DCLICK(fn) wx__DECLARE_TASKBAREVT(RIGHT_DCLICK, fn)
 
+// taskbar menu is shown on right button press under all platforms except MSW
+// where it's shown on right button release, using this event type and macro
+// allows to write code which works correctly on all platforms
+#ifdef __WXMSW__
+    #define wxEVT_TASKBAR_CLICK wxEVT_TASKBAR_RIGHT_UP
+#else
+    #define wxEVT_TASKBAR_CLICK wxEVT_TASKBAR_RIGHT_DOWN
 #endif
-    // wxHAS_TASK_BAR_ICON
+#define EVT_TASKBAR_CLICK(fn)        wx__DECLARE_TASKBAREVT(CLICK, fn)
 
-#endif
-    // _WX_TASKBAR_H_BASE_
+#endif // wxHAS_TASK_BAR_ICON
+
+#endif // _WX_TASKBAR_H_BASE_
diff --git a/src/common/taskbarcmn.cpp b/src/common/taskbarcmn.cpp
index ad25c102e4..08a5c86116 100644
--- a/src/common/taskbarcmn.cpp
+++ b/src/common/taskbarcmn.cpp
@@ -38,7 +38,7 @@ DEFINE_EVENT_TYPE( wxEVT_TASKBAR_RIGHT_DCLICK )
 
 
 BEGIN_EVENT_TABLE(wxTaskBarIconBase, wxEvtHandler)
-    EVT_TASKBAR_RIGHT_DOWN(wxTaskBarIconBase::OnRightButtonDown)
+    EVT_TASKBAR_CLICK(wxTaskBarIconBase::OnRightButtonDown)
 END_EVENT_TABLE()
 
 void wxTaskBarIconBase::OnRightButtonDown(wxTaskBarIconEvent& WXUNUSED(event))