Salome HOME
Merge branch 'master' of newgeom:newgeom.git
[modules/shaper.git] / src / XGUI / XGUI_MenuGroupPanel.h
1 #ifndef XGUI_MenuGroupPanel_H
2 #define XGUI_MenuGroupPanel_H
3
4 #include "XGUI.h"
5 #include <QFrame>
6 #include <QMap>
7
8 class XGUI_Command;
9 class QGridLayout;
10
11 /**\class XGUI_MenuGroupPanel
12  * \ingroup GUI
13  * \brief Represents a one group in a page of main menu (workbench)
14  */
15 class XGUI_EXPORT XGUI_MenuGroupPanel : public QFrame
16 {
17 Q_OBJECT
18
19  public:
20   explicit XGUI_MenuGroupPanel(QWidget *parent = 0);
21
22   //! Adding a new feature (Command) in the group
23   XGUI_Command* addFeature(const QString& theId,
24                            const QString& theTip,
25                            const QString& theTitle,
26                            const QIcon& theIcon,
27                            const QKeySequence& theKeys = QKeySequence());
28
29   XGUI_Command* addFeature(const QString& theId,
30                            const QString& theTip,
31                            const QString& theTitle,
32                            const QIcon& theIcon,
33                            const QString& theDocumentKind = QString(),
34                            const QKeySequence& theKeys = QKeySequence(),
35                            bool isCheckable = false);
36
37   //! Returns already created command by its ID
38   XGUI_Command* feature(const QString& theId) const;
39
40   //! Returns list of created commands
41   QList<XGUI_Command*> features() const
42   {
43     return myActions;
44   }
45
46  protected:
47   virtual void resizeEvent(QResizeEvent *theEvent);
48
49  private:
50   void addWidget(QWidget* theWgt);
51   void placeWidget(QWidget* theWgt);
52   void addCommand(XGUI_Command* theAction);
53
54   QList<XGUI_Command*> myActions;
55   QWidgetList myActionWidget;
56
57   QGridLayout* myLayout;
58   int myNewRow;
59   int myNewCol;
60   int myMaxRow;
61 };
62
63 #endif