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
|
/*
* Copyright (c) 1997 Silicon Graphics, Inc. All Rights Reserved.
* Copyright (c) 2009 Aconex. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef _LABELOBJ_H_
#define _LABELOBJ_H_
#include "text.h"
#include "viewobj.h"
class SoNode;
class SoSeparator;
class SoTranslation;
class LabelObj : public ViewObj
{
protected:
QString _str;
Text *_text;
Text::Direction _dir;
Text::FontSize _fontSize;
int _margin;
float _color[3];
public:
virtual ~LabelObj();
LabelObj(Text::Direction dir,
Text::FontSize fontSize,
const DefaultObj &defaults,
int x, int y,
int cols = 1, int rows = 1,
Alignment align = center);
LabelObj(const DefaultObj &defaults,
int x, int y,
int cols = 1, int rows = 1,
Alignment align = center);
const QString &str() const
{ return _str; }
Text::Direction dir() const
{ return _dir; }
Text::FontSize size() const
{ return _fontSize; }
int margin() const
{ return _margin; }
float color(int i) const
{ return _color[i]; }
// Local Changes
QString &str()
{ return _str; }
Text::Direction &dir()
{ return _dir; }
Text::FontSize &size()
{ return _fontSize; }
int &margin()
{ return _margin; }
void color(float r, float g, float b)
{ _color[0] = r; _color[1] = g; _color[2] = b; }
virtual int width() const
{ return _text->width() + (_margin * 2); }
virtual int depth() const
{ return _text->depth() + (_margin * 2); }
virtual void setTran(float xTran, float zTran, int width, int depth);
virtual void finishedAdd();
// Output
virtual void display(QTextStream& os) const;
virtual const char* name() const
{ return "Label"; }
friend QTextStream& operator<<(QTextStream& os, LabelObj const& rhs);
private:
LabelObj();
LabelObj(LabelObj const &);
LabelObj const& operator=(LabelObj const &);
};
#endif /* _LABELOBJ_H_ */
|