void DrawToolBar::SetFilterToolIcon(int i) { char const **tool_icon; switch (i) { case 0: tool_icon = filter0_xpm; break; case 1: tool_icon = filter1_xpm; break; case 2: tool_icon = filter2_xpm; break; case 3: tool_icon = filter3_xpm; break; case 4: tool_icon = filter4_xpm; break; case 5: tool_icon = filter5_xpm; break; default: assert(false); } int index = GetToolPos(drawTB_FILTER); assert(index != wxNOT_FOUND); DeleteTool(drawTB_FILTER); InsertTool(index, drawTB_FILTER, tool_icon, wxNullBitmap, false, NULL, _T(""), _("Filter")); Realize(); }
void CToolBar::MakeDropdownTool(int id) { wxToolBarToolBase* pOldTool = FindById(id); if (!pOldTool) return; wxToolBarToolBase* pTool = new wxToolBarToolBase(0, id, pOldTool->GetLabel(), pOldTool->GetNormalBitmap(), pOldTool->GetDisabledBitmap(), wxITEM_DROPDOWN, NULL, pOldTool->GetShortHelp(), pOldTool->GetLongHelp()); int pos = GetToolPos(id); wxASSERT(pos != wxNOT_FOUND); DeleteToolByPos(pos); InsertTool(pos, pTool); Realize(); }
bool CToolBar::HideTool(int id) { int pos = GetToolPos(id); if (pos == -1) return false; wxToolBarToolBase* tool = RemoveTool(id); if (!tool) return false; for (auto const& iter : m_hidden_tools) { if (iter.first > pos) break; ++pos; } m_hidden_tools[pos] = tool; return true; }
bool CToolBar::HideTool(int id) { int pos = GetToolPos(id); if (pos == -1) return false; wxToolBarToolBase* tool = RemoveTool(id); if (!tool) return false; for (auto iter = m_hidden_tools.begin(); iter != m_hidden_tools.end(); ++iter) { if (iter->first > pos) break; pos++; } m_hidden_tools[pos] = tool; return true; }
void DrawToolBar::NewDrawVersionAvailable() { int index = GetToolPos(drawTB_EXIT); InsertTool(index, drawTB_NEWDRAWVERSION, old_version_warning_xpm, wxNullBitmap, false, NULL, _T(""), _("New version available")); Realize(); }