]> SALOME platform Git repositories - modules/gui.git/blob - src/Qtx/QtxActionGroup.h
Salome HOME
45a8067e0861a2a8764c1711da6de76f9100c0a0
[modules/gui.git] / src / Qtx / QtxActionGroup.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File:      QtxActionGroup.h
23 // Author:    Sergey TELKOV
24 //
25 #ifndef QTXACTIONGROUP_H
26 #define QTXACTIONGROUP_H
27
28 #include "QtxActionSet.h"
29
30 #ifdef WIN32
31 #pragma warning( disable:4251 )
32 #endif
33
34 class QtxComboBox;
35 class QActionGroup;
36
37 class QTX_EXPORT QtxActionGroup : public QtxActionSet
38 {
39   Q_OBJECT
40
41 public:
42   QtxActionGroup( QObject* = 0 );
43   QtxActionGroup( QObject*, const bool );
44   virtual ~QtxActionGroup();
45
46   bool             isExclusive() const;
47   bool             usesDropDown() const;
48
49   void             add( QAction* );
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