Salome HOME
04613a05f559ab4c3f486475e56e025752d6ede1
[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
24 class HYDROGUI_Module;
25 class HYDROGUI_InputPanel;
26 class HYDROGUI_Shape;
27
28 class SUIT_SelectionMgr;
29 class OCCViewer_ViewManager;
30
31 class Handle_HYDROData_Document;
32 class Handle_HYDROData_Object;
33
34 class HYDROGUI_Operation : public LightApp_Operation
35 {
36   Q_OBJECT
37
38 public:
39
40   HYDROGUI_Operation( HYDROGUI_Module* theModule );
41   virtual ~HYDROGUI_Operation();
42
43 public:
44
45   void                                setName( const QString& theName );
46   const QString&                      getName() const;
47
48   HYDROGUI_InputPanel*                inputPanel() const;
49   SUIT_SelectionMgr*                  selectionMgr() const;
50   HYDROGUI_Module*                    module() const;
51
52   int                                 getPreviewZLayer() const;
53   virtual void                        updatePreviewZLayer( int theLayer );
54
55 signals:
56   void                                helpContextModule( const QString&,
57                                                          const QString&,
58                                                          const QString& );
59
60 protected:
61   virtual void                        startOperation();
62   virtual void                        abortOperation();
63   virtual void                        commitOperation();
64   virtual void                        stopOperation();
65   virtual void                        setDialogActive( const bool );
66
67   virtual HYDROGUI_InputPanel*        createInputPanel() const;
68   virtual void                        closeInputPanel();
69
70   virtual bool                        processApply( int& theUpdateFlags, QString& theErrorMsg,
71                                                     QStringList& theBrowseObjectsEntries );
72   virtual void                        processCancel();
73
74   void                                startDocOperation();
75   void                                abortDocOperation();
76   void                                commitDocOperation();
77
78   Handle_HYDROData_Document           doc() const;
79
80   virtual bool                        isToAbortOnApply() const { return true; }
81
82   void                                printErrorMessage( const QString& theErrorMsg );
83   void                                setPrintErrorMessage( const bool theIsPrint );
84
85   void                                browseObjects( const QStringList& theBrowseObjectsEntries );
86
87 protected slots:
88
89   virtual void                        onApply();
90   virtual void                        onCancel();
91   virtual void                        onHelp();
92
93 protected:
94
95   QString                             getHelpComponent() const;
96   QString                             getHelpFile() const;
97   QString                             getHelpContext() const;
98
99   virtual void                        setPreviewZLayer( int theLayer );
100   virtual HYDROGUI_Shape*             getPreviewShape() const;
101   OCCViewer_ViewManager*              getPreviewManager();
102   void                                setPreviewManager( OCCViewer_ViewManager* theManager );
103
104 private:
105
106   HYDROGUI_Module*                    myModule;
107   HYDROGUI_InputPanel*                myPanel;
108   OCCViewer_ViewManager*              myPreviewManager;
109   QString                             myName;
110   bool                                myIsPrintErrorMessage;
111   bool                                myIsTransactionOpened;
112   int                                 myPreviewZLayer;
113 };
114
115 #endif