This is the base class for the workbench facility. More...
#include <Workbench.h>
Public Member Functions | |
bool | activate () |
Activates the workbench and adds/removes GUI elements. More... | |
virtual void | activated () |
Run some actions when the workbench gets activated. More... | |
void | addTaskWatcher (const std::vector< Gui::TaskView::TaskWatcher * > &Watcher) |
helper to add TaskWatcher to the TaskView More... | |
virtual void | createMainWindowPopupMenu (MenuItem *) const |
Sets up the contextmenu for the main window for this workbench. More... | |
virtual void | deactivated () |
Run some actions when the workbench gets deactivated. More... | |
PyObject * | getPyObject () |
The default implementation returns an instance of WorkbenchPy. More... | |
std::list< std::pair< std::string, std::list< std::string > > > | getToolbarItems () const |
Shows a list of all toolbars and their commands. More... | |
std::list< std::string > | listCommandbars () const |
std::list< std::string > | listMenus () const |
std::list< std::string > | listToolbars () const |
std::string | name () const |
Returns the name of the workbench object. More... | |
void | removeTaskWatcher (void) |
remove the added TaskWatcher More... | |
void | retranslate () const |
Translates the window titles of all menus, toolbars and dock windows. More... | |
void | setName (const std::string &) |
Set the name to the workbench object. More... | |
virtual void | setupContextMenu (const char *recipient, MenuItem *) const |
Sets up the contextmenu for this workbench. More... | |
Workbench () | |
Constructs a workbench object. More... | |
virtual | ~Workbench () |
Public Member Functions inherited from Base::BaseClass | |
BaseClass () | |
Construction. More... | |
BaseClass (const BaseClass &)=default | |
virtual PyObject * | getPyObject () |
This method returns the Python wrapper for a C++ object. More... | |
virtual Type | getTypeId () const |
bool | isDerivedFrom (const Type type) const |
BaseClass & | operator= (const BaseClass &)=default |
virtual void | setPyObject (PyObject *) |
virtual | ~BaseClass () |
Destruction. More... | |
Static Public Member Functions | |
static void | addPermanentMenuItem (const std::string &cmd, const std::string &after) |
Add a permanent menu item cmd after an existing command after. More... | |
static void | createLinkMenu (MenuItem *) |
static void | removePermanentMenuItem (const std::string &cmd) |
Removes the command cmd from the permanent menu items. More... | |
Static Public Member Functions inherited from Base::BaseClass | |
static void * | create () |
static Type | getClassTypeId () |
static void | init () |
Protected Member Functions | |
void | addPermanentMenuItems (MenuItem *) const |
Add permanent menu items to the structure. More... | |
virtual ToolBarItem * | setupCommandBars () const =0 |
Returns a ToolBarItem tree structure of command bars for this workbench. More... | |
virtual DockWindowItems * | setupDockWindows () const =0 |
Returns a DockWindowItems structure of dock windows this workbench. More... | |
virtual MenuItem * | setupMenuBar () const =0 |
Returns a MenuItem tree structure of menus for this workbench. More... | |
virtual ToolBarItem * | setupToolBars () const =0 |
Returns a ToolBarItem tree structure of toolbars for this workbench. More... | |
Additional Inherited Members | |
Static Protected Member Functions inherited from Base::BaseClass | |
static void | initSubclass (Base::Type &toInit, const char *ClassName, const char *ParentName, Type::instantiationMethod method=nullptr) |
This is the base class for the workbench facility.
Each FreeCAD module can provide its own workbench implementation. The workbench defines which GUI elements (such as toolbars, menus, dockable windows, ...) are added to the mainwindow and which gets removed or hidden. When a workbench object gets activated the first time the module - it stands for - gets loaded into RAM.
Workbench::Workbench | ( | ) |
Constructs a workbench object.
|
virtual |
Reimplemented in CloudGui::Workbench, DrawingGui::Workbench, FemGui::Workbench, ImageGui::Workbench, ImportGui::Workbench, InspectionGui::Workbench, MeshGui::Workbench, MeshPartGui::Workbench, PartGui::Workbench, PartDesignGui::Workbench, PointsGui::Workbench, RaytracingGui::Workbench, ReverseEngineeringGui::Workbench, RobotGui::Workbench, SandboxGui::Workbench, SketcherGui::Workbench, SpreadsheetGui::Workbench, StartGui::Workbench, SurfaceGui::Workbench, TechDrawGui::Workbench, and WebGui::Workbench.
bool Workbench::activate | ( | void | ) |
Activates the workbench and adds/removes GUI elements.
References addPermanentMenuItems(), Gui::MenuManager::getInstance(), Gui::ToolBarManager::getInstance(), Gui::DockWindowManager::instance(), Gui::DockWindowManager::setup(), Gui::MenuManager::setup(), Gui::ToolBarManager::setup(), setupDockWindows(), setupMenuBar(), and setupToolBars().
Referenced by Gui::WorkbenchManager::activate(), ArchBuildingPart.ViewProviderBuildingPart::doubleClicked(), and draftviewproviders.view_layer.ViewProviderLayer::setupContextMenu().
|
virtual |
Run some actions when the workbench gets activated.
Reimplemented in Gui::BlankWorkbench, MeshGui::Workbench, PartDesignGui::Workbench, RobotGui::Workbench, SpreadsheetGui::Workbench, and StartGui::Workbench.
Referenced by MeshGui::Workbench::activated(), PartDesignGui::Workbench::activated(), RobotGui::Workbench::activated(), and Gui::Application::activateWorkbench().
|
static |
Add a permanent menu item cmd after an existing command after.
Permanent menu items are always added independent of what the active workbench is. Adding it will only fail if the item after doesn't exist.
|
protected |
Add permanent menu items to the structure.
References Gui::MenuItem::afterItem(), Gui::MenuItem::findItem(), Gui::MenuItem::findParentOf(), Gui::MenuItem::insertItem(), and Gui::MenuItem::setCommand().
Referenced by activate().
void Workbench::addTaskWatcher | ( | const std::vector< Gui::TaskView::TaskWatcher * > & | Watcher | ) |
helper to add TaskWatcher to the TaskView
References Gui::TaskView::TaskView::addTaskWatcher(), Gui::Control(), and Gui::ControlSingleton::taskPanel().
Referenced by MeshGui::Workbench::activated(), PartDesignGui::Workbench::activated(), and RobotGui::Workbench::activated().
|
static |
|
virtual |
Sets up the contextmenu for the main window for this workbench.
The default implementation does nothing.
Reimplemented in Gui::StdWorkbench, and Gui::PythonWorkbench.
Referenced by Gui::MainWindow::createPopupMenu().
|
virtual |
Run some actions when the workbench gets deactivated.
Reimplemented in Gui::BlankWorkbench, MeshGui::Workbench, PartDesignGui::Workbench, and RobotGui::Workbench.
Referenced by Gui::Application::activateWorkbench(), MeshGui::Workbench::deactivated(), PartDesignGui::Workbench::deactivated(), and RobotGui::Workbench::deactivated().
|
virtual |
The default implementation returns an instance of WorkbenchPy.
Reimplemented from Base::BaseClass.
Reimplemented in Gui::PythonBaseWorkbench.
Referenced by Gui::Application::activateWorkbench().
std::list< std::pair< std::string, std::list< std::string > > > Workbench::getToolbarItems | ( | ) | const |
Shows a list of all toolbars and their commands.
References setupToolBars().
std::list< std::string > Workbench::listCommandbars | ( | ) | const |
References setupCommandBars().
std::list< std::string > Workbench::listMenus | ( | ) | const |
References setupMenuBar().
std::list< std::string > Workbench::listToolbars | ( | ) | const |
References setupToolBars().
std::string Workbench::name | ( | ) | const |
Returns the name of the workbench object.
Referenced by draftguitools.gui_groups.Ui_AddNamedGroup::accept(), Gui::Application::activateWorkbench(), prototype.Node::addtofreecad(), Addon.Addon::disable(), Addon.Addon::enable(), addonmanager_macro.Macro::filename(), gzip_utf8.GzipFile::filename(), addonmanager_macro.Macro::fill_details_from_code(), addonmanager_macro.Macro::fill_details_from_wiki(), Addon.Addon::get_cached_icon_filename(), ifc4.ifcapproval::hasidentifierorname(), addonmanager_macro.Macro::install(), Addon.Addon::is_disabled(), femsolver.elmer.sifio.Section::keys(), automotive_design.si_unit::named_unit_dimensions(), Gui::Dialog::DlgSettingsLazyLoadedImp::onLoadClicked(), Mod.PartDesign.WizardShaft.SegmentFunction.SegmentFunction::output(), prototype.Node::pprint(), prototype.Node::pprint2(), PathScripts.PathSetupSheetGui.OpTaskPanel::propertyGroup(), PathScripts.PathSetupSheetGui.OpTaskPanel::propertyName(), PathScripts.PathJobGui.TaskPanel::reject(), addonmanager_macro.Macro::remove(), Gui::Application::sActiveWorkbenchHandler(), setName(), Gui::Application::setupContextMenu(), Addon.Addon::to_cache(), ifc2x3.ifcexternalreference::wr1(), ifc2x3.ifcdocumentreference::wr1(), ifc4.ifcexternalreference::wr1(), ifc4.ifcdocumentreference::wr1(), and automotive_design.general_property_association::wr2().
|
static |
Removes the command cmd from the permanent menu items.
void Workbench::removeTaskWatcher | ( | void | ) |
remove the added TaskWatcher
References Gui::TaskView::TaskView::clearTaskWatcher(), Gui::Control(), and Gui::ControlSingleton::taskPanel().
Referenced by MeshGui::Workbench::deactivated(), PartDesignGui::Workbench::deactivated(), and RobotGui::Workbench::deactivated().
void Workbench::retranslate | ( | ) | const |
Translates the window titles of all menus, toolbars and dock windows.
References Gui::MenuManager::getInstance(), Gui::ToolBarManager::getInstance(), Gui::DockWindowManager::instance(), Gui::DockWindowManager::retranslate(), Gui::MenuManager::retranslate(), and Gui::ToolBarManager::retranslate().
Referenced by Gui::MainWindow::changeEvent().
void Workbench::setName | ( | const std::string & | name | ) |
Set the name to the workbench object.
References name().
Referenced by Gui::WorkbenchFactoryInst::createWorkbench(), and Gui::WorkbenchManager::createWorkbench().
|
protectedpure virtual |
Returns a ToolBarItem tree structure of command bars for this workbench.
Implemented in Gui::StdWorkbench, Gui::BlankWorkbench, Gui::NoneWorkbench, Gui::TestWorkbench, Gui::PythonBaseWorkbench, Gui::PythonWorkbench, DrawingGui::Workbench, ImageGui::Workbench, ImportGui::Workbench, MeshGui::Workbench, MeshPartGui::Workbench, PartGui::Workbench, PartDesignGui::Workbench, PointsGui::Workbench, ReverseEngineeringGui::Workbench, SandboxGui::Workbench, SketcherGui::Workbench, SpreadsheetGui::Workbench, StartGui::Workbench, TechDrawGui::Workbench, and WebGui::Workbench.
Referenced by listCommandbars().
|
virtual |
Sets up the contextmenu for this workbench.
The default implementation does nothing.
Reimplemented in FemGui::Workbench, MeshGui::Workbench, PartDesignGui::Workbench, StartGui::Workbench, WebGui::Workbench, Gui::StdWorkbench, Gui::BlankWorkbench, Gui::NoneWorkbench, Gui::PythonBaseWorkbench, and Gui::PythonWorkbench.
Referenced by Gui::Application::setupContextMenu().
|
protectedpure virtual |
Returns a DockWindowItems structure of dock windows this workbench.
Implemented in Gui::StdWorkbench, Gui::BlankWorkbench, Gui::NoneWorkbench, Gui::PythonBaseWorkbench, Gui::PythonWorkbench, SandboxGui::Workbench, StartGui::Workbench, and WebGui::Workbench.
Referenced by activate().
|
protectedpure virtual |
Returns a MenuItem tree structure of menus for this workbench.
Implemented in Gui::StdWorkbench, Gui::BlankWorkbench, Gui::NoneWorkbench, Gui::TestWorkbench, Gui::PythonBaseWorkbench, Gui::PythonWorkbench, DrawingGui::Workbench, FemGui::Workbench, InspectionGui::Workbench, MeshGui::Workbench, PartGui::Workbench, PartDesignGui::Workbench, PointsGui::Workbench, RaytracingGui::Workbench, ReverseEngineeringGui::Workbench, RobotGui::Workbench, SandboxGui::Workbench, SketcherGui::Workbench, SpreadsheetGui::Workbench, StartGui::Workbench, SurfaceGui::Workbench, TechDrawGui::Workbench, and WebGui::Workbench.
Referenced by activate(), and listMenus().
|
protectedpure virtual |
Returns a ToolBarItem tree structure of toolbars for this workbench.
Implemented in Gui::StdWorkbench, Gui::BlankWorkbench, Gui::NoneWorkbench, Gui::TestWorkbench, Gui::PythonBaseWorkbench, Gui::PythonWorkbench, DrawingGui::Workbench, FemGui::Workbench, ImageGui::Workbench, ImportGui::Workbench, InspectionGui::Workbench, MeshGui::Workbench, MeshPartGui::Workbench, PartGui::Workbench, PartDesignGui::Workbench, PointsGui::Workbench, RaytracingGui::Workbench, ReverseEngineeringGui::Workbench, RobotGui::Workbench, SandboxGui::Workbench, SketcherGui::Workbench, SpreadsheetGui::Workbench, StartGui::Workbench, SurfaceGui::Workbench, TechDrawGui::Workbench, and WebGui::Workbench.
Referenced by activate(), getToolbarItems(), and listToolbars().