]> SALOME platform Git repositories - modules/gui.git/blob - src/Qtx/QtxActionGroup.h
Salome HOME
dd1ee2741477f6b0ea7bb1ac133bdcac988341be
[modules/gui.git] / src / Qtx / QtxActionGroup.h
1 // Copyright (C) 2007-2012  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.
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 public slots:
50   void             setExclusive( const bool );
51   void             setUsesDropDown( const bool );
52
53 signals:
54   void             selected( QAction* );
55
56 private slots:
57   void             onActivated( int );
58   void             onTriggered( QAction* );
59
60 protected:
61   virtual void     updateAction( QWidget* );
62   virtual void     updateAction( QtxComboBox* );
63
64   virtual QWidget* createWidget( QWidget* );
65
66   virtual bool     isEmptyAction() const;
67   virtual void     actionAdded( QAction* );
68   virtual void     actionRemoved( QAction* );
69
70 private:
71   void             updateType();
72   QtxComboBox*     createdWidget( QWidget* );
73
74 private:
75   bool             myDropDown;
76   QActionGroup*    myActionGroup;
77 };
78
79 #ifdef WIN32
80 #pragma warning( default:4251 )
81 #endif
82
83 #endif