Salome HOME
Issue #2130: arc is done not as desired
[modules/shaper.git] / src / Config / Config_Prop.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        Config_Prop.h
4 // Created:     12 Aug 2014
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef CONFIG_PROP_H
8 #define CONFIG_PROP_H
9
10 #include "Config_def.h"
11
12 #include <string>
13 #include <list>
14
15 const static char* SKETCH_TAB_NAME = "Sketch";
16
17 /*!
18  * \class Config_Prop
19  * \brief Class which describes a one property
20  * \ingroup Config
21  */
22 class Config_Prop
23 {
24  public:
25
26   /// Type of stored property
27   enum PropType
28   {
29     Disabled,
30     Space,
31     Boolean,
32     Color,
33     String,
34     Selector,
35     DblSpin,
36     IntSpin,
37     Double,
38     Integer,
39     GroupBox,
40     Tab,
41     Frame,
42     Font,
43     DirList,
44     File,
45     Slider,
46     Shortcut,
47     ShortcutTree,
48     BiColor,
49     Background,
50     Directory
51   };
52
53   /** 
54    * Creates a one property
55    * \param theSection - name of section (domain of using) of the property.
56    * \param theName - name (title) of the value.
57    * \param theTitle - title of the value
58    * \param theType - type of the value.
59    * \param theDefaultValue - default value of the property. This is an initial property value
60    */
61   Config_Prop(const std::string& theSection, const std::string& theName,
62               const std::string& theTitle, PropType theType, const std::string& theDefaultValue)
63   {
64     mySection = theSection;
65     myName = theName;
66     myTitle = theTitle;
67     myType = theType;
68     myValue = theDefaultValue;
69     myDefaultValue = theDefaultValue;
70   }
71
72   /// Get name of section
73   std::string section() const
74   {
75     return mySection;
76   }
77   /// Get name of property
78   std::string name() const
79   {
80     return myName;
81   }
82   /// Get title of property
83   std::string title() const
84   {
85     return myTitle;
86   }
87   /// Set title of property
88   void setTitle(const std::string& theTitle)
89   {
90     myTitle = theTitle;
91   }
92   /// Get type of property
93   PropType type() const
94   {
95     return myType;
96   }
97   /// Set type of property
98   void setType(PropType theType)
99   {
100     myType = theType;
101   }
102   /// Get property's value in string format
103   std::string value() const
104   {
105     return myValue;
106   }
107   /// Set property's value in string format
108   CONFIG_EXPORT void setValue(const std::string& theValue);
109   /// Get default value of property
110   std::string defaultValue() const
111   {
112     return myDefaultValue;
113   }
114   /// Set default value of property
115   CONFIG_EXPORT void setDefaultValue(const std::string& theValue);
116   /// Alows to compare Config_Prop with each other
117   bool operator==(const Config_Prop* theProp) const
118   {
119     return (mySection == theProp->section()) && (myName == theProp->name());
120   }
121
122  private:
123   std::string mySection; ///< Name of section
124   std::string myName; ///< Name of property
125   std::string myTitle; ///< Title of property
126   PropType myType; ///< Type of property
127   std::string myValue; // Value in string format
128   std::string myDefaultValue; // Default value
129 };
130
131 typedef std::list<Config_Prop*> Config_Properties;
132
133 #endif