Salome HOME
NRI : Merge from V1_2.
[modules/kernel.git] / src / SALOMEGUI / SALOMEGUI_Application.h
1 //  SALOME SALOMEGUI : implementation of desktop and GUI kernel
2 //
3 //  Copyright (C) 2003  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. 
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SALOMEGUI_Application.h
25 //  Author : Nicolas REJNERI
26 //  Module : SALOME
27 //  $Header$
28
29 #ifndef SALOMEGUI_APPLICATION_H
30 #define SALOMEGUI_APPLICATION_H
31
32 #include "QAD_Application.h"
33 #include "QAD_ViewFrame.h"
34 #include "QAD_Action.h"
35
36 // IDL headers
37 #include <SALOMEconfig.h>
38 #include CORBA_SERVER_HEADER(SALOMEDS)
39 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
40
41 // QT Includes
42 #include <qlist.h>
43 #include <qstring.h>
44 #include <qtoolbar.h>
45 #include <qpopupmenu.h>
46
47 class SALOMEGUI_Application : public QAD_Application
48 {
49   Q_OBJECT
50     enum { ViewToolBarId = 100 };
51   
52     enum { ViewDumpId, ViewTrihedronId, ViewFitAllId, ViewFitAreaId,
53            ViewZoomId, ViewPanId, ViewRotateId, ViewGlobalPanId,
54            ViewFrontId, ViewBackId, ViewTopId, ViewBottomId, ViewLeftId,
55            ViewRightId, ViewResetId };
56 public:
57         SALOMEGUI_Application ( const QString& format,
58                                 const QString& description,
59                                 const QString& filters);
60         ~SALOMEGUI_Application();
61 public slots:
62   // Common display services
63   void    onDisplay(int);
64   void    onErase();
65
66 protected:
67     /* application management */
68     bool    initApp( SALOME_NamingService* name_service );
69     bool    createDesktop( SALOME_NamingService* name_service );
70
71     /* popup */
72     void    onCreatePopup();
73
74     /* document management */
75     void    onStudyCreated( QAD_Study* );
76     void    onStudyOpened( QAD_Study* );
77     void    onActiveStudyChanged( QAD_Study* oldActiveStudy,
78                                   QAD_Study* newActiveStudy );
79     void    onStudyShown( QAD_Study* );
80
81     /* menu management */
82     int     onUpdateViewActions ( QPopupMenu*, bool add, int index );
83
84 private slots:
85     void    onDesktopCreated();
86
87 private:
88     void    connectToViewer( QAD_ViewFrame* );
89     void    disconnectFromViewer( QAD_ViewFrame* );
90     void    createActions();
91     void    updateActions();
92
93 private:
94     ActionMap           myViewActions;
95     QAD_Operation*      myCurOperation;
96 };
97
98 #endif
99