]> SALOME platform Git repositories - modules/shaper.git/blob - src/XGUI/XGUI_Workshop.h
Salome HOME
Testing GUI version
[modules/shaper.git] / src / XGUI / XGUI_Workshop.h
1
2 #ifndef XGUI_WORKSHOP_H
3 #define XGUI_WORKSHOP_H
4
5 #include "XGUI_Interfaces.h"
6
7 #include <QObject>
8 #include <QMap>
9 #include <QIcon>
10 #include <QKeySequence>
11
12 class XGUI_MainWindow;
13 class XGUI_Command;
14 class XGUI_Module;
15
16 class XGUI_Workshop: public QObject, IWorkshop
17 {
18         Q_OBJECT
19 public:
20     enum XCommandId {
21         NEW_CMD,
22         OPEN_CMD,
23         SAVE_CMD,
24         SAVEAS_CMD,
25         EXIT_CMD,
26         UNDO_CMD,
27         REDO_CMD,
28         COPY_CMD,
29         CUT_CMD,
30         PASTE_CMD,
31         LAST_CMD
32     };
33
34         XGUI_Workshop();
35         virtual ~XGUI_Workshop();
36
37     void startApplication();
38
39     XGUI_Command* command(XCommandId theId) const;
40
41     XGUI_MainWindow* mainWindow() const { return myMainWindow; }
42
43     virtual int addWorkbench(const QString& theName);
44     virtual int addGroup(int thePageId);
45     virtual int addFeature(int thePageId, int theGroupId, 
46                            const QString& theTitle, const QString& theTip, 
47                            const QIcon& theIcon, 
48                            const QKeySequence& theKeys = QKeySequence());
49
50
51 public slots:
52     void onNew();
53     void onOpen();
54     void onSave();
55     void onSaveAs();
56     void onExit();
57
58 private:
59     void initMenu();
60
61     IModule* loadModule(const QString& theModule);
62     bool activateModule();
63
64     void addCommand(XCommandId theCommandId, int thePageId, int theGroupId, XGUI_Command* theCommand);
65     XGUI_Command* createMenuCommand(int thePageId, int theGroupId, XCommandId theCmdId, 
66                                     const QString& theTitle, const QString& theTip, 
67                                     const QIcon& theIcon = QIcon(), const QKeySequence& theKeys = QKeySequence());
68
69     QMap<int, XGUI_Command*> myCommands;
70
71     XGUI_MainWindow* myMainWindow;
72 };
73
74 #endif