]> SALOME platform Git repositories - modules/hydro.git/blob - src/HYDROGUI/HYDROGUI_Operation.h
Salome HOME
Merge branch 'BR_H2018_2' of https://codev-tuleap.cea.fr/plugins/git/salome/hydro...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Operation.h
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #ifndef HYDROGUI_OPERATION_H
20 #define HYDROGUI_OPERATION_H
21
22 #include <LightApp_Operation.h>
23 #include <Standard_DefineHandle.hxx>
24 #include <QCursor>
25
26 class HYDROGUI_Module;
27 class HYDROGUI_InputPanel;
28 class HYDROGUI_Shape;
29
30 class SUIT_SelectionMgr;
31 class OCCViewer_ViewManager;
32
33 class HYDROData_Document;
34 class HYDROData_Object;
35
36 class HYDROGUI_Operation : public LightApp_Operation
37 {
38   Q_OBJECT
39
40 public:
41
42   HYDROGUI_Operation( HYDROGUI_Module* theModule );
43   virtual ~HYDROGUI_Operation();
44
45 public:
46
47   void                                setName( const QString& theName );
48   const QString&                      getName() const;
49
50   HYDROGUI_InputPanel*                inputPanel() const;
51   SUIT_SelectionMgr*                  selectionMgr() const;
52   HYDROGUI_Module*                    module() const;
53
54   int                                 getPreviewZLayer() const;
55   virtual void                        updatePreviewZLayer( int theLayer );
56
57 signals:
58   void                                helpContextModule( const QString&,
59                                                          const QString&,
60                                                          const QString& );
61
62 protected:
63   virtual void                        startOperation();
64   virtual void                        abortOperation();
65   virtual void                        commitOperation();
66   virtual void                        stopOperation();
67   virtual void                        setDialogActive( const bool );
68
69   virtual HYDROGUI_InputPanel*        createInputPanel() const;
70   virtual void                        closeInputPanel();
71
72   virtual bool                        processApply( int& theUpdateFlags, QString& theErrorMsg,
73                                                     QStringList& theBrowseObjectsEntries );
74   virtual void                        processCancel();
75
76   void                                startDocOperation();
77   void                                abortDocOperation();
78   void                                commitDocOperation();
79
80   Handle(HYDROData_Document)          doc() const;
81
82   virtual bool                        isToAbortOnApply() const { return true; }
83
84   void                                printErrorMessage( const QString& theErrorMsg );
85   void                                setPrintErrorMessage( const bool theIsPrint );
86
87   void                                browseObjects( const QStringList& theBrowseObjectsEntries,
88                                                      const bool theIsApplyAndClose = true );
89
90 protected slots:
91
92   virtual void                        onApplyAndClose();
93   virtual void                        onApply();
94   virtual void                        onCancel();
95   virtual void                        onHelp();
96
97 protected:
98
99   QString                             getHelpComponent() const;
100   QString                             getHelpFile() const;
101   QString                             getHelpContext() const;
102
103   virtual void                        setPreviewZLayer( int theLayer );
104   virtual HYDROGUI_Shape*             getPreviewShape() const;
105   OCCViewer_ViewManager*              getPreviewManager();
106   void                                setPreviewManager( OCCViewer_ViewManager* theManager );
107
108   /**
109    * Set specific cursor chosen in preferences for edition operations.
110    */
111   virtual void                        setCursor();
112   /**
113    * Restore the default cursor.
114    */
115   virtual void                        restoreCursor();
116
117   /**
118    * Set flag indicating, if 'Apply and Close' button is clicked on input panel.
119    * @param theFlag a flag value to be set
120    */
121   virtual void                        setIsApplyAndClose( const bool theFlag );
122   /**
123    * Get flag indicating, if 'Apply and Close' button is clicked on input panel.
124    * \return a flag value
125    */
126   virtual bool                        isApplyAndClose() const;
127
128   /**
129    * Apply changes done by this operation.
130    */
131   virtual void                        apply();
132
133 private:
134
135   HYDROGUI_Module*                    myModule;
136   HYDROGUI_InputPanel*                myPanel;
137   OCCViewer_ViewManager*              myPreviewManager;
138   QString                             myName;
139   bool                                myIsPrintErrorMessage;
140   bool                                myIsTransactionOpened;
141   int                                 myPreviewZLayer;
142
143   QCursor                             myCursor;
144
145   bool                                myIsApplyAndClose;
146 };
147
148 #endif