+ if (m_hBitmap)
+ {
+ ::DeleteObject((HBITMAP) m_hBitmap);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// adding/removing buttons
+// ----------------------------------------------------------------------------
+
+void wxToolBar95::ClearTools()
+{
+ // TODO: Don't know how to reset the toolbar bitmap, as yet.
+ // But adding tools and calling CreateTools should probably
+ // recreate a buttonbar OK.
+ wxToolBarBase::ClearTools();
+}
+
+bool wxToolBar95::DeleteTool(int id)
+{
+ int index = GetIndexFromId(id);
+ wxASSERT_MSG( index != wxNOT_FOUND, _T("invalid toolbar button id") );
+
+ if ( !SendMessage(GetHwnd(), TB_DELETEBUTTON, index, 0) )
+ {
+ wxLogLastError("TB_DELETEBUTTON");
+
+ return FALSE;
+ }
+
+ wxNode *node = m_tools.Nth(index);
+ delete (wxToolBarTool *)node->Data();
+ m_tools.DeleteNode(node);
+
+ m_ids.RemoveAt(index);
+
+ return TRUE;
+}
+
+bool wxToolBar95::AddControl(wxControl *control)
+{
+ wxCHECK_MSG( control, FALSE, _T("toolbar: can't insert NULL control") );
+
+ wxCHECK_MSG( control->GetParent() == this, FALSE,
+ _T("control must have toolbar as parent") );
+
+ wxToolBarTool *tool = new wxToolBarTool(control);
+
+ m_tools.Append(control->GetId(), tool);
+ m_ids.Add(control->GetId());
+
+ return TRUE;
+}
+
+wxToolBarTool *wxToolBar95::AddTool(int index,
+ const wxBitmap& bitmap,
+ const wxBitmap& pushedBitmap,
+ bool toggle,
+ long xPos, long yPos,
+ wxObject *clientData,
+ const wxString& helpString1,
+ const wxString& helpString2)
+{
+ wxToolBarTool *tool = new wxToolBarTool(index, bitmap, wxNullBitmap,
+ toggle, xPos, yPos,
+ helpString1, helpString2);
+ tool->m_clientData = clientData;
+
+ if (xPos > -1)
+ tool->m_x = xPos;
+ else
+ tool->m_x = m_xMargin;
+
+ if (yPos > -1)
+ tool->m_y = yPos;
+ else
+ tool->m_y = m_yMargin;
+
+ tool->SetSize(GetToolSize().x, GetToolSize().y);
+
+ m_tools.Append((long)index, tool);
+ m_ids.Add(index);
+
+ return tool;