Salome HOME
Update copyrights 2014.
[modules/gui.git] / src / SALOME_PYQT / SALOME_PYQT_GUILight / SALOME_PYQT_ModuleLight.h
1 // Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // File   : SALOME_PYQT_ModuleLight.h
21 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
22
23 #ifndef SALOME_PYQT_MODULELIGHT_H
24 #define SALOME_PYQT_MODULELIGHT_H
25
26 #include "SALOME_PYQT_GUILight.h"
27
28 #include "PyInterp_Interp.h" // !!! WARNING !!! THIS INCLUDE MUST BE THE VERY FIRST !!!
29 #include "LightApp_Module.h"
30
31 #include <QIcon>
32 #include <QMap>
33 #include <QStringList>
34
35 class QMenu;
36 class PyModuleHelper;
37 class SALOME_PYQT_DataObjectLight;
38
39 class SALOME_PYQT_LIGHT_EXPORT SALOME_PYQT_ModuleLight: public LightApp_Module
40 {
41   Q_OBJECT;
42
43 public:
44   SALOME_PYQT_ModuleLight();
45   ~SALOME_PYQT_ModuleLight();
46
47 public:
48   // module activation, preferences, menus
49   void            initialize( CAM_Application* );
50   bool            activateModule( SUIT_Study* );
51   bool            deactivateModule( SUIT_Study* );
52   void            onModelClosed();
53   void            windows( QMap<int, int>& ) const;
54   void            viewManagers( QStringList& ) const;
55   void            studyActivated();
56   void            contextMenuPopup( const QString&, QMenu*, QString& );
57   void            createPreferences();
58   void            preferencesChanged( const QString&, const QString& );
59
60   // persistence & dump python
61   void            save( QStringList& );
62   bool            load( const QStringList& );
63   void            dumpPython( QStringList& );
64
65   // drag-n-drop support
66   bool            isDraggable( const SUIT_DataObject* ) const;
67   bool            isDropAccepted( const SUIT_DataObject* ) const;
68   void            dropObjects( const DataObjectList&, SUIT_DataObject*,
69                                const int, Qt::DropAction );
70
71   // data model management
72   QString         createObject( const QString& );
73   QString         createObject( const QString&, 
74                                 const QString&,
75                                 const QString&,
76                                 const QString& );
77
78   void            setName( const QString&, const QString& );
79   QString         getName( const QString& ) const;
80
81   void            setIcon( const QString&, const QString& );
82
83   void            setToolTip( const QString&, const QString& );
84   QString         getToolTip( const QString& ) const;
85
86   void            setColor( const QString&, const QColor& );
87   QColor          getColor( const QString& ) const;
88
89   void            setReference( const QString&, const QString& );
90   QString         getReference( const QString& ) const;
91
92   void            removeObject( const QString& );
93   void            removeChildren( const QString& );
94
95   void            setObjectPosition( const QString&, int );
96   int             getObjectPosition( const QString& );
97
98   QStringList     getChildren( const QString&, const bool = false ) const;
99
100 protected:
101   CAM_DataModel*  createDataModel();
102
103 private:
104   SALOME_PYQT_DataObjectLight* 
105                   findObject( const QString& ) const;
106
107 private:
108   PyModuleHelper* myHelper;
109 };
110
111 #endif // SALOME_PYQT_MODULELIGHT_H