X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7e0f753950f9c3fe004818b9d7ba733a22bd169d..a45f904dea79c37cfd02b001ff9006849e0041db:/src/common/wincmn.cpp diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 13ccfb0e47..90a8b02e9d 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -78,9 +78,6 @@ #else #include #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;