m_style = style;
m_clientData = (void *)NULL;
m_eventHandler = this;
-
-#if wxUSE_MENU_CALLBACK
- m_callback = (wxFunction) NULL;
-#endif // wxUSE_MENU_CALLBACK
}
wxMenuBase::~wxMenuBase()
// find by position
wxMenuItem* wxMenuBase::FindItemByPosition(size_t position) const
{
- wxASSERT ( position > -1 && position < m_items.GetCount() );
- if ( position > -1 && position < m_items.GetCount() )
- return m_items.Item( position )->GetData();
- else
- return NULL;
+ wxCHECK_MSG( position < m_items.GetCount(), NULL,
+ _T("wxMenu::FindItemByPosition(): invalid menu index") );
+
+ return m_items.Item( position )->GetData();
}
// ----------------------------------------------------------------------------
if ( source->ProcessEvent(event) )
{
- // if anything changed, update the chanegd attribute
+ // if anything changed, update the changed attribute
if (event.GetSetText())
SetLabel(id, event.GetText());
if (event.GetSetChecked())
if ( item->GetSubMenu() )
item->GetSubMenu()->UpdateUI(source);
}
- //else: item is a separator (which don't process update UI events)
+ //else: item is a separator (which doesn't process update UI events)
node = node->GetNext();
}
bool processed = FALSE;
-#if wxUSE_MENU_CALLBACK
- // Try a callback
- if (m_callback)
- {
- (void)(*(m_callback))(*this, event);
- processed = TRUE;
- }
-#endif // wxUSE_MENU_CALLBACK
-
// Try the menu's event handler
if ( !processed )
{