Salome HOME
Merge branch 'master' of newgeom:newgeom
[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
12 /**\class XGUI_MenuGroupPanel
13  * \ingroup GUI
14  * \brief Represents a one group in a page of main menu (workbench)
15  */
16 class XGUI_EXPORT XGUI_MenuGroupPanel: public QFrame
17 {
18   Q_OBJECT
19
20  public:
21   explicit XGUI_MenuGroupPanel(QWidget *parent = 0);
22
23   //! Adding a new feature (Command) in the group
24   XGUI_Command* addFeature(const QString& theId, const QString& theTitle, const QString& theTip,
25                            const QIcon& theIcon, const QKeySequence& theKeys = QKeySequence(),
26                            bool isCheckable = false);
27
28   //! Returns already created command by its ID
29   XGUI_Command* feature(const QString& theId) const;
30
31   //! Returns list of created commands
32   QList<XGUI_Command*> features() const { return myActions; }
33
34 protected:
35   virtual void resizeEvent(QResizeEvent *theEvent);
36
37 private:
38   void addWidget(QWidget* theWgt);
39   void placeWidget(QWidget* theWgt);
40   void addCommand(XGUI_Command* theAction);
41
42   QList<XGUI_Command*> myActions;
43   QWidgetList          myActionWidget;
44
45   QGridLayout* myLayout;
46   int myNewRow;
47   int myNewCol;
48   int myMaxRow;
49 };
50
51 #endif