Salome HOME
Avoid of reference to not-initialized attributes values
[modules/shaper.git] / src / ModuleBase / ModuleBase_ToolBox.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModuleBase_ToolBox.h
4 // Created:     10 August 2015
5 // Author:      Alexandre SOLOVYOV
6
7 #ifndef ModuleBase_ToolBox_H
8 #define ModuleBase_ToolBox_H
9
10 #include <ModuleBase.h>
11 #include <QFrame>
12
13 class QButtonGroup;
14 class QFrame;
15 class QHBoxLayout;
16 class QStackedWidget;
17 class ModuleBase_ModelWidget;
18
19 /**
20  * \class ModuleBase_ToolBox
21  * \ingroup GUI
22  * \brief An extension of QFrame object
23  */
24 class MODULEBASE_EXPORT ModuleBase_ToolBox : public QFrame
25 {
26   Q_OBJECT
27
28 public:
29   /// Constructor
30   /// \param theParent a parent widget
31   /// \param theUseFrameStyleBox a flag if the tool box should have box covered
32   /// buttons and current page
33   ModuleBase_ToolBox(QWidget* theParent, const bool theUseFrameStyleBox = false);
34   virtual ~ModuleBase_ToolBox();
35
36   ///  Add a new item to the tool box
37   /// \param thePage a widget of the new item
38   /// \param theName a name of the item
39   /// \param theIcon an icon of the item
40   void addItem(QWidget* thePage, const QString& theName, const QPixmap& theIcon);
41
42   /// \return number of items
43   int count() const;
44
45   /// \return index of current widget
46   int currentIndex() const;
47
48   /// Set current item
49   /// \param theIdx an index
50   void setCurrentIndex(const int theIdx);
51
52   /// Found in the controls of the model widget parent in Stacked Widget
53   /// returns whether this controls are in the current widget of the stacked widgets
54   /// \param theWidget a model widget
55   /// \return boolean result
56   static bool isOffToolBoxParent(ModuleBase_ModelWidget* theWidget);
57
58 signals:
59   /// A signal which is emited on current item changed
60   void currentChanged(int);
61
62 private slots:
63   /// A slot called on button press
64   void onButton(int);
65
66 private:
67   QButtonGroup*   myButtonsGroup;
68   QFrame*         myButtonsFrame;
69   QHBoxLayout*    myButtonsLayout;
70   QStackedWidget* myStack;
71 };
72 #endif