OpenSceneGraph 3.6.5
Label
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14// Code by: Jeremy Moles (cubicool) 2007-2008
15
16#ifndef OSGWIDGET_LABEL
17#define OSGWIDGET_LABEL
18
19#include <osgText/Text>
20#include <osgWidget/Widget>
21#include <osgWidget/Window>
22
23namespace osgWidget {
24
26{
27 public:
28
30
31 Label (const std::string& = "", const std::string& = "");
32 Label (const Label&, const osg::CopyOp&);
33
34 virtual void parented (Window*);
35 virtual void unparented (Window*);
36 virtual void positioned ();
37
38 void setLabel (const std::string&);
40 void setFont (const std::string&);
41 void setFontSize (unsigned int);
42 void setFontColor (const Color&);
44
46
47 std::string getLabel() const { return _text->getText().createUTF8EncodedString(); }
48
50
51 osgText::Text* getText() { return _text.get(); }
52
53 const osgText::Text* getText() const { return _text.get(); }
54
55 protected:
56
58 unsigned int _textIndex;
59
60 virtual void _calculateSize(const XYCoord&);
61
62};
63
64}
65
66#endif
The osgWidget library is a NodeKit that extends the core scene graph to support a 2D (and eventually ...
Definition Box:21
Point::value_type point_type
Definition Types:33
osg::Vec2 XYCoord
Definition Types:36
ColorArray::value_type Color
Definition Types:30
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
Definition String:44
Definition Text:27
Label(const Label &, const osg::CopyOp &)
std::string getLabel() const
Definition Label:47
virtual void parented(Window *)
void setFontSize(unsigned int)
void setLabel(const std::string &)
void setLabel(const osgText::String &)
void setFontColor(point_type r, point_type g, point_type b, point_type a)
Definition Label:49
osgText::Text * getText()
Definition Label:51
void setFontColor(const Color &)
META_Object(osgWidget, Label)
virtual void unparented(Window *)
virtual void _calculateSize(const XYCoord &)
virtual void positioned()
void setFont(const std::string &)
unsigned int _textIndex
Definition Label:58
Label(const std::string &="", const std::string &="")
osg::ref_ptr< osgText::Text > _text
Definition Label:57
XYCoord getTextSize() const
const osgText::Text * getText() const
Definition Label:53
void setShadow(point_type)
friend class Window
Definition Widget:459
Widget(const std::string &="", point_type=0.0f, point_type=0.0f)
#define OSGWIDGET_EXPORT
Definition Export:42

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.