SuperTuxKart
button_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_BUTTON_HPP
21 #define HEADER_BUTTON_HPP
22 
28 #include <irrString.h>
29 
30 #include "guiengine/widget.hpp"
31 #include "utils/leak_check.hpp"
32 #include "utils/ptr_vector.hpp"
33 
34 namespace GUIEngine
35 {
40  class ButtonWidget : public Widget
41  {
42  public:
43 
44  LEAK_CHECK()
45 
46  ButtonWidget();
47  virtual ~ButtonWidget() {}
48 
50  void add();
51 
57  void setLabel(const irr::core::stringw &label);
58 
61  virtual int getWidthNeededAroundLabel() const { return 35; }
62 
65  virtual int getHeightNeededAroundLabel() const { return 4; }
66  };
67 }
68 
69 #endif
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:31
virtual int getHeightNeededAroundLabel() const
When inferring widget size from its label length, this method will be called to if/how much space mus...
Definition: button_widget.hpp:65
void setLabel(const irr::core::stringw &label)
Change the label on the button.
Definition: button_widget.cpp:52
A text button widget.
Definition: button_widget.hpp:40
virtual int getWidthNeededAroundLabel() const
When inferring widget size from its label length, this method will be called to if/how much space mus...
Definition: button_widget.hpp:61
The nearly-abstract base of all widgets (not fully abstract since a bare Widget can be created for th...
Definition: widget.hpp:138
void add()
Implement callback from base class Widget.
Definition: button_widget.cpp:35