Aether
SDL2 based UI Framework for NX
MessageBox.hpp
1 #ifndef AETHER_MESSAGEBOX_HPP
2 #define AETHER_MESSAGEBOX_HPP
3 
4 #include "Aether/horizon/button/BorderButton.hpp"
5 #include "Aether/primary/Rectangle.hpp"
6 #include "Aether/Overlay.hpp"
7 
8 namespace Aether {
16  class MessageBox : public Overlay {
17  private:
19  BorderButton * left;
21  BorderButton * right;
23  BorderButton * top;
25  Rectangle * topH;
27  Rectangle * bottomH;
29  Rectangle * vertH;
31  Element * body;
33  Rectangle * rect;
35  Colour buttonColour;
36 
40  void repositionButtons();
41 
45  void resizeElements();
46 
47  public:
51  MessageBox();
52 
58  void setLineColour(Colour c);
59 
65  void setRectangleColour(Colour c);
66 
72  void setTextColour(Colour c);
73 
80  void addLeftButton(std::string s, std::function<void()> f);
81 
88  void addRightButton(std::string s, std::function<void()> f);
89 
96  void addTopButton(std::string s, std::function<void()> f);
97 
104  void getBodySize(int * w, int * h);
105 
112  void setBodySize(int w, int h);
113 
117  void emptyBody();
118 
124  void setBody(Element * e);
125  };
126 };
127 
128 #endif
void addTopButton(std::string s, std::function< void()> f)
Add button to top rectangle.
A rectangle is a texture containing either a normal or rounded rectangle.
Definition: Rectangle.hpp:11
void setTextColour(Colour c)
Set the text colour object.
MessageBox()
Construct a new Message Box object.
void setLineColour(Colour c)
Set the line colour.
The BorderButton element looks similar to the unfilled buttons seen within Horizon.
Definition: BorderButton.hpp:13
void addRightButton(std::string s, std::function< void()> f)
Add button to bottom right rectangle.
void addLeftButton(std::string s, std::function< void()> f)
Add button to bottom left rectangle.
void setRectangleColour(Colour c)
Set the rectangle colour.
int w()
Returns width of element.
Stores RGBA values representing a colour. Each component can be within the range 0 to 255 (inclusive)...
Definition: Colour.hpp:9
Element is the base class to be inherited to form all other types of elements.
Definition: Element.hpp:18
int h()
Returns height of element.
Base namespace for all Aether related classes and functions.
void emptyBody()
Deletes the element (and it&#39;s children!) used as body.
void setBody(Element *e)
Set the body element Does nothing if a body has been set alreadu!
An object representing an overlay.
Definition: Overlay.hpp:14
void setBodySize(int w, int h)
Set the body size.
A "MessageBox" is a box presented in the middle of the screen, usually containing a few yes/no/cancel...
Definition: MessageBox.hpp:16
void getBodySize(int *w, int *h)
Get the body size.