paramdesc.h

Go to the documentation of this file.
00001 /* === S Y N F I G ========================================================= */
00021 /* ========================================================================= */
00022 
00023 /* === S T A R T =========================================================== */
00024 
00025 #ifndef __SYNFIG_PARAMDESC_H
00026 #define __SYNFIG_PARAMDESC_H
00027 
00028 /* === H E A D E R S ======================================================= */
00029 
00030 #include "string.h"
00031 #include "real.h"
00032 #include "color.h"
00033 #include <list>
00034 
00035 /* === M A C R O S ========================================================= */
00036 
00037 /* === T Y P E D E F S ===================================================== */
00038 
00039 /* === C L A S S E S & S T R U C T S ======================================= */
00040 
00041 namespace synfig {
00042 
00043 class ValueBase;
00044 
00049 class ParamDesc
00050 {
00051 public:
00052 
00054     struct EnumData
00055     {
00056         int value;
00057         String name;
00058         String local_name;
00059         EnumData(int value, const String &name, const String &local_name):
00060             value(value),
00061             name(name),
00062             local_name(local_name)
00063         {
00064         }
00065     };
00066 
00067     /*
00068  -- ** -- D A T A -------------------------------------------------------------
00069     */
00070 
00071 private:
00072     String name_;           
00073     String local_name_;     
00074     String desc_;           
00075     String group_;          
00076     String hint_;           
00077     String origin_;         
00078     String connect_;
00079     String box_;
00080     Real scalar_;           
00081     bool critical_;
00082     bool hidden_;
00083     bool invisible_duck_;
00084     bool is_distance_;
00085     bool animation_only_;
00086 
00087     std::list<EnumData> enum_list_;
00088 
00089     /*
00090  -- ** -- C O N S T R U C T O R S ---------------------------------------------
00091     */
00092 
00093 public:
00094 
00095     ParamDesc(const String &a="IM_A_BUG_SO_REPORT_ME"):
00096         name_           (a),
00097         local_name_     (a),
00098         scalar_         (1.0),
00099         critical_       (true),
00100         hidden_         (false),
00101         invisible_duck_ (false),
00102         is_distance_    (false),
00103         animation_only_ (false)
00104     { }
00105 
00106     ParamDesc(const ValueBase&, const String &a);
00107 
00108     ParamDesc(synfig::Color::BlendMethod, const String &a);
00109 
00110 
00111     /*
00112  -- ** -- M E M B E R   F U N C T I O N S -------------------------------------
00113     */
00114 
00115 public:
00116 
00118     const std::list<EnumData> &get_enum_list()const { return enum_list_; }
00119 
00121     ParamDesc &set_local_name(const String &n) { local_name_=n; return *this; }
00122 
00124     ParamDesc &set_description(const String &d) { desc_=d; return *this; }
00125 
00127     ParamDesc &set_group(const String &n) { group_=n; return *this; }
00128 
00130     ParamDesc &set_hint(const String &h) { hint_=h; return *this; }
00131 
00133     ParamDesc &set_connect(const String &h) { connect_=h; return *this; }
00134 
00136     ParamDesc &set_box(const String &h) { box_=h; return *this; }
00137 
00139     ParamDesc &set_invisible_duck(bool x=true) { invisible_duck_=x; return *this; }
00140 
00142     bool get_invisible_duck() { return invisible_duck_; }
00143 
00144 
00146     ParamDesc &set_animation_only(bool x=true) { animation_only_=x; return *this; }
00147 
00149     bool get_animation_only() { return animation_only_; }
00150 
00151 
00153     ParamDesc &set_origin(const String &h) { origin_=h; return *this; }
00154 
00156 
00158     ParamDesc &set_scalar(const Real &n) { scalar_=n; return *this; }
00159     ParamDesc &set_scalar(const String &h) { hint_=h; return *this; }
00160 
00162     ParamDesc &not_critical() { critical_=false; return *this; }
00163 
00165     ParamDesc &hidden() { hidden_=true; return *this; }
00166 
00168 
00169     ParamDesc &read_only() { return *this; }
00170 
00172 
00173     ParamDesc &write_only() { return *this; }
00174 
00176 
00177     ParamDesc &add_enum_value(int val, const String &enum_name,const String &enum_local_name)
00178         { enum_list_.push_back(EnumData(val,enum_name,enum_local_name)); return *this; }
00179 
00181     const String &get_local_name()const { return local_name_; }
00182 
00184     const String &get_name()const { return name_; }
00185 
00187     const String &get_description()const { return desc_; }
00188 
00190     const String &get_group()const { return group_; }
00191 
00193     const String &get_hint()const { return hint_; }
00194 
00196     const String &get_origin()const { return origin_; }
00197 
00199     const String &get_connect()const { return connect_; }
00200 
00202     const String &get_box()const { return box_; }
00203 
00205     const Real &get_scalar()const { return scalar_; }
00206 
00208     bool get_critical()const { return critical_; }
00209 
00211     bool get_hidden()const { return hidden_; }
00212 
00213 
00214 
00215     ParamDesc& set_is_distance(bool x=true) { is_distance_=x; return *this;}
00216     bool get_is_distance()const { return is_distance_; }
00217 }; // END of class ParamDesc
00218 
00219 class ParamVocab : public std::list< ParamDesc >
00220 {
00221 };
00222 
00223 }; // END of namespace synfig
00224 
00225 /* === E N D =============================================================== */
00226 
00227 #endif

Generated on Wed Dec 12 03:11:41 2007 for synfig by  doxygen 1.5.4