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