1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef HYDROGUI_OPERATION_H
24 #define HYDROGUI_OPERATION_H
26 #include <LightApp_Operation.h>
30 class HYDROGUI_Module;
31 class HYDROGUI_InputPanel;
34 class SUIT_SelectionMgr;
35 class OCCViewer_ViewManager;
37 class Handle_HYDROData_Document;
38 class Handle_HYDROData_Object;
40 class HYDROGUI_Operation : public LightApp_Operation
46 HYDROGUI_Operation( HYDROGUI_Module* theModule );
47 virtual ~HYDROGUI_Operation();
51 void setName( const QString& theName );
52 const QString& getName() const;
54 HYDROGUI_InputPanel* inputPanel() const;
55 SUIT_SelectionMgr* selectionMgr() const;
56 HYDROGUI_Module* module() const;
58 int getPreviewZLayer() const;
59 virtual void updatePreviewZLayer( int theLayer );
62 void helpContextModule( const QString&,
67 virtual void startOperation();
68 virtual void abortOperation();
69 virtual void commitOperation();
70 virtual void stopOperation();
71 virtual void setDialogActive( const bool );
73 virtual HYDROGUI_InputPanel* createInputPanel() const;
74 virtual void closeInputPanel();
76 virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg,
77 QStringList& theBrowseObjectsEntries );
78 virtual void processCancel();
80 void startDocOperation();
81 void abortDocOperation();
82 void commitDocOperation();
84 Handle_HYDROData_Document doc() const;
86 virtual bool isToAbortOnApply() const { return true; }
88 void printErrorMessage( const QString& theErrorMsg );
89 void setPrintErrorMessage( const bool theIsPrint );
91 void browseObjects( const QStringList& theBrowseObjectsEntries,
92 const bool theIsApplyAndClose = true );
96 virtual void onApplyAndClose();
97 virtual void onApply();
98 virtual void onCancel();
99 virtual void onHelp();
103 QString getHelpComponent() const;
104 QString getHelpFile() const;
105 QString getHelpContext() const;
107 virtual void setPreviewZLayer( int theLayer );
108 virtual HYDROGUI_Shape* getPreviewShape() const;
109 OCCViewer_ViewManager* getPreviewManager();
110 void setPreviewManager( OCCViewer_ViewManager* theManager );
113 * Set specific cursor chosen in preferences for edition operations.
115 virtual void setCursor();
117 * Restore the default cursor.
119 virtual void restoreCursor();
122 * Set flag indicating, if 'Apply and Close' button is clicked on input panel.
123 * @param theFlag a flag value to be set
125 virtual void setIsApplyAndClose( const bool theFlag );
127 * Get flag indicating, if 'Apply and Close' button is clicked on input panel.
128 * \return a flag value
130 virtual bool isApplyAndClose() const;
133 * Apply changes done by this operation.
135 virtual void apply();
139 HYDROGUI_Module* myModule;
140 HYDROGUI_InputPanel* myPanel;
141 OCCViewer_ViewManager* myPreviewManager;
143 bool myIsPrintErrorMessage;
144 bool myIsTransactionOpened;
149 bool myIsApplyAndClose;