Salome HOME
91a77ba94abf48e94bead31f3082490452e98a68
[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. 
21   It is possible to store/ restore the attribute values.
22 */
23 class ModuleBase_WidgetSelectorStore
24 {
25  public:
26
27   /// Constructor
28   MODULEBASE_EXPORT ModuleBase_WidgetSelectorStore();
29   /// Destructor
30   MODULEBASE_EXPORT virtual ~ModuleBase_WidgetSelectorStore() {}
31
32   /// Creates a backup of the current values of the attribute
33   /// \param theAttribute a model attribute which parameters are to be stored
34   /// \param theWorkshop a current workshop
35   MODULEBASE_EXPORT void storeAttributeValue(const AttributePtr& theAttribute,
36                                              ModuleBase_IWorkshop* theWorkshop);
37
38   /// Creates a backup of the current values of the attribute
39   /// \param theAttribute a model attribute which parameters are to be restored
40   /// \param theWorkshop a current workshop
41   MODULEBASE_EXPORT void restoreAttributeValue(const AttributePtr& theAttribute,
42                                                ModuleBase_IWorkshop* theWorkshop);
43
44 private:
45   /// backup parameters of the model attribute. The class processes three types of attribute:
46   /// Reference, RefAttr and Selection. 
47   /// Depending on the attribute type, only the attribute parameter
48   /// values are reserved in the backup
49   /// An attribute object
50   ObjectPtr myObject;
51   /// An attribute shape
52   GeomShapePtr myShape;
53   /// A reference of the attribute
54   AttributePtr myRefAttribute;
55   /// A boolean value whether refAttr uses reference of object
56   bool myIsObject;
57
58   /// Variable of selection type
59   std::string mySelectionType;
60   /// Variable of GeomSelection
61   int mySelectionCount; // number of elements in the attribute selection list when store
62
63 };
64
65 #endif