g4tools  5.4.0
base_text
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
2 // See the file tools.license for terms.
3 
4 #ifndef tools_sg_base_text
5 #define tools_sg_base_text
6 
7 #include "node"
8 
9 #include "sf_enum"
10 #include "mf"
11 #include "enums" //hjust,vjust
12 //#include "../lina/box3f"
13 
14 namespace tools {
15 namespace sg {
16 
17 class base_text : public node {
18  typedef node parent;
19 public:
20  virtual float ascent(float) const = 0;
21  virtual float descent(float) const = 0;
22  virtual float y_advance(float) const = 0;
23  virtual void get_bounds(float,
24  float&,float&,float&,
25  float&,float&,float&) const = 0;
26 
27  virtual bool truncate(const std::string&,float,float,std::string&) const = 0;
28 public:
33 public:
34  virtual const desc_fields& node_desc_fields() const {
36  static const desc_fields s_v(parent::node_desc_fields(),4, //WARNING : take care of count.
41  );
42  return s_v;
43  }
44 private:
45  void add_fields(){
47  add_field(&height);
48  add_field(&hjust);
49  add_field(&vjust);
50  }
51 public:
53  :parent()
54  ,height(1.0f)
55  ,hjust(left)
56  ,vjust(bottom)
57  {
58  add_fields();
59  }
60  virtual ~base_text(){}
61 protected:
62  base_text(const base_text& a_from)
63  :parent(a_from)
64  ,strings(a_from.strings)
65  ,height(a_from.height)
66  ,hjust(a_from.hjust)
67  ,vjust(a_from.vjust)
68  {
69  add_fields();
70  }
71  base_text& operator=(const base_text& a_from){
72  parent::operator=(a_from);
73  height = a_from.height;
74  strings = a_from.strings;
75  hjust = a_from.hjust;
76  vjust = a_from.vjust;
77  return *this;
78  }
79 public:
80 
81 // void get_bounds(float a_height,box3f& a_box) {
82 // //for backward compatibility.
83 // float mn_x,mn_y,mn_z;
84 // float mx_x,mx_y,mx_z;
85 // get_bounds(a_height,mn_x,mn_y,mn_z,mx_x,mx_y,mx_z);
86 // a_box.set_bounds(mn_x,mn_y,mn_z,mx_x,mx_y,mx_z);
87 // }
88 
89 };
90 
91 }}
92 
93 #endif
node
tools::sg::base_text::base_text
base_text(const base_text &a_from)
Definition: base_text:62
tools::sg::base_text::operator=
base_text & operator=(const base_text &a_from)
Definition: base_text:71
tools::sg::base_text
Definition: base_text:17
tools::sg::base_text::truncate
virtual bool truncate(const std::string &, float, float, std::string &) const =0
tools::sg::base_text::height
sf< float > height
Definition: base_text:30
tools::sg::hjust
hjust
Definition: enums:73
tools::sg::base_text::hjust
sf_enum< sg::hjust > hjust
Definition: base_text:31
tools::sg::node
Definition: node:28
mf
tools::sg::base_text::~base_text
virtual ~base_text()
Definition: base_text:60
tools::sg::base_text::descent
virtual float descent(float) const =0
tools::sg::base_text::get_bounds
virtual void get_bounds(float, float &, float &, float &, float &, float &, float &) const =0
tools::sg::base_text::ascent
virtual float ascent(float) const =0
tools::sg::desc_fields
Definition: field_desc:148
tools::sg::node::operator=
node & operator=(const node &)
Definition: node:124
tools::sg::base_text::node_desc_fields
virtual const desc_fields & node_desc_fields() const
Definition: base_text:34
tools::sg::left
@ left
Definition: enums:74
tools::sg::base_text::vjust
sf_enum< sg::vjust > vjust
Definition: base_text:32
tools::sg::sf_enum< sg::hjust >
tools::sg::vjust
vjust
Definition: enums:79
tools::sg::base_text::base_text
base_text()
Definition: base_text:52
tools::sg::bottom
@ bottom
Definition: enums:80
tools::sg::mf_string
Definition: mf:76
sf_enum
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::sg::node::node_desc_fields
virtual const desc_fields & node_desc_fields() const
Definition: node:48
tools::sg::node::add_field
void add_field(field *a_field)
Definition: node:128
enums
tools::sg::base_text::y_advance
virtual float y_advance(float) const =0
tools::sg::base_text::strings
mf_string strings
Definition: base_text:29
TOOLS_FIELD_DESC_NODE_CLASS
#define TOOLS_FIELD_DESC_NODE_CLASS(a__class)
Definition: field:68
tools::sg::sf< float >
TOOLS_ARG_FIELD_DESC
#define TOOLS_ARG_FIELD_DESC(a__field)
Definition: field:71