Salome HOME
3665ac95d0defe767c17cfcb6d081654b5cb4634
[modules/shaper.git] / src / SHAPERGUI / SHAPERGUI_NestedButton.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 /*
4  * SHAPERGUI_NestedButton.h
5  *
6  *  Created on: Apr 13, 2015
7  *      Author: sbh
8  */
9
10 #ifndef SRC_SHAPERGUI_NESTEDBUTTON_H_
11 #define SRC_SHAPERGUI_NESTEDBUTTON_H_
12
13 #include <QWidgetAction>
14
15 class QFrame;
16 class QAction;
17 class QWidget;
18 class QToolButton;
19
20 /*!
21  * \ingroup Salome
22  * Custom (nested) button in salome mode.
23  */
24 class SHAPERGUI_NestedButton : public QWidgetAction
25 {
26   Q_OBJECT
27  public:
28    /// Constructor
29    /// \param theParent a parent objects
30    /// \param theNestedActions a list of nested actions
31   SHAPERGUI_NestedButton(QObject* theParent, const QList<QAction*>& theNestedActions);
32   virtual ~SHAPERGUI_NestedButton();
33
34  private slots:
35   /// Shows/hides the additional buttons widget
36   void showAdditionalButtons(bool);
37
38   /// Slot called on action state
39   void actionStateChanged();
40
41  protected:
42   /// Creates the button representation
43   /// \param theParent a parent widget
44   virtual QWidget * createWidget(QWidget * theParent);
45   
46   virtual bool event(QEvent* theEvent);
47
48  private:
49   QList<QAction*> myNestedActions; ///< list of nested actions
50   QWidget* myAdditionalButtonsWidget; ///< widget to precess additional buttons visibility
51   QFrame* myButtonFrame; ///< frame arround button representation
52   QToolButton* myThisButton; ///< main button
53 };
54
55 #endif /* SRC_SHAPERGUI_NESTEDBUTTON_H_ */