1 // Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : LightApp_ModuleAction.h
21 // Author : Sergey TELKOV, Vadim SANDLER
23 #ifndef LIGHTAPP_MODULEACTION_H
24 #define LIGHTAPP_MODULEACTION_H
28 #include <QtxAction.h>
31 #pragma warning ( disable:4251 )
38 class LIGHTAPP_EXPORT LightApp_ModuleAction : public QtxAction
48 typedef enum { Buttons = 0x01,
51 All = Buttons | List | AddRemove
55 LightApp_ModuleAction( QtxResourceMgr*, QObject* = 0 );
56 virtual ~LightApp_ModuleAction();
59 QStringList modules() const;
61 QIcon moduleIcon( const QString& ) const;
62 void setModuleIcon( const QString&, const QIcon& );
64 QAction* moduleAction( const QString& ) const;
66 void insertModule( const QString&, const QIcon&, const int = -1 );
67 void insertModule( const QString&, const QIcon&, bool, const int = -1 );
68 void removeModule( const QString& );
70 QString activeModule() const;
72 void setMode( const Mode& );
73 void setModeEnabled( const Mode&, bool );
74 bool isModeEnabled( const Mode& ) const;
77 void setActiveModule( const QString& );
81 virtual void addedTo( QWidget* );
82 virtual void removedFrom( QWidget* );
84 virtual bool event( QEvent* );
87 void moduleActivated( const QString& );
89 void removing( const QString& );
93 void update( QtxComboBox* );
95 QAction* active() const;
96 void activate( int, bool = true );
100 void onTriggered( int );
101 void onComboActivated( int );
104 ComboAction* myCombo;
108 QAction* mySeparator;
110 QSignalMapper* myMapper;
113 class LightApp_ModuleAction::ComboAction : public QtxAction
118 ComboAction( QObject* parent );
120 QList<QtxComboBox*> widgets() const;
123 void activatedId( int );
126 virtual QWidget* createWidget( QWidget* );
129 #endif // LIGHTAPP_MODULEACTION_H