remove unused/unneeded menuitem cruft
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53811 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
9a2183c900
commit
aac7dbf3aa
@ -7,8 +7,8 @@
|
|||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef __GTKMENUITEMH__
|
#ifndef _WX_GTKMENUITEM_H_
|
||||||
#define __GTKMENUITEMH__
|
#define _WX_GTKMENUITEM_H_
|
||||||
|
|
||||||
#include "wx/bitmap.h"
|
#include "wx/bitmap.h"
|
||||||
|
|
||||||
@ -30,8 +30,8 @@ public:
|
|||||||
// implement base class virtuals
|
// implement base class virtuals
|
||||||
virtual void SetItemLabel( const wxString& str );
|
virtual void SetItemLabel( const wxString& str );
|
||||||
virtual wxString GetItemLabel() const;
|
virtual wxString GetItemLabel() const;
|
||||||
virtual void Enable( bool enable = TRUE );
|
virtual void Enable( bool enable = true );
|
||||||
virtual void Check( bool check = TRUE );
|
virtual void Check( bool check = true );
|
||||||
virtual bool IsChecked() const;
|
virtual bool IsChecked() const;
|
||||||
virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
|
virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
|
||||||
virtual const wxBitmap& GetBitmap() const { return m_bitmap; }
|
virtual const wxBitmap& GetBitmap() const { return m_bitmap; }
|
||||||
@ -43,11 +43,6 @@ public:
|
|||||||
// implementation
|
// implementation
|
||||||
void SetMenuItem(GtkWidget *menuItem) { m_menuItem = menuItem; }
|
void SetMenuItem(GtkWidget *menuItem) { m_menuItem = menuItem; }
|
||||||
GtkWidget *GetMenuItem() const { return m_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,
|
// splits given string in the label, doing & => _ translation, which is returned,
|
||||||
// and in the hotkey which is used to set given pointer
|
// and in the hotkey which is used to set given pointer
|
||||||
@ -77,10 +72,8 @@ private:
|
|||||||
wxBitmap m_bitmap; // Bitmap for menuitem, if any
|
wxBitmap m_bitmap; // Bitmap for menuitem, if any
|
||||||
|
|
||||||
GtkWidget *m_menuItem; // GtkMenuItem
|
GtkWidget *m_menuItem; // GtkMenuItem
|
||||||
GtkWidget* m_labelWidget; // Label widget
|
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuItem)
|
DECLARE_DYNAMIC_CLASS(wxMenuItem)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // _WX_GTKMENUITEM_H_
|
||||||
//__GTKMENUITEMH__
|
|
||||||
|
@ -623,7 +623,6 @@ wxMenuItem::wxMenuItem(wxMenu *parentMenu,
|
|||||||
|
|
||||||
void wxMenuItem::Init(const wxString& text)
|
void wxMenuItem::Init(const wxString& text)
|
||||||
{
|
{
|
||||||
m_labelWidget = (GtkWidget *) NULL;
|
|
||||||
m_menuItem = (GtkWidget *) NULL;
|
m_menuItem = (GtkWidget *) NULL;
|
||||||
|
|
||||||
DoSetText(text);
|
DoSetText(text);
|
||||||
@ -706,7 +705,7 @@ void wxMenuItem::SetItemLabel( const wxString& str )
|
|||||||
oldLabel.Replace(wxT("_"), wxT(""));
|
oldLabel.Replace(wxT("_"), wxT(""));
|
||||||
wxString label1 = wxStripMenuCodes(str);
|
wxString label1 = wxStripMenuCodes(str);
|
||||||
#if wxUSE_ACCEL
|
#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 <control>foo
|
wxCharBuffer oldbuf = wxGTK_CONV_SYS( GetGtkHotKey(*this) ); // and as <control>foo
|
||||||
#endif // wxUSE_ACCEL
|
#endif // wxUSE_ACCEL
|
||||||
|
|
||||||
@ -714,17 +713,11 @@ void wxMenuItem::SetItemLabel( const wxString& str )
|
|||||||
|
|
||||||
#if wxUSE_ACCEL
|
#if wxUSE_ACCEL
|
||||||
if (oldLabel == label1 &&
|
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;
|
return;
|
||||||
|
|
||||||
if (m_menuItem)
|
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:
|
// stock menu items can have empty labels:
|
||||||
wxString text = m_text;
|
wxString text = m_text;
|
||||||
if (text.IsEmpty() && !IsSeparator())
|
if (text.IsEmpty() && !IsSeparator())
|
||||||
@ -736,7 +729,8 @@ void wxMenuItem::SetItemLabel( const wxString& str )
|
|||||||
text = GTKProcessMenuItemLabel(text, NULL);
|
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
|
// 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
|
wxAcceleratorEntry *wxMenuItem::GetAccel() const
|
||||||
{
|
{
|
||||||
if ( !GetHotKey() )
|
if (m_hotKey.empty())
|
||||||
{
|
{
|
||||||
// nothing
|
// nothing
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -859,7 +853,7 @@ wxAcceleratorEntry *wxMenuItem::GetAccel() const
|
|||||||
// accelerator parsing code looks for them after a TAB, so insert a dummy
|
// accelerator parsing code looks for them after a TAB, so insert a dummy
|
||||||
// one here
|
// one here
|
||||||
wxString label;
|
wxString label;
|
||||||
label << wxT('\t') << GetHotKey();
|
label << wxT('\t') << m_hotKey;
|
||||||
|
|
||||||
return wxAcceleratorEntry::Create(label);
|
return wxAcceleratorEntry::Create(label);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user