]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wincmn.cpp
Skip the event to allow further child processing
[wxWidgets.git] / src / common / wincmn.cpp
index 13ccfb0e473255e084b9ab8a4b51c4e80a8d8a3c..90a8b02e9d7800ae08ebef400d6a3c2e8c7b4892 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__
 
@@ -2348,9 +2384,9 @@ void wxWindowBase::OnMiddleClick( wxMouseEvent& event )
         wxMessageBox(msg, _T("wxWidgets information"),
                      wxICON_INFORMATION | wxOK,
                      (wxWindow *)this);
+#endif // wxUSE_MSGDLG
     }
     else
-#endif // wxUSE_MSGDLG
     {
         event.Skip();
     }
@@ -2415,6 +2451,10 @@ wxBorder wxWindowBase::GetBorder(long flags) const
     {
         border = GetDefaultBorder();
     }
+    else if ( border == wxBORDER_THEME )
+    {
+        border = GetDefaultBorderForControl();
+    }
 
     return border;
 }
@@ -2631,6 +2671,7 @@ bool wxWindowBase::DoNavigateIn(int flags)
 {
 #ifdef wxHAS_NATIVE_TAB_TRAVERSAL
     // native code doesn't process our wxNavigationKeyEvents anyhow
+    wxUnusedVar(flags);
     return false;
 #else // !wxHAS_NATIVE_TAB_TRAVERSAL
     wxNavigationKeyEvent eventNav;