Version: 9.16.0
SUIT_Application.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5//
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, or (at your option) any later version.
10//
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.
15//
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
19//
20// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21//
22
23#ifndef SUIT_APPLICATION_H
24#define SUIT_APPLICATION_H
25
26#include "SUIT.h"
27
28#include <QObject>
29#include <QMap>
30#include <QIcon>
31
32class QLabel;
33class QString;
34class QAction;
35class QWidget;
36class QKeySequence;
37
38class SUIT_Desktop;
42class SUIT_Study;
43
44#ifdef WIN32
45#pragma warning ( disable:4251 )
46#endif
47
61{
62 Q_OBJECT
63
64public:
66 virtual ~SUIT_Application();
67
69 virtual SUIT_Desktop* desktop();
70
73 virtual bool isPossibleToClose( bool& );
74
77 virtual void closeApplication();
78
80 virtual SUIT_Study* activeStudy() const;
81
83 virtual QString applicationName() const = 0;
84
85 virtual QString applicationVersion() const;
86
88 virtual void start();
89
91 virtual bool useFile( const QString& theFileName);
92
94 virtual void createEmptyStudy();
95
98 virtual int getNbStudies() const;
99
100 SUIT_ResourceMgr* resourceMgr() const;
101
102 SUIT_ShortcutMgr* shortcutMgr() const;
103
105 void putInfo ( const QString&, const int = 0 );
106
108 virtual QString getFileName( bool open, const QString& initial, const QString& filters,
109 const QString& caption, QWidget* parent ) = 0;
110
112 virtual QString getDirectory( const QString& initial, const QString& caption, QWidget* parent ) = 0;
113
114
115 virtual int viewManagerId ( const SUIT_ViewManager* ) const = 0;
116 virtual void viewManagers( const QString&, QList<SUIT_ViewManager*>& ) const = 0;
117 QAction* action( const int ) const;
118
119 void addPostRoutine( void (*theRoutine)() );
120 //@{
122 int createTool( const QString&, const QString& = QString() );
123 int createTool( const int, const int, const int = -1 );
124 int createTool( const int, const QString&, const int = -1 );
125 int createTool( QAction*, const int, const int = -1, const int = -1 );
126 int createTool( QAction*, const QString&, const int = -1, const int = -1 );//@}
127 void clearTool( const QString& );
128 //@{
130 int createMenu( const QString&, const int, const int = -1, const int = -1, const int = -1 );
131 int createMenu( const QString&, const QString&, const int = -1, const int = -1, const int = -1 );
132 int createMenu( const int, const int, const int = -1, const int = -1 );
133 int createMenu( const int, const QString&, const int = -1, const int = -1 );
134 int createMenu( QAction*, const int, const int = -1, const int = -1, const int = -1 );
135 int createMenu( QAction*, const QString&, const int = -1, const int = -1, const int = -1 );//@}
136
137signals:
140// void moving();
141 void infoChanged( QString );
142
143public slots:
144 virtual void updateCommandsStatus();
145 virtual void onHelpContextModule( const QString&, const QString&, const QString& = QString() );
146
147private slots:
148 void onInfoClear();
149
150protected:
151 SUIT_Application* startApplication( int, char** ) const;
152 SUIT_Application* startApplication( const QString&, int, char** ) const;
153
154 virtual void setDesktop( SUIT_Desktop* );
155
157 virtual SUIT_Study* createNewStudy();
158 virtual void setActiveStudy( SUIT_Study* );
159 //@{
161 void setMenuShown( QAction*, const bool );
162 void setMenuShown( const int, const bool );//@} //@{
164 void setToolShown( QAction*, const bool );
165 void setToolShown( const int, const bool );//@}
166
167 void setActionShown( QAction*, const bool );
168 void setActionShown( const int, const bool );
169
170 static QAction* separator();
171 int actionId( const QAction* ) const;
172
173 QList<QAction*> actions() const;
174 QList<int> actionIds() const;
175
176 int registerAction( const int, QAction* );
177 QAction* createAction( const int, const QString&, const QIcon&, const QString&,
178 const QString&, const int, QObject* = 0,
179 const bool = false, QObject* = 0, const char* = 0,
180 const QString& = QString() );
181 QAction* createAction( const int, const QString&, const QIcon&, const QString&,
182 const QString&, const QKeySequence&, QObject* = 0,
183 const bool = false, QObject* = 0, const char* = 0,
184 const QString& = QString() );
185 QAction* createAction( const int, QObject*, const bool, const QString&,
186 const QString&, const QString&, const QString&, const QIcon& = QIcon(),
187 QObject* = nullptr, const char* = nullptr);
188
189protected slots:
190 virtual void onDesktopActivated();
191// void onDesktopMoved();
192
193private:
196 QMap<int, QAction*> myActionMap;
198
200
201 typedef void (*PostRoutine)();
203};
204
206extern "C"
207{
208 //jfa 22.06.2005:typedef SUIT_Application* (*APP_CREATE_FUNC)( int, char** );
209 typedef SUIT_Application* (*APP_CREATE_FUNC)();
210}
211
212#define APP_CREATE_NAME "createApplication"
213
214#ifdef WIN32
215#pragma warning ( default:4251 )
216#endif
217
218#endif
#define SUIT_EXPORT
Definition: SUIT.h:36
For more information see QT documentation.
Definition: SUIT_Application.h:61
void infoChanged(QString)
virtual QString applicationName() const =0
Returns Name of application. Using is not defined.
SUIT_ShortcutMgr * myShortcutMgr
Definition: SUIT_Application.h:197
SUIT_Desktop * myDesktop
Definition: SUIT_Application.h:195
virtual void viewManagers(const QString &, QList< SUIT_ViewManager * > &) const =0
void applicationClosed(SUIT_Application *)
virtual QString getDirectory(const QString &initial, const QString &caption, QWidget *parent)=0
Invokes application-specific "Select Directory" dialog and returns the selected directory name.
virtual QString getFileName(bool open, const QString &initial, const QString &filters, const QString &caption, QWidget *parent)=0
Invokes application-specific "Open/Save File" dialog and returns the selected file name.
void activated(SUIT_Application *)
virtual int viewManagerId(const SUIT_ViewManager *) const =0
SUIT_Study * myStudy
Definition: SUIT_Application.h:194
QLabel * myStatusLabel
Definition: SUIT_Application.h:199
QMap< int, QAction * > myActionMap
Definition: SUIT_Application.h:196
QList< PostRoutine > myPostRoutines
Definition: SUIT_Application.h:202
Definition: SUIT_Desktop.h:47
Definition: SUIT_ResourceMgr.h:31
Handles action shortcut customization.
Definition: SUIT_ShortcutMgr.h:482
Definition: SUIT_Study.h:41
Definition: SUIT_ViewManager.h:50