Salome HOME
ModuleBase_ViewerPrs is wrapped into shared_ptr.
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetSelectorStore.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModuleBase_WidgetSelectorStore.h
4 // Created:     2 June 2014
5 // Author:      Vitaly Smetannikov
6
7 #ifndef ModuleBase_WidgetSelectorStore_H
8 #define ModuleBase_WidgetSelectorStore_H
9
10 #include "ModuleBase.h"
11
12 #include <ModelAPI_Object.h>
13 #include <ModelAPI_Attribute.h>
14 #include <GeomAPI_Shape.h>
15
16 class ModuleBase_IWorkshop;
17
18 /**
19 * \ingroup GUI
20   Provides for an attribute backup of values. It is possible to store/ restore the attribute values.
21 */
22 class ModuleBase_WidgetSelectorStore
23 {
24  public:
25
26   /// Constructor
27   MODULEBASE_EXPORT ModuleBase_WidgetSelectorStore();
28   /// Destructor
29   MODULEBASE_EXPORT virtual ~ModuleBase_WidgetSelectorStore() {}
30
31   /// Creates a backup of the current values of the attribute
32   /// \param theAttribute a model attribute which parameters are to be stored
33   /// \param theWorkshop a current workshop
34   MODULEBASE_EXPORT void storeAttributeValue(const AttributePtr& theAttribute,
35                                              ModuleBase_IWorkshop* theWorkshop);
36
37   /// Creates a backup of the current values of the attribute
38   /// \param theAttribute a model attribute which parameters are to be restored
39   /// \param theWorkshop a current workshop
40   MODULEBASE_EXPORT void restoreAttributeValue(const AttributePtr& theAttribute,
41                                                ModuleBase_IWorkshop* theWorkshop);
42
43 private:
44   /// backup parameters of the model attribute. The class processes three types of attribute:
45   /// Reference, RefAttr and Selection. Depending on the attribute type, only the attribute parameter
46   /// values are reserved in the backup
47   /// An attribute object
48   ObjectPtr myObject;
49   /// An attribute shape
50   GeomShapePtr myShape;
51   /// A reference of the attribute
52   AttributePtr myRefAttribute;
53   /// A boolean value whether refAttr uses reference of object
54   bool myIsObject;
55
56   /// Variable of selection type
57   std::string mySelectionType;
58   /// Variable of GeomSelection
59   int mySelectionCount; // number of elements in the attribute selection list when store
60
61 };
62
63 #endif