]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/frame.cpp
wxItemContainerImmutable::FindString unified.
[wxWidgets.git] / src / mac / carbon / frame.cpp
index 756166a792274e259f70e181d9bfa3c938de079c..a009da920021a5420cec854c49e708bce635cf3a 100644 (file)
@@ -9,10 +9,6 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "frame.h"
-#endif
-
 #include "wx/wxprec.h"
 
 #include "wx/frame.h"
@@ -85,6 +81,33 @@ wxFrame::~wxFrame()
     DeleteAllBars();
 }
 
+// get the origin of the client area in the client coordinates
+wxPoint wxFrame::GetClientAreaOrigin() const
+{
+    wxPoint pt = wxTopLevelWindow::GetClientAreaOrigin();
+    
+#if wxUSE_TOOLBAR && !defined(__WXUNIVERSAL__)
+    wxToolBar *toolbar = GetToolBar();
+    if ( toolbar && toolbar->IsShown() )
+    {
+        int w, h;
+        toolbar->GetSize(&w, &h);
+        
+        if ( toolbar->GetWindowStyleFlag() & wxTB_VERTICAL )
+        {
+            pt.x += w;
+        }
+        else
+        {
+#if !wxMAC_USE_NATIVE_TOOLBAR
+            pt.y += h;
+#endif
+        }
+    }
+#endif // wxUSE_TOOLBAR
+    
+    return pt;
+}
 
 bool wxFrame::Enable(bool enable)
 {
@@ -243,7 +266,9 @@ void wxFrame::DoGetClientSize(int *x, int *y) const
         }
         else
         {
+#if !wxMAC_USE_NATIVE_TOOLBAR
             if ( y )  *y -= h;
+#endif
         }
     }
 #endif // wxUSE_TOOLBAR
@@ -288,6 +313,23 @@ void wxFrame::DoSetClientSize(int clientwidth, int clientheight)
 
 
 #if wxUSE_TOOLBAR
+void wxFrame::SetToolBar(wxToolBar *toolbar)
+{
+    if ( m_frameToolBar == toolbar )
+        return ;
+    
+#if wxMAC_USE_NATIVE_TOOLBAR
+    if ( m_frameToolBar )
+        m_frameToolBar->MacInstallNativeToolbar(false) ;
+#endif
+    
+    m_frameToolBar = toolbar ;
+#if wxMAC_USE_NATIVE_TOOLBAR
+    if ( toolbar )
+        toolbar->MacInstallNativeToolbar( true ) ;
+#endif
+}
+
 wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
 {
     if ( wxFrameBase::CreateToolBar(style, id, name) )
@@ -326,8 +368,10 @@ void wxFrame::PositionToolBar()
         }
         else
         {
+#if !wxMAC_USE_NATIVE_TOOLBAR
             // Use the 'real' position
             GetToolBar()->SetSize(tx , ty , cw , th, wxSIZE_NO_ADJUSTMENTS );
+#endif
         }
     }
 }