git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39623 
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
26 files changed:
     #include "wx/app.h"
     #include "wx/dcclient.h"
     #include "wx/dcscreen.h"
     #include "wx/app.h"
     #include "wx/dcclient.h"
     #include "wx/dcscreen.h"
+    #include "wx/toolbar.h"
 #endif
 
 //#include "wx/dcbuffer.h"
 
 #include "wx/image.h"
 #endif
 
 //#include "wx/dcbuffer.h"
 
 #include "wx/image.h"
 
 #if wxUSE_MDI
      #include "wx/mdi.h"
 
 #if wxUSE_MDI
      #include "wx/mdi.h"
 
 // Created:     2003/08/17
 // RCS-ID:      $Id$
 // Copyright:   (c) 2003 David Elliott
 // Created:     2003/08/17
 // RCS-ID:      $Id$
 // Copyright:   (c) 2003 David Elliott
-// Licence:    wxWidgets licence
+// Licence:     wxWidgets licence
 /////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
 /////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
 #include "wx/wxprec.h"
 
 #if wxUSE_TOOLBAR_NATIVE
 #include "wx/wxprec.h"
 
 #if wxUSE_TOOLBAR_NATIVE
+
+#include "wx/toolbar.h"
+
-    #include "wx/toolbar.h"
     #include "wx/frame.h"
     #include "wx/log.h"
 #endif // WX_PRECOMP
     #include "wx/frame.h"
     #include "wx/log.h"
 #endif // WX_PRECOMP
 
     #include "wx/menu.h"
     #include "wx/menuitem.h"
     #include "wx/dcclient.h"
     #include "wx/menu.h"
     #include "wx/menuitem.h"
     #include "wx/dcclient.h"
+    #include "wx/toolbar.h"
-#if wxUSE_TOOLBAR
-    #include "wx/toolbar.h"
-#endif
 #if wxUSE_STATUSBAR
     #include "wx/statusbr.h"
 #endif
 #if wxUSE_STATUSBAR
     #include "wx/statusbr.h"
 #endif
 
     #include "wx/menu.h"
     #include "wx/dialog.h"
     #include "wx/control.h"
     #include "wx/menu.h"
     #include "wx/dialog.h"
     #include "wx/control.h"
+    #include "wx/toolbar.h"
-#if wxUSE_TOOLBAR
-    #include "wx/toolbar.h"
-#endif
 #if wxUSE_STATUSBAR
     #include "wx/statusbr.h"
 #endif
 #if wxUSE_STATUSBAR
     #include "wx/statusbr.h"
 #endif
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
-#include "wx/toolbar.h"
-
+#include "wx/toolbar.h"
+
 #ifndef WX_PRECOMP
     #include "wx/frame.h"
 #endif
 #ifndef WX_PRECOMP
     #include "wx/frame.h"
 #endif
 
     #include "wx/settings.h"
     #include "wx/msgdlg.h"
     #include "wx/textctrl.h"
     #include "wx/settings.h"
     #include "wx/msgdlg.h"
     #include "wx/textctrl.h"
+    #include "wx/toolbar.h"
 #endif
 
 #include "wx/layout.h"
 #include "wx/module.h"
 #include "wx/combobox.h"
 
 #endif
 
 #include "wx/layout.h"
 #include "wx/module.h"
 #include "wx/combobox.h"
 
-#if wxUSE_TOOLBAR_NATIVE
-    #include "wx/toolbar.h"
-#endif
-
 #if wxUSE_DRAG_AND_DROP
     #include "wx/dnd.h"
 #endif
 #if wxUSE_DRAG_AND_DROP
     #include "wx/dnd.h"
 #endif
 
     #include "wx/menu.h"
     #include "wx/dialog.h"
     #include "wx/control.h"
     #include "wx/menu.h"
     #include "wx/dialog.h"
     #include "wx/control.h"
+    #include "wx/toolbar.h"
-#if wxUSE_TOOLBAR
-    #include "wx/toolbar.h"
-#endif
 #if wxUSE_STATUSBAR
     #include "wx/statusbr.h"
 #endif
 #if wxUSE_STATUSBAR
     #include "wx/statusbr.h"
 #endif
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
-#include "wx/toolbar.h"
-
+#include "wx/toolbar.h"
+
 #ifndef WX_PRECOMP
     #include "wx/frame.h"
 #endif
 #ifndef WX_PRECOMP
     #include "wx/frame.h"
 #endif
 
     #include "wx/settings.h"
     #include "wx/msgdlg.h"
     #include "wx/textctrl.h"
     #include "wx/settings.h"
     #include "wx/msgdlg.h"
     #include "wx/textctrl.h"
+    #include "wx/toolbar.h"
 #endif // WXPRECOMP
 
 #include "wx/html/helpfrm.h"
 #endif // WXPRECOMP
 
 #include "wx/html/helpfrm.h"
 #include "wx/html/htmlwin.h"
 #include "wx/busyinfo.h"
 #include "wx/progdlg.h"
 #include "wx/html/htmlwin.h"
 #include "wx/busyinfo.h"
 #include "wx/progdlg.h"
 #include "wx/fontenum.h"
 #include "wx/filedlg.h"
 #include "wx/artprov.h"
 #include "wx/fontenum.h"
 #include "wx/filedlg.h"
 #include "wx/artprov.h"
 
     #include "wx/settings.h"
     #include "wx/msgdlg.h"
     #include "wx/textctrl.h"
     #include "wx/settings.h"
     #include "wx/msgdlg.h"
     #include "wx/textctrl.h"
+    #include "wx/toolbar.h"
 #endif // WXPRECOMP
 
 #include "wx/html/helpfrm.h"
 #endif // WXPRECOMP
 
 #include "wx/html/helpfrm.h"
 #include "wx/html/htmlwin.h"
 #include "wx/busyinfo.h"
 #include "wx/progdlg.h"
 #include "wx/html/htmlwin.h"
 #include "wx/busyinfo.h"
 #include "wx/progdlg.h"
 #include "wx/fontenum.h"
 #include "wx/filedlg.h"
 #include "wx/artprov.h"
 #include "wx/fontenum.h"
 #include "wx/filedlg.h"
 #include "wx/artprov.h"
 
     #include "wx/menu.h"
     #include "wx/dialog.h"
     #include "wx/settings.h"
     #include "wx/menu.h"
     #include "wx/dialog.h"
     #include "wx/settings.h"
+    #include "wx/toolbar.h"
 #endif // WX_PRECOMP
 
 #include "wx/statusbr.h"
 #endif // WX_PRECOMP
 
 #include "wx/statusbr.h"
 #include "wx/menuitem.h"
 
 #include "wx/mac/uma.h"
 #include "wx/menuitem.h"
 
 #include "wx/mac/uma.h"
 
-#include "wx/wx.h"
-#include "wx/bitmap.h"
+#ifndef WX_PRECOMP
+    #include "wx/wx.h"
+#endif
+
+#include "wx/bitmap.h"
+
 #include "wx/mac/uma.h"
 #include "wx/geometry.h"
 
 #include "wx/mac/uma.h"
 #include "wx/geometry.h"
 
 
     #include "wx/scrolbar.h"
     #include "wx/statbox.h"
     #include "wx/textctrl.h"
     #include "wx/scrolbar.h"
     #include "wx/statbox.h"
     #include "wx/textctrl.h"
+    #include "wx/toolbar.h"
 #endif
 
 #include "wx/layout.h"
 #endif
 
 #include "wx/layout.h"
 #include "wx/spinctrl.h"
 #include "wx/geometry.h"
 
 #include "wx/spinctrl.h"
 #include "wx/geometry.h"
 
-#include "wx/toolbar.h"
-
 #if wxUSE_CARET
     #include "wx/caret.h"
 #endif
 #if wxUSE_CARET
     #include "wx/caret.h"
 #endif
 
     #include "wx/menu.h"
     #include "wx/dialog.h"
     #include "wx/settings.h"
     #include "wx/menu.h"
     #include "wx/dialog.h"
     #include "wx/settings.h"
+    #include "wx/toolbar.h"
 #endif // WX_PRECOMP
 
 #include "wx/statusbr.h"
 #endif // WX_PRECOMP
 
 #include "wx/statusbr.h"
 #include "wx/menuitem.h"
 
 #include "wx/mac/uma.h"
 #include "wx/menuitem.h"
 
 #include "wx/mac/uma.h"
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
+// Name:        src/mac/classic/toolbar.cpp
 // Purpose:     wxToolBar
 // Author:      Stefan Csomor
 // Modified by:
 // Purpose:     wxToolBar
 // Author:      Stefan Csomor
 // Modified by:
 // Licence:     The wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // Licence:     The wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 
 #if wxUSE_TOOLBAR
 
 #include "wx/toolbar.h"
 
 #if wxUSE_TOOLBAR
 
 #include "wx/toolbar.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/wx.h"
+#endif
+
 #include "wx/notebook.h"
 #include "wx/tabctrl.h"
 #include "wx/bitmap.h"
 #include "wx/notebook.h"
 #include "wx/tabctrl.h"
 #include "wx/bitmap.h"
 IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
 
 BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
 IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
 
 BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
-    EVT_MOUSE_EVENTS( wxToolBar::OnMouse ) 
-    EVT_PAINT( wxToolBar::OnPaint ) 
+    EVT_MOUSE_EVENTS( wxToolBar::OnMouse )
+    EVT_PAINT( wxToolBar::OnPaint )
 END_EVENT_TABLE()
 
 #include "wx/mac/uma.h"
 END_EVENT_TABLE()
 
 #include "wx/mac/uma.h"
                   wxObject *clientData,
                   const wxString& shortHelp,
                   const wxString& longHelp) ;
                   wxObject *clientData,
                   const wxString& shortHelp,
                   const wxString& longHelp) ;
     wxToolBarTool(wxToolBar *tbar, wxControl *control)
         : wxToolBarToolBase(tbar, control)
     {
         Init() ;
     }
     wxToolBarTool(wxToolBar *tbar, wxControl *control)
         : wxToolBarToolBase(tbar, control)
     {
         Init() ;
     }
     ~wxToolBarTool()
     {
         if ( m_controlHandle )
             DisposeControl( m_controlHandle ) ;
     }
     ~wxToolBarTool()
     {
         if ( m_controlHandle )
             DisposeControl( m_controlHandle ) ;
     }
     ControlHandle   GetControlHandle() { return m_controlHandle ; }
     void SetControlHandle( ControlHandle handle ) { m_controlHandle = handle ; }
 
     ControlHandle   GetControlHandle() { return m_controlHandle ; }
     void SetControlHandle( ControlHandle handle ) { m_controlHandle = handle ; }
 
     wxPoint GetPosition() const
     {
         return wxPoint(m_x, m_y);
     wxPoint GetPosition() const
     {
         return wxPoint(m_x, m_y);
     {
         m_controlHandle = NULL ;
     }
     {
         m_controlHandle = NULL ;
     }
     {
         int x , y ;
         x = y = 0 ;
     {
         int x , y ;
         x = y = 0 ;
-        WindowRef rootwindow = (WindowRef) GetToolBar()->MacGetRootWindow() ;    
+        WindowRef rootwindow = (WindowRef) GetToolBar()->MacGetRootWindow() ;
         GetToolBar()->MacWindowToRootWindow( &x , &y ) ;
         int mac_x = x + position.x ;
         int mac_y = y + position.y ;
         GetToolBar()->MacWindowToRootWindow( &x , &y ) ;
         int mac_x = x + position.x ;
         int mac_y = y + position.y ;
-        Rect contrlRect ;       
-        GetControlBounds( m_controlHandle , &contrlRect ) ; 
+
+        Rect contrlRect ;
+        GetControlBounds( m_controlHandle , &contrlRect ) ;
         int former_mac_x = contrlRect.left ;
         int former_mac_y = contrlRect.top ;
         wxSize sz = GetToolBar()->GetToolSize() ;
         int former_mac_x = contrlRect.left ;
         int former_mac_y = contrlRect.top ;
         wxSize sz = GetToolBar()->GetToolSize() ;
         if ( mac_x != former_mac_x || mac_y != former_mac_y )
         {
             {
         if ( mac_x != former_mac_x || mac_y != former_mac_y )
         {
             {
 const short kwxMacToolBarLeftMargin = 2 ;
 
 wxToolBarTool::wxToolBarTool(wxToolBar *tbar,
 const short kwxMacToolBarLeftMargin = 2 ;
 
 wxToolBarTool::wxToolBarTool(wxToolBar *tbar,
-  int id,
-  const wxString& label,
-  const wxBitmap& bmpNormal,
-  const wxBitmap& bmpDisabled,
-  wxItemKind kind,
-  wxObject *clientData,
-  const wxString& shortHelp,
-  const wxString& longHelp)
+                             int id,
+                             const wxString& label,
+                             const wxBitmap& bmpNormal,
+                             const wxBitmap& bmpDisabled,
+                             wxItemKind kind,
+                             wxObject *clientData,
+                             const wxString& shortHelp,
+                             const wxString& longHelp)
         : wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind,
                             clientData, shortHelp, longHelp)
 {
     Init();
         : wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind,
                             clientData, shortHelp, longHelp)
 {
     Init();
     if (id == wxID_SEPARATOR) return;
     if (id == wxID_SEPARATOR) return;
-    
-    WindowRef window = (WindowRef) tbar->MacGetRootWindow() ;    
-    wxSize toolSize = tbar->GetToolSize() ;    
+
+    WindowRef window = (WindowRef) tbar->MacGetRootWindow() ;
+    wxSize toolSize = tbar->GetToolSize() ;
     Rect toolrect = { 0, 0 , toolSize.y , toolSize.x } ;
     Rect toolrect = { 0, 0 , toolSize.y , toolSize.x } ;
     ControlButtonContentInfo info ;
     wxMacCreateBitmapButton( &info , GetNormalBitmap() ) ;
     ControlButtonContentInfo info ;
     wxMacCreateBitmapButton( &info , GetNormalBitmap() ) ;
     SInt16 behaviour = kControlBehaviorOffsetContents ;
     if ( CanBeToggled() )
         behaviour += kControlBehaviorToggles ;
     SInt16 behaviour = kControlBehaviorOffsetContents ;
     if ( CanBeToggled() )
         behaviour += kControlBehaviorToggles ;
-    
-    if ( info.contentType != kControlNoContent ) 
+
+    if ( info.contentType != kControlNoContent )
-        m_controlHandle = ::NewControl( window , &toolrect , "\p" , false , 0 , 
+        m_controlHandle = ::NewControl( window , &toolrect , "\p" , false , 0 ,
                                         behaviour + info.contentType , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
                                         behaviour + info.contentType , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
         ::SetControlData( m_controlHandle , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
     }
     else
     {
         ::SetControlData( m_controlHandle , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
     }
     else
     {
-        m_controlHandle = ::NewControl( window , &toolrect , "\p" , false , 0 , 
+        m_controlHandle = ::NewControl( window , &toolrect , "\p" , false , 0 ,
                                         behaviour  , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
     }
     UMAShowControl( m_controlHandle ) ;
                                         behaviour  , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
     }
     UMAShowControl( m_controlHandle ) ;
     {
         ::SetControl32BitValue( m_controlHandle , 0 ) ;
     }
     {
         ::SetControl32BitValue( m_controlHandle , 0 ) ;
     }
     ControlHandle container = (ControlHandle) tbar->MacGetContainerForEmbedding() ;
     wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
     ::EmbedControl( m_controlHandle , container ) ;
     ControlHandle container = (ControlHandle) tbar->MacGetContainerForEmbedding() ;
     wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
     ::EmbedControl( m_controlHandle , container ) ;
 
 bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
             long style, const wxString& name)
 
 bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
             long style, const wxString& name)
     int x = pos.x;
     int y = pos.y;
     int width = size.x;
     int height = size.y;
     int x = pos.x;
     int y = pos.y;
     int width = size.x;
     int height = size.y;
     if (width <= 0)
         width = 100;
     if (height <= 0)
     if (width <= 0)
         width = 100;
     if (height <= 0)
     m_windowStyle = style;
     parent->AddChild(this);
     m_windowStyle = style;
     parent->AddChild(this);
     m_backgroundColour = parent->GetBackgroundColour() ;
     m_foregroundColour = parent->GetForegroundColour() ;
     m_backgroundColour = parent->GetBackgroundColour() ;
     m_foregroundColour = parent->GetForegroundColour() ;
         m_windowId = NewControlId();
     else
         m_windowId = id;
         m_windowId = NewControlId();
     else
         m_windowId = id;
     {
         m_width = size.x ;
         m_height = size.y ;
     {
         m_width = size.x ;
         m_height = size.y ;
 }
 
 wxToolBar::~wxToolBar()
 }
 
 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
 }
     // 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)
 bool wxToolBar::Realize()
 {
     if (m_tools.GetCount() == 0)
 
     int x = m_xMargin + kwxMacToolBarLeftMargin ;
     int y = m_yMargin + kwxMacToolBarTopMargin ;
 
     int tw, th;
     GetSize(& tw, & th);
 
     int x = m_xMargin + kwxMacToolBarLeftMargin ;
     int y = m_yMargin + kwxMacToolBarTopMargin ;
 
     int tw, th;
     GetSize(& tw, & th);
     int maxWidth = 0 ;
     int maxHeight = 0 ;
     int maxWidth = 0 ;
     int maxHeight = 0 ;
     int maxToolWidth = 0;
     int maxToolHeight = 0;
 
     int maxToolWidth = 0;
     int maxToolHeight = 0;
 
     {
         wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
         wxSize cursize = tool->GetSize() ;
     {
         wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
         wxSize cursize = tool->GetSize() ;
         // 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 ;
         // 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 ;
         tool->SetPosition( wxPoint( x , y ) ) ;
         tool->SetPosition( wxPoint( x , y ) ) ;
         if ( GetWindowStyleFlag() & wxTB_VERTICAL )
         {
             y += cursize.y ;
         if ( GetWindowStyleFlag() & wxTB_VERTICAL )
         {
             y += cursize.y ;
 
         node = node->GetNext();
     }
 
         node = node->GetNext();
     }
     if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
     {
         if ( m_maxRows == 0 )
     if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
     {
         if ( m_maxRows == 0 )
             // if not set yet, only one row
             SetRows(1);
         }
             // if not set yet, only one row
             SetRows(1);
         }
         maxHeight += m_yMargin + kwxMacToolBarTopMargin;
         m_maxHeight = maxHeight ;
     }
         maxHeight += m_yMargin + kwxMacToolBarTopMargin;
         m_maxHeight = maxHeight ;
     }
         maxWidth += m_xMargin + kwxMacToolBarLeftMargin;
         m_maxWidth = maxWidth ;
     }
         maxWidth += m_xMargin + kwxMacToolBarLeftMargin;
         m_maxWidth = maxWidth ;
     }
     SetSize(maxWidth, maxHeight);
     InvalidateBestSize();
     SetSize(maxWidth, maxHeight);
     InvalidateBestSize();
 }
 
 void wxToolBar::SetToolBitmapSize(const wxSize& size)
 }
 
 void wxToolBar::SetToolBitmapSize(const wxSize& size)
     return wxSize(m_defaultWidth + 4, m_defaultHeight + 4);
 }
 
     return wxSize(m_defaultWidth + 4, m_defaultHeight + 4);
 }
 
-void wxToolBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED( mouseStillDown ) ) 
+void wxToolBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED( mouseStillDown ) )
 {
     wxToolBarToolsList::Node *node;
     for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
     {
 {
     wxToolBarToolsList::Node *node;
     for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
     {
-        wxToolBarTool* tool = (wxToolBarTool*) node->GetData() ; 
+        wxToolBarTool* tool = (wxToolBarTool*) node->GetData() ;
         if ( tool->IsButton() )
         {
         if ( tool->IsButton() )
         {
-           if( (WXWidget) tool->GetControlHandle() == control ) 
+           if( (WXWidget) tool->GetControlHandle() == control )
            {
                 if ( tool->CanBeToggled() )
                 {
            {
                 if ( tool->CanBeToggled() )
                 {
-void wxToolBar::MacSuperChangedPosition() 
+void wxToolBar::MacSuperChangedPosition()
 {
     wxWindow::MacSuperChangedPosition() ;
     Realize() ;
 {
     wxWindow::MacSuperChangedPosition() ;
     Realize() ;
     tool->Attach(this);
     InvalidateBestSize();
 
     tool->Attach(this);
     InvalidateBestSize();
 
 }
 
 void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle))
 }
 
 void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle))
     tool->Detach();
 
     // and finally reposition all the controls after this one
     tool->Detach();
 
     // and finally reposition all the controls after this one
     for ( /* node -> first after deleted */ ; node; node = node->GetNext() )
     {
         wxToolBarTool *tool2 = (wxToolBarTool*) node->GetData();
     for ( /* node -> first after deleted */ ; node; node = node->GetNext() )
     {
         wxToolBarTool *tool2 = (wxToolBarTool*) node->GetData();
         }
         tool2->SetPosition( pt ) ;
     }
         }
         tool2->SetPosition( pt ) ;
     }
 }
 
 void wxToolBar::OnPaint(wxPaintEvent& event)
 {
     wxPaintDC dc(this) ;
     wxMacPortSetter helper(&dc) ;
 }
 
 void wxToolBar::OnPaint(wxPaintEvent& event)
 {
     wxPaintDC dc(this) ;
     wxMacPortSetter helper(&dc) ;
-    
-    Rect toolbarrect = { dc.YLOG2DEVMAC(0) , dc.XLOG2DEVMAC(0) , 
+
+    Rect toolbarrect = { dc.YLOG2DEVMAC(0) , dc.XLOG2DEVMAC(0) ,
         dc.YLOG2DEVMAC(m_height) , dc.XLOG2DEVMAC(m_width) } ;
     UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
     {
         wxToolBarToolsList::Node *node;
         for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
         {
         dc.YLOG2DEVMAC(m_height) , dc.XLOG2DEVMAC(m_width) } ;
     UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
     {
         wxToolBarToolsList::Node *node;
         for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
         {
-            wxToolBarTool* tool = (wxToolBarTool*) node->GetData() ; 
+            wxToolBarTool* tool = (wxToolBarTool*) node->GetData() ;
             if ( tool->IsButton() )
             {
                UMADrawControl( tool->GetControlHandle() ) ;
             if ( tool->IsButton() )
             {
                UMADrawControl( tool->GetControlHandle() ) ;
-void  wxToolBar::OnMouse( wxMouseEvent &event ) 
+void  wxToolBar::OnMouse( wxMouseEvent &event )
 {
     if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
     {
 {
     if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
     {
         int x = event.m_x ;
         int y = event.m_y ;
         int x = event.m_x ;
         int y = event.m_y ;
         MacClientToRootWindow( &x , &y ) ;
         MacClientToRootWindow( &x , &y ) ;
         ControlHandle   control ;
         Point       localwhere ;
         SInt16      controlpart ;
         WindowRef   window = (WindowRef) MacGetRootWindow() ;
         ControlHandle   control ;
         Point       localwhere ;
         SInt16      controlpart ;
         WindowRef   window = (WindowRef) MacGetRootWindow() ;
         localwhere.h = x ;
         localwhere.v = y ;
         localwhere.h = x ;
         localwhere.v = y ;
         if ( !event.m_leftDown && !event.m_rightDown )
             modifiers  |= btnState ;
         if ( !event.m_leftDown && !event.m_rightDown )
             modifiers  |= btnState ;
         if ( event.m_shiftDown )
             modifiers |= shiftKey ;
         if ( event.m_shiftDown )
             modifiers |= shiftKey ;
         if ( event.m_controlDown )
             modifiers |= controlKey ;
         if ( event.m_controlDown )
             modifiers |= controlKey ;
         if ( event.m_altDown )
             modifiers |= optionKey ;
         if ( event.m_altDown )
             modifiers |= optionKey ;
         if ( event.m_metaDown )
             modifiers |= cmdKey ;
         if ( event.m_metaDown )
             modifiers |= cmdKey ;
         controlpart = ::FindControl( localwhere , window , &control ) ;
         {
             if ( control && ::IsControlActive( control ) )
         controlpart = ::FindControl( localwhere , window , &control ) ;
         {
             if ( control && ::IsControlActive( control ) )
 }
 
 #endif // wxUSE_TOOLBAR
 }
 
 #endif // wxUSE_TOOLBAR
 
     #include "wx/menu.h"
     #include "wx/icon.h"
     #include "wx/settings.h"
     #include "wx/menu.h"
     #include "wx/icon.h"
     #include "wx/settings.h"
+    #include "wx/toolbar.h"
 #endif
 
 #include "wx/statusbr.h"
 #endif
 
 #include "wx/statusbr.h"
 
 #ifdef __VMS__
     #pragma message disable nosimpint
 
 #ifdef __VMS__
     #pragma message disable nosimpint
 
     #include "wx/settings.h"
     #include "wx/intl.h"
     #include "wx/log.h"
     #include "wx/settings.h"
     #include "wx/intl.h"
     #include "wx/log.h"
+    #include "wx/toolbar.h"
 #endif
 
 #include "wx/msw/private.h"
 #endif
 
 #include "wx/msw/private.h"
     #include "wx/msw/wince/resources.h"
 #endif // __SMARTPHONE__ && __WXWINCE__
 
     #include "wx/msw/wince/resources.h"
 #endif // __SMARTPHONE__ && __WXWINCE__
 
-#if wxUSE_TOOLBAR && defined(__POCKETPC__)
-#include "wx/toolbar.h"
-#endif
-
 // ----------------------------------------------------------------------------
 // wxWin macros
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // wxWin macros
 // ----------------------------------------------------------------------------
 
     #include "wx/mdi.h"
     #include "wx/panel.h"
     #include "wx/log.h"
     #include "wx/mdi.h"
     #include "wx/panel.h"
     #include "wx/log.h"
+    #include "wx/toolbar.h"
 #endif // WX_PRECOMP
 
 #include "wx/msw/private.h"
 #endif // WX_PRECOMP
 
 #include "wx/msw/private.h"
     #include "wx/generic/statusbr.h"
 #endif // wxUSE_STATUSBAR
 
     #include "wx/generic/statusbr.h"
 #endif // wxUSE_STATUSBAR
 
-#if wxUSE_TOOLBAR
-    #include "wx/toolbar.h"
-#endif // wxUSE_TOOLBAR
-
 #include "wx/menuitem.h"
 
 #ifdef __WXUNIVERSAL__
 #include "wx/menuitem.h"
 
 #ifdef __WXUNIVERSAL__
 
     #include "wx/settings.h"
     #include "wx/intl.h"
     #include "wx/log.h"
     #include "wx/settings.h"
     #include "wx/intl.h"
     #include "wx/log.h"
+    #include "wx/toolbar.h"
 #endif
 
 #include "wx/stockitem.h"
 #endif
 
 #include "wx/stockitem.h"
     #include "wx/msw/statbr95.h"
 #endif
 
     #include "wx/msw/statbr95.h"
 #endif
 
-#if wxUSE_TOOLBAR
-    #include "wx/toolbar.h"
-#endif // wxUSE_TOOLBAR
-
 #include <string.h>
 
 // ---------------------------------------------------------------------------
 #include <string.h>
 
 // ---------------------------------------------------------------------------
 
 
 #if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && !defined(__SMARTPHONE__)
 
 
 #if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && !defined(__SMARTPHONE__)
 
+#include "wx/toolbar.h"
+
 #ifndef WX_PRECOMP
     #include "wx/dynarray.h"
     #include "wx/frame.h"
 #ifndef WX_PRECOMP
     #include "wx/dynarray.h"
     #include "wx/frame.h"
     #include "wx/app.h"         // for GetComCtl32Version
 #endif
 
     #include "wx/app.h"         // for GetComCtl32Version
 #endif
 
 #include "wx/sysopt.h"
 #include "wx/image.h"
 
 #include "wx/sysopt.h"
 #include "wx/image.h"
 
 
 // with a WinCE earlier than 4, or we wish to emulate a PocketPC-style UI
 #if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__))
 
 // with a WinCE earlier than 4, or we wish to emulate a PocketPC-style UI
 #if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__))
 
+#include "wx/toolbar.h"
+
 #ifndef WX_PRECOMP
     #include "wx/dynarray.h"
     #include "wx/frame.h"
 #ifndef WX_PRECOMP
     #include "wx/dynarray.h"
     #include "wx/frame.h"
     #include "wx/control.h"
 #endif
 
     #include "wx/control.h"
 #endif
 
-#include "wx/toolbar.h"
-
 #if !defined(__GNUWIN32__) && !defined(__SALFORDC__)
     #include "malloc.h"
 #endif
 #if !defined(__GNUWIN32__) && !defined(__SALFORDC__)
     #include "malloc.h"
 #endif
 
     #include "wx/settings.h"
     #include "wx/dcclient.h"
     #include "wx/mdi.h"
     #include "wx/settings.h"
     #include "wx/dcclient.h"
     #include "wx/mdi.h"
+    #include "wx/toolbar.h"
 #endif // WX_PRECOMP
 
 #include "wx/os2/private.h"
 #endif // WX_PRECOMP
 
 #include "wx/os2/private.h"
     #include "wx/generic/statusbr.h"
 #endif // wxUSE_STATUSBAR
 
     #include "wx/generic/statusbr.h"
 #endif // wxUSE_STATUSBAR
 
-#if wxUSE_TOOLBAR
-    #include "wx/toolbar.h"
-#endif // wxUSE_TOOLBAR
-
 #include "wx/menuitem.h"
 
 // ----------------------------------------------------------------------------
 #include "wx/menuitem.h"
 
 // ----------------------------------------------------------------------------
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
+// Name:        src/os2/toolbar.cpp
 // Purpose:     wxToolBar
 // Author:      David Webster
 // Modified by:
 // Purpose:     wxToolBar
 // Author:      David Webster
 // Modified by:
 
 #if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE
 
 
 #if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE
 
+#include "wx/toolbar.h"
+
 #ifndef WX_PRECOMP
     #include "wx/settings.h"
     #include "wx/window.h"
 #ifndef WX_PRECOMP
     #include "wx/settings.h"
     #include "wx/window.h"
 #endif
 
 #include "wx/tooltip.h"
 #endif
 
 #include "wx/tooltip.h"
-bool                                wxToolBar::m_bInitialized = FALSE;
+bool wxToolBar::m_bInitialized = false;
 
 // ----------------------------------------------------------------------------
 // private classes
 
 // ----------------------------------------------------------------------------
 // private classes
     return pTool;
 } // end of wxToolBar::InsertTool
 
     return pTool;
 } // end of wxToolBar::InsertTool
 
-bool wxToolBar::DoInsertTool(
-  size_t                            WXUNUSED(nPos)
-, wxToolBarToolBase*                pToolBase
-)
+bool wxToolBar::DoInsertTool( size_t WXUNUSED(nPos),
+                              wxToolBarToolBase* pToolBase )
-    wxToolBarTool*                  pTool = (wxToolBarTool *)pToolBase;
+    wxToolBarTool* pTool = (wxToolBarTool *)pToolBase;
 
     pTool->m_vX = m_vXPos;
     if (pTool->m_vX == -1)
 
     pTool->m_vX = m_vXPos;
     if (pTool->m_vX == -1)
         if ((pTool->m_vY + pTool->GetNormalBitmap().GetHeight() + m_yMargin) > m_vMaxHeight)
             m_vMaxHeight = (wxCoord)((pTool->m_vY + pTool->GetHeight() + m_yMargin));
     }
         if ((pTool->m_vY + pTool->GetNormalBitmap().GetHeight() + m_yMargin) > m_vMaxHeight)
             m_vMaxHeight = (wxCoord)((pTool->m_vY + pTool->GetHeight() + m_yMargin));
     }
 } // end of wxToolBar::DoInsertTool
 
 } // end of wxToolBar::DoInsertTool
 
-bool wxToolBar::DoDeleteTool(
-  size_t                            WXUNUSED(nPos)
-, wxToolBarToolBase*                pTool
-)
+bool wxToolBar::DoDeleteTool( size_t WXUNUSED(nPos),
+                              wxToolBarToolBase* pTool )
 {
     pTool->Detach();
     Refresh();
 {
     pTool->Detach();
     Refresh();
 } // end of wxToolBar::DoDeleteTool
 
 } // end of wxToolBar::DoDeleteTool
 
-bool wxToolBar::Create(
-  wxWindow*                         pParent
-, wxWindowID                        vId
-, const wxPoint&                    rPos
-, const wxSize&                     rSize
-, long                              lStyle
-, const wxString&                   rsName
-)
+bool wxToolBar::Create( wxWindow* pParent,
+                        wxWindowID vId,
+                        const wxPoint& rPos,
+                        const wxSize& rSize,
+                        long lStyle,
+                        const wxString& rsName )
 {
     if ( !wxWindow::Create( pParent
                            ,vId
 {
     if ( !wxWindow::Create( pParent
                            ,vId
 
     // Set it to grey (or other 3D face colour)
     SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR));
 
     // Set it to grey (or other 3D face colour)
     SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR));
 } // end of wxToolBar::Create
 
 wxToolBar::~wxToolBar()
 } // end of wxToolBar::Create
 
 wxToolBar::~wxToolBar()
 
     m_maxWidth += m_xMargin;
     m_maxHeight += m_yMargin;
 
     m_maxWidth += m_xMargin;
     m_maxHeight += m_yMargin;
-    m_bInitialized = TRUE;
-    return TRUE;
+    m_bInitialized = true;
+    return true;
 } // end of wxToolBar::Realize
 
 // ----------------------------------------------------------------------------
 } // end of wxToolBar::Realize
 
 // ----------------------------------------------------------------------------
             pTool = (wxToolBarTool *)FindById(m_nCurrentTool);
             if (pTool && !pTool->IsToggled())
             {
             pTool = (wxToolBarTool *)FindById(m_nCurrentTool);
             if (pTool && !pTool->IsToggled())
             {
-                RaiseTool( pTool
-                          ,FALSE
-                         );
+                RaiseTool( pTool, FALSE );
             }
             m_nCurrentTool = -1;
             OnMouseEnter(-1);
             }
             m_nCurrentTool = -1;
             OnMouseEnter(-1);
             wxToolBarTool*          pOldTool = (wxToolBarTool*)FindById(m_nCurrentTool);
 
             if (pOldTool && !pTool->IsToggled())
             wxToolBarTool*          pOldTool = (wxToolBarTool*)FindById(m_nCurrentTool);
 
             if (pOldTool && !pTool->IsToggled())
-                RaiseTool( pOldTool
-                          ,FALSE
-                         );
+                RaiseTool( pOldTool, FALSE );
             m_nCurrentTool = pTool->GetId();
             OnMouseEnter(m_nCurrentTool);
             if (!pTool->GetShortHelp().empty())
             m_nCurrentTool = pTool->GetId();
             OnMouseEnter(m_nCurrentTool);
             if (!pTool->GetShortHelp().empty())
 // drawing
 // ----------------------------------------------------------------------------
 
 // drawing
 // ----------------------------------------------------------------------------
 
-void wxToolBar::DrawTool(
-  wxToolBarToolBase*                pTool
-)
+void wxToolBar::DrawTool( wxToolBarToolBase* pTool )
-    DrawTool( vDc
-             ,pTool
-            );
+    DrawTool( vDc, pTool );
 } // end of wxToolBar::DrawTool
 
 } // end of wxToolBar::DrawTool
 
-void wxToolBar::DrawTool(
-  wxDC&                             rDc
-, wxToolBarToolBase*                pToolBase
-)
+void wxToolBar::DrawTool( wxDC& rDc, wxToolBarToolBase* pToolBase )
 {
     wxToolBarTool* pTool = (wxToolBarTool *)pToolBase;
     wxColour gray85( 85,85,85 );
     wxPen vDarkGreyPen( gray85, 1, wxSOLID );
     wxBitmap vBitmap = pTool->GetNormalBitmap();
 {
     wxToolBarTool* pTool = (wxToolBarTool *)pToolBase;
     wxColour gray85( 85,85,85 );
     wxPen vDarkGreyPen( gray85, 1, wxSOLID );
     wxBitmap vBitmap = pTool->GetNormalBitmap();
     wxMask* pMask = NULL;
 
     PrepareDC(rDc);
     wxMask* pMask = NULL;
 
     PrepareDC(rDc);
         return;
     if ((pMask = vBitmap.GetMask()) != NULL)
         if (pMask->GetMaskBitmap() != NULLHANDLE)
         return;
     if ((pMask = vBitmap.GetMask()) != NULL)
         if (pMask->GetMaskBitmap() != NULLHANDLE)
 
     if (!pTool->IsToggled())
     {
 
     if (!pTool->IsToggled())
     {
     }
 } // end of wxToolBar::RaiseTool
 
     }
 } // end of wxToolBar::RaiseTool
 
-void wxToolBar::OnTimer (
-  wxTimerEvent&                     rEvent
-)
+void wxToolBar::OnTimer ( wxTimerEvent& rEvent )
 {
     if (rEvent.GetId() == m_vToolTimer.GetTimerId())
     {
 {
     if (rEvent.GetId() == m_vToolTimer.GetTimerId())
     {
-        wxPoint                     vPos( m_vXMouse
-                                         ,m_vYMouse
-                                        );
+        wxPoint vPos( m_vXMouse, m_vYMouse );
 
         m_pToolTip->DisplayToolTipWindow(vPos);
         m_vToolTimer.Stop();
 
         m_pToolTip->DisplayToolTipWindow(vPos);
         m_vToolTimer.Stop();
 
     #include "wx/mdi.h"
     #include "wx/panel.h"
     #include "wx/log.h"
     #include "wx/mdi.h"
     #include "wx/panel.h"
     #include "wx/log.h"
+    #include "wx/toolbar.h"
 #endif // WX_PRECOMP
 
 #if wxUSE_STATUSBAR
 #endif // WX_PRECOMP
 
 #if wxUSE_STATUSBAR
     #include "wx/generic/statusbr.h"
 #endif // wxUSE_STATUSBAR
 
     #include "wx/generic/statusbr.h"
 #endif // wxUSE_STATUSBAR
 
-#if wxUSE_TOOLBAR
-    #include "wx/toolbar.h"
-#endif // wxUSE_TOOLBAR
-
 #include "wx/menuitem.h"
 
 #ifdef __WXUNIVERSAL__
 #include "wx/menuitem.h"
 
 #ifdef __WXUNIVERSAL__
 
     #include "wx/settings.h"
     #include "wx/intl.h"
     #include "wx/log.h"
     #include "wx/settings.h"
     #include "wx/intl.h"
     #include "wx/log.h"
+    #include "wx/toolbar.h"
 #endif
 
 #include "wx/mdi.h"
 #endif
 
 #include "wx/mdi.h"
     #include "wx/palmos/statbr95.h"
 #endif
 
     #include "wx/palmos/statbr95.h"
 #endif
 
-#if wxUSE_TOOLBAR
-    #include "wx/toolbar.h"
-#endif // wxUSE_TOOLBAR
-
 #include <string.h>
 
 // ---------------------------------------------------------------------------
 #include <string.h>
 
 // ---------------------------------------------------------------------------
 
 
 #ifndef WX_PRECOMP
     #include "wx/frame.h"
 
 #ifndef WX_PRECOMP
     #include "wx/frame.h"
+    #include "wx/toolbar.h"
-#include "wx/toolbar.h"
-
 IMPLEMENT_DYNAMIC_CLASS(wxToolBarXmlHandler, wxXmlResourceHandler)
 
 wxToolBarXmlHandler::wxToolBarXmlHandler()
 IMPLEMENT_DYNAMIC_CLASS(wxToolBarXmlHandler, wxXmlResourceHandler)
 
 wxToolBarXmlHandler::wxToolBarXmlHandler()