+ m_maxWidth = -1;
+ m_maxHeight = -1;
+ m_defaultWidth = kwxMacToolBarToolDefaultWidth;
+ m_defaultHeight = kwxMacToolBarToolDefaultHeight;
+}
+
+bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
+ long style, const wxString& name)
+{
+
+ if ( !wxToolBarBase::Create( parent , id , pos , size , style ) )
+ return FALSE ;
+
+ return TRUE;
+}
+
+wxToolBar::~wxToolBar()
+{
+ // we must refresh the frame size when the toolbar is deleted but the frame
+ // is not - otherwise toolbar leaves a hole in the place it used to occupy
+}
+
+bool wxToolBar::Realize()
+{
+ if (m_tools.GetCount() == 0)
+ return FALSE;
+
+ int x = m_xMargin + kwxMacToolBarLeftMargin ;
+ int y = m_yMargin + kwxMacToolBarTopMargin ;
+
+ int tw, th;
+ GetSize(& tw, & th);
+
+ int maxWidth = 0 ;
+ int maxHeight = 0 ;
+
+ int maxToolWidth = 0;
+ int maxToolHeight = 0;
+
+ // Find the maximum tool width and height
+ wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
+ while ( node )
+ {
+ wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
+ wxSize sz = tool->GetSize() ;
+
+ if ( sz.x > maxToolWidth )
+ maxToolWidth = sz.x ;
+ if (sz.y> maxToolHeight)
+ maxToolHeight = sz.y;
+
+ node = node->GetNext();
+ }
+
+ bool lastWasRadio = FALSE;
+ node = m_tools.GetFirst();
+ while (node)
+ {
+ wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
+ wxSize cursize = tool->GetSize() ;
+
+ bool isRadio = FALSE;
+
+ if ( tool->IsButton() && tool->GetKind() == wxITEM_RADIO )
+ {
+ if ( !lastWasRadio )
+ {
+ if (tool->Toggle(true))
+ {
+ DoToggleTool(tool, true);
+ }
+ }
+ isRadio = TRUE;
+ }
+ else
+ {
+ isRadio = FALSE;
+ }
+ lastWasRadio = isRadio;
+
+ // for the moment we just do a single row/column alignement
+ if ( x + cursize.x > maxWidth )
+ maxWidth = x + cursize.x ;
+ if ( y + cursize.y > maxHeight )
+ maxHeight = y + cursize.y ;
+
+ if ( GetWindowStyleFlag() & wxTB_VERTICAL )
+ {
+ int x1 = x + (maxToolWidth - cursize.x)/2 ;
+ tool->SetPosition( wxPoint( x1 , y ) ) ;
+ }
+ else
+ {
+ int y1 = y + (maxToolHeight - cursize.y)/2 ;
+ tool->SetPosition( wxPoint( x , y1 ) ) ;
+ }
+ if ( GetWindowStyleFlag() & wxTB_VERTICAL )
+ {
+ y += cursize.y ;
+ y += kwxMacToolSpacing ;
+ }
+ else
+ {
+ x += cursize.x ;
+ x += kwxMacToolSpacing ;
+ }
+
+ node = node->GetNext();
+ }
+
+ if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
+ {
+ if ( m_maxRows == 0 )
+ {
+ // if not set yet, only one row
+ SetRows(1);
+ }
+ m_minWidth = maxWidth;
+ maxWidth = tw ;
+ maxHeight += m_yMargin + kwxMacToolBarTopMargin;
+ m_minHeight = m_maxHeight = maxHeight ;
+ }
+ else
+ {
+ if ( GetToolsCount() > 0 && m_maxRows == 0 )
+ {
+ // if not set yet, have one column
+ SetRows(GetToolsCount());
+ }
+ m_minHeight = maxHeight;
+ maxHeight = th ;
+ maxWidth += m_xMargin + kwxMacToolBarLeftMargin;
+ m_minWidth = m_maxWidth = maxWidth ;
+ }
+
+ SetSize( maxWidth, maxHeight );
+ InvalidateBestSize();
+
+ return TRUE;
+}
+
+void wxToolBar::SetToolBitmapSize(const wxSize& size)
+{
+ m_defaultWidth = size.x+kwxMacToolBorder; m_defaultHeight = size.y+kwxMacToolBorder;