]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/toolbar.mm
Fix wrong tab order in wxAuiNotebook after dragging.
[wxWidgets.git] / src / osx / cocoa / toolbar.mm
index 41daeac737f5bc74971966136d2041fe287da297..5fa4bb5c5a4a65c221b09f56864506fdb525b585 100644 (file)
 
 #if wxUSE_TOOLBAR
 
 
 #if wxUSE_TOOLBAR
 
-#include "wx/toolbar.h"
-
 #ifndef WX_PRECOMP
     #include "wx/wx.h"
 #endif
 
 #ifndef WX_PRECOMP
     #include "wx/wx.h"
 #endif
 
+#include "wx/toolbar.h"
 #include "wx/app.h"
 #include "wx/osx/private.h"
 #include "wx/geometry.h"
 #include "wx/app.h"
 #include "wx/osx/private.h"
 #include "wx/geometry.h"
@@ -192,6 +191,10 @@ public:
         if ( IsButton() )
             [(NSButton*)m_controlHandle setTitle:l.AsNSString()];
 
         if ( IsButton() )
             [(NSButton*)m_controlHandle setTitle:l.AsNSString()];
 
+        if ( m_controlHandle )
+        {
+            [m_controlHandle setToolTip:sh.AsNSString()];
+        }
     }
 
     void Action()
     }
 
     void Action()
@@ -758,6 +761,41 @@ void wxToolBar::DoGetSize( int *width, int *height ) const
 #endif
 }
 
 #endif
 }
 
+void wxToolBar::DoGetPosition(int*x, int *y) const
+{
+#if wxOSX_USE_NATIVE_TOOLBAR
+    bool    ownToolbarInstalled;
+    
+    MacTopLevelHasNativeToolbar( &ownToolbarInstalled );
+    if ( ownToolbarInstalled )
+    {
+        WXWindow tlw = MacGetTopLevelWindowRef();
+        float toolbarHeight = 0.0;
+        NSRect windowFrame = NSMakeRect(0, 0, 0, 0);
+        
+        if(m_macToolbar && [(NSToolbar*)m_macToolbar isVisible])
+        {
+            windowFrame = [NSWindow contentRectForFrameRect:[tlw frame]
+                                                  styleMask:[tlw styleMask]];
+            toolbarHeight = NSHeight(windowFrame)
+            - NSHeight([[tlw contentView] frame]);
+        }
+        
+        // it is extending to the north of the content area
+        
+        if ( x != NULL )
+            *x = 0;
+        if ( y != NULL )
+            *y = -toolbarHeight;
+    }
+    else
+        wxToolBarBase::DoGetPosition( x, y );
+    
+#else
+    wxToolBarBase::DoGetPosition( x, y );
+#endif
+}
+
 wxSize wxToolBar::DoGetBestSize() const
 {
     // was updated in Realize()
 wxSize wxToolBar::DoGetBestSize() const
 {
     // was updated in Realize()
@@ -1190,6 +1228,9 @@ bool wxToolBar::Realize()
     SetInitialSize( wxSize(m_minWidth, m_minHeight));
 
     SendSizeEventToParent();
     SetInitialSize( wxSize(m_minWidth, m_minHeight));
 
     SendSizeEventToParent();
+    wxWindow * const parent = GetParent();
+    if ( parent && !parent->IsBeingDeleted() )
+        parent->MacOnInternalSize();
     
     return true;
 }
     
     return true;
 }
@@ -1387,7 +1428,9 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
 
                 wxNSToolBarButton* v = [[wxNSToolBarButton alloc] initWithFrame:toolrect];
 
 
                 wxNSToolBarButton* v = [[wxNSToolBarButton alloc] initWithFrame:toolrect];
 
-                [v setBezelStyle:NSRegularSquareBezelStyle];
+                [v setBezelStyle:NSSmallSquareBezelStyle];
+                [[v cell] setControlSize:NSSmallControlSize];
+                [v setFont:[NSFont fontWithName:[[v font] fontName] size:[NSFont systemFontSizeForControlSize:NSSmallControlSize]]];
                 [v setBordered:NO];
                 [v setButtonType: ( tool->CanBeToggled() ? NSToggleButton : NSMomentaryPushInButton )];
                 [v setImplementation:tool];
                 [v setBordered:NO];
                 [v setButtonType: ( tool->CanBeToggled() ? NSToggleButton : NSMomentaryPushInButton )];
                 [v setImplementation:tool];