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.
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.
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
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef HYDROGUI_OPERATION_H
20 #define HYDROGUI_OPERATION_H
22 #include <LightApp_Operation.h>
23 #include <Standard_DefineHandle.hxx>
26 class HYDROGUI_Module;
27 class HYDROGUI_InputPanel;
30 class SUIT_SelectionMgr;
31 class OCCViewer_ViewManager;
33 class HYDROData_Document;
34 class HYDROData_Object;
36 class HYDROGUI_Operation : public LightApp_Operation
42 HYDROGUI_Operation( HYDROGUI_Module* theModule );
43 virtual ~HYDROGUI_Operation();
47 void setName( const QString& theName );
48 const QString& getName() const;
50 HYDROGUI_InputPanel* inputPanel() const;
51 SUIT_SelectionMgr* selectionMgr() const;
52 HYDROGUI_Module* module() const;
54 int getPreviewZLayer() const;
55 virtual void updatePreviewZLayer( int theLayer );
58 void helpContextModule( const QString&,
63 virtual void startOperation();
64 virtual void abortOperation();
65 virtual void commitOperation();
66 virtual void stopOperation();
67 virtual void setDialogActive( const bool );
69 virtual HYDROGUI_InputPanel* createInputPanel() const;
70 virtual void closeInputPanel();
72 virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg,
73 QStringList& theBrowseObjectsEntries );
74 virtual void processCancel();
76 void startDocOperation();
77 void abortDocOperation();
78 void commitDocOperation();
80 Handle(HYDROData_Document) doc() const;
82 virtual bool isToAbortOnApply() const { return true; }
84 void printErrorMessage( const QString& theErrorMsg );
85 void setPrintErrorMessage( const bool theIsPrint );
87 void browseObjects( const QStringList& theBrowseObjectsEntries,
88 const bool theIsApplyAndClose = true );
92 virtual void onApplyAndClose();
93 virtual void onApply();
94 virtual void onCancel();
95 virtual void onHelp();
99 QString getHelpComponent() const;
100 QString getHelpFile() const;
101 QString getHelpContext() const;
103 virtual void setPreviewZLayer( int theLayer );
104 virtual HYDROGUI_Shape* getPreviewShape() const;
105 OCCViewer_ViewManager* getPreviewManager();
106 void setPreviewManager( OCCViewer_ViewManager* theManager );
109 * Set specific cursor chosen in preferences for edition operations.
111 virtual void setCursor();
113 * Restore the default cursor.
115 virtual void restoreCursor();
118 * Set flag indicating, if 'Apply and Close' button is clicked on input panel.
119 * @param theFlag a flag value to be set
121 virtual void setIsApplyAndClose( const bool theFlag );
123 * Get flag indicating, if 'Apply and Close' button is clicked on input panel.
124 * \return a flag value
126 virtual bool isApplyAndClose() const;
129 * Apply changes done by this operation.
131 virtual void apply();
135 HYDROGUI_Module* myModule;
136 HYDROGUI_InputPanel* myPanel;
137 OCCViewer_ViewManager* myPreviewManager;
139 bool myIsPrintErrorMessage;
140 bool myIsTransactionOpened;
145 bool myIsApplyAndClose;