SuperTuxKart
check_box_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_CHECKBOX_HPP
21 #define HEADER_CHECKBOX_HPP
22 
23 #include "guiengine/widget.hpp"
24 #include "utils/leak_check.hpp"
25 #include "utils/ptr_vector.hpp"
26 
27 namespace GUIEngine
28 {
33  class CheckBoxWidget : public Widget
34  {
35  bool m_state;
36  EventPropagation transmitEvent(Widget* w,
37  const std::string& originator,
38  const int playerID);
39 
40  public:
41 
42  LEAK_CHECK()
43 
45  virtual ~CheckBoxWidget() {}
46 
48  void add();
49 
51  bool getState() const { return m_state; }
52 
54  void setState(const bool checked) { m_state = checked; }
55 
56 
59  virtual int getHeightNeededAroundLabel() const { return 10; }
60  };
61 }
62 
63 #endif
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:31
void setState(const bool checked)
Set whether the checkbox is checked.
Definition: check_box_widget.hpp:54
A checkbox widget.
Definition: check_box_widget.hpp:33
bool getState() const
Get whether the checkbox is checked.
Definition: check_box_widget.hpp:51
void add()
Implement callback from parent class Widget.
Definition: check_box_widget.cpp:37
EventPropagation transmitEvent(Widget *w, const std::string &originator, const int playerID)
All widgets, including their parents (m_event_handler) will be notified on event through this call.
Definition: check_box_widget.cpp:52
The nearly-abstract base of all widgets (not fully abstract since a bare Widget can be created for th...
Definition: widget.hpp:138
virtual int getHeightNeededAroundLabel() const
When inferring widget size from its label length, this method will be called to if/how much space mus...
Definition: check_box_widget.hpp:59