Chesto
0.9
A declarative and element-based library for creating GUIs on homebrew'd consoles
Loading...
Searching...
No Matches
src
AlertDialog.hpp
1
#include <string>
2
#include <functional>
3
#include "TextElement.hpp"
4
#include "Container.hpp"
5
6
namespace
Chesto {
7
8
class
AlertDialog
:
public
Element
{
9
public
:
10
AlertDialog
(
const
std::string& title,
const
std::string& message);
11
12
void
show();
13
14
// can be set by the user
15
std::string title;
16
std::string message;
17
std::function<void()> onConfirm;
18
std::function<void()> onCancel;
19
bool
useAnimation =
true
;
20
21
void
setText(
const
std::string& newText);
22
23
CST_Color blackColor = CST_Color{0, 0, 0, 0xff};
// default text color
24
25
// Raw pointers to children (owned by elements vector)
26
TextElement
* messageText =
nullptr
;
27
Element
* overlay =
nullptr
;
28
Container
* vStack =
nullptr
;
29
30
// max sizes of the inner dialogue (not the whole screen-covering element)
31
int
dialogWidth = 450;
32
int
dialogHeight = 200;
33
34
// overridden lifecycle methods
35
virtual
void
render
(
Element
*
parent
)
override
;
36
virtual
bool
process
(
InputEvents
* event)
override
;
37
};
38
39
}
// namespace Chesto
Chesto::AlertDialog
Definition
AlertDialog.hpp:8
Chesto::AlertDialog::render
virtual void render(Element *parent) override
display the current state of the display
Definition
AlertDialog.cpp:95
Chesto::AlertDialog::process
virtual bool process(InputEvents *event) override
process any input that is received for this element
Definition
AlertDialog.cpp:101
Chesto::Container
Definition
Container.hpp:10
Chesto::Element
Definition
Element.hpp:29
Chesto::Element::parent
Element * parent
the parent element (reference only, not owned)
Definition
Element.hpp:116
Chesto::InputEvents
Definition
InputEvents.hpp:78
Chesto::TextElement
Definition
TextElement.hpp:23
Generated by
1.9.8