]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/framecmn.cpp
setting and restoring the graf port
[wxWidgets.git] / src / common / framecmn.cpp
index 55ce182110342e95c670bb939ae91da370f67ebb..7b067ddf0dda3d3585e91b4b4e72623a57089a29 100644 (file)
@@ -148,12 +148,13 @@ wxPoint wxFrameBase::GetClientAreaOrigin() const
     wxPoint pt = wxTopLevelWindow::GetClientAreaOrigin();
 
 #if wxUSE_TOOLBAR
     wxPoint pt = wxTopLevelWindow::GetClientAreaOrigin();
 
 #if wxUSE_TOOLBAR
-    if ( GetToolBar() && GetToolBar()->IsShown() )
+    wxToolBar *toolbar = GetToolBar();
+    if ( toolbar && toolbar->IsShown() )
     {
         int w, h;
     {
         int w, h;
-        GetToolBar()->GetSize(& w, & h);
+        toolbar->GetSize(&w, &h);
 
 
-        if ( GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL )
+        if ( toolbar->GetWindowStyleFlag() & wxTB_VERTICAL )
         {
             pt.x += w;
         }
         {
             pt.x += w;
         }
@@ -182,12 +183,17 @@ bool wxFrameBase::ProcessCommand(int id)
     commandEvent.SetEventObject(this);
 
     wxMenuItem *item = bar->FindItem(id);
     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);
     }
 
     return GetEventHandler()->ProcessEvent(commandEvent);