Salome HOME
Selection priority in Sketch, clear selection when sketch goes from entity to neutral...
[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   ModuleBase_ToolBox( QWidget* theParent );
32   virtual ~ModuleBase_ToolBox();
33
34   ///  Add a new item to the tool box
35   /// \param thePage a widget of the new item
36   /// \param theName a name of the item
37   /// \param theIcon an icon of the item
38   void addItem( QWidget* thePage, const QString& theName, const QPixmap& theIcon );
39
40   /// \return number of items
41   int count() const;
42
43   /// \return index of current widget
44   int currentIndex() const;
45
46   /// Set current item
47   /// \param theIdx an index
48   void setCurrentIndex( const int theIdx);
49
50   /// Found in the controls of the model widget parent in Stacked Widget
51   /// returns whether this controls are in the current widget of the stacked widgets
52   /// \param theWidget a model widget
53   /// \return boolean result
54   static bool isOffToolBoxParent(ModuleBase_ModelWidget* theWidget);
55
56 signals:
57   /// A signal which is emited on current item changed
58   void currentChanged( int );
59
60 private slots:
61   /// A slot called on button press
62   void onButton( int );
63
64 private:
65   QButtonGroup*   myButtonsGroup;
66   QFrame*         myButtonsFrame;
67   QHBoxLayout*    myButtonsLayout;
68   QStackedWidget* myStack;
69 };
70 #endif