X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0f9b48d1e1535f8b92a73031be8cceff39123d27..cf516c2bb2b8bc462f6f0cb852fb2fc2d86c9c66:/src/osx/cocoa/toolbar.mm diff --git a/src/osx/cocoa/toolbar.mm b/src/osx/cocoa/toolbar.mm index 674971e1a1..320f1017f4 100644 --- a/src/osx/cocoa/toolbar.mm +++ b/src/osx/cocoa/toolbar.mm @@ -39,10 +39,6 @@ END_EVENT_TABLE() #pragma mark - #pragma mark Tool Implementation -#if wxOSX_USE_COCOA -#define wxOSX_USE_NATIVE_TOOLBAR 1 -#endif - // ---------------------------------------------------------------------------- // private classes // ---------------------------------------------------------------------------- @@ -162,6 +158,7 @@ public: void UpdateLabel() { +#if wxOSX_USE_NATIVE_TOOLBAR if ( m_toolbarItem ) { // strip mnemonics from the label for compatibility with the usual @@ -174,6 +171,7 @@ public: wxCFStringRef sh( GetShortHelp(), GetToolBarFontEncoding() ); [m_toolbarItem setToolTip:sh.AsNSString()]; } +#endif } void Action() @@ -256,6 +254,8 @@ private: #endif }; +#if wxOSX_USE_NATIVE_TOOLBAR + @interface wxNSToolbarItem : NSToolbarItem { wxToolBarTool* impl; @@ -284,6 +284,8 @@ private: @end +#endif + @interface wxNSToolBarButton : NSButton { @@ -298,6 +300,8 @@ private: @end +#if wxOSX_USE_NATIVE_TOOLBAR + @implementation wxNSToolbarItem - (id)initWithItemIdentifier: (NSString*) identifier @@ -348,7 +352,11 @@ private: - (NSToolbarItem*) toolbar:(NSToolbar*) toolbar itemForItemIdentifier:(NSString*) itemIdentifier willBeInsertedIntoToolbar:(BOOL) flag { +#ifdef __LP64__ + wxToolBarTool* tool = (wxToolBarTool*) [itemIdentifier longLongValue]; +#else wxToolBarTool* tool = (wxToolBarTool*) [itemIdentifier intValue]; +#endif if ( tool ) { wxNSToolbarItem* item = (wxNSToolbarItem*) tool->GetToolbarItemRef(); @@ -370,6 +378,8 @@ private: @end +#endif + @implementation wxNSToolBarButton - (id)initWithFrame:(NSRect)frame @@ -943,7 +953,7 @@ bool wxToolBar::Realize() } } } - wxString identifier = wxString::Format( wxT("%d"), (int) tool ); + wxString identifier = wxString::Format( wxT("%ld"), (long) tool ); wxCFStringRef cfidentifier(identifier); [refTB insertItemWithItemIdentifier:cfidentifier.AsNSString() atIndex:currentPosition]; @@ -1094,7 +1104,7 @@ void wxToolBar::MacSuperChangedPosition() void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap ) { - wxToolBarTool* tool = wx_static_cast(wxToolBarTool*, FindById(id)); + wxToolBarTool* tool = static_cast(FindById(id)); if ( tool ) { wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools.")); @@ -1108,7 +1118,7 @@ void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap ) void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap ) { - wxToolBarTool* tool = wx_static_cast(wxToolBarTool*, FindById(id)); + wxToolBarTool* tool = static_cast(FindById(id)); if ( tool ) { wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools.")); @@ -1163,7 +1173,7 @@ void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle) bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) { - wxToolBarTool *tool = wx_static_cast( wxToolBarTool*, toolBase ); + wxToolBarTool *tool = static_cast< wxToolBarTool*>(toolBase ); if (tool == NULL) return false; @@ -1225,7 +1235,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) #if wxOSX_USE_NATIVE_TOOLBAR if (m_macToolbar != NULL) { - wxString identifier = wxString::Format(wxT("%d"), (int) tool); + wxString identifier = wxString::Format(wxT("%ld"), (long) tool); wxCFStringRef cfidentifier( identifier, wxFont::GetDefaultEncoding() ); wxNSToolbarItem* item = [[wxNSToolbarItem alloc] initWithItemIdentifier:cfidentifier.AsNSString() ]; [item setImplementation:tool]; @@ -1256,7 +1266,7 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase) WXWidget view = (WXWidget) tool->GetControl()->GetHandle() ; wxCHECK_MSG( view, false, _T("control must be non-NULL") ); - wxString identifier = wxString::Format(wxT("%d"), (int) tool); + wxString identifier = wxString::Format(wxT("%ld"), (long) tool); wxCFStringRef cfidentifier( identifier, wxFont::GetDefaultEncoding() ); wxNSToolbarItem* item = [[wxNSToolbarItem alloc] initWithItemIdentifier:cfidentifier.AsNSString() ]; [item setImplementation:tool]; @@ -1295,7 +1305,7 @@ void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(tog bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolbase) { - wxToolBarTool* tool = wx_static_cast( wxToolBarTool*, toolbase ); + wxToolBarTool* tool = static_cast< wxToolBarTool*>(toolbase ); wxToolBarToolsList::compatibility_iterator node; for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) {