Plutonium framework API  0.1
Simple UI framework for libnx and SDL2
Toggle.hpp
Go to the documentation of this file.
1 
2 /*
3 
4  Plutonium library
5 
6  @file Toggle.hpp
7  @brief A Toggle is an Element used to switch between two options by toggling the item.
8  @author XorTroll
9 
10  @copyright Plutonium project - an easy-to-use UI framework for Nintendo Switch homebrew
11 
12 */
13 
14 #pragma once
15 #include <pu/element/Element.hpp>
16 
17 namespace pu::element
18 {
19  class Toggle : public Element
20  {
21  public:
22  Toggle(u32 X, u32 Y, std::string Content, u64 Key, draw::Color Color);
23  ~Toggle();
24  u32 GetX();
25  void SetX(u32 X);
26  u32 GetY();
27  void SetY(u32 Y);
28  u32 GetWidth();
29  u32 GetHeight();
30  std::string GetContent();
31  void SetContent(std::string Content);
34  void SetColor(draw::Color General);
35  u64 GetKey();
36  void SetKey(u64 Key);
37  bool IsChecked();
38  void OnRender(render::Renderer *Drawer);
39  void OnInput(u64 Down, u64 Up, u64 Held, bool Touch, bool Focus);
40  private:
41  std::string cnt;
42  u32 x;
43  u32 y;
44  u64 key;
45  bool checked;
46  draw::Color clr;
48  u32 fsize;
49  s32 togfact;
51  };
52 }
draw::Color GetColor()
Definition: Renderer.hpp:22
void SetColor(draw::Color General)
void SetKey(u64 Key)
Font
Definition: Font.hpp:18
void OnInput(u64 Down, u64 Up, u64 Held, bool Touch, bool Focus)
TTF_Font * NativeFont
Definition: SDL2.hpp:17
Definition: Button.hpp:18
Definition: Element.hpp:27
Toggle(u32 X, u32 Y, std::string Content, u64 Key, draw::Color Color)
void SetContent(std::string Content)
Definition: Toggle.hpp:19
void SetFont(render::NativeFont Font)
SDL_Texture * NativeTexture
Definition: SDL2.hpp:16
std::string GetContent()
Definition: Color.hpp:19
void OnRender(render::Renderer *Drawer)