Gui/Workbench.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef GUI_WORKBENCH_H
00025 #define GUI_WORKBENCH_H
00026
00027 #include <list>
00028 #include <string>
00029 #include <Base/BaseClass.h>
00030 #include <Gui/TaskView/TaskWatcher.h>
00031
00032 namespace Base {
00033 class PyObjectBase;
00034 }
00035
00036 namespace Gui {
00037
00038 class MenuItem;
00039 class ToolBarItem;
00040 class DockWindowItems;
00041 class WorkbenchManager;
00042
00051 class GuiExport Workbench : public Base::BaseClass
00052 {
00053 TYPESYSTEM_HEADER();
00054
00055 public:
00057 Workbench();
00058 virtual ~Workbench();
00062 std::string name() const;
00066 void setName(const std::string&);
00070 PyObject* getPyObject();
00074 virtual void setupContextMenu(const char* recipient,MenuItem*) const;
00078 virtual void createMainWindowPopupMenu(MenuItem*) const;
00082 bool activate();
00086 void retranslate() const;
00088 virtual void activated();
00090 virtual void deactivated();
00091
00093 void addTaskWatcher(std::vector<Gui::TaskView::TaskWatcher*> &Watcher);
00095 void removeTaskWatcher(void);
00096
00097 protected:
00099 virtual MenuItem* setupMenuBar() const=0;
00101 virtual ToolBarItem* setupToolBars() const=0;
00103 virtual ToolBarItem* setupCommandBars() const=0;
00105 virtual DockWindowItems* setupDockWindows() const=0;
00106
00107 private:
00112 void setupCustomToolbars(ToolBarItem* root, const char* toolbar) const;
00113 void setupCustomShortcuts() const;
00114
00115 private:
00116 std::string _name;
00117 };
00118
00125 class GuiExport StdWorkbench : public Workbench
00126 {
00127 TYPESYSTEM_HEADER();
00128
00129 public:
00130 StdWorkbench();
00131 virtual ~StdWorkbench();
00132
00133 public:
00135 virtual void setupContextMenu(const char* recipient, MenuItem*) const;
00136 virtual void createMainWindowPopupMenu(MenuItem*) const;
00137
00138 protected:
00140 virtual MenuItem* setupMenuBar() const;
00142 virtual ToolBarItem* setupToolBars() const;
00144 virtual ToolBarItem* setupCommandBars() const;
00146 virtual DockWindowItems* setupDockWindows() const;
00147 };
00148
00153 class GuiExport BlankWorkbench : public Workbench
00154 {
00155 TYPESYSTEM_HEADER();
00156
00157 public:
00158 BlankWorkbench();
00159 virtual ~BlankWorkbench();
00160
00162 virtual void setupContextMenu(const char* recipient,MenuItem*) const;
00164 virtual void activated();
00166 virtual void deactivated();
00167
00168 protected:
00170 virtual MenuItem* setupMenuBar() const;
00172 virtual ToolBarItem* setupToolBars() const;
00174 virtual ToolBarItem* setupCommandBars() const;
00176 virtual DockWindowItems* setupDockWindows() const;
00177 };
00178
00183 class GuiExport NoneWorkbench : public StdWorkbench
00184 {
00185 TYPESYSTEM_HEADER();
00186
00187 public:
00188 NoneWorkbench();
00189 virtual ~NoneWorkbench();
00190
00192 virtual void setupContextMenu(const char* recipient,MenuItem*) const;
00193
00194 protected:
00196 virtual MenuItem* setupMenuBar() const;
00198 virtual ToolBarItem* setupToolBars() const;
00200 virtual ToolBarItem* setupCommandBars() const;
00202 virtual DockWindowItems* setupDockWindows() const;
00203 };
00204
00205 class GuiExport TestWorkbench : public StdWorkbench
00206 {
00207 TYPESYSTEM_HEADER();
00208
00209 public:
00210 TestWorkbench();
00211 ~TestWorkbench();
00212
00213 protected:
00214 MenuItem* setupMenuBar() const;
00215 ToolBarItem* setupToolBars() const;
00216 ToolBarItem* setupCommandBars() const;
00217 };
00218
00224 class GuiExport PythonWorkbench : public StdWorkbench
00225 {
00226 TYPESYSTEM_HEADER();
00227
00228 public:
00229 PythonWorkbench();
00230 ~PythonWorkbench();
00234 PyObject* getPyObject();
00235
00238
00239 void appendMenu(const std::list<std::string>& menu, const std::list<std::string>& items) const;
00241 void removeMenu(const std::string& menu ) const;
00243 std::list<std::string> listMenus() const;
00244
00246 void appendContextMenu(const std::list<std::string>& menu, const std::list<std::string>& items) const;
00248 void removeContextMenu(const std::string& menu ) const;
00249 void setupContextMenu(const char* recipient,MenuItem*) const;
00250 void clearContextMenu();
00251
00253 void appendToolbar(const std::string& bar, const std::list<std::string>& items) const;
00255 void removeToolbar(const std::string& bar) const;
00257 std::list<std::string> listToolbars() const;
00258
00260 void appendCommandbar(const std::string& bar, const std::list<std::string>& items) const;
00262 void removeCommandbar(const std::string& bar) const;
00264 std::list<std::string> listCommandbars() const;
00266
00267 protected:
00268 MenuItem* setupMenuBar() const;
00269 ToolBarItem* setupToolBars() const;
00270 ToolBarItem* setupCommandBars() const;
00271
00272 private:
00273 MenuItem* _menuBar;
00274 MenuItem* _contextMenu;
00275 ToolBarItem* _toolBar;
00276 ToolBarItem* _commandBar;
00277 Base::PyObjectBase* _workbenchPy;
00278 };
00279
00280 }
00281
00282
00283 #endif // GUI_WORKBENCH_H