Chesto 0.9
A declarative and element-based library for creating GUIs on homebrew'd consoles
Button.hpp
1#pragma once
2
3#include "ImageElement.hpp"
4#include "TextElement.hpp"
5
6namespace Chesto {
7
8class Button : public Element
9{
10public:
11 Button(std::string text, int button, bool dark = false, int size = 20, int width = 0);
12
13 void render(Element* parent);
14 bool process(InputEvents* event);
15
16 void updateBounds();
17 void updateText(const std::string &inc_text);
18 const std::string getText();
19
20 std::string myLastSeenGamepad = "";
21
22 TextElement text;
23 static std::string getControllerButtonImageForPlatform(int button, bool isGray, bool isOutline);
24
25 // a width we set the button to regardless of inner text
26 int fixedWidth = 0;
27
28 // whether the button is dark or light themed
29 bool dark = false;
30
31private:
32 static CST_Color colors[2];
34 int physical = -1;
35
36 ImageElement icon;
37
38 bool shouldRenderGlossy();
39};
40
41} // namespace Chesto
bool process(InputEvents *event)
process any input that is received for this element
Definition: Button.cpp:155
void render(Element *parent)
display the current state of the display
Definition: Button.cpp:108
int width
width and height of this element (must be manually set, isn't usually calculated (but is in some case...
Definition: Element.hpp:132
Element * parent
the parent element (reference only, not owned)
Definition: Element.hpp:116