Toolbar refactoring

1) toolbar items define 3 callback functions for setting the visibility, setting the enabling state and defining their action which are set while adding a new item to the toolbar

2) the toolbar takes care to update all its items visibility and enabled states through a new update method to be called by the parent idle event handler

3) the toolbar handles mouse events by calling its on_mouse method
This commit is contained in:
Enrico Turri 2019-03-14 13:54:05 +01:00
parent f02f24c4b7
commit 5018089351
9 changed files with 968 additions and 5 deletions

View file

@ -122,6 +122,9 @@ void View3D::mirror_selection(Axis axis)
m_canvas->mirror_selection(axis);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#if !ENABLE_CANVAS_GUI_REFACTORING
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
void View3D::update_toolbar_items_visibility()
{
if (m_canvas != nullptr)
@ -133,6 +136,9 @@ void View3D::enable_toolbar_item(const std::string& name, bool enable)
if (m_canvas != nullptr)
m_canvas->enable_toolbar_item(name, enable);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#endif // !ENABLE_CANVAS_GUI_REFACTORING
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
int View3D::check_volumes_outside_state() const
{