From: Paul Cornett Date: Thu, 29 May 2008 04:41:37 +0000 (+0000) Subject: remove unused/unneeded menuitem cruft X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/aac7dbf3aa68d419365cfeb1dcbacc467271e67c?ds=inline remove unused/unneeded menuitem cruft git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53811 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/gtk/menuitem.h b/include/wx/gtk/menuitem.h index d8cbbd1798..dbc24b2d88 100644 --- a/include/wx/gtk/menuitem.h +++ b/include/wx/gtk/menuitem.h @@ -7,8 +7,8 @@ // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// -#ifndef __GTKMENUITEMH__ -#define __GTKMENUITEMH__ +#ifndef _WX_GTKMENUITEM_H_ +#define _WX_GTKMENUITEM_H_ #include "wx/bitmap.h" @@ -30,8 +30,8 @@ public: // implement base class virtuals virtual void SetItemLabel( const wxString& str ); virtual wxString GetItemLabel() const; - virtual void Enable( bool enable = TRUE ); - virtual void Check( bool check = TRUE ); + virtual void Enable( bool enable = true ); + virtual void Check( bool check = true ); virtual bool IsChecked() const; virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } virtual const wxBitmap& GetBitmap() const { return m_bitmap; } @@ -43,11 +43,6 @@ public: // implementation void SetMenuItem(GtkWidget *menuItem) { m_menuItem = menuItem; } GtkWidget *GetMenuItem() const { return m_menuItem; } - GtkWidget *GetLabelWidget() const { return m_labelWidget; } - void SetLabelWidget(GtkWidget *labelWidget) { m_labelWidget = labelWidget; } - wxString GetFactoryPath() const; - - wxString GetHotKey() const { return m_hotKey; } // splits given string in the label, doing & => _ translation, which is returned, // and in the hotkey which is used to set given pointer @@ -77,10 +72,8 @@ private: wxBitmap m_bitmap; // Bitmap for menuitem, if any GtkWidget *m_menuItem; // GtkMenuItem - GtkWidget* m_labelWidget; // Label widget DECLARE_DYNAMIC_CLASS(wxMenuItem) }; -#endif - //__GTKMENUITEMH__ +#endif // _WX_GTKMENUITEM_H_ diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 153a5ce3d9..679ca87859 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -623,7 +623,6 @@ wxMenuItem::wxMenuItem(wxMenu *parentMenu, void wxMenuItem::Init(const wxString& text) { - m_labelWidget = (GtkWidget *) NULL; m_menuItem = (GtkWidget *) NULL; DoSetText(text); @@ -706,7 +705,7 @@ void wxMenuItem::SetItemLabel( const wxString& str ) oldLabel.Replace(wxT("_"), wxT("")); wxString label1 = wxStripMenuCodes(str); #if wxUSE_ACCEL - wxString oldhotkey = GetHotKey(); // Store the old hotkey in Ctrl-foo format + wxString oldhotkey = m_hotKey; // Store the old hotkey in Ctrl-foo format wxCharBuffer oldbuf = wxGTK_CONV_SYS( GetGtkHotKey(*this) ); // and as foo #endif // wxUSE_ACCEL @@ -714,17 +713,11 @@ void wxMenuItem::SetItemLabel( const wxString& str ) #if wxUSE_ACCEL if (oldLabel == label1 && - oldhotkey == GetHotKey()) // Make sure we can change a hotkey even if the label is unaltered + oldhotkey == m_hotKey) // Make sure we can change a hotkey even if the label is unaltered return; if (m_menuItem) { - GtkLabel *label; - if (m_labelWidget) - label = (GtkLabel*) m_labelWidget; - else - label = GTK_LABEL( GTK_BIN(m_menuItem)->child ); - // stock menu items can have empty labels: wxString text = m_text; if (text.IsEmpty() && !IsSeparator()) @@ -736,7 +729,8 @@ void wxMenuItem::SetItemLabel( const wxString& str ) text = GTKProcessMenuItemLabel(text, NULL); } - gtk_label_set_text_with_mnemonic( GTK_LABEL(label), wxGTK_CONV_SYS(text) ); + GtkLabel* label = GTK_LABEL(GTK_BIN(m_menuItem)->child); + gtk_label_set_text_with_mnemonic(label, wxGTK_CONV_SYS(text)); } // remove old accelerator from our parent's accelerator group, if present @@ -850,7 +844,7 @@ void wxMenuItem::DoSetText( const wxString& str ) wxAcceleratorEntry *wxMenuItem::GetAccel() const { - if ( !GetHotKey() ) + if (m_hotKey.empty()) { // nothing return NULL; @@ -859,7 +853,7 @@ wxAcceleratorEntry *wxMenuItem::GetAccel() const // accelerator parsing code looks for them after a TAB, so insert a dummy // one here wxString label; - label << wxT('\t') << GetHotKey(); + label << wxT('\t') << m_hotKey; return wxAcceleratorEntry::Create(label); }