Sparkle 0.0.1
Loading...
Searching...
No Matches
spk_message_box.hpp
1#pragma once
2
3#include <cstddef>
4#include <limits>
5
6#include "structure/widget/spk_interface_window.hpp"
7#include "structure/widget/spk_prompt_panel.hpp"
8#include "structure/widget/spk_widget.hpp"
9
10#ifdef MessageBox
11# undef MessageBox
12#endif
13
14namespace spk
15{
26 class MessageBox : public InterfaceWindow<PromptPanel>
27 {
28 public:
34 explicit MessageBox(const std::wstring &p_name, Widget *p_parent);
35
40 void setMinimalWidth(size_t p_width);
45 void setGeometry(const Extend2D &p_geometry) override;
46
58 PushButton &addButton(const std::wstring &p_name, const std::wstring &p_text);
64 PushButton *button(const std::wstring &p_name);
69 void setMessage(const std::wstring &p_message);
70
71 private:
72 void _refreshSizeHints();
73
74 size_t _minimalWidthCap = std::numeric_limits<size_t>::max();
75 };
76}
InterfaceWindow(const std::wstring &p_name, spk::Widget *p_parent)
Definition spk_interface_window.hpp:251
PushButton & addButton(const std::wstring &p_name, const std::wstring &p_text)
Adds a button to the message box.
Definition spk_message_box.cpp:21
void setMessage(const std::wstring &p_message)
Sets the displayed message text.
Definition spk_message_box.cpp:33
TextArea & textArea()
Returns the text area used for message content.
Definition spk_message_box.cpp:16
void setGeometry(const Extend2D &p_geometry) override
Sets geometry and updates size hints.
Definition spk_message_box.cpp:59
PushButton * button(const std::wstring &p_name)
Finds a button by name.
Definition spk_message_box.cpp:28
void setMinimalWidth(size_t p_width)
Sets a minimal width for the message box.
Definition spk_message_box.cpp:39
MessageBox(const std::wstring &p_name, Widget *p_parent)
Builds a message box widget.
Definition spk_message_box.cpp:6
Button widget displaying text with background visuals.
Definition spk_push_button.hpp:21
Text display widget with wrapping and background support.
Definition spk_text_area.hpp:25
Base class for interactive UI elements handling focus and events.
Definition spk_widget.hpp:52
Axis-aligned rectangle defined by an anchor point and size.
Definition spk_extend_2d.hpp:24