return wxPoint( m_x, m_y );
}
- bool DoEnable( bool enable );
+ virtual bool Enable( bool enable );
void UpdateToggleImage( bool toggle );
-#if wxOSX_USE_NATIVE_TOOLBAR
- void SetToolbarItemRef( HIToolbarItemRef ref )
+ virtual bool Toggle(bool toggle)
{
- if ( m_controlHandle )
- HideControl( m_controlHandle );
- if ( m_toolbarItemRef )
- CFRelease( m_toolbarItemRef );
-
- m_toolbarItemRef = ref;
+ if ( wxToolBarToolBase::Toggle( toggle ) == false )
+ return false;
+
+ UpdateToggleImage(toggle);
+ return true;
+ }
+
+ void UpdateHelpStrings()
+ {
+#if wxOSX_USE_NATIVE_TOOLBAR
if ( m_toolbarItemRef )
{
wxFontEncoding enc = GetToolBarFontEncoding();
wxCFStringRef( GetShortHelp(), enc ),
wxCFStringRef( GetLongHelp(), enc ) );
}
+#endif
}
-
- HIToolbarItemRef GetToolbarItemRef() const
+
+ virtual bool SetShortHelp(const wxString& help)
{
- return m_toolbarItemRef;
+ if ( wxToolBarToolBase::SetShortHelp( help ) == false )
+ return false;
+
+ UpdateHelpStrings();
+ return true;
}
-
- void SetIndex( CFIndex idx )
+
+ virtual bool SetLongHelp(const wxString& help)
{
- m_index = idx;
+ if ( wxToolBarToolBase::SetLongHelp( help ) == false )
+ return false;
+
+ UpdateHelpStrings();
+ return true;
}
- CFIndex GetIndex() const
+ virtual void SetNormalBitmap(const wxBitmap& bmp)
{
- return m_index;
+ wxToolBarToolBase::SetNormalBitmap(bmp);
+ UpdateToggleImage(CanBeToggled() && IsToggled());
}
-
+
virtual void SetLabel(const wxString& label)
{
wxToolBarToolBase::SetLabel(label);
-
+#if wxOSX_USE_NATIVE_TOOLBAR
if ( m_toolbarItemRef )
{
// strip mnemonics from the label for compatibility with the usual
m_toolbarItemRef,
wxCFStringRef(labelStr, GetToolBarFontEncoding()) );
}
+#endif
+ }
+
+#if wxOSX_USE_NATIVE_TOOLBAR
+ void SetToolbarItemRef( HIToolbarItemRef ref )
+ {
+ if ( m_controlHandle )
+ HideControl( m_controlHandle );
+ if ( m_toolbarItemRef )
+ CFRelease( m_toolbarItemRef );
+
+ m_toolbarItemRef = ref;
+ UpdateHelpStrings();
+ }
+
+ HIToolbarItemRef GetToolbarItemRef() const
+ {
+ return m_toolbarItemRef;
+ }
+
+ void SetIndex( CFIndex idx )
+ {
+ m_index = idx;
+ }
+
+ CFIndex GetIndex() const
+ {
+ return m_index;
}
#endif // wxOSX_USE_NATIVE_TOOLBAR
#endif
-bool wxToolBarTool::DoEnable( bool enable )
+bool wxToolBarTool::Enable( bool enable )
{
+ if ( wxToolBarToolBase::Enable( enable ) == false )
+ return false;
+
if ( IsControl() )
{
GetControl()->Enable( enable );
{
// since setting the help texts is non-virtual we have to update
// the strings now
- HIToolbarItemSetHelpText( hiItemRef,
- wxCFStringRef( tool->GetShortHelp(), enc ),
- wxCFStringRef( tool->GetLongHelp(), enc ) );
-
if ( insertAll || (tool->GetIndex() != currentPosition) )
{
OSStatus err = noErr;
return wxEmptyString;
}
-void wxToolBar::DoEnableTool(wxToolBarToolBase *t, bool enable)
+void wxToolBar::DoEnableTool(wxToolBarToolBase *WXUNUSED(t), bool WXUNUSED(enable))
{
- if ( t != NULL )
- ((wxToolBarTool*)t)->DoEnable( enable );
+ // everything already done in the tool's implementation
}
void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle)
{
- wxToolBarTool *tool = (wxToolBarTool *)t;
- if ( ( tool != NULL ) && tool->IsButton() )
- tool->UpdateToggleImage( toggle );
+ // everything already done in the tool's implementation
}
bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle))
{
- wxFAIL_MSG( wxT("not implemented") );
+ // nothing to do
}
bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolbase)