Salome HOME
68542417a3f8a5896946889b7c3288296292d07b
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Operation.h
1 //  SALOME SMESHGUI
2 //
3 //  Copyright (C) 2005  CEA/DEN, EDF R&D
4 //
5 //
6 //
7 //  File   : SMESHGUI_Operation.h
8 //  Author : Sergey LITONIN
9 //  Module : SALOME
10
11
12 #ifndef SMESHGUI_Operation_H
13 #define SMESHGUI_Operation_H
14
15 #include <SalomeApp_Operation.h>
16 #include <SMESHGUI_Dialog.h>
17 #include <SALOME_InteractiveObject.hxx>
18 #include <SVTK_Selection.h>
19
20 #include <SALOMEDSClient.hxx>
21
22 class SMESHGUI;
23 class SVTK_ViewWindow;
24 class SVTK_Selector;
25 class TColStd_MapOfInteger;
26
27
28 /*
29   Class       : SMESHGUI_Operation
30   Description : Base class for all SMESH operations
31 */
32
33 class SMESHGUI_Operation : public SalomeApp_Operation
34 {
35   Q_OBJECT
36
37 public:
38   SMESHGUI_Operation();
39   virtual ~SMESHGUI_Operation();
40
41   static  int       prefix( const QString& );
42   // Return hard-coded prefix using to differ intersecting types
43   
44 protected:
45   typedef enum
46   {
47     Object,
48     MeshNode,
49     MeshElement
50
51   } SelectedObjectType;
52
53 protected:
54   Selection_Mode    selectionMode() const;
55   void              setSelectionMode( const Selection_Mode );
56   void              highlight( const Handle( SALOME_InteractiveObject )&,
57                                const bool, const bool = true );
58   void              addOrRemoveIndex( const Handle( SALOME_InteractiveObject )&,
59                                       const TColStd_MapOfInteger&, const bool );
60
61   //! sets the dialog widgets to state just after operation start
62   virtual void      initDialog();
63
64   virtual void      startOperation();
65   virtual bool      isReadyToStart();
66
67   SMESHGUI*         getSMESHGUI() const;
68   SVTK_ViewWindow*  viewWindow() const;
69   SVTK_Selector*    selector() const;
70
71   _PTR(Study)       studyDS() const;
72
73
74   //! Get names, types and ids of selected objects
75   virtual void      selected( QStringList&, SMESHGUI_Dialog::TypesList&, QStringList& ) const;
76   
77   //! Find type by id
78   virtual int       typeById( const QString&, const SelectedObjectType ) const;
79   
80   //! Char using to divide <entry> and <id> in string id representation. By default, '#'
81   virtual QChar     idChar() const;
82   
83   //! Set accroding dialog active or inactive
84   virtual void      setDialogActive( const bool );
85
86 protected slots:
87   virtual void onOk();
88   virtual bool onApply();
89   virtual void onCancel();
90 };
91
92 #endif
93
94
95
96
97
98