File: label.hpp

package info (click to toggle)
python-visual 1%3A5.12-1.1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 7,672 kB
  • ctags: 7,636
  • sloc: cpp: 15,593; sh: 9,615; ansic: 6,631; python: 4,737; makefile: 385
file content (114 lines) | stat: -rw-r--r-- 2,409 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#ifndef VPYTHON_LABEL_HPP
#define VPYTHON_LABEL_HPP

// Copyright (c) 2000, 2001, 2002, 2003 by David Scherer and others.
// Copyright (c) 2003, 2004 by Jonathan Brandmeyer and others.
// See the file license.txt for complete license terms.
// See the file authors.txt for a complete list of contributors.

#include "renderable.hpp"
#include "text.hpp"

#include <vector>

namespace cvisual {

class label : public renderable
{
 public:
	label();
	label( const label& other);
	virtual ~label();

	void set_pos( const vector& n_pos);
	shared_vector& get_pos();

	void set_x( double x);
	double get_x();

	void set_y( double y);
	double get_y();

	void set_z( double z);
	double get_z();

	void set_color( const rgb& n_color);
	rgb get_color();

	void set_red( float x);
	double get_red();

	void set_green( float x);
	double get_green();

	void set_blue( float x);
	double get_blue();

	void set_opacity( float);
	double get_opacity();
	
	void set_text( const std::wstring& t);
	std::wstring get_text();

	void set_space( double space);
	double get_space();

	void set_xoffset( double xoffset);
	double get_xoffset();

	void set_yoffset( double yoffset);
	double get_yoffset();

	void set_border( double border);
	double get_border();

	void set_font_family( const std::wstring& name);
	std::wstring get_font_family();

	void set_font_size(double);
	double get_font_size();

	void render_box( bool);
	bool has_box();

	void render_line( bool);
	bool has_line();

	void set_linecolor( const rgb& color);
	rgb get_linecolor();

 protected:
	// In world space:
	shared_vector pos;
	double space;

	// In pixels:
	double xoffset;   // offset from pos + space to the box
	double yoffset;
	double border;    // space between text and box

	/// A common name for the font.
	std::wstring font_description;
	/// The nominal size of the font, in pixels.
	double font_size;

	bool box_enabled; ///< True to draw a box around the text
	bool line_enabled; ///< True to draw a line to the text.

	// bitmap_font* font;
	rgb linecolor; ///< The color of the lines in the label. (color is for text)
	float opacity; ///< The opacity of the background for the text.

	std::wstring text;

	bool text_changed;
	boost::shared_ptr<layout> text_layout;

	virtual void gl_render( const view&);
	virtual vector get_center() const;
	virtual void grow_extent( extent& );
};

} // !namespace cvisual

#endif // !defined VPYTHON_LABEL_HPP