Salome HOME
7cf1f1d4164e5a76246034ddfc98d6e3b5e3e305
[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, const QString& theTitle, const QString& theTip,
24                            const QIcon& theIcon, const QKeySequence& theKeys = QKeySequence(),
25                            bool isCheckable = false);
26
27   //! Returns already created command by its ID
28   XGUI_Command* feature(const QString& theId) const;
29
30   //! Returns list of created commands
31   QList<XGUI_Command*> features() const
32   {
33     return myActions;
34   }
35
36  protected:
37   virtual void resizeEvent(QResizeEvent *theEvent);
38
39  private:
40   void addWidget(QWidget* theWgt);
41   void placeWidget(QWidget* theWgt);
42   void addCommand(XGUI_Command* theAction);
43
44   QList<XGUI_Command*> myActions;
45   QWidgetList myActionWidget;
46
47   QGridLayout* myLayout;
48   int myNewRow;
49   int myNewCol;
50   int myMaxRow;
51 };
52
53 #endif