NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

Grlib - Widget Tree Structure

From Texas Instruments Wiki
Jump to: navigation, search

StellarisWare Grlib[edit]

StellarisWare Grlib Block Diagram

The Grlib (Graphic Library) delivered in StellarisWare software package offers the possibility to develop a complex GUI (Graphical User Interface) on widget levels with high-level API (Application Programming Interface). The Widget Classes of Grlib is build on top of the lower layers basic Graphics Functions (to draw lines, rectangles, circles, etc.) and display drivers (e.g. LCD driver) allowing user to easily build the user interface with pre-defined controls such as buttons, sliders, checkboxes, etc.

The Grlib supports the following widget types:

  • Canvas: simple drawing surface providing no means for interaction with the user (can be filled with a color, outlined with a color, having an image/test drawn within the canvas area, and allowing application to draw into the canvas)
  • Checkbox: graphical element whcih can be selected or unselected, resulting in a binary selection.
  • Container: providing means of grouping widget together within the widget hierarchy.
  • Image Button: providing a button that can be pressed, causing an action to be performed.
  • Listbox: allowing the user to select one from a list of several strings held by the widget.
  • Push Button: providing a button that can be pressed, causing an action to be performed.
  • Radio Button: providing a graphical element that can be grouped with other radio buttons to form a means of selecting one of many items.
  • Slider: allowing the user to drag a marker either horizontally or vertically to select a value from within an application-supplied range.


Grlib Widget Tree Structure[edit]

The widgets in Grlib are organized in a tree like structure to enable the Widget Manager painting the widgets and processing/passing user's input to the widgets in a deterministic manner. Each widget has basically three pointers which connect them with the other widgets in the tree structure:

  • Parent pointer (pParent): pointer to the widget on the above level
  • Sibling pointer (pNext): pointer to the widget on the same level
  • Child pointer (pChild): pointer to the widget on the below level

The following image shows an example of a widget tree structure:

Grlib WidgetTreeStructure Example 01.PNG

As can be seen above, the widgets are anchored by a global called WIDGET_ROOT. The other user defined widgets can be attached to the WIDGET_ROOT in a tree like structure either during compile-time (hard-coded in the Widget Class structure definitions) or run-time (by using WidgetAddr(tWidget*pParent, tWidget *pWidget) function).

Determining the correct tree structure hierarchy is vital for the application to ensure the correct repainting process and handling of user input. Consider the following example with two containers, one contains two radio buttons, and another one contains a push button:

Grlib Example TreeStructure 01.PNG


Painting The Widget Tree[edit]

The Widget Tree is painted starting at WIDGET_ROOT downwards (parents are painted before children - therefore parents can be thought of as being below their children on the screen). For the example above, the following repainting process will be executed by the Widget Manager if the application executes (re)painting by calling WidgetPaint(WIDGET_ROOT):

Grlib Example Repainting Process.PNG


Passing User Input[edit]

In contrast of how the Widget Manager (re)paints the widgets downwards in the widget tree structure hierarchy, the User Input is passed upwards in the tree structure (children gets the input first before the parents). The user input message passed to the widgets in the tree structure contains the following information:

  • Message type (WIDGET_MSG_PTR_DOWN, WIDGET_MSG_PTR_MOVE, or WIDGET_MSG_PTR_UP):
    • When a pointer down message (WIDGET_MSG_PTR_DOWN) is received, the Widget Manager passes it to all widgets, children first.
    • Each widget checks to see if the pointer is within its area and, if so, claims the message by returning “true” from the message procedure.
    • All further pointer move messages (WIDGET_MSG_PTR_MOVE) are sent to this widget until pointer up (WIDGET_MSG_PTR_UP) is received or the widget is removed.
  • X and Y coordinates of the input.

For the example with the two containers above, the following user input processing will be executed by the Widget Manager if the application receives a user input:

Grlib Example User Input Processing.PNG
E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Grlib - Widget Tree Structure here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Grlib - Widget Tree Structure here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article Grlib - Widget Tree Structure here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article Grlib - Widget Tree Structure here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article Grlib - Widget Tree Structure here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Grlib - Widget Tree Structure here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Grlib - Widget Tree Structure here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article Grlib - Widget Tree Structure here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Grlib - Widget Tree Structure here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity