Plutonium framework API 0.3.0
UI framework libraries for libnx
Loading...
Searching...
No Matches
extras_Toast.hpp
Go to the documentation of this file.
1
2/*
3
4 Plutonium library
5
6 @file extras_Toast.hpp
7 @brief An Overlay similar to Android's toast notifications
8 @author XorTroll
9
10 @copyright Plutonium project - an easy-to-use UI framework for Nintendo Switch homebrew
11
12*/
13
14#pragma once
15#include <pu/ui/ui_Overlay.hpp>
16#include <pu/ui/elm/elm_TextBlock.hpp>
17
18namespace pu::ui::extras {
19
20 class Toast final : public Overlay {
21 public:
22 static constexpr i32 DefaultY = 550;
24 static constexpr i32 DefaulHorizontalMargin = 50;
25 static constexpr u8 DefaulBaseAlpha = 200;
26
27 private:
28 pu::ui::elm::TextBlock::Ref text;
29 i32 height_and_text_height_factor;
30 i32 h_margin;
31 u8 base_alpha;
32
33 void AdjustDimensions();
34
35 public:
36 Toast(elm::TextBlock::Ref &text_block, const Color bg_clr);
37 PU_SMART_CTOR(Toast)
38
39 PU_CLASS_POD_GETSET(HeightAndTextHeightFactor, height_and_text_height_factor, i32)
40 PU_CLASS_POD_GETSET(HorizontalMargin, h_margin, i32)
41 PU_CLASS_POD_GETSET(BaseAlpha, base_alpha, u8)
42
43 void SetText(const std::string &text);
44 void OnPreRender(render::Renderer::Ref &drawer) override;
45 void OnPostRender(render::Renderer::Ref &drawer) override;
46 };
47
48}
Definition ui_Overlay.hpp:19
Definition elm_TextBlock.hpp:19
static constexpr i32 DefaultY
Definition extras_Toast.hpp:22
static constexpr i32 DefaulHeightAndTextHeightFactor
Definition extras_Toast.hpp:23
void SetText(const std::string &text)
static constexpr i32 DefaulHorizontalMargin
Definition extras_Toast.hpp:24
static constexpr u8 DefaulBaseAlpha
Definition extras_Toast.hpp:25
Toast(elm::TextBlock::Ref &text_block, const Color bg_clr)
void OnPostRender(render::Renderer::Ref &drawer) override
void OnPreRender(render::Renderer::Ref &drawer) override
Definition render_Renderer.hpp:127
Definition extras_Toast.hpp:18
Definition render_Renderer.hpp:20
Definition elm_Button.hpp:18
#define PU_SMART_CTOR(type)
Definition pu_Include.hpp:20
#define PU_CLASS_POD_GETSET(fn_name, var_name, type)
Definition pu_Include.hpp:37
Definition ui_Types.hpp:44