1 // Copyright (C) 2007-2012 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
23 // File : SalomePyQt.h
24 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
35 #include <LightApp_Application.h>
36 #include <LightApp_Preferences.h>
38 class LightApp_SelectionMgr;
39 class LightApp_Application;
47 class SALOME_Selection : public QObject
53 static SALOME_Selection* GetSelection( LightApp_Application* );
60 void currentSelectionChanged();
63 void onSelMgrDestroyed();
66 LightApp_SelectionMgr* mySelMgr;
67 SALOME_Selection( QObject* );
81 WT_ObjectBrowser = LightApp_Application::WT_ObjectBrowser,
82 WT_PyConsole = LightApp_Application::WT_PyConsole,
83 WT_LogWindow = LightApp_Application::WT_LogWindow,
84 WT_User = LightApp_Application::WT_User
88 PT_Auto = LightApp_Preferences::Auto,
89 PT_Space = LightApp_Preferences::Space,
90 PT_Bool = LightApp_Preferences::Bool,
91 PT_Color = LightApp_Preferences::Color,
92 PT_String = LightApp_Preferences::String,
93 PT_Selector = LightApp_Preferences::Selector,
94 PT_DblSpin = LightApp_Preferences::DblSpin,
95 PT_IntSpin = LightApp_Preferences::IntSpin,
96 PT_Double = LightApp_Preferences::Double,
97 PT_Integer = LightApp_Preferences::Integer,
98 PT_GroupBox = LightApp_Preferences::GroupBox,
99 PT_Tab = LightApp_Preferences::Tab,
100 PT_Frame = LightApp_Preferences::Frame,
101 PT_Font = LightApp_Preferences::Font,
102 PT_DirList = LightApp_Preferences::DirList,
103 PT_File = LightApp_Preferences::File,
108 Horizontal = 0, //!< Horizontal orientation
109 Vertical = 1 //!< Vertical orientation
112 //! Action of splitting corresponding to QtxWorkstack::SplitType enumeration
114 MoveWidget = 0, //!< move specified widget to the new area, other views stay in the previous area
115 LeaveWidget = 1, //!< specified widget stays in the old area, all other views are moved to the new area
116 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
122 static QWidget* getDesktop();
123 static QWidget* getMainFrame();
124 static QMenuBar* getMainMenuBar();
125 static QMenu* getPopupMenu( const MenuName );
126 static QMenu* getPopupMenu( const QString& );
127 static QTreeView* getObjectBrowser();
128 static SALOME_Selection* getSelection();
129 static int getStudyId();
130 static void putInfo( const QString&, const int = 0 );
131 static const QString getActiveComponent();
132 static PyObject* getActivePythonModule();
133 static bool activateModule( const QString& );
134 static void updateObjBrowser( const int = 0, bool = true );
136 static bool isModified();
137 static void setModified( bool );
139 static QString getFileName ( QWidget*, const QString&, const QStringList&, const QString&, bool );
140 static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& );
141 static QString getExistingDirectory( QWidget*, const QString&, const QString& );
143 static QString createObject(const QString& parent = QString(""));
144 static QString createObject(const QString& name,
145 const QString& iconname,
146 const QString& tooltip,
147 const QString& parent = QString(""));
149 static void removeObject( const QString& obj);
150 static void removeChild( const QString& obj = QString(""));
151 static QStringList getChildren(const QString& obj = QString(""), const bool rec = false);
152 static void setName(const QString& obj,const QString& name);
153 static void setIcon(const QString& obj,const QString& iconname);
154 static void setToolTip(const QString& obj,const QString& tooltip);
155 static QString getName(const QString& obj);
156 static QString getToolTip(const QString& obj);
158 static void setColor(const QString& obj,const QColor& color);
159 static QColor getColor(const QString& obj);
161 static void setReference( const QString& obj,
162 const QString& refEntry );
163 static QString getReference( const QString& obj );
165 static QIcon loadIcon( const QString&, const QString& );
167 static void helpContext( const QString&, const QString& );
169 static bool dumpView( const QString& );
171 static int defaultMenuGroup();
173 static int createTool( const QString& );
174 static int createTool( const int, const int, const int = -1 );
175 static int createTool( const int, const QString&, const int = -1 );
176 static int createTool( QAction*, const int, const int = -1, const int = -1 );
177 static int createTool( QAction*, const QString&, const int = -1, const int = -1 );
179 static int createMenu( const QString&, const int = -1,
180 const int = -1, const int = -1, const int = -1 );
181 static int createMenu( const QString&, const QString& = QString(),
182 const int = -1, const int = -1, const int = -1 );
183 static int createMenu( const int, const int = -1,
184 const int = -1, const int = -1 );
185 static int createMenu( const int, const QString& = QString(),
186 const int = -1, const int = -1 );
187 static int createMenu( QAction*, const int, const int = -1,
188 const int = -1, const int = -1 );
189 static int createMenu( QAction*, const QString&, const int = -1,
190 const int = -1, const int = -1 );
192 static QAction* createSeparator();
194 static QAction* createAction( const int, const QString&,
195 const QString& = QString(), const QString& = QString(),
196 const QString& = QString(), const int = 0, const bool = false );
198 static QtxActionGroup* createActionGroup( const int, const bool = true );
200 static QAction* action( const int );
201 static int actionId( const QAction* );
203 static void addSetting ( const QString&, const QString&, const double );
204 static void addSetting ( const QString&, const QString&, const int );
205 static void addSetting ( const QString&, const QString&, const bool, const int );
206 static void addSetting ( const QString&, const QString&, const QString& );
207 static void addSetting ( const QString&, const QString&, const QColor& );
208 static int integerSetting( const QString&, const QString&, const int = 0 );
209 static double doubleSetting ( const QString&, const QString&, const double = 0 );
210 static bool boolSetting ( const QString&, const QString&, const bool = 0 );
211 static QString stringSetting ( const QString&, const QString&, const QString& = QString("") );
212 static QColor colorSetting ( const QString&, const QString&, const QColor& = QColor() );
213 static void removeSetting ( const QString&, const QString& );
214 static bool hasSetting ( const QString&, const QString& );
216 static void addStringSetting( const QString&, const QString&, bool = true );
217 static void addIntSetting ( const QString&, const int, bool = true );
218 static void addBoolSetting ( const QString&, const bool, bool = true );
219 static void addDoubleSetting( const QString&, const double, bool = true );
220 static void removeSettings ( const QString& );
221 static QString getSetting ( const QString& );
223 static int addGlobalPreference( const QString& );
224 static int addPreference( const QString& );
225 static int addPreference( const QString&,
226 const int, const int = PT_Auto,
227 const QString& = QString(),
228 const QString& = QString() );
229 static QVariant preferenceProperty( const int, const QString& );
230 static void setPreferenceProperty( const int,
233 static void addPreferenceProperty( const int,
238 static void message( const QString&, bool = true );
239 static void clearMessages();
241 static QList<int> getViews();
242 static int getActiveView();
243 static QString getViewType( const int );
244 static bool setViewTitle( const int, const QString& );
245 static QString getViewTitle( const int );
246 static QList<int> findViews( const QString& );
247 static bool activateView( const int );
248 static int createView( const QString& );
249 static int createView( const QString&, QWidget* );
250 static bool closeView( const int );
251 static int cloneView( const int );
252 static bool isViewVisible( const int );
253 static void setViewClosable( const int, const bool );
254 static bool isViewClosable( const int );
256 static bool groupAllViews();
257 static bool splitView( const int, const Orientation, const Action );
258 static bool moveView( const int, const int, const bool );
259 static QList<int> neighbourViews( const int );
262 #endif // SALOME_PYQT_H