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 //#include "../lina/box3f"
0013
0014 namespace tools {
0015 namespace sg {
0016
0017 class base_text : public node {
0018 typedef node parent;
0019 public:
0020 virtual float ascent(float) const = 0;
0021 virtual float descent(float) const = 0;
0022 virtual float y_advance(float) const = 0;
0023 virtual void get_bounds(float,
0024 float&,float&,float&,
0025 float&,float&,float&) const = 0;
0026
0027 virtual bool truncate(const std::string&,float,float,std::string&) const = 0;
0028 public:
0029 mf_string strings;
0030 sf<float> height;
0031 sf_enum<sg::hjust> hjust;
0032 sf_enum<sg::vjust> vjust;
0033 public:
0034 virtual const desc_fields& node_desc_fields() const {
0035 TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::base_text)
0036 static const desc_fields s_v(parent::node_desc_fields(),4, //WARNING : take care of count.
0037 TOOLS_ARG_FIELD_DESC(strings),
0038 TOOLS_ARG_FIELD_DESC(height),
0039 TOOLS_ARG_FIELD_DESC(hjust),
0040 TOOLS_ARG_FIELD_DESC(vjust)
0041 );
0042 return s_v;
0043 }
0044 private:
0045 void add_fields(){
0046 add_field(&strings);
0047 add_field(&height);
0048 add_field(&hjust);
0049 add_field(&vjust);
0050 }
0051 public:
0052 base_text()
0053 :parent()
0054 ,height(1.0f)
0055 ,hjust(left)
0056 ,vjust(bottom)
0057 {
0058 add_fields();
0059 }
0060 virtual ~base_text(){}
0061 protected:
0062 base_text(const base_text& a_from)
0063 :parent(a_from)
0064 ,strings(a_from.strings)
0065 ,height(a_from.height)
0066 ,hjust(a_from.hjust)
0067 ,vjust(a_from.vjust)
0068 {
0069 add_fields();
0070 }
0071 base_text& operator=(const base_text& a_from){
0072 parent::operator=(a_from);
0073 height = a_from.height;
0074 strings = a_from.strings;
0075 hjust = a_from.hjust;
0076 vjust = a_from.vjust;
0077 return *this;
0078 }
0079 public:
0080
0081 // void get_bounds(float a_height,box3f& a_box) {
0082 // //for backward compatibility.
0083 // float mn_x,mn_y,mn_z;
0084 // float mx_x,mx_y,mx_z;
0085 // get_bounds(a_height,mn_x,mn_y,mn_z,mx_x,mx_y,mx_z);
0086 // a_box.set_bounds(mn_x,mn_y,mn_z,mx_x,mx_y,mx_z);
0087 // }
0088
0089 };
0090
0091 }}
0092
0093 #endif