void ToolGuiObjectManager::AddTool (ToolGuiObject &toolGuiObject, ToolBar &toolBar) { // Use same ID as for menu allowing reuse of menu event handler: int id = this->FindId (&toolGuiObject); if (toolGuiObject.CanAddTool ()) { toolGuiObject.AddTool (id, toolBar); } else { // We assume: // (a) the label gives enough information as tooltip. // (b) an exclusive tool must be toggleable. toolBar.AddTool (id, "", toolGuiObject.GetToolIcon (), toolGuiObject.GetName (), toolGuiObject.IsToggle (), !toolGuiObject.IsExclusive ()); } m_toolList[&toolGuiObject] = &toolBar; }