1 /* === S Y N F I G ========================================================= */
3 ** \brief ParamDesc Class Implementation
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
10 ** This package is free software; you can redistribute it and/or
11 ** modify it under the terms of the GNU General Public License as
12 ** published by the Free Software Foundation; either version 2 of
13 ** the License, or (at your option) any later version.
15 ** This package is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ** General Public License for more details.
21 /* ========================================================================= */
23 /* === S T A R T =========================================================== */
25 #ifndef __SYNFIG_PARAMDESC_H
26 #define __SYNFIG_PARAMDESC_H
28 /* === H E A D E R S ======================================================= */
35 /* === M A C R O S ========================================================= */
37 /* === T Y P E D E F S ===================================================== */
39 /* === C L A S S E S & S T R U C T S ======================================= */
46 ** \brief Parameter Description Class
59 EnumData(int value, const String &name, const String &local_name):
62 local_name(local_name)
68 -- ** -- D A T A -------------------------------------------------------------
72 String name_; //! The actual parameter name
73 String local_name_; //! Localized name
74 String desc_; //! Short description of parameter (Think tooltops)
75 String group_; //! Which group this parameter is a member of (optional)
76 String hint_; //! Parameter hint
77 String origin_; //! Parameter origin
80 Real scalar_; //! Scalar value for visual editing
87 std::list<EnumData> enum_list_;
90 -- ** -- C O N S T R U C T O R S ---------------------------------------------
95 ParamDesc(const String &a="IM_A_BUG_SO_REPORT_ME"):
101 invisible_duck_ (false),
102 is_distance_ (false),
103 animation_only_ (false)
106 ParamDesc(const ValueBase&, const String &a);
108 ParamDesc(synfig::Color::BlendMethod, const String &a);
112 -- ** -- M E M B E R F U N C T I O N S -------------------------------------
118 const std::list<EnumData> &get_enum_list()const { return enum_list_; }
120 //! Sets the localized name of the parameter.
121 ParamDesc &set_local_name(const String &n) { local_name_=n; return *this; }
123 //! Sets the localized description of the parameter.
124 ParamDesc &set_description(const String &d) { desc_=d; return *this; }
126 //! Sets the group that this parameter is a member of
127 ParamDesc &set_group(const String &n) { group_=n; return *this; }
129 //! Sets a "hint" for the parameter.
130 ParamDesc &set_hint(const String &h) { hint_=h; return *this; }
133 ParamDesc &set_connect(const String &h) { connect_=h; return *this; }
136 ParamDesc &set_box(const String &h) { box_=h; return *this; }
138 //! Sets a flag regarding the duck visibility
139 ParamDesc &set_invisible_duck(bool x=true) { invisible_duck_=x; return *this; }
141 //! Returns the flag regarding duck visibility
142 bool get_invisible_duck() { return invisible_duck_; }
146 ParamDesc &set_animation_only(bool x=true) { animation_only_=x; return *this; }
149 bool get_animation_only() { return animation_only_; }
152 //! Sets which parameter is to be used as the origin when the user edits visually.
153 ParamDesc &set_origin(const String &h) { origin_=h; return *this; }
155 //! Sets the scalar value for the parameter
156 /*! This value determines how the value is to be presented
157 ** to the user when editing visually. */
158 ParamDesc &set_scalar(const Real &n) { scalar_=n; return *this; }
159 ParamDesc &set_scalar(const String &h) { hint_=h; return *this; }
161 //! Marks the parameter as not necessary for saving or copying
162 ParamDesc ¬_critical() { critical_=false; return *this; }
165 ParamDesc &hidden() { hidden_=true; return *this; }
167 //! Marks the parameter as only readable. Implies not_critical()
168 /*! \todo This function needs to be written, as it is only a stub */
169 ParamDesc &read_only() { return *this; }
171 //! Marks the parameter as only writable. Implies not_critical()
172 /*! \todo This function needs to be written, as it is only a stub */
173 ParamDesc &write_only() { return *this; }
175 //! Adds a description of a possible enumeration value
176 /*! Only relevant if the parameter is of an integer type and hint set to \c "enum" . */
177 ParamDesc &add_enum_value(int val, const String &enum_name,const String &enum_local_name)
178 { enum_list_.push_back(EnumData(val,enum_name,enum_local_name)); return *this; }
180 //! Returns the localized name of the parameter
181 const String &get_local_name()const { return local_name_; }
183 //! Returns the name of the parameter
184 const String &get_name()const { return name_; }
186 //! Returns the localized description of the parameter
187 const String &get_description()const { return desc_; }
189 //! Returns the paramater's group
190 const String &get_group()const { return group_; }
192 //! Returns a "hint" about the parameter, regarding how it is to be displayed to the user
193 const String &get_hint()const { return hint_; }
195 //! Returns the name of the parameter that is defined as the "origin". Used for visual editing.
196 const String &get_origin()const { return origin_; }
199 const String &get_connect()const { return connect_; }
202 const String &get_box()const { return box_; }
204 //! Returns the scalar value for the parameter. Used for visual editing.
205 const Real &get_scalar()const { return scalar_; }
207 //! Returns \c true if the layer is critical, \c false otherwise.
208 bool get_critical()const { return critical_; }
210 //! Returns \c true if the layer is hidden, \c false otherwise.
211 bool get_hidden()const { return hidden_; }
215 ParamDesc& set_is_distance(bool x=true) { is_distance_=x; return *this;}
216 bool get_is_distance()const { return is_distance_; }
217 }; // END of class ParamDesc
219 class ParamVocab : public std::list< ParamDesc >
223 }; // END of namespace synfig
225 /* === E N D =============================================================== */