Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/sg/base_text is written in an unsupported language. File is not indexed.

0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003 
0004 #ifndef tools_sg_base_text
0005 #define tools_sg_base_text
0006 
0007 #include "node"
0008 
0009 #include "sf_enum"
0010 #include "mf"
0011 #include "enums" //hjust,vjust
0012 
0013 namespace tools {
0014 namespace sg {
0015 
0016 class base_text : public node {
0017   typedef node parent;
0018 public:
0019   virtual float ascent(float) const = 0;
0020   virtual float descent(float) const = 0;
0021   virtual float y_advance(float) const = 0;
0022   virtual void get_bounds(float,
0023                           float&,float&,float&,
0024                           float&,float&,float&) const = 0;
0025 
0026   virtual bool truncate(const std::string&,float,float,std::string&) const = 0;
0027 public:
0028   mf_string strings;
0029   sf<float> height;
0030   sf_enum<sg::hjust> hjust;
0031   sf_enum<sg::vjust> vjust;
0032 public:
0033   virtual const desc_fields& node_desc_fields() const {
0034     TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::base_text)
0035     static const desc_fields s_v(parent::node_desc_fields(),4, //WARNING : take care of count.
0036       TOOLS_ARG_FIELD_DESC(strings),
0037       TOOLS_ARG_FIELD_DESC(height),
0038       TOOLS_ARG_FIELD_DESC(hjust),
0039       TOOLS_ARG_FIELD_DESC(vjust)
0040     );
0041     return s_v;
0042   }
0043 private:
0044   void add_fields(){
0045     add_field(&strings);
0046     add_field(&height);
0047     add_field(&hjust);
0048     add_field(&vjust);
0049   }
0050 public:
0051   base_text()
0052   :parent()
0053   ,height(1.0f)
0054   ,hjust(left)
0055   ,vjust(bottom)
0056   {
0057     add_fields();
0058   }
0059   virtual ~base_text(){}
0060 protected:
0061   base_text(const base_text& a_from)
0062   :parent(a_from)
0063   ,strings(a_from.strings)
0064   ,height(a_from.height)
0065   ,hjust(a_from.hjust)
0066   ,vjust(a_from.vjust)
0067   {
0068     add_fields();
0069   }
0070   base_text& operator=(const base_text& a_from){
0071     parent::operator=(a_from);
0072     height = a_from.height;
0073     strings = a_from.strings;
0074     hjust = a_from.hjust;
0075     vjust = a_from.vjust;
0076     return *this;
0077   }
0078 };
0079 
0080 }}
0081 
0082 #endif