Sparkle 0.0.1
Loading...
Searching...
No Matches
spk_prompt_panel.hpp
1#pragma once
2
3#include <cstddef>
4#include <limits>
5
6#include "structure/graphics/spk_extend_2d.hpp"
7#include "structure/widget/components/spk_nine_slice_background.hpp"
8#include "structure/widget/spk_command_panel.hpp"
9#include "structure/widget/spk_linear_layout.hpp"
10#include "structure/widget/spk_text_area.hpp"
11#include "structure/widget/spk_widget.hpp"
12#include "type/spk_text_aligmnent.hpp"
13
14namespace spk
15{
26 class PromptPanel : public Widget
27 {
28 public:
34 PromptPanel(const std::wstring &p_name, Widget *p_parent);
35
40 void setMessage(const std::wstring &p_text);
45 const std::wstring &message() const;
46
53 PushButton &addButton(const std::wstring &p_name, const std::wstring &p_text);
59 PushButton *button(const std::wstring &p_name);
64 void removeButton(const std::wstring &p_name);
65
70 void setButtonPadding(size_t p_elementPadding);
75 const uint32_t &buttonPadding() const;
76
81 void setButtonsAlignment(HorizontalAlignment p_alignment);
86 HorizontalAlignment buttonsAlignment() const noexcept;
97
111 void refreshSizeHints();
112
117 void setBackgroundTexture(const spk::SpriteSheet *p_texture);
122 const spk::SpriteSheet *backgroundTexture() const;
123
128 void setCornerSize(const spk::Vector2UInt &p_cornerSize);
133 const spk::Vector2UInt &cornerSize() const;
134
135 protected:
139 void _onGeometryChange() override;
144 void _onPaintEvent(spk::PaintEvent &p_event) override;
145
146 private:
147 NineSliceBackground _background;
148 VerticalLayout _layout;
149 TextArea _textArea;
150 CommandPanel _commandPanel;
151 };
152}
Horizontal panel that manages a collection of command buttons.
Definition spk_command_panel.hpp:27
Renders a scalable nine-slice background using a sprite sheet.
Definition spk_nine_slice_background.hpp:25
HorizontalAlignment buttonsAlignment() const noexcept
Returns the button alignment.
Definition spk_prompt_panel.cpp:86
void setBackgroundTexture(const spk::SpriteSheet *p_texture)
Sets the background texture.
Definition spk_prompt_panel.cpp:129
PromptPanel(const std::wstring &p_name, Widget *p_parent)
Builds a prompt panel widget.
Definition spk_prompt_panel.cpp:6
void setButtonsAlignment(HorizontalAlignment p_alignment)
Sets button alignment within the command panel.
Definition spk_prompt_panel.cpp:79
const uint32_t & buttonPadding() const
Returns padding between command buttons.
Definition spk_prompt_panel.cpp:74
void _onPaintEvent(spk::PaintEvent &p_event) override
Paints the background.
Definition spk_prompt_panel.cpp:153
Layout::SizePolicy::Value buttonSizePolicy() const noexcept
Returns the button size policy.
Definition spk_prompt_panel.cpp:98
PushButton * button(const std::wstring &p_name)
Finds a button by name.
Definition spk_prompt_panel.cpp:55
const spk::SpriteSheet * backgroundTexture() const
Returns the background texture.
Definition spk_prompt_panel.cpp:135
void setMessage(const std::wstring &p_text)
Sets the message text.
Definition spk_prompt_panel.cpp:35
const spk::Vector2UInt & cornerSize() const
Returns the background corner size.
Definition spk_prompt_panel.cpp:148
void _onGeometryChange() override
Updates layout geometry when size changes.
Definition spk_prompt_panel.cpp:119
void setCornerSize(const spk::Vector2UInt &p_cornerSize)
Sets the background corner size.
Definition spk_prompt_panel.cpp:140
void refreshSizeHints()
Refreshes size hints for layout.
Definition spk_prompt_panel.cpp:113
void setButtonPadding(size_t p_elementPadding)
Sets padding between command buttons.
Definition spk_prompt_panel.cpp:67
void removeButton(const std::wstring &p_name)
Removes a button by name.
Definition spk_prompt_panel.cpp:60
PushButton & addButton(const std::wstring &p_name, const std::wstring &p_text)
Adds a button to the command panel.
Definition spk_prompt_panel.cpp:47
CommandPanel & commandPanel()
Returns the command panel.
Definition spk_prompt_panel.cpp:108
TextArea & textArea()
Returns the text area.
Definition spk_prompt_panel.cpp:103
void setButtonSizePolicy(Layout::SizePolicy::Value p_policy)
Sets button size policy.
Definition spk_prompt_panel.cpp:91
const std::wstring & message() const
Returns the message text.
Definition spk_prompt_panel.cpp:42
Button widget displaying text with background visuals.
Definition spk_push_button.hpp:21
Loads an image and exposes individual sprite regions.
Definition spk_sprite_sheet.hpp:21
Text display widget with wrapping and background support.
Definition spk_text_area.hpp:25
Widget(const std::wstring &p_name, Widget *p_parent)
Builds a widget optionally attached to a parent.
Definition spk_widget.cpp:103
Value
Policy value controlling sizing behavior.
Definition spk_layout.hpp:37
Event emitted when a drawable region needs repainting.
Definition spk_paint_event.hpp:19