FabGL
ESP32 VGA Controller and Graphics Library
fabgl::uiApp Class Reference

Represents the whole application base class. More...

#include <fabui.h>

Inheritance diagram for fabgl::uiApp:
Collaboration diagram for fabgl::uiApp:

Public Member Functions

uiWindowactiveWindow ()
 Gets a pointer to the currently active window. More...
 
uiAppapp ()
 Determines the app that owns this object. More...
 
uiAppPropsappProps ()
 Sets or gets application properties. More...
 
uiWindowcapturedMouseWindow ()
 Determines which window is capturing mouse. More...
 
void destroyWindow (uiWindow *window)
 Destroys a window. More...
 
uiWindowfocusedWindow ()
 Gets the focused window (control) More...
 
virtual void init ()
 Method to inherit to implement an application. More...
 
bool insertEvent (uiEvent const *event)
 Inserts (first position) an event in the event queue and returns without waiting for the receiver to process the event. More...
 
void killTimer (uiTimerHandle handle)
 Kills a timer. More...
 
void maximizeWindow (uiWindow *window, bool value)
 Maximizes or restores a window. More...
 
uiMessageBoxResult messageBox (char const *title, char const *text, char const *button1Text, char const *button2Text=nullptr, char const *button3Text=nullptr, uiMessageBoxIcon icon=uiMessageBoxIcon::Question)
 Displays a modal dialog box with an icon, text and some buttons. More...
 
void minimizeWindow (uiWindow *window, bool value)
 Minimizes or restores a window. More...
 
uiWindowmoveFocus (int delta)
 Move focus to a control with current focus index plus a delta. More...
 
void moveWindow (uiWindow *window, int x, int y)
 Moves a window. More...
 
uiObjectTypeobjectType ()
 Determines the object type. More...
 
bool postEvent (uiEvent const *event)
 Places an event in the event queue and returns without waiting for the receiver to process the event. More...
 
void repaintRect (Rect const &rect)
 Repaints a screen area. More...
 
void repaintWindow (uiWindow *window)
 Repaints a window. More...
 
void reshapeWindow (uiWindow *window, Rect const &rect)
 Reshapes a window. More...
 
void resizeWindow (uiWindow *window, int width, int height)
 Resizes a window. More...
 
void resizeWindow (uiWindow *window, Size size)
 Resizes a window. More...
 
uiFramerootWindow ()
 Gets a pointer to the root window. More...
 
void run ()
 Initialize application and executes the main event loop. More...
 
uiWindowscreenToWindow (Point &point)
 Determines which window a point belongs to. More...
 
uiWindowsetActiveWindow (uiWindow *value)
 Sets the active window. More...
 
uiWindowsetFocusedWindow (uiWindow *value)
 Sets the focused window (control) More...
 
uiTimerHandle setTimer (uiEvtHandler *dest, int periodMS)
 Setups a timer. More...
 
int showModalWindow (uiWindow *window)
 Makes a window visible and handles it has a modal window. More...
 
void showWindow (uiWindow *window, bool value)
 Makes a window visible or invisible. More...
 

Public Attributes

Delegate< uiTimerHandle > onTimer
 Timer event delegate. More...
 

Detailed Description

Represents the whole application base class.

FabGL UI apps must inherit from uiApp, create UI elements in uiApp.init() method, and finally call uiApp.run() to start the application. uiApp is responsible for events queue handling, windows manager, windows and controls lifecycle and memory management.

Member Function Documentation

◆ activeWindow()

uiWindow* fabgl::uiApp::activeWindow ( )
inline

Gets a pointer to the currently active window.

There is only one active window at the time. Active window is the foreground window and receives (along with focused control) all keyboard events. To set the active window call uiApp.setActiveWindow().

Returns
The active window, or nullptr if there isn't one

◆ app()

uiApp* fabgl::uiEvtHandler::app ( )
inlineinherited

Determines the app that owns this object.

Returns
An uiApp object.

◆ appProps()

uiAppProps& fabgl::uiApp::appProps ( )
inline

Sets or gets application properties.

Returns
L-value representing some application properties

◆ capturedMouseWindow()

uiWindow* fabgl::uiApp::capturedMouseWindow ( )
inline

Determines which window is capturing mouse.

Mouse is captured by a window when mouse is dragged (left button down while moving mouse) starting from window area.

Returns
Window that captured mouse

◆ destroyWindow()

void fabgl::uiApp::destroyWindow ( uiWindow window)

Destroys a window.

Parameters
windowWindow to destroy

◆ focusedWindow()

uiWindow* fabgl::uiApp::focusedWindow ( )
inline

Gets the focused window (control)

There is only one focused window or control at the time. Focused window is also the active window (or its parent is the active window). Focused window receives (along with active window) all keyboard events. Focused window can have a blinking caret. Finally, a focused window partecipates to the TAB "trip", respecting the tab-order (see uiWindow.focusIndex()).

To set the focoused window use uiApp.setFocusedWindow().

Returns
Focused window or nullptr if there isn't one

◆ init()

void fabgl::uiApp::init ( )
virtual

Method to inherit to implement an application.

◆ insertEvent()

bool fabgl::uiApp::insertEvent ( uiEvent const *  event)

Inserts (first position) an event in the event queue and returns without waiting for the receiver to process the event.

Parameters
eventEvent to insert. A copy of the event is sent.
Returns
True if the event is correctly placed. False if there is no available space in the event queue

◆ killTimer()

void fabgl::uiApp::killTimer ( uiTimerHandle  handle)

Kills a timer.

To create a timer use uiApp.setTimer().

Parameters
handleHandle identifying the timer to destroy

◆ maximizeWindow()

void fabgl::uiApp::maximizeWindow ( uiWindow window,
bool  value 
)

Maximizes or restores a window.

Parameters
windowWindow to be maximized or restored
valueTrue maximizes the window, False restores it from maximized state

◆ messageBox()

uiMessageBoxResult fabgl::uiApp::messageBox ( char const *  title,
char const *  text,
char const *  button1Text,
char const *  button2Text = nullptr,
char const *  button3Text = nullptr,
uiMessageBoxIcon  icon = uiMessageBoxIcon::Question 
)

Displays a modal dialog box with an icon, text and some buttons.

Parameters
titleThe dialog box title. If nullptr the messaebox has no title bar
textThe message to be displayed
button1TextLeft button text
button2TextMiddle button text (may be nullptr, if not present)
button3TextRight button text (may be nullptr, if not present)
iconIcon to be displayed
Returns
Message box result

◆ minimizeWindow()

void fabgl::uiApp::minimizeWindow ( uiWindow window,
bool  value 
)

Minimizes or restores a window.

Parameters
windowWindow to be minimized or restored
valueTrue minimizes the window, False restores it from minimized state

◆ moveFocus()

uiWindow * fabgl::uiApp::moveFocus ( int  delta)

Move focus to a control with current focus index plus a delta.

A focused window partecipates to the TAB "trip", respecting the tab-order (see uiWindow.focusIndex()). Calling moveFocus(1) is the same of pressing TAB. Calling moveFocus(-1) is the same of pressing SHIFT-TAB.

Parameters
deltaSpecifies how many controls pass (1 = next control, -1 = previous control)
Returns
Previous focused window

◆ moveWindow()

void fabgl::uiApp::moveWindow ( uiWindow window,
int  x,
int  y 
)

Moves a window.

Parameters
windowWindow to be moved
xNew horizontal coordinate, relative to parent window
yNew vertical coordinate, relative to parent window

◆ objectType()

uiObjectType& fabgl::uiObject::objectType ( )
inlineinherited

Determines the object type.

Returns
Object type.

◆ postEvent()

bool fabgl::uiApp::postEvent ( uiEvent const *  event)

Places an event in the event queue and returns without waiting for the receiver to process the event.

Parameters
eventEvent to send. A copy of the event is sent.
Returns
True if the event is correctly placed. False if there is no available space in the event queue

◆ repaintRect()

void fabgl::uiApp::repaintRect ( Rect const &  rect)

Repaints a screen area.

Parameters
rectRectangle to be repainted (in screen coordiantes)

◆ repaintWindow()

void fabgl::uiApp::repaintWindow ( uiWindow window)

Repaints a window.

Parameters
windowThe window to be repainted

◆ reshapeWindow()

void fabgl::uiApp::reshapeWindow ( uiWindow window,
Rect const &  rect 
)

Reshapes a window.

Parameters
windowWindow to be reshaped
rectNew window bounding box, relative to the parent window

◆ resizeWindow() [1/2]

void fabgl::uiApp::resizeWindow ( uiWindow window,
int  width,
int  height 
)

Resizes a window.

Parameters
windowWindow to be resized
widthNew horizontal size
heightNew vertical size

◆ resizeWindow() [2/2]

void fabgl::uiApp::resizeWindow ( uiWindow window,
Size  size 
)

Resizes a window.

Parameters
windowWindow to be resized
sizeNew window size

◆ rootWindow()

uiFrame* fabgl::uiApp::rootWindow ( )
inline

Gets a pointer to the root window.

The root window is the first window created and covers the whole screen. All windows and controls must have the root window as parent, or as ancestor.

Returns
The root window pointer

◆ run()

void fabgl::uiApp::run ( )

Initialize application and executes the main event loop.

This is the last method that should be called: it never returns.

◆ screenToWindow()

uiWindow * fabgl::uiApp::screenToWindow ( Point point)

Determines which window a point belongs to.

Parameters
pointA point relative to the screen
Returns
A window

◆ setActiveWindow()

uiWindow * fabgl::uiApp::setActiveWindow ( uiWindow value)

Sets the active window.

There is only one active window at the time. Active window is the foreground window and receives (along with focused control) all keyboard events.

Parameters
valuePointer of the active window. nullptr to set no active window
Returns
Previous active window

◆ setFocusedWindow()

uiWindow * fabgl::uiApp::setFocusedWindow ( uiWindow value)

Sets the focused window (control)

There is only one focused window or control at the time. Focused window is also the active window (or its parent is the active window). Focused window receives (along with active window) all keyboard events. Focused window can have a blinking caret. Finally, a focused window partecipates to the TAB "trip", respecting the tab-order (see uiWindow.focusIndex()).

Returns
Previous focused window

◆ setTimer()

uiTimerHandle fabgl::uiApp::setTimer ( uiEvtHandler dest,
int  periodMS 
)

Setups a timer.

A timer fires uiApp.onTimer or uiFrame.onTimer delegate. To destroy a timer use uiApp.killTimer().

Parameters
destDestination window or app
periodMSTimer period in milliseconds
Returns
Handle identifying the new timer

◆ showModalWindow()

int fabgl::uiApp::showModalWindow ( uiWindow window)

Makes a window visible and handles it has a modal window.

A modal window disables the main window but keeps it visible. Users must interact with the modal window before they can return to the parent window. A modal window exits from modal state using uiWindow.exitModal().

Parameters
windowWindow to be made visible and modal
Returns
The same value specified calling uiWindow.exitModal()

◆ showWindow()

void fabgl::uiApp::showWindow ( uiWindow window,
bool  value 
)

Makes a window visible or invisible.

Parameters
windowWindow to be made visible
valueIf true the window will be shown, if false the window will be hidden

Member Data Documentation

◆ onTimer

Delegate<uiTimerHandle> fabgl::uiApp::onTimer

Timer event delegate.

This delegate is called when the timer expires. To create a timer use uiApp.setTimer().


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