1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SalomePyQt.h
23 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
32 #include <LightApp_Application.h>
33 #include <LightApp_Preferences.h>
35 class LightApp_SelectionMgr;
36 class SalomeApp_Application;
43 class SALOME_Selection : public QObject
49 static SALOME_Selection* GetSelection( SalomeApp_Application* );
56 void currentSelectionChanged();
59 void onSelMgrDestroyed();
62 LightApp_SelectionMgr* mySelMgr;
63 SALOME_Selection( QObject* );
77 WT_ObjectBrowser = LightApp_Application::WT_ObjectBrowser,
78 WT_PyConsole = LightApp_Application::WT_PyConsole,
79 WT_LogWindow = LightApp_Application::WT_LogWindow,
80 WT_User = LightApp_Application::WT_User
84 PT_Auto = LightApp_Preferences::Auto,
85 PT_Space = LightApp_Preferences::Space,
86 PT_Bool = LightApp_Preferences::Bool,
87 PT_Color = LightApp_Preferences::Color,
88 PT_String = LightApp_Preferences::String,
89 PT_Selector = LightApp_Preferences::Selector,
90 PT_DblSpin = LightApp_Preferences::DblSpin,
91 PT_IntSpin = LightApp_Preferences::IntSpin,
92 PT_Double = LightApp_Preferences::Double,
93 PT_Integer = LightApp_Preferences::Integer,
94 PT_GroupBox = LightApp_Preferences::GroupBox,
95 PT_Tab = LightApp_Preferences::Tab,
96 PT_Frame = LightApp_Preferences::Frame,
97 PT_Font = LightApp_Preferences::Font,
98 PT_DirList = LightApp_Preferences::DirList,
99 PT_File = LightApp_Preferences::File,
104 Horizontal = 0, //!< Horizontal orientation
105 Vertical = 1 //!< Vertical orientation
108 //! Action of splitting corresponding to QtxWorkstack::SplitType enumeration
110 MoveWidget = 0, //!< move specified widget to the new area, other views stay in the previous area
111 LeaveWidget = 1, //!< specified widget stays in the old area, all other views are moved to the new area
112 SplitAt = 2 //!< the view area is splitted in such a way, that specified view and all views which follow it, are moved to the new area
118 static QWidget* getDesktop();
119 static QWidget* getMainFrame();
120 static QMenuBar* getMainMenuBar();
121 static QMenu* getPopupMenu( const MenuName );
122 static QMenu* getPopupMenu( const QString& );
123 static SALOME_Selection* getSelection();
124 static int getStudyId();
125 static void putInfo( const QString&, const int = 0 );
126 static const QString getActiveComponent();
127 static void updateObjBrowser( const int = 0, bool = true );
129 static QString getFileName ( QWidget*, const QString&, const QStringList&, const QString&, bool );
130 static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& );
131 static QString getExistingDirectory( QWidget*, const QString&, const QString& );
133 static void helpContext( const QString&, const QString& );
135 static bool dumpView( const QString& );
137 static int defaultMenuGroup();
139 static int createTool( const QString& );
140 static int createTool( const int, const int, const int = -1 );
141 static int createTool( const int, const QString&, const int = -1 );
142 static int createTool( QAction*, const int, const int = -1, const int = -1 );
143 static int createTool( QAction*, const QString&, const int = -1, const int = -1 );
145 static int createMenu( const QString&, const int = -1,
146 const int = -1, const int = -1, const int = -1 );
147 static int createMenu( const QString&, const QString& = QString(),
148 const int = -1, const int = -1, const int = -1 );
149 static int createMenu( const int, const int = -1,
150 const int = -1, const int = -1 );
151 static int createMenu( const int, const QString& = QString(),
152 const int = -1, const int = -1 );
153 static int createMenu( QAction*, const int, const int = -1,
154 const int = -1, const int = -1 );
155 static int createMenu( QAction*, const QString&, const int = -1,
156 const int = -1, const int = -1 );
158 static QAction* createSeparator();
160 static QAction* createAction( const int, const QString&,
161 const QString& = QString(), const QString& = QString(),
162 const QString& = QString(), const int = 0, const bool = false );
164 static QtxActionGroup* createActionGroup( const int, const bool = true );
166 static QAction* action( const int );
167 static int actionId( const QAction* );
169 static void addSetting ( const QString&, const QString&, const double );
170 static void addSetting ( const QString&, const QString&, const int );
171 static void addSetting ( const QString&, const QString&, const bool, const int );
172 static void addSetting ( const QString&, const QString&, const QString& );
173 static void addSetting ( const QString&, const QString&, const QColor& );
174 static int integerSetting( const QString&, const QString&, const int = 0 );
175 static double doubleSetting ( const QString&, const QString&, const double = 0 );
176 static bool boolSetting ( const QString&, const QString&, const bool = 0 );
177 static QString stringSetting ( const QString&, const QString&, const QString& = QString("") );
178 static QColor colorSetting ( const QString&, const QString&, const QColor& = QColor() );
179 static void removeSetting ( const QString&, const QString& );
180 static bool hasSetting ( const QString&, const QString& );
182 static void addStringSetting( const QString&, const QString&, bool = true );
183 static void addIntSetting ( const QString&, const int, bool = true );
184 static void addBoolSetting ( const QString&, const bool, bool = true );
185 static void addDoubleSetting( const QString&, const double, bool = true );
186 static void removeSettings ( const QString& );
187 static QString getSetting ( const QString& );
189 static int addGlobalPreference( const QString& );
190 static int addPreference( const QString& );
191 static int addPreference( const QString&,
192 const int, const int = PT_Auto,
193 const QString& = QString(),
194 const QString& = QString() );
195 static QVariant preferenceProperty( const int, const QString& );
196 static void setPreferenceProperty( const int,
199 static void addPreferenceProperty( const int,
204 static void message( const QString&, bool = true );
205 static void clearMessages();
207 static QList<int> getViews();
208 static int getActiveView();
209 static QString getViewType( const int );
210 static bool setViewTitle( const int, const QString& );
211 static QString getViewTitle( const int );
212 static QList<int> findViews( const QString& );
213 static bool activateView( const int );
214 static int createView( const QString& );
215 static bool closeView( const int );
216 static int cloneView( const int );
217 static bool isViewVisible( const int id );
219 static bool groupAllViews();
220 static bool splitView( const int, const Orientation, const Action );
221 static bool moveView( const int, const int, const bool );
222 static QList<int> neighbourViews( const int );
225 #endif // SALOME_PYQT_H