// headers
// ----------------------------------------------------------------------------
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "menubase.h"
#endif
m_isChecked = FALSE;
m_id = id;
m_kind = kind;
+ if (m_id == wxID_ANY)
+ m_id = wxNewId();
+ if (m_id == wxID_SEPARATOR)
+ m_kind = wxITEM_SEPARATOR;
}
wxMenuItemBase::~wxMenuItemBase()
// specified
wxAcceleratorEntry *wxGetAccelFromString(const wxString& label)
{
+ // wxPrintf( wxT("label %s\n"), label.c_str() );
+
// check for accelerators: they are given after '\t'
int posTab = label.Find(wxT('\t'));
if ( posTab != wxNOT_FOUND ) {
current.clear();
}
else {
- current += wxTolower(label[n]);
+ current += (wxChar) wxTolower(label[n]);
}
}
}
else {
// is it a function key?
- if ( current[0U] == 'f' && isdigit(current[1U]) &&
+ if ( current[0U] == 'f' && wxIsdigit(current[1U]) &&
(current.Len() == 2 ||
- (current.Len() == 3 && isdigit(current[2U]))) ) {
+ (current.Len() == 3 && wxIsdigit(current[2U]))) ) {
int n;
wxSscanf(current.c_str() + 1, wxT("%d"), &n);
keyCode = WXK_DELETE;
else if ( current == wxT("DELETE") )
keyCode = WXK_DELETE;
+ else if ( current == wxT("BACK") )
+ keyCode = WXK_BACK;
else if ( current == wxT("INS") )
keyCode = WXK_INSERT;
else if ( current == wxT("INSERT") )
#endif // wxUSE_ACCEL
+bool wxMenuBase::ms_locked = true;
+
// ----------------------------------------------------------------------------
// wxMenu ctor and dtor
// ----------------------------------------------------------------------------
wxMenuBase::~wxMenuBase()
{
WX_CLEAR_LIST(wxMenuItemList, m_items);
-
+
// Actually, in GTK, the submenus have to get deleted first.
}
submenu->SetParent((wxMenu *)this);
}
-bool wxMenuBase::DoAppend(wxMenuItem *item)
+wxMenuItem* wxMenuBase::DoAppend(wxMenuItem *item)
{
- wxCHECK_MSG( item, FALSE, wxT("invalid item in wxMenu::Append()") );
+ wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Append()") );
m_items.Append(item);
item->SetMenu((wxMenu*)this);
AddSubMenu(item->GetSubMenu());
}
- return TRUE;
+ return item;
}
-bool wxMenuBase::Insert(size_t pos, wxMenuItem *item)
+wxMenuItem* wxMenuBase::Insert(size_t pos, wxMenuItem *item)
{
- wxCHECK_MSG( item, FALSE, wxT("invalid item in wxMenu::Insert") );
+ wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Insert") );
if ( pos == GetMenuItemCount() )
{
}
}
-bool wxMenuBase::DoInsert(size_t pos, wxMenuItem *item)
+wxMenuItem* wxMenuBase::DoInsert(size_t pos, wxMenuItem *item)
{
- wxCHECK_MSG( item, FALSE, wxT("invalid item in wxMenu::Insert()") );
+ wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Insert()") );
wxMenuItemList::compatibility_iterator node = m_items.Item(pos);
wxCHECK_MSG( node, FALSE, wxT("invalid index in wxMenu::Insert()") );
AddSubMenu(item->GetSubMenu());
}
- return TRUE;
+ return item;
}
wxMenuItem *wxMenuBase::Remove(wxMenuItem *item)
// window will be used.
void wxMenuBase::UpdateUI(wxEvtHandler* source)
{
+ if (GetInvokingWindow())
+ {
+ // Don't update menus if the parent
+ // frame is about to get deleted
+ wxWindow *tlw = wxGetTopLevelParent( GetInvokingWindow() );
+ if (tlw && wxPendingDelete.Member(tlw))
+ return;
+ }
+
if ( !source && GetInvokingWindow() )
source = GetInvokingWindow()->GetEventHandler();
if ( !source )
wxCHECK_MSG( node, NULL, wxT("bad index in wxMenuBar::Remove()") );
wxMenu *menu = node->GetData();
- wxCHECK( node, NULL ); // unexpected
m_menus.Erase(node);
menu->Detach();