SuperTuxKart
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 
30 namespace GUIEngine
31 {
35  class LabelWidget : public Widget
36  {
37  bool m_bright;
38  bool m_has_color;
39  irr::video::SColor m_color;
40 
43 
46 
47  // Hide overloaded methods
48  using Widget::setText;
49 
50  public:
51 
52  LEAK_CHECK()
53 
54 
59  LabelWidget(bool title=false, bool bright=false);
60 
61  virtual ~LabelWidget() {}
62 
64  virtual void add();
65 
68  void setColor(const irr::video::SColor& color);
69  void setErrorColor();
70  void setDefaultColor();
71 
73  virtual void update(float dt);
74 
89  virtual void setText(const irr::core::stringw& text, bool expandAsNeeded);
90 
91  // --------------------------------------------------------------------
92 
94  void setScrollSpeed(float speed);
95 
96  // --------------------------------------------------------------------
97 
103  bool scrolledOff() const;
104 
105  };
106 }
107 
108 #endif
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:31
float m_scroll_offset
Current scroll offset.
Definition: label_widget.hpp:45
float m_scroll_speed
Scroll speed in characters/seconds (0 if no scrolling).
Definition: label_widget.hpp:42
virtual void setText(const irr::core::stringw &text, bool expandAsNeeded)
Sets the text in the label.
Definition: label_widget.cpp:118
void setColor(const irr::video::SColor &color)
Sets the color of the widget.
Definition: label_widget.cpp:174
virtual void add()
Callback from base class Widget.
Definition: label_widget.cpp:59
virtual void setText(const irr::core::stringw &s)
Sets the text of a widget from a wchar_t.
Definition: widget.cpp:124
void setScrollSpeed(float speed)
Sets horizontal scroll speed.
Definition: label_widget.cpp:167
bool scrolledOff() const
Check if the current has been fully scrolled.
Definition: label_widget.cpp:158
A simple label widget.
Definition: label_widget.hpp:35
virtual void update(float dt)
Callback from base class Widget.
Definition: label_widget.cpp:147
The nearly-abstract base of all widgets (not fully abstract since a bare Widget can be created for th...
Definition: widget.hpp:138