Salome HOME
First integration of Salome On Demand
[modules/gui.git] / src / LightApp / LightApp_ModuleAction.h
index 2bf4f3fc3565701f23658416da955f578ef16d4e..0b5fbdc3d0d81250d3813a472db0322a84412e67 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -32,6 +32,8 @@
 #endif
 
 class QtxComboBox;
+class QtxResourceMgr;
+class QSignalMapper;
 
 class LIGHTAPP_EXPORT LightApp_ModuleAction : public QtxAction
 {
@@ -43,26 +45,40 @@ private:
   class ActivateEvent;
 
 public:
-  enum { None = 0x00, Buttons = 0x01, ComboItem = 0x02, All = Buttons | ComboItem };
+  typedef enum { Buttons   = 0x01,
+                 List      = 0x02,
+                 AddRemove = 0x04,
+                 All       = Buttons | List | AddRemove
+  } Mode;
 
 public:
-  LightApp_ModuleAction( const QString&, QObject* = 0 );
-  LightApp_ModuleAction( const QString&, const QIcon&, QObject* = 0 );
+  LightApp_ModuleAction( QtxResourceMgr*, QObject* = 0 );
   virtual ~LightApp_ModuleAction();
 
+  int              count() const;
   QStringList      modules() const;
 
   QIcon            moduleIcon( const QString& ) const;
   void             setModuleIcon( const QString&, const QIcon& );
 
+  QAction*         moduleAction( const QString& ) const;
+
   void             insertModule( const QString&, const QIcon&, const int = -1 );
+  void             insertModule( const QString&, const QIcon&, bool, const int = -1 );
   void             removeModule( const QString& );
+  void             insertExtension(const QString&);
+  void             removeExtension(const QString&);
+  void             updateExtActions();
 
   QString          activeModule() const;
+
+  void             setMode( const Mode& );
+  void             setModeEnabled( const Mode&, bool );
+  bool             isModeEnabled( const Mode& ) const;
+
+public slots:
   void             setActiveModule( const QString& );
 
-  void             setMode( const int );
-  int              mode() const;
 
 protected:
   virtual void     addedTo( QWidget* );
@@ -72,10 +88,11 @@ protected:
 
 signals:
   void             moduleActivated( const QString& );
+  void             adding();
+  void             removing( const QString& );
+  void             showExtInfo();
 
 private:
-  void             init();
-
   void             update();
   void             update( QtxComboBox* );
 
@@ -89,8 +106,13 @@ private slots:
 
 private:
   ComboAction*     myCombo;
+  QtxAction*       myAdd;
+  QtxAction*       myRemove;
+  QtxAction*       myInfo;
   ActionSet*       mySet;
+  QAction*         mySeparator;
   int              myMode;
+  QSignalMapper*   myMapper;
 };
 
 class LightApp_ModuleAction::ComboAction : public QtxAction