X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a738f87caeafd5e51fc029a6228c540e942505b7..bb276f53fca627231b1e1f50550a314a5687650b:/src/gtk1/menu.cpp diff --git a/src/gtk1/menu.cpp b/src/gtk1/menu.cpp index cfd9427eb3..5d65aa257d 100644 --- a/src/gtk1/menu.cpp +++ b/src/gtk1/menu.cpp @@ -143,19 +143,19 @@ static void DoCommonMenuCallbackCode(wxMenu *menu, wxMenuEvent& event) wxWindow *win = menu->GetInvokingWindow(); if (win) - win->GetEventHandler()->ProcessEvent( event ); + win->HandleWindowEvent( event ); } extern "C" { -static void gtk_menu_open_callback( GtkWidget *widget, wxMenu *menu ) +static void gtk_menu_open_callback( GtkWidget *WXUNUSED(widget), wxMenu *menu ) { wxMenuEvent event(wxEVT_MENU_OPEN, -1, menu); DoCommonMenuCallbackCode(menu, event); } -static void gtk_menu_close_callback( GtkWidget *widget, wxMenuBar *menubar ) +static void gtk_menu_close_callback( GtkWidget *WXUNUSED(widget), wxMenuBar *menubar ) { if ( !menubar->GetMenuCount() ) { @@ -181,10 +181,10 @@ void wxMenuBar::Init(size_t n, wxMenu *menus[], const wxString titles[], long st // the parent window is known after wxFrame::SetMenu() m_needParent = false; m_style = style; - m_invokingWindow = (wxWindow*) NULL; + m_invokingWindow = NULL; - if (!PreCreation( (wxWindow*) NULL, wxDefaultPosition, wxDefaultSize ) || - !CreateBase( (wxWindow*) NULL, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("menubar") )) + if (!PreCreation( NULL, wxDefaultPosition, wxDefaultSize ) || + !CreateBase( NULL, -1, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("menubar") )) { wxFAIL_MSG( wxT("wxMenuBar creation failed") ); return; @@ -243,7 +243,7 @@ wxMenuBar::~wxMenuBar() static void wxMenubarUnsetInvokingWindow( wxMenu *menu, wxWindow *win ) { - menu->SetInvokingWindow( (wxWindow*) NULL ); + menu->SetInvokingWindow( NULL ); wxWindow *top_frame = win; while (top_frame->GetParent() && !(top_frame->IsTopLevel())) @@ -308,7 +308,7 @@ void wxMenuBar::SetInvokingWindow( wxWindow *win ) void wxMenuBar::UnsetInvokingWindow( wxWindow *win ) { - m_invokingWindow = (wxWindow*) NULL; + m_invokingWindow = NULL; wxWindow *top_frame = win; while (top_frame->GetParent() && !(top_frame->IsTopLevel())) top_frame = top_frame->GetParent(); @@ -410,7 +410,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title) wxMenu *menuOld = Remove(pos); if ( menuOld && !Insert(pos, menu, title) ) { - return (wxMenu*) NULL; + return NULL; } // either Insert() succeeded or Remove() failed and menuOld is NULL @@ -421,7 +421,7 @@ wxMenu *wxMenuBar::Remove(size_t pos) { wxMenu *menu = wxMenuBarBase::Remove(pos); if ( !menu ) - return (wxMenu*) NULL; + return NULL; gtk_menu_item_remove_submenu( GTK_MENU_ITEM(menu->m_owner) ); gtk_container_remove(GTK_CONTAINER(m_menubar), menu->m_owner); @@ -510,7 +510,7 @@ wxMenuItem* wxMenuBar::FindItem( int id, wxMenu **menuForItem ) const if ( menuForItem ) { - *menuForItem = result ? result->GetMenu() : (wxMenu *)NULL; + *menuForItem = result ? result->GetMenu() : NULL; } return result; @@ -632,7 +632,7 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu ) commandEvent.SetInt(item->IsChecked()); commandEvent.SetEventObject(menu); - frame->GetEventHandler()->ProcessEvent(commandEvent); + frame->HandleWindowEvent(commandEvent); } else { @@ -666,7 +666,7 @@ static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu ) return; wxWindow *win = menu->GetInvokingWindow(); - if (win) win->GetEventHandler()->ProcessEvent( event ); + if (win) win->HandleWindowEvent( event ); } } @@ -695,7 +695,7 @@ static void gtk_menu_nolight_callback( GtkWidget *widget, wxMenu *menu ) wxWindow *win = menu->GetInvokingWindow(); if (win) - win->GetEventHandler()->ProcessEvent( event ); + win->HandleWindowEvent( event ); } } @@ -740,8 +740,8 @@ wxMenuItem::wxMenuItem(wxMenu *parentMenu, void wxMenuItem::Init() { - m_labelWidget = (GtkWidget *) NULL; - m_menuItem = (GtkWidget *) NULL; + m_labelWidget = NULL; + m_menuItem = NULL; DoSetText(m_text); } @@ -751,47 +751,6 @@ wxMenuItem::~wxMenuItem() // don't delete menu items, the menus take care of that } -// return the menu item text without any menu accels -/* static */ -wxString wxMenuItemBase::GetLabelText(const wxString& text) -{ - // The argument to this function will now always be in wxWidgets standard label - // format, not GTK+ format, so we do what the other ports do. - - return wxStripMenuCodes(text); - -#if 0 - wxString label; - - for ( const wxChar *pc = text.c_str(); *pc; pc++ ) - { - if ( *pc == wxT('\t')) - break; - - if ( *pc == wxT('_') ) - { - // GTK 1.2 escapes "xxx_xxx" to "xxx__xxx" - pc++; - label += *pc; - continue; - } - - if ( (*pc == wxT('&')) && (*(pc+1) != wxT('&')) ) - { - // wxMSW escapes "&" - // "&" is doubled to indicate "&" instead of accelerator - continue; - } - - label += *pc; - } - - // wxPrintf( wxT("GetLabelText(): text %s label %s\n"), text.c_str(), label.c_str() ); - - return label; -#endif -} - wxString wxMenuItem::GetItemLabel() const { wxString label = wxConvertFromGTKToWXLabel(m_text); @@ -913,7 +872,7 @@ wxAcceleratorEntry *wxMenuItem::GetAccel() const if ( !GetHotKey() ) { // nothing - return (wxAcceleratorEntry *)NULL; + return NULL; } // accelerator parsing code looks for them after a TAB, so insert a dummy @@ -979,7 +938,7 @@ void wxMenu::Init() // our back by GTK+ e.g. when it is removed from menubar: gtk_widget_ref(m_menu); - m_owner = (GtkWidget*) NULL; + m_owner = NULL; // Tearoffs are entries, just like separators. So if we want this // menu to be a tear-off one, we just append a tearoff entry @@ -1030,7 +989,7 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos) } else if (mitem->GetBitmap().Ok()) { - text = mitem->wxMenuItembase::GetItemLabel(); + text = mitem->wxMenuItemBase::GetItemLabel(); const wxBitmap *bitmap = &mitem->GetBitmap(); // TODO @@ -1192,7 +1151,7 @@ wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item) wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) { if ( !wxMenuBase::DoRemove(item) ) - return (wxMenuItem *)NULL; + return NULL; // TODO: this code doesn't delete the item factory item and this seems // impossible as of GTK 1.2.6. @@ -1576,8 +1535,8 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y ) gtk_menu_popup( GTK_MENU(menu->m_menu), - (GtkWidget *) NULL, // parent menu shell - (GtkWidget *) NULL, // parent menu item + NULL, // parent menu shell + NULL, // parent menu item posfunc, // function to position it userdata, // client data 0, // button used to activate it