Plutonium framework API 1.0.0
Easy-to-use, SDL2-based UI framework for Nintendo Switch homebrew
Loading...
Searching...
No Matches
pu::ui::elm::ProgressBar Class Reference

Element for creating UI progress bars. More...

#include <elm_ProgressBar.hpp>

Inheritance diagram for pu::ui::elm::ProgressBar:
pu::ui::elm::Element

Public Member Functions

 ProgressBar (const i32 x, const i32 y, const i32 width, const i32 height, const double max_val)
 Creates a new instance of a ProgressBar.
 
i32 GetX () override
 Gets the X position of the Element.
 
void SetX (const i32 x)
 Sets the X position of the ProgressBar.
 
i32 GetY () override
 Gets the Y position of the Element.
 
void SetY (const i32 y)
 Sets the Y position of the ProgressBar.
 
i32 GetWidth () override
 Gets the width of the Element.
 
void SetWidth (const i32 width)
 Sets the width of the ProgressBar.
 
i32 GetHeight () override
 Gets the height of the Element.
 
void SetHeight (const i32 height)
 Sets the height of the ProgressBar.
 
void SetProgress (const double progress)
 Sets the progress of the ProgressBar.
 
void IncrementProgress (const double extra_progress)
 Increments the progress of the ProgressBar.
 
void DecrementProgress (const double extra_progress)
 Decrements the progress of the ProgressBar.
 
void FillProgress ()
 Fills the ProgressBar up to the maximum value.
 
void ClearProgress ()
 Clears the ProgressBar progress.
 
bool IsCompleted ()
 Gets whether the ProgressBar is completed.
 
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 DefaultProgressColor = { 139, 195, 74, 255 }
 
static constexpr Color DefaultBackgroundColor = { 140, 140, 140, 255 }
 
static constexpr double DefaultHeightRadiusFactor = 0.333
 

Additional Inherited Members

- Protected Attributes inherited from pu::ui::elm::Element
bool visible
 
HorizontalAlign h_align
 
VerticalAlign v_align
 
Containerparent_container
 

Detailed Description

Element for creating UI progress bars.

Constructor & Destructor Documentation

◆ ProgressBar()

pu::ui::elm::ProgressBar::ProgressBar ( const i32 x,
const i32 y,
const i32 width,
const i32 height,
const double max_val )

Creates a new instance of a ProgressBar.

Parameters
xX position of the ProgressBar.
yY position of the ProgressBar.
widthWidth of the ProgressBar.
heightHeight of the ProgressBar.
max_valMaximum value of the ProgressBar.

Member Function Documentation

◆ ClearProgress()

void pu::ui::elm::ProgressBar::ClearProgress ( )
inline

Clears the ProgressBar progress.

◆ DecrementProgress()

void pu::ui::elm::ProgressBar::DecrementProgress ( const double extra_progress)
inline

Decrements the progress of the ProgressBar.

Parameters
extra_progressExtra progress to subtract, with respect to the maximum value.

◆ FillProgress()

void pu::ui::elm::ProgressBar::FillProgress ( )
inline

Fills the ProgressBar up to the maximum value.

◆ GetHeight()

i32 pu::ui::elm::ProgressBar::GetHeight ( )
inlineoverridevirtual

Gets the height of the Element.

Returns
Height of the Element.

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

◆ GetWidth()

i32 pu::ui::elm::ProgressBar::GetWidth ( )
inlineoverridevirtual

Gets the width of the Element.

Returns
Width of the Element.

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

◆ GetX()

i32 pu::ui::elm::ProgressBar::GetX ( )
inlineoverridevirtual

Gets the X position of the Element.

Returns
X position of the Element.

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

◆ GetY()

i32 pu::ui::elm::ProgressBar::GetY ( )
inlineoverridevirtual

Gets the Y position of the Element.

Returns
Y position of the Element.

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

◆ IncrementProgress()

void pu::ui::elm::ProgressBar::IncrementProgress ( const double extra_progress)
inline

Increments the progress of the ProgressBar.

Parameters
extra_progressExtra progress to add, with respect to the maximum value.

◆ IsCompleted()

bool pu::ui::elm::ProgressBar::IsCompleted ( )
inline

Gets whether the ProgressBar is completed.

Returns
Whether the ProgressBar is completed, that is, the progress is equal to the maximum value.

◆ OnInput()

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

Called before rendering the Element in order to handle input.

Parameters
keys_downKeys that are currently being pressed.
keys_upKeys that are currently being released.
keys_heldKeys that are currently held.
touch_posPosition of the touch on the screen.
Note
This method is called by the Application. It should not be called manually.

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

◆ OnRender()

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

Renders the Element on the screen.

Parameters
drawerRenderer to use for rendering.
xX position to render the Element.
yY position to render the Element.
Note
This method is called by the Application. It should not be called manually.

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

◆ SetHeight()

void pu::ui::elm::ProgressBar::SetHeight ( const i32 height)
inline

Sets the height of the ProgressBar.

Parameters
heightNew height.

◆ SetProgress()

void pu::ui::elm::ProgressBar::SetProgress ( const double progress)

Sets the progress of the ProgressBar.

Parameters
progressProgress to set, with respect to the maximum value.

◆ SetWidth()

void pu::ui::elm::ProgressBar::SetWidth ( const i32 width)
inline

Sets the width of the ProgressBar.

Parameters
widthNew width.

◆ SetX()

void pu::ui::elm::ProgressBar::SetX ( const i32 x)
inline

Sets the X position of the ProgressBar.

Parameters
xNew X position.

◆ SetY()

void pu::ui::elm::ProgressBar::SetY ( const i32 y)
inline

Sets the Y position of the ProgressBar.

Parameters
yNew Y position.

Member Data Documentation

◆ DefaultBackgroundColor

Color pu::ui::elm::ProgressBar::DefaultBackgroundColor = { 140, 140, 140, 255 }
staticconstexpr

◆ DefaultHeightRadiusFactor

double pu::ui::elm::ProgressBar::DefaultHeightRadiusFactor = 0.333
staticconstexpr

◆ DefaultProgressColor

Color pu::ui::elm::ProgressBar::DefaultProgressColor = { 139, 195, 74, 255 }
staticconstexpr

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