TurtleBrains  0.3.5
High quality, portable, C++ framework for rapid 2D game development.
tbx_interface_checkbox.hpp
1 
9 #ifndef TurtleBrainsExpress_InterfaceCheckbox_hpp
10 #define TurtleBrainsExpress_InterfaceCheckbox_hpp
11 
12 #include <turtle_brains/express/interface/tbx_interface.hpp>
13 #include <turtle_brains/express/interface/tbx_interface_element.hpp>
14 
15 #include <functional>
16 
17 namespace TurtleBrainsExpress
18 {
19  namespace Interface
20  {
21  namespace Unstable
22  {
23  class InterfaceHandlerInterface;
24 
28  class Checkbox : public Element
29  {
30  public:
31  Checkbox(void);
32  virtual ~Checkbox(void) = 0;
33 
34  bool IsChecked(void) const { return mIsChecked; }
35  void SetChecked(const bool checked);
36 
37  protected:
38  void AddCheckedGraphic(tbGraphics::Graphic& graphic);
39  void AddCheckedGraphic(tbGraphics::Graphic* graphic);
40  void RemoveCheckedGraphic(tbGraphics::Graphic* graphic);
41 
42  virtual void OnHandleUserEvent(const UserEvent& userEvent) override;
43  virtual void OnHandleActiveUserEvent(const UserEvent& userEvent) override;
44  virtual void OnActivate(void) override;
45 
46  private:
47  //TODO: TurtleBrainsExpress: Interface:
48  //Having a single "checked graphics" list may prove problematic WRT having the visuals
49  //change with focus/enabled/disabled - but the alternative (having a checked graphics
50  //list for each state, seems not so fun either... Will continue ponder to refactor later.
51  tbGraphics::GraphicList mCheckedGraphics;
52  bool mIsChecked;
53  };
54 
55  class SimpleCheckbox : public Checkbox
56  {
57  public:
58  SimpleCheckbox(const tbCore::tbString& labelString, const tbGraphics::PixelSpace& width, const tbGraphics::PixelSpace& height);
59  virtual ~SimpleCheckbox(void);
60 
61  private:
62  const tbCore::tbString mLabelString;
63  };
64 
65  };
66  }; /* namespace Interface */
67 }; /* namespace TurtleBrainsExpress */
68 
70 
71 #endif /* TurtleBrainsExpress_InterfaceCheckbox_hpp */
Definition: tb_graphic.hpp:61
Definition: tb_graphic_list.hpp:27
A collection of objects and functions to express games quickly.
Definition: tbx_interface.hpp:18
Definition: tbx_interface_checkbox.hpp:55
tbCore::uint16 PixelSpace
Definition: tb_texture_manager.hpp:36
Definition: tbx_interface_element.hpp:28
Definition: tbx_interface_checkbox.hpp:28
std::string tbString
Definition: tb_string.hpp:335