UI_Lib  a1366e08a59cc549a65fa26081e6409aa12f26d5
This is a user interface library for graphical LCDs. It offers many different controls and indicators that can be nested depending on the element types.
Loading...
Searching...
No Matches
MessageDialog.h
Go to the documentation of this file.
1
5
6#ifndef MESSAGEDIALOG_H_
7#define MESSAGEDIALOG_H_
8
9#include "../Core/UIElement.h"
11#include "../Indicators/Label.h"
12#include "../Indicators/Icon.h"
14#include "../Core/UI_Icons.h"
15
16#define DEFAULT_MAX_MSG_STRING_LENGTH 55
17#define DEFAULT_MSG_BUTTON_HEIGHT 20
18
19#define MSG_INFO_COLOR RGB565(0x00, 0x66, 0xCC)
20#define MSG_WARNING_COLOR RGB565(0xFF, 0xFF, 0x00)
21#define MSG_ERR_COLOR RGB565(0xFF, 0x00, 0x00)
22
32
42
47{
48 private:
49 uint16_t _maxMsgLength;
56
57 public:
58
73 MessageDialog(uint16_t locX, uint16_t locY, uint16_t width, uint16_t height, const char* message, MessageSeverity_t severity, MessageButtons_t buttons = MSG_BTN_OK, void* controlContext = NULL, void(*onOkClick)(void* controlContext) = NULL, void(*onCancelClick)(void* controlContext) = NULL, uint16_t maxMsgLength = DEFAULT_MAX_MSG_STRING_LENGTH);
74
78 virtual void Draw(bool redraw) override;
79
86 virtual bool KeyInput(Keys_t key) override;
87
95 virtual bool TouchInput(uint16_t x, uint16_t y, TouchTypes touchType) override;
96
100 virtual void RecalculateDimensions() override;
101
105 virtual void RecalculateLayout() override;
106};
107
108#endif /* MESSAGEDIALOG_H_ */
Containing a class for a button control that is showing a clickable button used to trigger some actio...
Containing a class for a container that is showing all items at a time.
Containing a class for an icon indicator that is drawing an icon to the screen.
enum Keys Keys_t
Available input keys.
Containing a class for an Label indicator that is drawing a string to the screen.
MessageButtons
Available message dialog buttons.
Definition MessageDialog.h:37
@ MSG_BTN_OK_CANCEL
Dialog with an OK and CANCEL button.
Definition MessageDialog.h:40
@ MSG_BTN_NONE
Dialog without any buttons.
Definition MessageDialog.h:38
@ MSG_BTN_OK
Dialog with one OK button.
Definition MessageDialog.h:39
enum MessageSeverity MessageSeverity_t
Available message dialog severity types.
enum MessageButtons MessageButtons_t
Available message dialog buttons.
#define DEFAULT_MAX_MSG_STRING_LENGTH
Default string length for the message dialog text.
Definition MessageDialog.h:16
MessageSeverity
Available message dialog severity types.
Definition MessageDialog.h:27
@ MSG_ERROR
Message is an error.
Definition MessageDialog.h:30
@ MSG_WARNING
Message is a warning.
Definition MessageDialog.h:29
@ MSG_INFO
Message is an information.
Definition MessageDialog.h:28
TouchTypes
Available touch types.
Definition TouchTypes.h:13
Containing icons for the UI_Lib.
Containing the abstract base class for all user interface elements (controls, indicators,...
Class for a button control that is showing a clickable button used to trigger some action.
Definition ButtonControl.h:17
class for a container that is showing all items at a time.
Definition ContainerPage.h:25
Class for an icon indicator that is drawing an icon to the screen.
Definition Icon.h:17
Class for an Label indicator that is drawing a string to the screen.
Definition Label.h:19
virtual void RecalculateDimensions() override
Recalculate the Height and Width of the UIElement.
Definition MessageDialog.cpp:62
uint16_t _maxMsgLength
Maximum length for the internally used string buffer of the Label of the MessageDialog.
Definition MessageDialog.h:49
MessageSeverity_t _severity
Message severity.
Definition MessageDialog.h:52
MessageDialog(uint16_t locX, uint16_t locY, uint16_t width, uint16_t height, const char *message, MessageSeverity_t severity, MessageButtons_t buttons=MSG_BTN_OK, void *controlContext=NULL, void(*onOkClick)(void *controlContext)=NULL, void(*onCancelClick)(void *controlContext)=NULL, uint16_t maxMsgLength=DEFAULT_MAX_MSG_STRING_LENGTH)
Constructor of the MessageDialog.
Definition MessageDialog.cpp:8
virtual void RecalculateLayout() override
Recalculate the UIElement layout (containers update the X- and Y-Location of all their items,...
Definition MessageDialog.cpp:69
virtual bool TouchInput(uint16_t x, uint16_t y, TouchTypes touchType) override
Process a touch input at the given point (x, y)
Definition MessageDialog.cpp:53
ButtonControl _buttonOk
Optional Ok button.
Definition MessageDialog.h:54
virtual bool KeyInput(Keys_t key) override
Process the given key.
Definition MessageDialog.cpp:48
ButtonControl _buttonCancel
Optional Cancel button.
Definition MessageDialog.h:55
ContainerPage _page
Container page that is internally used to group and handle all elements of the message dialog.
Definition MessageDialog.h:50
Icon _severityIcon
Icon UIElement used to display the message severity.
Definition MessageDialog.h:51
Label _message
Label UIElement used to display the dialog message.
Definition MessageDialog.h:53
virtual void Draw(bool redraw) override
Method used for drawing of the MessageDialog.
Definition MessageDialog.cpp:37
UIElement(UIElementType type)
Constructor of the UIElement.
Definition UIElement.h:43