]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wincmn.cpp
Added wxVariantData::Clone and wxVariant::Unshare
[wxWidgets.git] / src / common / wincmn.cpp
index 307f2c1c640200262486557dbbb17fec493e2ea5..200adf03afec71175f4394db66c00d22f70a0901 100644 (file)
@@ -78,9 +78,6 @@
     #else
         #include <gtk/gtkfeatures.h>
     #endif
-    extern const unsigned int gtk_major_version;
-    extern const unsigned int gtk_minor_version;
-    extern const unsigned int gtk_micro_version;
 #endif
 
 #include "wx/platinfo.h"
@@ -1131,8 +1128,6 @@ wxColour wxWindowBase::GetForegroundColour() const
     // logic is the same as above
     if ( !m_hasFgCol && !m_foregroundColour.Ok() )
     {
-        wxASSERT_MSG( !m_hasFgCol, _T("we have invalid explicit fg colour?") );
-
         wxColour colFg = GetDefaultAttributes().colFg;
 
         if ( !colFg.Ok() )
@@ -2238,6 +2233,47 @@ void wxWindowBase::OnInitDialog( wxInitDialogEvent &WXUNUSED(event) )
     UpdateWindowUI(wxUPDATE_UI_RECURSE);
 }
 
+// ----------------------------------------------------------------------------
+// menu-related functions
+// ----------------------------------------------------------------------------
+
+#if wxUSE_MENUS
+
+// this is used to pass the id of the selected item from the menu event handler
+// to the main function itself
+//
+// it's ok to use a global here as there can be at most one popup menu shown at
+// any time
+static int gs_popupMenuSelection = wxID_NONE;
+
+void wxWindowBase::InternalOnPopupMenu(wxCommandEvent& event)
+{
+    // store the id in a global variable where we'll retrieve it from later
+    gs_popupMenuSelection = event.GetId();
+}
+
+int
+wxWindowBase::DoGetPopupMenuSelectionFromUser(wxMenu& menu, int x, int y)
+{
+    gs_popupMenuSelection = wxID_NONE;
+
+    Connect(wxEVT_COMMAND_MENU_SELECTED,
+            wxCommandEventHandler(wxWindowBase::InternalOnPopupMenu),
+            NULL,
+            this);
+
+    PopupMenu(&menu, x, y);
+
+    Disconnect(wxEVT_COMMAND_MENU_SELECTED,
+               wxCommandEventHandler(wxWindowBase::InternalOnPopupMenu),
+               NULL,
+               this);
+
+    return gs_popupMenuSelection;
+}
+
+#endif // wxUSE_MENUS
+
 // methods for drawing the sizers in a visible way
 #ifdef __WXDEBUG__