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();
45 static bool myIsClear;
49 void setName( const QString& theName );
50 const QString& getName() const;
52 HYDROGUI_InputPanel* inputPanel() const;
53 SUIT_SelectionMgr* selectionMgr() const;
54 HYDROGUI_Module* module() const;
56 int getPreviewZLayer() const;
57 virtual void updatePreviewZLayer( int theLayer );
60 void helpContextModule( const QString&,
65 virtual void startOperation();
66 virtual void abortOperation();
67 virtual void commitOperation();
68 virtual void stopOperation();
69 virtual void setDialogActive( const bool );
71 virtual HYDROGUI_InputPanel* createInputPanel() const;
72 virtual void closeInputPanel();
74 virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg,
75 QStringList& theBrowseObjectsEntries );
76 virtual void processCancel();
78 void startDocOperation();
79 void abortDocOperation();
80 void commitDocOperation();
82 Handle(HYDROData_Document) doc() const;
84 virtual bool isToAbortOnApply() const { return true; }
86 void printErrorMessage( const QString& theErrorMsg );
87 void setPrintErrorMessage( const bool theIsPrint );
89 void browseObjects( const QStringList& theBrowseObjectsEntries,
90 const bool theIsApplyAndClose = true );
94 virtual void onApplyAndClose();
95 virtual void onApply();
96 virtual void onCancel();
97 virtual void onHelp();
101 QString getHelpComponent() const;
102 QString getHelpFile() const;
103 QString getHelpContext() const;
105 virtual void setPreviewZLayer( int theLayer );
106 virtual HYDROGUI_Shape* getPreviewShape() const;
107 OCCViewer_ViewManager* getPreviewManager();
108 void setPreviewManager( OCCViewer_ViewManager* theManager );
111 * Set specific cursor chosen in preferences for edition operations.
113 virtual void setCursor();
115 * Restore the default cursor.
117 virtual void restoreCursor();
120 * Set flag indicating, if 'Apply and Close' button is clicked on input panel.
121 * @param theFlag a flag value to be set
123 virtual void setIsApplyAndClose( const bool theFlag );
125 * Get flag indicating, if 'Apply and Close' button is clicked on input panel.
126 * \return a flag value
128 virtual bool isApplyAndClose() const;
131 * Apply changes done by this operation.
133 virtual void apply();
135 virtual void restoreOCCViewerSelection(OCCViewer_ViewManager* theViewManager = 0);
139 HYDROGUI_Module* myModule;
140 HYDROGUI_InputPanel* myPanel;
141 OCCViewer_ViewManager* myPreviewManager;
143 bool myIsPrintErrorMessage;
144 bool myIsTransactionOpened;
149 bool myIsApplyAndClose;