Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/gui.git] / src / SALOME_PYQT / SalomePyQt / SalomePyQt.h
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
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.
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 #ifndef SALOME_PYQT_H
21 #define SALOME_PYQT_H
22
23 #include <qstring.h>
24 #include <qobject.h>
25 #include <qcolor.h>
26
27 #include <LightApp_Application.h>
28
29 class LightApp_SelectionMgr;
30 class SalomeApp_Application;
31 class QMenuBar;
32 class QPopupMenu;
33 class QWidget;
34 class QtxAction;
35
36 class SALOME_Selection : public QObject
37 {
38   Q_OBJECT
39
40 public:
41   ~SALOME_Selection();
42   static SALOME_Selection* GetSelection( SalomeApp_Application* );
43
44   void Clear();
45   void ClearIObjects();
46   void ClearFilters();
47
48 signals:
49   void currentSelectionChanged();
50
51 private slots:
52   void onSelMgrDestroyed();
53
54 private:
55   LightApp_SelectionMgr* mySelMgr;
56   SALOME_Selection( QObject* );
57 };
58
59 enum MenuName {
60   File        = 1,
61   View        = 2,
62   Edit        = 3,
63   Preferences = 4,
64   Tools       = 5,
65   Window      = 6,
66   Help        = 7  
67 };
68
69 enum {
70   WT_ObjectBrowser = LightApp_Application::WT_ObjectBrowser,
71   WT_PyConsole     = LightApp_Application::WT_PyConsole,
72   WT_LogWindow     = LightApp_Application::WT_LogWindow,
73   WT_User          = LightApp_Application::WT_User
74 };
75
76 class SalomePyQt
77 {
78 public:
79   static QWidget*          getDesktop();
80   static QWidget*          getMainFrame();
81   static QMenuBar*         getMainMenuBar();
82   static QPopupMenu*       getPopupMenu( const MenuName );
83   static SALOME_Selection* getSelection();
84   static int               getStudyId();
85   static void              putInfo( const QString&, const int = 0 );
86   static const QString     getActiveComponent();
87   static void              updateObjBrowser( const int = 0, bool = true );
88
89   static QString           getFileName         ( QWidget*, const QString&, const QStringList&, const QString&, bool );
90   static QStringList       getOpenFileNames    ( QWidget*, const QString&, const QStringList&, const QString& );
91   static QString           getExistingDirectory( QWidget*, const QString&, const QString& );
92
93   static void              helpContext( const QString&, const QString& );
94
95   static bool              dumpView( const QString& );
96
97   static int               defaultMenuGroup();
98
99   static int               createTool( const QString& );
100   static int               createTool( const int,  const int,      const int = -1 );
101   static int               createTool( const int,  const QString&, const int = -1 );
102   static int               createTool( QtxAction*, const int,      const int = -1, const int = -1 );
103   static int               createTool( QtxAction*, const QString&, const int = -1, const int = -1 );
104
105   static int               createMenu( const QString&, const int = -1,
106                                        const int = -1, const int = -1, const int = -1 );
107   static int               createMenu( const QString&, const QString& = QString::null, 
108                                        const int = -1, const int = -1, const int = -1 );
109   static int               createMenu( const int,      const int = -1,
110                                        const int = -1, const int = -1 );
111   static int               createMenu( const int,      const QString& = QString::null, 
112                                        const int = -1, const int = -1 );
113   static int               createMenu( QtxAction*,     const int,      const int = -1, 
114                                        const int = -1, const int = -1 );
115   static int               createMenu( QtxAction*,     const QString&, const int = -1, 
116                                        const int = -1, const int = -1 );
117
118   static QtxAction*        createSeparator();
119
120   static QtxAction*        createAction( const int, const QString&,
121                                          const QString& = QString::null, const QString& = QString::null, 
122                                          const QString& = QString::null, const int = 0, const bool = false );
123
124   static QtxAction*        action( const int );
125   static int               actionId( const QtxAction* );
126
127   static bool              clearMenu( const int = 0, const int = 0,
128                                       const bool = true );
129
130   static void              addSetting    ( const QString&, const QString&, const double );
131   static void              addSetting    ( const QString&, const QString&, const int );
132   static void              addSetting    ( const QString&, const QString&, const QString& );
133   static void              addSetting    ( const QString&, const QString&, const QColor& );
134   static int               integerSetting( const QString&, const QString&, const int = 0 );
135   static double            doubleSetting ( const QString&, const QString&, const int = 0 );
136   static bool              boolSetting   ( const QString&, const QString&, const bool = 0 );
137   static QString           stringSetting ( const QString&, const QString&, const QString& = QString("") );
138   static QColor            colorSetting  ( const QString&, const QString&, const QColor& = QColor() );
139   static void              removeSetting ( const QString&, const QString& );
140   // obsolete
141   static void              addStringSetting( const QString&, const QString&, bool = true );
142   static void              addIntSetting   ( const QString&, const int,      bool = true );
143   static void              addDoubleSetting( const QString&, const double,   bool = true );
144   static void              removeSettings  ( const QString& );
145   static QString           getSetting      ( const QString& );
146 };
147
148 #endif // SALOME_PYQT_H