+
+// ----------------------------------------------------------------------------
+// private classes
+// ----------------------------------------------------------------------------
+
+class wxToolBarTool : public wxToolBarToolBase
+{
+public:
+ wxToolBarTool(wxToolBar *tbar,
+ int id,
+ const wxBitmap& bitmap1,
+ const wxBitmap& bitmap2,
+ bool toggle,
+ wxObject *clientData,
+ const wxString& shortHelpString,
+ const wxString& longHelpString)
+ : wxToolBarToolBase(tbar, id, bitmap1, bitmap2, toggle,
+ clientData, shortHelpString, longHelpString)
+ {
+ m_nSepCount = 0;
+ }
+
+ wxToolBarTool(wxToolBar *tbar, wxControl *control)
+ : wxToolBarToolBase(tbar, control)
+ {
+ m_nSepCount = 1;
+ }
+
+ // set/get the number of separators which we use to cover the space used by
+ // a control in the toolbar
+ void SetSeparatorsCount(size_t count) { m_nSepCount = count; }
+ size_t GetSeparatorsCount() const { return m_nSepCount; }
+
+private:
+ size_t m_nSepCount;
+};
+
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// wxToolBarTool
+// ----------------------------------------------------------------------------
+
+wxToolBarToolBase *wxToolBar::CreateTool(int id,
+ const wxBitmap& bitmap1,
+ const wxBitmap& bitmap2,
+ bool toggle,
+ wxObject *clientData,
+ const wxString& shortHelpString,
+ const wxString& longHelpString)
+{
+ return new wxToolBarTool(this, id, bitmap1, bitmap2, toggle,
+ clientData, shortHelpString, longHelpString);
+}
+
+wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control)
+{
+ return new wxToolBarTool(this, control);
+}
+
+// ----------------------------------------------------------------------------
+// wxToolBar construction
+// ----------------------------------------------------------------------------
+
+void wxToolBar::Init()
+{
+ m_hBitmap = 0;
+
+ m_nButtons = 0;
+
+ m_defaultWidth = DEFAULTBITMAPX;
+ m_defaultHeight = DEFAULTBITMAPY;
+}
+
+bool wxToolBar::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxString& name)
+{
+ // common initialisation
+ if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) )
+ return FALSE;
+
+ // prepare flags
+ DWORD msflags = 0; // WS_VISIBLE | WS_CHILD always included
+ if (style & wxBORDER)
+ msflags |= WS_BORDER;
+
+#ifdef TBSTYLE_TOOLTIPS
+ msflags |= TBSTYLE_TOOLTIPS;