]> SALOME platform Git repositories - modules/gui.git/blob - src/Qtx/QtxActionSet.h
Salome HOME
952a849da9c75741744b88a498b5a9be22182de7
[modules/gui.git] / src / Qtx / QtxActionSet.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:      QtxActionSet.h
23 // Author:    Sergey TELKOV
24 //
25 #ifndef QTXACTIONSET_H
26 #define QTXACTIONSET_H
27
28 #include "QtxAction.h"
29
30 #include <QList>
31
32 #ifdef WIN32
33 #pragma warning( disable:4251 )
34 #endif
35
36 class QTX_EXPORT QtxActionSet : public QtxAction
37 {
38   Q_OBJECT
39
40 public:
41   QtxActionSet( QObject* = 0 );
42   virtual ~QtxActionSet();
43
44   QList<QAction*> actions() const;
45   void            setActions( const QList<QAction*>& );
46
47   void            insertActions( const QList<QAction*>&, const int = -1 );
48
49   int             insertAction( QAction*, const int id = -1, const int = -1 );
50   int             insertAction( const QString&, const int id = -1, const int = -1 );
51   int             insertAction( const QString&, const QIcon&, const int id = -1, const int = -1 );
52
53   void            removeAction( QAction* );
54   void            removeAction( const int );
55
56   void            clear();
57
58 signals:
59   void            triggered( int );
60   void            triggered( QAction* );
61
62 private slots:
63   void            onChanged();
64   void            onActionTriggered( bool = false );
65
66 protected:
67   virtual void    addedTo( QWidget* );
68   virtual void    removedFrom( QWidget* );
69
70   virtual void    actionAdded( QAction* );
71   virtual void    actionRemoved( QAction* );
72
73   QAction*        action( int ) const;
74   int             actionId( QAction* ) const;
75   void            setActionId( QAction*, const int );
76
77   virtual bool    isEmptyAction() const;
78
79   virtual void    updateAction();
80   virtual void    updateAction( QWidget* );
81
82 private:
83   int             generateId() const;
84
85 private:
86   typedef QList<QAction*> ActionList;
87
88 private:
89   ActionList      mySet;      //!< actions list
90 };
91
92 #ifdef WIN32
93 #pragma warning( default:4251 )
94 #endif
95
96 #endif