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

pu::ui::elm::Menu Class Reference

`#include <elm_Menu.hpp>`

Inheritance diagram for pu::ui::elm::Menu:

## Public Types

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

## Public Member Functions

| Menu (const i32 x, const i32 y, const i32 width, const Color items_clr, const Color items_focus_clr, const i32 items_height, const i32 items_to_show)
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
i32 | GetItemsHeight ()
void | SetItemsHeight (const i32 items_height)
i32 | GetNumberOfItemsToShow ()
void | SetNumberOfItemsToShow (const i32 items_to_show)
Color | GetItemsColor ()
void | SetItemsColor (const Color items_clr)
Color | GetItemsFocusColor ()
void | SetItemsFocusColor (const Color items_focus_clr)
Color | GetScrollbarColor ()
void | SetScrollbarColor (const Color scrollbar_clr)
void | SetOnSelectionChanged (OnSelectionChangedCallback on_selection_changed_cb)
void | AddItem (MenuItem::Ref &item)
void | ClearItems ()
void | SetCooldownEnabled (const bool enabled)
MenuItem::Ref & | GetSelectedItem ()
std::vector< MenuItem::Ref > & | GetItems ()
i32 | GetSelectedIndex ()
void | SetSelectedIndex (const i32 idx)
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 Color | DefaultScrollbarColor = { 110, 110, 110, 0xFF }
static constexpr u8 | ItemAlphaIncrement = 48
static constexpr float | IconItemSizesFactor = 0.8f
static constexpr u32 | IconMargin = 25
static constexpr u32 | TextMargin = 25
static constexpr u8 | LightScrollbarColorFactor = 30
static constexpr u32 | ScrollbarWidth = 20
static constexpr u32 | ShadowHeight = 5
static constexpr u8 | ShadowBaseAlpha = 160

## 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

## OnSelectionChangedCallback

using pu::ui::elm::Menu::OnSelectionChangedCallback = std::function<void()>

## Constructor & Destructor Documentation

## Menu()

pu::ui::elm::Menu::Menu | ( | const i32 | x,
|  | const i32 | y,
|  | const i32 | width,
|  | const Color | items_clr,
|  | const Color | items_focus_clr,
|  | const i32 | items_height,
|  | const i32 | items_to_show
| ) |  |

## Member Function Documentation

## AddItem()

void pu::ui::elm::Menu::AddItem | ( | MenuItem::Ref & | item | ) |

inline

## ClearItems()

void pu::ui::elm::Menu::ClearItems | ( |  | ) |

inline

## GetHeight()

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

inlineoverridevirtual

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

## GetItems()

std::vector< MenuItem::Ref > & pu::ui::elm::Menu::GetItems | ( |  | ) |

inline

## GetItemsColor()

Color pu::ui::elm::Menu::GetItemsColor | ( |  | ) |

inline

## GetItemsFocusColor()

Color pu::ui::elm::Menu::GetItemsFocusColor | ( |  | ) |

inline

## GetItemsHeight()

i32 pu::ui::elm::Menu::GetItemsHeight | ( |  | ) |

inline

## GetNumberOfItemsToShow()

i32 pu::ui::elm::Menu::GetNumberOfItemsToShow | ( |  | ) |

inline

## GetScrollbarColor()

Color pu::ui::elm::Menu::GetScrollbarColor | ( |  | ) |

inline

## GetSelectedIndex()

i32 pu::ui::elm::Menu::GetSelectedIndex | ( |  | ) |

inline

## GetSelectedItem()

MenuItem::Ref & pu::ui::elm::Menu::GetSelectedItem | ( |  | ) |

inline

## GetWidth()

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

inlineoverridevirtual

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

## GetX()

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

inlineoverridevirtual

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

## GetY()

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

inlineoverridevirtual

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

## OnInput()

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

overridevirtual

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

## SetCooldownEnabled()

void pu::ui::elm::Menu::SetCooldownEnabled | ( | const bool | enabled | ) |

inline

## SetItemsColor()

void pu::ui::elm::Menu::SetItemsColor | ( | const Color | items_clr | ) |

inline

## SetItemsFocusColor()

void pu::ui::elm::Menu::SetItemsFocusColor | ( | const Color | items_focus_clr | ) |

inline

## SetItemsHeight()

void pu::ui::elm::Menu::SetItemsHeight | ( | const i32 | items_height | ) |

inline

## SetNumberOfItemsToShow()

void pu::ui::elm::Menu::SetNumberOfItemsToShow | ( | const i32 | items_to_show | ) |

inline

## SetOnSelectionChanged()

void pu::ui::elm::Menu::SetOnSelectionChanged | ( | OnSelectionChangedCallback | on_selection_changed_cb | ) |

inline

## SetScrollbarColor()

void pu::ui::elm::Menu::SetScrollbarColor | ( | const Color | scrollbar_clr | ) |

inline

## SetSelectedIndex()

void pu::ui::elm::Menu::SetSelectedIndex | ( | const i32 | idx | ) |

## SetWidth()

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

inline

## SetX()

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

inline

## SetY()

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

inline

## Member Data Documentation

## DefaultScrollbarColor

constexpr Color pu::ui::elm::Menu::DefaultScrollbarColor = { 110, 110, 110, 0xFF }

staticconstexpr

## IconItemSizesFactor

constexpr float pu::ui::elm::Menu::IconItemSizesFactor = 0.8f

staticconstexpr

## IconMargin

constexpr u32 pu::ui::elm::Menu::IconMargin = 25

staticconstexpr

## ItemAlphaIncrement

constexpr u8 pu::ui::elm::Menu::ItemAlphaIncrement = 48

staticconstexpr

## LightScrollbarColorFactor

constexpr u8 pu::ui::elm::Menu::LightScrollbarColorFactor = 30

staticconstexpr

## ScrollbarWidth

constexpr u32 pu::ui::elm::Menu::ScrollbarWidth = 20

staticconstexpr

## ShadowBaseAlpha

constexpr u8 pu::ui::elm::Menu::ShadowBaseAlpha = 160

staticconstexpr

## ShadowHeight

constexpr u32 pu::ui::elm::Menu::ShadowHeight = 5

staticconstexpr

## TextMargin

constexpr u32 pu::ui::elm::Menu::TextMargin = 25

staticconstexpr

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

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