|
Plutonium framework API 1.0.0
Easy-to-use, SDL2-based UI framework for Nintendo Switch homebrew
|
Represents a menu. More...
#include <elm_Menu.hpp>
Public Types | |
| using | OnSelectionChangedCallback = std::function<void()> |
| Represents a function called when the selection of the Menu changes. | |
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 u32 items_to_show) | |
| Creates a new instance of a Menu. | |
| i32 | GetX () override |
| Gets the X position of the Element. | |
| void | SetX (const i32 x) |
| Sets the X position of the Menu. | |
| i32 | GetY () override |
| Gets the Y position of the Element. | |
| void | SetY (const i32 y) |
| Sets the Y position of the Menu. | |
| i32 | GetWidth () override |
| Gets the width of the Element. | |
| void | SetWidth (const i32 width) |
| Sets the width of the Menu. | |
| i32 | GetHeight () override |
| Gets the height of the Element. | |
| void | SetOnSelectionChanged (OnSelectionChangedCallback on_selection_changed_cb) |
| Sets the font name to use for the Menu. | |
| void | AddItem (MenuItem::Ref &item) |
| Adds a new item to the Menu. | |
| void | ClearItems () |
| Clears all items from the Menu. | |
| void | ForceReloadItems () |
| Forces the Menu to reload all items. | |
| MenuItem::Ref & | GetSelectedItem () |
| Gets the selected item of the Menu. | |
| std::vector< MenuItem::Ref > & | GetItems () |
| Gets the items of the Menu. | |
| void | SetSelectedIndex (const u32 idx) |
| Sets the selected index of the Menu. | |
| void | OnRender (render::Renderer::Ref &drawer, const i32 x, const i32 y) override |
| Renders the Element on the screen. | |
| void | OnInput (const u64 keys_down, const u64 keys_up, const u64 keys_held, const TouchPoint touch_pos) override |
| Called before rendering the Element in order to handle input. | |
Public Member Functions inherited from pu::ui::elm::Element | |
| Element () | |
| Creates a new instance of an Element. | |
| virtual | ~Element () |
| bool | IsVisible () |
| Gets whether the Element is visible. | |
| void | SetVisible (const bool visible) |
| Sets whether the Element is visible. | |
| void | SetHorizontalAlign (const HorizontalAlign align) |
| Sets the horizontal alignment of the Element. | |
| HorizontalAlign | GetHorizontalAlign () |
| Gets the horizontal alignment of the Element. | |
| void | SetVerticalAlign (const VerticalAlign align) |
| Sets the vertical alignment of the Element. | |
| VerticalAlign | GetVerticalAlign () |
| Gets the vertical alignment of the Element. | |
| void | SetParentContainer (Container *parent_container) |
| Sets the parent Container of the Element. | |
| i32 | GetProcessedX () |
| Gets the actual X position of the Element, considering the parent Container (depends on alignment). | |
| i32 | GetProcessedY () |
| Gets the actual Y position of the Element, considering the parent Container (depends on alignment). | |
Static Public Attributes | |
| static constexpr Color | DefaultScrollbarColor = { 110, 110, 110, 0xFF } |
| static constexpr u8 | DefaultItemAlphaIncrementSteps = 15 |
| static constexpr float | DefaultIconItemSizesFactor = 0.8f |
| static constexpr u32 | DefaultIconMargin = 37 |
| static constexpr u32 | DefaultTextMargin = 37 |
| static constexpr u8 | DefaultLightScrollbarColorFactor = 30 |
| static constexpr u32 | DefaultScrollbarWidth = 30 |
| static constexpr u32 | DefaultShadowHeight = 7 |
| static constexpr u8 | DefaultShadowBaseAlpha = 160 |
| static constexpr s64 | DefaultMoveWaitTimeMs = 150 |
Additional Inherited Members | |
Protected Attributes inherited from pu::ui::elm::Element | |
| bool | visible |
| HorizontalAlign | h_align |
| VerticalAlign | v_align |
| Container * | parent_container |
Represents a menu.
| using pu::ui::elm::Menu::OnSelectionChangedCallback = std::function<void()> |
Represents a function called when the selection of the Menu changes.
| 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 u32 | items_to_show ) |
Creates a new instance of a Menu.
|
inline |
Adds a new item to the Menu.
| item | Item to add. |
| void pu::ui::elm::Menu::ClearItems | ( | ) |
Clears all items from the Menu.
|
inline |
Forces the Menu to reload all items.
|
inlineoverridevirtual |
|
inline |
|
inline |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Gets the X position of the Element.
Implements pu::ui::elm::Element.
|
inlineoverridevirtual |
Gets the Y position of the Element.
Implements pu::ui::elm::Element.
|
overridevirtual |
Called before rendering the Element in order to handle input.
| keys_down | Keys that are currently being pressed. |
| keys_up | Keys that are currently being released. |
| keys_held | Keys that are currently held. |
| touch_pos | Position of the touch on the screen. |
Implements pu::ui::elm::Element.
|
overridevirtual |
Renders the Element on the screen.
| drawer | Renderer to use for rendering. |
| x | X position to render the Element. |
| y | Y position to render the Element. |
Implements pu::ui::elm::Element.
|
inline |
Sets the font name to use for the Menu.
| font_name | Name of the font to use. |
| void pu::ui::elm::Menu::SetSelectedIndex | ( | const u32 | idx | ) |
Sets the selected index of the Menu.
| idx | Index to set. |
|
inline |
Sets the width of the Menu.
| width | New width. |
|
inline |
Sets the X position of the Menu.
| x | New X position. |
|
inline |
Sets the Y position of the Menu.
| y | New Y position. |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |