// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
-// Licence: The wxWidgets licence
+// Licence: The wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
void SetSize(const wxSize& size) ;
void SetPosition( const wxPoint& position ) ;
+
wxSize GetSize() const
{
if ( IsControl() )
{
return wxPoint(m_x, m_y);
}
+ bool DoEnable( bool enable ) ;
private :
void Init()
{
// wxToolBarTool
// ----------------------------------------------------------------------------
+bool wxToolBarTool::DoEnable(bool enable)
+{
+ if ( IsControl() )
+ {
+ GetControl()->Enable( enable ) ;
+ }
+ else if ( IsButton() )
+ {
+#if TARGET_API_MAC_OSX
+ if ( enable )
+ EnableControl( m_controlHandle ) ;
+ else
+ DisableControl( m_controlHandle ) ;
+#else
+ if ( enable )
+ ActivateControl( m_controlHandle ) ;
+ else
+ DeactivateControl( m_controlHandle ) ;
+#endif
+ }
+ return true ;
+}
void wxToolBarTool::SetSize(const wxSize& size)
{
if ( IsControl() )
GetEventTypeCount(eventList), eventList, this,NULL);
UMAShowControl( m_controlHandle ) ;
- if ( !IsEnabled() )
- DisableControl( m_controlHandle ) ;
if ( CanBeToggled() && IsToggled() )
::SetControl32BitValue( m_controlHandle , 1 ) ;
int maxToolHeight = 0;
// Find the maximum tool width and height
- wxToolBarToolsList::Node *node = m_tools.GetFirst();
+ wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
while ( node )
{
wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
}
SetSize( maxWidth, maxHeight );
+ InvalidateBestSize();
return TRUE;
}
wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
{
- wxToolBarToolsList::Node *node = m_tools.GetFirst();
+ wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
while (node)
{
wxToolBarTool *tool = (wxToolBarTool *)node->GetData() ;
if (!IsShown())
return ;
- wxToolBarTool *tool = (wxToolBarTool *)t;
- if ( tool->IsControl() )
- {
- tool->GetControl()->Enable( enable ) ;
- }
- else if ( tool->IsButton() )
- {
- if ( enable )
- UMAActivateControl( (ControlRef) tool->GetControlHandle() ) ;
- else
- UMADeactivateControl( (ControlRef) tool->GetControlHandle() ) ;
- }
+ ((wxToolBarTool*)t)->DoEnable( enable ) ;
}
void wxToolBar::DoToggleTool(wxToolBarToolBase *t, bool toggle)
{
// nothing special to do here - we relayout in Realize() later
tool->Attach(this);
+ InvalidateBestSize();
return TRUE;
}
bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
{
- wxToolBarToolsList::Node *node;
+ wxToolBarToolsList::compatibility_iterator node;
for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
{
wxToolBarToolBase *tool2 = node->GetData();
tool2->SetPosition( pt ) ;
}
+ InvalidateBestSize();
return TRUE ;
}