// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
-// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
{
}
-IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
-
wxMenuItem::wxMenuItem(wxMenu *pParentMenu,
int id,
const wxString& t,
// In other languages there is no difference in naming the Exit/Quit menu item between MacOS and Windows guidelines
// therefore these item must not be translated
- if ( wxStripMenuCodes(m_text).Upper() == wxT("EXIT") )
- m_text = wxT("Quit\tCtrl+Q") ;
+ if (pParentMenu != NULL && !pParentMenu->GetNoEventsMode())
+ if ( wxStripMenuCodes(m_text).Upper() == wxT("EXIT") )
+ m_text = wxT("Quit\tCtrl+Q") ;
m_radioGroup.start = -1;
m_isRadioGroupStart = false;
- wxString text = wxStripMenuCodes(m_text);
+ wxString text = wxStripMenuCodes(m_text, (pParentMenu != NULL && pParentMenu->GetNoEventsMode()) ? wxStrip_Accel : wxStrip_All);
if (text.IsEmpty() && !IsSeparator())
{
wxASSERT_MSG(wxIsStockID(GetId()), wxT("A non-stock menu item with an empty label?"));
if ( !m_parentMenu )
return;
- if ( m_bitmap.Ok() )
+ if ( m_bitmap.IsOk() )
{
- m_peer->SetBitmap( m_bitmap );
+ GetPeer()->SetBitmap( m_bitmap );
}
}
return ;
if ( IsCheckable() && IsChecked() )
- m_peer->Check( true );
+ GetPeer()->Check( true );
else
- m_peer->Check( false );
+ GetPeer()->Check( false );
- m_peer->Enable( IsEnabled() );
+ GetPeer()->Enable( IsEnabled() );
}
void wxMenuItem::UpdateItemText()
if ( !m_parentMenu )
return ;
- wxString text = wxStripMenuCodes(m_text);
+ wxString text = wxStripMenuCodes(m_text, m_parentMenu != NULL && m_parentMenu->GetNoEventsMode() ? wxStrip_Accel : wxStrip_All);
if (text.IsEmpty() && !IsSeparator())
{
wxASSERT_MSG(wxIsStockID(GetId()), wxT("A non-stock menu item with an empty label?"));
}
wxAcceleratorEntry *entry = wxAcceleratorEntry::Create( m_text ) ;
- m_peer->SetLabel( text, entry );
+ GetPeer()->SetLabel( text, entry );
delete entry ;
}
// radio group stuff
// -----------------
-void wxMenuItem::SetAsRadioGroupStart()
+void wxMenuItem::SetAsRadioGroupStart(bool start)
{
- m_isRadioGroupStart = true;
+ m_isRadioGroupStart = start;
}
void wxMenuItem::SetRadioGroupStart(int start)
m_radioGroup.end = end;
}
+bool wxMenuItem::IsRadioGroupStart() const
+{
+ return m_isRadioGroupStart;
+}
+
+int wxMenuItem::GetRadioGroupStart() const
+{
+ wxASSERT_MSG( !m_isRadioGroupStart,
+ wxS("shouldn't be called for the first radio item") );
+
+ return m_radioGroup.start;
+}
+
+int wxMenuItem::GetRadioGroupEnd() const
+{
+ wxASSERT_MSG( m_isRadioGroupStart,
+ wxS("shouldn't be called for the first radio item") );
+
+ return m_radioGroup.end;
+}
+
// ----------------------------------------------------------------------------
// wxMenuItemBase
// ----------------------------------------------------------------------------