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

pu::ui::elm::Button Class Reference

`#include <elm_Button.hpp>`

Inheritance diagram for pu::ui::elm::Button:

## Public Types

using | OnClickCallback = std::function< void()>

## Public Member Functions

| Button (const i32 x, const i32 y, const i32 width, const i32 height, const std::string &content, const Color content_clr, const Color bg_clr)
| ~Button ()
i32 | GetX () override
void | SetX (const i32 x)
i32 | GetY () override
void | SetY (const i32 y)
i32 | GetWidth () override
void | SetWidth (const i32 width)
i32 | GetHeight () override
void | SetHeight (const i32 height)
std::string | GetContent ()
void | SetContent (const std::string &content)
Color | GetContentColor ()
void | SetContentColor (const Color content_clr)
Color | GetBackgroundColor ()
void | SetBackgroundColor (const Color bg_clr)
void | SetContentFont (const std::string &font_name)
void | SetOnClick (OnClickCallback on_click_cb)
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 Attributes

static constexpr u8 | DarkerColorFactor = 70
static constexpr u8 | HoverAlphaIncrement = 48

## Additional Inherited Members

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

## Member Typedef Documentation

## OnClickCallback

using pu::ui::elm::Button::OnClickCallback = std::function<void()>

## Constructor & Destructor Documentation

## Button()

pu::ui::elm::Button::Button | ( | const i32 | x,
|  | const i32 | y,
|  | const i32 | width,
|  | const i32 | height,
|  | const std::string & | content,
|  | const Color | content_clr,
|  | const Color | bg_clr
| ) |  |

## ~Button()

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

## Member Function Documentation

## GetBackgroundColor()

Color pu::ui::elm::Button::GetBackgroundColor | ( |  | ) |

inline

## GetContent()

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

inline

## GetContentColor()

Color pu::ui::elm::Button::GetContentColor | ( |  | ) |

inline

## GetHeight()

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

inlineoverridevirtual

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

## GetWidth()

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

inlineoverridevirtual

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

## GetX()

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

inlineoverridevirtual

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

## GetY()

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

inlineoverridevirtual

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

## OnInput()

void pu::ui::elm::Button::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::Button::OnRender | ( | render::Renderer::Ref & | drawer,
|  | const i32 | x,
|  | const i32 | y
| ) |  |

overridevirtual

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

## SetBackgroundColor()

void pu::ui::elm::Button::SetBackgroundColor | ( | const Color | bg_clr | ) |

inline

## SetContent()

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

## SetContentColor()

void pu::ui::elm::Button::SetContentColor | ( | const Color | content_clr | ) |

## SetContentFont()

void pu::ui::elm::Button::SetContentFont | ( | const std::string & | font_name | ) |

## SetHeight()

void pu::ui::elm::Button::SetHeight | ( | const i32 | height | ) |

inline

## SetOnClick()

void pu::ui::elm::Button::SetOnClick | ( | OnClickCallback | on_click_cb | ) |

inline

## SetWidth()

void pu::ui::elm::Button::SetWidth | ( | const i32 | width | ) |

inline

## SetX()

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

inline

## SetY()

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

inline

## Member Data Documentation

## DarkerColorFactor

constexpr u8 pu::ui::elm::Button::DarkerColorFactor = 70

staticconstexpr

## HoverAlphaIncrement

constexpr u8 pu::ui::elm::Button::HoverAlphaIncrement = 48

staticconstexpr

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

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