Salome HOME
ad5ae73bb811dba3f0c9ad7bde27d29e64aa31c0
[modules/gui.git] / src / Qtx / QtxActionGroup.h
1 // Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // File:      QtxActionGroup.h
21 // Author:    Sergey TELKOV
22 //
23 #ifndef QTXACTIONGROUP_H
24 #define QTXACTIONGROUP_H
25
26 #include "QtxActionSet.h"
27
28 #ifdef WIN32
29 #pragma warning( disable:4251 )
30 #endif
31
32 class QtxComboBox;
33 class QActionGroup;
34
35 class QTX_EXPORT QtxActionGroup : public QtxActionSet
36 {
37   Q_OBJECT
38
39 public:
40   QtxActionGroup( QObject* = 0 );
41   QtxActionGroup( QObject*, const bool );
42   virtual ~QtxActionGroup();
43
44   bool             isExclusive() const;
45   bool             usesDropDown() const;
46
47   void             add( QAction* );
48
49   void             setEnabled( bool );
50
51 public slots:
52   void             setExclusive( const bool );
53   void             setUsesDropDown( const bool );
54
55 signals:
56   void             selected( QAction* );
57
58 private slots:
59   void             onActivated( int );
60   void             onTriggered( QAction* );
61
62 protected:
63   virtual void     updateAction( QWidget* );
64   virtual void     updateAction( QtxComboBox* );
65
66   virtual QWidget* createWidget( QWidget* );
67
68   virtual bool     isEmptyAction() const;
69   virtual void     actionAdded( QAction* );
70   virtual void     actionRemoved( QAction* );
71
72 private:
73   void             updateType();
74   QtxComboBox*     createdWidget( QWidget* );
75
76 private:
77   bool             myDropDown;
78   QActionGroup*    myActionGroup;
79 };
80
81 #ifdef WIN32
82 #pragma warning( default:4251 )
83 #endif
84
85 #endif