Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef LIGHTAPP_MODULEACTION_H
00024 #define LIGHTAPP_MODULEACTION_H
00025
00026 #include "LightApp.h"
00027
00028 #include <QtxAction.h>
00029
00030 #ifdef WIN32
00031 #pragma warning ( disable:4251 )
00032 #endif
00033
00034 class QtxComboBox;
00035
00036 class LIGHTAPP_EXPORT LightApp_ModuleAction : public QtxAction
00037 {
00038 Q_OBJECT
00039
00040 private:
00041 class ActionSet;
00042 class ComboAction;
00043
00044 public:
00045 enum { None = 0x00, Buttons = 0x01, ComboItem = 0x02, All = Buttons | ComboItem };
00046
00047 public:
00048 LightApp_ModuleAction( const QString&, QObject* = 0 );
00049 LightApp_ModuleAction( const QString&, const QIcon&, QObject* = 0 );
00050 virtual ~LightApp_ModuleAction();
00051
00052 QStringList modules() const;
00053
00054 QIcon moduleIcon( const QString& ) const;
00055 void setModuleIcon( const QString&, const QIcon& );
00056
00057 void insertModule( const QString&, const QIcon&, const int = -1 );
00058 void removeModule( const QString& );
00059
00060 QString activeModule() const;
00061 void setActiveModule( const QString& );
00062
00063 void setMode( const int );
00064 int mode() const;
00065
00066 protected:
00067 virtual void addedTo( QWidget* );
00068 virtual void removedFrom( QWidget* );
00069
00070 signals:
00071 void moduleActivated( const QString& );
00072
00073 private:
00074 void init();
00075
00076 void update();
00077 void update( QtxComboBox* );
00078
00079 QAction* active() const;
00080 void activate( int, bool = true );
00081
00082 private slots:
00083 void onChanged();
00084 void onTriggered( int );
00085 void onComboActivated( int );
00086
00087 private:
00088 ComboAction* myCombo;
00089 ActionSet* mySet;
00090 int myMode;
00091 };
00092
00093 class LightApp_ModuleAction::ComboAction : public QtxAction
00094 {
00095 Q_OBJECT
00096
00097 public:
00098 ComboAction( QObject* parent );
00099
00100 QList<QtxComboBox*> widgets() const;
00101
00102 protected:
00103 virtual QWidget* createWidget( QWidget* );
00104
00105 signals:
00106 void activatedId( int );
00107 };
00108
00109 #endif // LIGHTAPP_MODULEACTION_H