#if wxUSE_TOOLBAR
-#include "wx/toolbar.h"
-
#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"
if ( IsButton() )
[(NSButton*)m_controlHandle setTitle:l.AsNSString()];
+ if ( m_controlHandle )
+ {
+ [m_controlHandle setToolTip:sh.AsNSString()];
+ }
}
void Action()
#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()
NSString *nsItemId;
if (tool->GetStyle() == wxTOOL_STYLE_SEPARATOR)
{
- nsItemId = tool->IsStretchable() ? NSToolbarFlexibleSpaceItemIdentifier
- : NSToolbarSeparatorItemIdentifier;
+ if ( tool->IsStretchable() )
+ nsItemId = NSToolbarFlexibleSpaceItemIdentifier;
+ else
+ {
+ if ( UMAGetSystemVersion() < 0x1070 )
+ nsItemId = NSToolbarSeparatorItemIdentifier;
+ else
+ nsItemId = NSToolbarSpaceItemIdentifier;
+ }
}
else
{
SetInitialSize( wxSize(m_minWidth, m_minHeight));
SendSizeEventToParent();
+ wxWindow * const parent = GetParent();
+ if ( parent && !parent->IsBeingDeleted() )
+ parent->MacOnInternalSize();
return true;
}
#if wxOSX_USE_NATIVE_TOOLBAR
if (m_macToolbar != NULL)
{
- NSString * nsItemId = tool->IsStretchable() ? NSToolbarFlexibleSpaceItemIdentifier
- : NSToolbarSeparatorItemIdentifier;
+ NSString * nsItemId = nil;
+
+ if ( tool->IsStretchable() )
+ nsItemId = NSToolbarFlexibleSpaceItemIdentifier;
+ else
+ {
+ if ( UMAGetSystemVersion() < 0x1070 )
+ nsItemId = NSToolbarSeparatorItemIdentifier;
+ else
+ nsItemId = NSToolbarSpaceItemIdentifier;
+ }
+
NSToolbarItem* item = [[NSToolbarItem alloc] initWithItemIdentifier:nsItemId];
tool->SetToolbarItemRef( item );
}
[v setButtonType: ( tool->CanBeToggled() ? NSToggleButton : NSMomentaryPushInButton )];
[v setImplementation:tool];
- if ( style & wxTB_NOICONS )
- [v setImagePosition:NSNoImage];
- else if ( style & wxTB_TEXT )
- [v setImagePosition:NSImageAbove];
- else
- [v setImagePosition:NSImageOnly];
-
-
controlHandle = v;
#if wxOSX_USE_NATIVE_TOOLBAR
tool->SetControlHandle( controlHandle );
tool->UpdateImages();
tool->UpdateLabel();
+
+ if ( style & wxTB_NOICONS )
+ [v setImagePosition:NSNoImage];
+ else if ( style & wxTB_TEXT )
+ [v setImagePosition:NSImageAbove];
+ else
+ [v setImagePosition:NSImageOnly];
[v sizeToFit];
#if 0