]> git.saurik.com Git - wxWidgets.git/commitdiff
Added TREE_ITEM_MENU event that gets sent if the
authorRobert Roebling <robert@roebling.de>
Sun, 26 Dec 2004 17:37:59 +0000 (17:37 +0000)
committerRobert Roebling <robert@roebling.de>
Sun, 26 Dec 2004 17:37:59 +0000 (17:37 +0000)
   user hits the "Menu" key on the newer keyboards.
   So far generic control only.

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

docs/latex/wx/treectrl.tex
include/wx/treebase.h
src/common/treebase.cpp
src/generic/treectlg.cpp

index 2d00ee1eed29dec660aa67bc5ee40468ea42fc05..44c52544c933eb1a10628dd7705ad6e20fb88e51 100644 (file)
@@ -93,6 +93,7 @@ functions that take a \helpref{wxTreeEvent}{wxtreeevent} argument.
 \twocolitem{{\bf EVT\_TREE\_KEY\_DOWN(id, func)}}{A key has been pressed.}
 \twocolitem{{\bf EVT\_TREE\_ITEM\_GETTOOLTIP(id, func)}}{The opportunity to set the item tooltip
 is being given to the application (call wxTreeEvent::SetToolTip). Windows only.}
 \twocolitem{{\bf EVT\_TREE\_KEY\_DOWN(id, func)}}{A key has been pressed.}
 \twocolitem{{\bf EVT\_TREE\_ITEM\_GETTOOLTIP(id, func)}}{The opportunity to set the item tooltip
 is being given to the application (call wxTreeEvent::SetToolTip). Windows only.}
+\twocolitem{{\bf EVT\_TREE\_ITEM\_MENU(id, func)}}{The menu key has been pressed, asking for a context menu for the selected item.}
 \end{twocollist}
 
 \wxheading{See also}
 \end{twocollist}
 
 \wxheading{See also}
index 15944f047629becff3d709efb45bc3ad9dedab58..28ec4e527148b341563ae42437c3c3562477624d 100644 (file)
@@ -331,6 +331,7 @@ BEGIN_DECLARE_EVENT_TYPES()
     DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_END_DRAG, 617)
     DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK, 618)
     DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, 619)
     DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_END_DRAG, 617)
     DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK, 618)
     DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, 619)
+    DECLARE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_MENU, 620)
 END_DECLARE_EVENT_TYPES()
 
 // GetItem() returns the item being dragged, GetPoint() the mouse coords
 END_DECLARE_EVENT_TYPES()
 
 // GetItem() returns the item being dragged, GetPoint() the mouse coords
@@ -379,6 +380,9 @@ END_DECLARE_EVENT_TYPES()
 // GetItem() returns the item that was activated (double click, enter, space)
 #define EVT_TREE_ITEM_ACTIVATED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxTreeEventFunction, & fn ), NULL ),
 
 // GetItem() returns the item that was activated (double click, enter, space)
 #define EVT_TREE_ITEM_ACTIVATED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxTreeEventFunction, & fn ), NULL ),
 
+// GetItem() returns the item for which the context menu shall be shown
+#define EVT_TREE_ITEM_MENU(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TREE_ITEM_MENU, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxTreeEventFunction, & fn ), (wxObject *) NULL ),
+
 // GetItem() returns the item that was clicked on
 #define EVT_TREE_ITEM_RIGHT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxTreeEventFunction, & fn ), NULL ),
 #define EVT_TREE_ITEM_MIDDLE_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxTreeEventFunction, & fn ), NULL ),
 // GetItem() returns the item that was clicked on
 #define EVT_TREE_ITEM_RIGHT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxTreeEventFunction, & fn ), NULL ),
 #define EVT_TREE_ITEM_MIDDLE_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction)  wxStaticCastEvent( wxTreeEventFunction, & fn ), NULL ),
index 54b9c28d4ae1091c545761e889906da67176939f..d166c7d7056e55e8c06d441e746a2374450b7555 100644 (file)
@@ -63,6 +63,7 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_END_DRAG)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_END_DRAG)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK)
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TREE_ITEM_MENU)
 
 // ----------------------------------------------------------------------------
 // Tree event
 
 // ----------------------------------------------------------------------------
 // Tree event
index a75a6d718399eb2cf18d5c1862d6b43da83b8575..b27512a2427483d13499c55d58ed2735b7af1edf 100644 (file)
@@ -2653,6 +2653,14 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
             }
             break;
 
             }
             break;
 
+        case WXK_MENU:
+            {
+                wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_MENU, GetId() );
+                event.m_item = m_current;
+                event.SetEventObject( this );
+                GetEventHandler()->ProcessEvent( event );
+                break;
+            }
         case ' ':
         case WXK_RETURN:
             if ( !event.HasModifiers() )
         case ' ':
         case WXK_RETURN:
             if ( !event.HasModifiers() )