SuperTuxKart
Loading...
Searching...
No Matches
label_widget.hpp
1// SuperTuxKart - a fun racing game with go-kart
2// Copyright (C) 2009-2015 Marianne Gagnon
3//
4// This program is free software; you can redistribute it and/or
5// modify it under the terms of the GNU General Public License
6// as published by the Free Software Foundation; either version 3
7// of the License, or (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18
19
20#ifndef HEADER_LABEL_HPP
21#define HEADER_LABEL_HPP
22
23#include <irrString.h>
24#include <SColor.h>
25
26#include "guiengine/widget.hpp"
27#include "utils/leak_check.hpp"
28#include "utils/ptr_vector.hpp"
29
30namespace GUIEngine
31{
35 class LabelWidget : public Widget
36 {
37 public:
38
39 enum LabelType
40 {
41 NORMAL,
42 BRIGHT,
43 TITLE,
44 SMALL_TITLE,
45 TINY_TITLE,
46 COUNT
47 };
48
49 private:
50
51 LabelType m_type;
52 irr::video::SColor m_color;
53 bool m_has_color;
54
57
60
61 // Hide overloaded methods
62 using Widget::setText;
63
64 public:
65
66 LEAK_CHECK()
67
68
71 LabelWidget(LabelType type = NORMAL);
72
73 virtual ~LabelWidget() {}
74
76 virtual void add();
77
80 void setColor(const irr::video::SColor& color);
81 void setErrorColor();
82 void setDefaultColor();
83
85 virtual void update(float dt);
86
101 virtual void setText(const irr::core::stringw& text, bool expandAsNeeded);
102
103 // --------------------------------------------------------------------
104
106 void setScrollSpeed(float speed);
107
108 // --------------------------------------------------------------------
109
115 bool scrolledOff() const;
116
117 };
118}
119
120#endif
A simple label widget.
Definition: label_widget.hpp:36
float m_scroll_speed
Scroll speed in characters/seconds (0 if no scrolling).
Definition: label_widget.hpp:56
void setScrollSpeed(float speed)
Sets horizontal scroll speed.
Definition: label_widget.cpp:185
virtual void update(float dt)
Callback from base class Widget.
Definition: label_widget.cpp:165
bool scrolledOff() const
Check if the current has been fully scrolled.
Definition: label_widget.cpp:176
virtual void add()
Callback from base class Widget.
Definition: label_widget.cpp:59
void setColor(const irr::video::SColor &color)
Sets the color of the widget.
Definition: label_widget.cpp:192
virtual void setText(const irr::core::stringw &text, bool expandAsNeeded)
Sets the text in the label.
Definition: label_widget.cpp:129
float m_scroll_offset
Current scroll offset.
Definition: label_widget.hpp:59
The nearly-abstract base of all widgets (not fully abstract since a bare Widget can be created for th...
Definition: widget.hpp:143
virtual void setText(const irr::core::stringw &s)
Sets the text of a widget from a wchar_t.
Definition: widget.cpp:139
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33