wxPoint pt = wxTopLevelWindow::GetClientAreaOrigin();
#if wxUSE_TOOLBAR
- if ( GetToolBar() && GetToolBar()->IsShown() )
+ wxToolBar *toolbar = GetToolBar();
+ if ( toolbar && toolbar->IsShown() )
{
int w, h;
- GetToolBar()->GetSize(& w, & h);
+ toolbar->GetSize(&w, &h);
- if ( GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL )
+ if ( toolbar->GetWindowStyleFlag() & wxTB_VERTICAL )
{
pt.x += w;
}
commandEvent.SetEventObject(this);
wxMenuItem *item = bar->FindItem(id);
- if ( item && item->IsCheckable() )
+ if (item)
{
- item->Toggle();
+ if (!item->IsEnabled())
+ return TRUE;
- // use the new value
- commandEvent.SetInt(item->IsChecked());
+ if (item->IsCheckable())
+ {
+ item->Toggle();
+ // use the new value
+ commandEvent.SetInt(item->IsChecked());
+ }
}
return GetEventHandler()->ProcessEvent(commandEvent);