C++ DevKit
C++ set of OOP library
Loading...
Searching...
No Matches
Widget Class Referenceabstract

A widget is a displayed object on a device screen. This is the base widget, it is derived as GraphicWidget with graphical capabilities and GraphicWidget is derived as TextWidget that adds textual capabilities. More...

#include <widget.h>

Inheritance diagram for Widget:
Inheritance graph
Collaboration diagram for Widget:
Collaboration graph

Public Member Functions

 Widget (Model *actual_displayed_model, DisplayDevice *graphic_display_device=nullptr)
 contructor for generic widget
 
void add_widget (Widget *_sub_widget)
 add sub_widget to the current widget
 
void set_display_device (DisplayDevice *_new_display_device)
 Set the display screen object.
 
virtual void draw ()=0
 a pure virtual member that is called to effectively draw the widget.
 

Protected Attributes

DisplayDevicedisplay_device {nullptr}
 the display device where the attached to the frame buffer
 
Modelactual_displayed_model {nullptr}
 a pointer to the Model actually displayed by the widget
 
std::vector< Widget * > widgets
 A widget can be composed by several widgets.
 

Detailed Description

A widget is a displayed object on a device screen. This is the base widget, it is derived as GraphicWidget with graphical capabilities and GraphicWidget is derived as TextWidget that adds textual capabilities.

USAGE: A widget is defined by a frame with width and height in pixel, and line and column of text if derived as TextualWidget. This frame is located within the display device screen at an anchor point (x,y).

The widget frame inside the display screen frame
Note
IMPORTANT NOTICE 1: The widget is only drawn if something has changed in the Model it represents. This allows to save drawing processing time. However there is a strong limitation : only the widget buffer is transfered to the device GDDRAM, based of its specific addressing scheme. As a result, if the widget is located such that the buffer is written across device pages, the contents of the overwritten pages is lost. This is why the widget height and the widget_anchor_y must be multiple of 8. Doing so the widget buffer bytes do not ovewrite pixel outside the widget border.

Constructor & Destructor Documentation

◆ Widget()

Widget::Widget ( Model * actual_displayed_model,
DisplayDevice * graphic_display_device = nullptr )

contructor for generic widget

Parameters
actual_displayed_modelthe displayed model of the widget
graphic_display_deviceThe display device on which the widget is drawn. This device can be "null".
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ add_widget()

void Widget::add_widget ( Widget * _sub_widget)

add sub_widget to the current widget

Parameters
_sub_widget
Here is the call graph for this function:

◆ draw()

virtual void Widget::draw ( )
pure virtual

a pure virtual member that is called to effectively draw the widget.

Note
USAGE: This member function can be called by the draw_refresh_all_attached_widgets() method of the Model. Refer to the following diagram.

Implemented in TextWidget, WidgetBlinkingSquareLed, WidgetHorizontalBar, WidgetHorizontalBargraph, WidgetSquareLed, and WidgetVerticalBargraph.

◆ set_display_device()

void Widget::set_display_device ( DisplayDevice * _new_display_device)

Set the display screen object.

Parameters
_new_display_device

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