# Plutonium framework API: pu::ui::elm::Toggle Class Reference

pu::ui::elm::Toggle Class Reference

`#include <elm_Toggle.hpp>`

Inheritance diagram for pu::ui::elm::Toggle:

## Public Member Functions

| Toggle (const i32 x, const i32 y, const std::string &content, const u64 toggle_key, const Color clr)
| ~Toggle ()
i32 | GetX () override
void | SetX (const i32 x)
i32 | GetY () override
void | SetY (const i32 y)
i32 | GetWidth () override
i32 | GetHeight () override
std::string | GetContent ()
void | SetContent (const std::string &content)
void | SetFont (const std::string &font_name)
Color | GetColor ()
void | SetColor (const Color clr)
u64 | GetKey ()
void | SetKey (const u64 toggle_key)
bool | IsChecked ()
void | OnRender (render::Renderer::Ref &drawer, const i32 x, const i32 y) override
void | OnInput (const u64 keys_down, const u64 keys_up, const u64 keys_held, const TouchPoint touch_pos) override
Public Member Functions inherited from pu::ui::elm::Element
| Element ()
virtual | ~Element ()
virtual i32 | GetX ()=0
virtual i32 | GetY ()=0
virtual i32 | GetWidth ()=0
virtual i32 | GetHeight ()=0
virtual void | OnRender (render::Renderer::Ref &drawer, const i32 x, const i32 y)=0
virtual void | OnInput (const u64 keys_down, const u64 keys_up, const u64 keys_held, const TouchPoint touch_pos)=0
bool | IsVisible ()
void | SetVisible (const bool visible)
void | SetHorizontalAlign (const HorizontalAlign align)
HorizontalAlign | GetHorizontalAlign ()
void | SetVerticalAlign (const VerticalAlign align)
VerticalAlign | GetVerticalAlign ()
void | SetParentContainer (Container *parent_container)
i32 | GetProcessedX ()
i32 | GetProcessedY ()

## Static Public Member Functions

static constexpr Color | MakeBackgroundColor (const u8 alpha)

## Static Public Attributes

static constexpr u32 | ContentHorizontalMargin = 30
static constexpr u32 | ContentVerticalMargin = 20
static constexpr u8 | ToggleAlphaIncrement = 48

## Additional Inherited Members

Protected Attributes inherited from pu::ui::elm::Element
bool | visible
HorizontalAlign | h_align
VerticalAlign | v_align
Container * | parent_container

## Constructor & Destructor Documentation

## Toggle()

pu::ui::elm::Toggle::Toggle | ( | const i32 | x,
|  | const i32 | y,
|  | const std::string & | content,
|  | const u64 | toggle_key,
|  | const Color | clr
| ) |  |

## ~Toggle()

pu::ui::elm::Toggle::~Toggle | ( |  | ) |

## Member Function Documentation

## GetColor()

Color pu::ui::elm::Toggle::GetColor | ( |  | ) |

inline

## GetContent()

std::string pu::ui::elm::Toggle::GetContent | ( |  | ) |

inline

## GetHeight()

i32 pu::ui::elm::Toggle::GetHeight | ( |  | ) |

overridevirtual

Implements pu::ui::elm::Element.

## GetKey()

u64 pu::ui::elm::Toggle::GetKey | ( |  | ) |

inline

## GetWidth()

i32 pu::ui::elm::Toggle::GetWidth | ( |  | ) |

overridevirtual

Implements pu::ui::elm::Element.

## GetX()

i32 pu::ui::elm::Toggle::GetX | ( |  | ) |

inlineoverridevirtual

Implements pu::ui::elm::Element.

## GetY()

i32 pu::ui::elm::Toggle::GetY | ( |  | ) |

inlineoverridevirtual

Implements pu::ui::elm::Element.

## IsChecked()

bool pu::ui::elm::Toggle::IsChecked | ( |  | ) |

inline

## MakeBackgroundColor()

static constexpr Color pu::ui::elm::Toggle::MakeBackgroundColor | ( | const u8 | alpha | ) |

inlinestaticconstexpr

## OnInput()

void pu::ui::elm::Toggle::OnInput | ( | const u64 | keys_down,
|  | const u64 | keys_up,
|  | const u64 | keys_held,
|  | const TouchPoint | touch_pos
| ) |  |

overridevirtual

Implements pu::ui::elm::Element.

## OnRender()

void pu::ui::elm::Toggle::OnRender | ( | render::Renderer::Ref & | drawer,
|  | const i32 | x,
|  | const i32 | y
| ) |  |

overridevirtual

Implements pu::ui::elm::Element.

## SetColor()

void pu::ui::elm::Toggle::SetColor | ( | const Color | clr | ) |

## SetContent()

void pu::ui::elm::Toggle::SetContent | ( | const std::string & | content | ) |

## SetFont()

void pu::ui::elm::Toggle::SetFont | ( | const std::string & | font_name | ) |

## SetKey()

void pu::ui::elm::Toggle::SetKey | ( | const u64 | toggle_key | ) |

inline

## SetX()

void pu::ui::elm::Toggle::SetX | ( | const i32 | x | ) |

inline

## SetY()

void pu::ui::elm::Toggle::SetY | ( | const i32 | y | ) |

inline

## Member Data Documentation

## ContentHorizontalMargin

constexpr u32 pu::ui::elm::Toggle::ContentHorizontalMargin = 30

staticconstexpr

## ContentVerticalMargin

constexpr u32 pu::ui::elm::Toggle::ContentVerticalMargin = 20

staticconstexpr

## ToggleAlphaIncrement

constexpr u8 pu::ui::elm::Toggle::ToggleAlphaIncrement = 48

staticconstexpr

The documentation for this class was generated from the following file:

- Plutonium/include/pu/ui/elm/elm_Toggle.hpp