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 Class Reference

Class for a message dialog with optional Ok and Cancel buttons. More...

#include <MessageDialog.h>

Inheritance diagram for MessageDialog:
UIElement

Public Member Functions

 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.
 
virtual void Draw (bool redraw) override
 Method used for drawing of the MessageDialog.
 
virtual bool KeyInput (Keys_t key) override
 Process the given key.
 
virtual bool TouchInput (uint16_t x, uint16_t y, TouchTypes touchType) override
 Process a touch input at the given point (x, y)
 
virtual void RecalculateDimensions () override
 Recalculate the Height and Width of the UIElement.
 
virtual void RecalculateLayout () override
 Recalculate the UIElement layout (containers update the X- and Y-Location of all their items, all other items can do other layout update stuff)
 
- Public Member Functions inherited from UIElement
 UIElement (UIElementType type)
 Constructor of the UIElement.
 
 UIElement (uint16_t locX, uint16_t locY, UIElementType type)
 Constructor of the UIElement.
 
bool HitTest (uint16_t x, uint16_t y)
 Check if the given point (x, y) is inside this UIElement.
 

Private Attributes

uint16_t _maxMsgLength
 Maximum length for the internally used string buffer of the Label of the MessageDialog.
 
ContainerPage _page
 Container page that is internally used to group and handle all elements of the message dialog.
 
Icon _severityIcon
 Icon UIElement used to display the message severity.
 
MessageSeverity_t _severity
 Message severity.
 
Label _message
 Label UIElement used to display the dialog message.
 
ButtonControl _buttonOk
 Optional Ok button.
 
ButtonControl _buttonCancel
 Optional Cancel button.
 

Additional Inherited Members

- Public Attributes inherited from UIElement
UIElementType Type
 Element type (control, indicator, container)
 
uint16_t LocX
 X Location of the upper left corner of the UIElement.
 
uint16_t LocY
 Y Location of the upper left corner of the UIElement.
 
uint16_t Width
 Drawing width of the UIElement.
 
uint16_t Height
 Drawing height of the UIElement.
 
bool Visible
 The UIElement is only drawn if the visibility is set to true.
 
bool IsInEditMode
 Is the UIElement in edit mode?
 
UIElementParent
 Parent UIElement that this UIElement belongs to.
 
UIElementActiveChild
 Child element that is currently active (receiving all key inputs).
 
- Protected Attributes inherited from UIElement
bool _lastDrawnVisible
 The Visible value that was last drawn.
 

Detailed Description

Class for a message dialog with optional Ok and Cancel buttons.

Constructor & Destructor Documentation

◆ MessageDialog()

MessageDialog::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.

Parameters
locXX Location of the upper left corner of the MessageDialog
locYY Location of the upper left corner of the MessageDialog
widthDrawing width of the MessageDialog
heightDrawing height of the MessageDialog
messageMessage string that is shown by this message dialog
severityMessage severity
buttonsOptional dialog buttons (None, Ok, Ok & Cancel)
controlContextContext pointer that is returned with the onOkClick and onCancelClick function pointers
onOkClickFunction pointer for onOkClick event. This function is called when the Ok button is clicked.
onCancelClickFunction pointer for onCancelClick event. This function is called when the Cancel button is clicked.
maxMsgLengthMaximum length for the internally used string buffer of the Label of the MessageDialog. This is the maximum length that the message can be.

Member Function Documentation

◆ Draw()

void MessageDialog::Draw ( bool redraw)
overridevirtual

Method used for drawing of the MessageDialog.

Implements UIElement.

◆ KeyInput()

bool MessageDialog::KeyInput ( Keys_t key)
overridevirtual

Process the given key.

If this element doesn't support the key type, the key is forwarded to the parent. This is done until the key is processed or the root of the visual tree is reached.

Parameters
keyKey that should be processed. Supported keys are: KEYOK, KEYUP, KEYDOWN
Returns
true if the key was processed; false if not.

Reimplemented from UIElement.

◆ RecalculateDimensions()

void MessageDialog::RecalculateDimensions ( )
overridevirtual

Recalculate the Height and Width of the UIElement.

Implements UIElement.

◆ RecalculateLayout()

void MessageDialog::RecalculateLayout ( )
overridevirtual

Recalculate the UIElement layout (containers update the X- and Y-Location of all their items, all other items can do other layout update stuff)

Reimplemented from UIElement.

◆ TouchInput()

bool MessageDialog::TouchInput ( uint16_t x,
uint16_t y,
TouchTypes touchType )
overridevirtual

Process a touch input at the given point (x, y)

Parameters
xX-Coordinate of the touched point
yY-Coordinate of the touched point
touchTypeType of the touch
Returns
true if the touch was processed; false if not.

Reimplemented from UIElement.

Member Data Documentation

◆ _maxMsgLength

uint16_t MessageDialog::_maxMsgLength
private

Maximum length for the internally used string buffer of the Label of the MessageDialog.

This is the maximum length that the message can be.


The documentation for this class was generated from the following files: