MPLABĀ® Harmony Graphics Suite
Data Structures | Typedefs | Functions
legato_state.h File Reference
#include "gfx/legato/common/legato_common.h"
#include "gfx/driver/gfx_driver.h"
#include "gfx/legato/core/legato_input.h"
#include "gfx/legato/core/legato_scheme.h"
#include "gfx/legato/string/legato_stringtable.h"
#include "gfx/legato/widget/legato_editwidget.h"
Include dependency graph for legato_state.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  leLayerState
 This struct describes the layer state for a layer. More...
 
struct  leState
 This struct represents the state of the library. More...
 

Typedefs

typedef void(* leLanguageChangedCallback_FnPtr) (uint32_t)
 This function pointer represents a language change callback. More...
 
typedef struct leState leState
 This struct represents the state of the library. More...
 

Functions

leResult leInitialize (const gfxDisplayDriver *dispDriver, const gfxGraphicsProcessor *gpuDriver)
 Initialize Legato library. More...
 
LIB_EXPORT void leShutdown ()
 Shutdown Legato library. More...
 
LIB_EXPORT leResult leUpdate (uint32_t dt)
 Shutdown Legato library. More...
 
LIB_EXPORT leColorMode leGetColorMode ()
 Get color mode. More...
 
LIB_EXPORT leColorMode leGetLayerColorMode (uint32_t lyrIdx)
 Get layer color mode. More...
 
leResult leSetLayerColorMode (uint32_t lyrIdx, leColorMode mode)
 Set layer color mode. More...
 
leBool leGetLayerRenderHorizontal (uint32_t lyrIdx)
 Get layer render direction. More...
 
leResult leSetLayerRenderHorizontal (uint32_t lyrIdx, leBool horz)
 Set layer render direction. More...
 
LIB_EXPORT leStringTableleGetStringTable ()
 Get string table. More...
 
LIB_EXPORT void leSetStringTable (const leStringTable *table)
 Set string table. More...
 
LIB_EXPORT uint32_t leGetStringLanguage ()
 Get language index. More...
 
LIB_EXPORT void leSetStringLanguage (uint32_t id)
 Get language by index. More...
 
LIB_EXPORT leSchemeleGetDefaultScheme ()
 Get default scheme. More...
 
LIB_EXPORT leWidgetleGetFocusWidget ()
 Get focus widget. More...
 
LIB_EXPORT leResult leSetFocusWidget (leWidget *widget)
 Get language by index. More...
 
LIB_EXPORT leEditWidgetleGetEditWidget ()
 Get edit widget. More...
 
LIB_EXPORT leResult leSetEditWidget (leEditWidget *widget)
 Set edit widget. More...
 
LIB_EXPORT leResult leSetLanguageChangedCallback (leLanguageChangedCallback_FnPtr cb)
 Set language change callback. More...
 
LIB_EXPORT void leRedrawAll ()
 Redraw All. More...
 
LIB_EXPORT leBool leIsDrawing ()
 Check active screen drawing state. More...
 
LIB_EXPORT leResult leAddRootWidget (leWidget *wgt, uint32_t layer)
 Add root widget to layer. More...
 
LIB_EXPORT leResult leRemoveRootWidget (leWidget *wgt, uint32_t layer)
 Remove root widget to layer. More...
 
leBool leWidgetIsInScene (const leWidget *wgt)
 Determines whether the widget is in the scene. More...
 
int32_t leGetWidgetLayer (const leWidget *wgt)
 
leResult leEdit_StartEdit ()
 Send start edit command. More...
 
void leEdit_EndEdit ()
 Send end edit command. More...
 
void leEdit_Clear ()
 Send clear command. More...
 
void leEdit_Accept ()
 Send accept command. More...
 
void leEdit_Set (leString *str)
 Send set command. More...
 
void leEdit_Append (leString *str)
 Send start edit command. More...
 
void leEdit_Backspace ()
 Send backspace command. More...
 

Detailed Description

Typedef Documentation

◆ leLanguageChangedCallback_FnPtr

typedef void(* leLanguageChangedCallback_FnPtr) (uint32_t)

This function pointer represents a language change callback.

A language change callback is called when when the language change event occurs.

◆ leState

typedef struct leState leState

This struct represents the state of the library.

The state of the libary is a global structure.

Function Documentation

◆ leAddRootWidget()

LIB_EXPORT leResult leAddRootWidget ( leWidget wgt,
uint32_t  layer 
)

Add root widget to layer.

Adds the root widget wgt to the layer layer. The library maintains a static list of widgets that are considered to be scene roots. The library treats these roots as layers and the display driver may configure itself to render these roots to different hardware layers. This API adds a child widget to one of the static roots.

leResult res = leAddRootWidget(wgt, layer);
Parameters
void.
Returns
leResult.

◆ leEdit_Accept()

void leEdit_Accept ( )

Send accept command.

Passes a 'accept' command to the current edit widget, if one exists.

Returns
void.
Here is the call graph for this function:

◆ leEdit_Append()

void leEdit_Append ( leString str)

Send start edit command.

Passes a 'append' command and string str to the current edit widget, if one exists.

leString* str;
Parameters
void.
Returns
void.
Here is the call graph for this function:

◆ leEdit_Backspace()

void leEdit_Backspace ( )

Send backspace command.

Passes a 'backspace' command to the current edit widget, if one exists.

Parameters
void.
Returns
void.
Here is the call graph for this function:

◆ leEdit_Clear()

void leEdit_Clear ( )

Send clear command.

Sends a 'clear' command to the current edit widget, if one exists.

Returns
void.
Here is the call graph for this function:

◆ leEdit_EndEdit()

void leEdit_EndEdit ( )

Send end edit command.

Sends an 'end edit' command to the current edit widget, if one exists.

Returns
void.
Here is the call graph for this function:

◆ leEdit_Set()

void leEdit_Set ( leString str)

Send set command.

Passes a 'set' command and string str to the current edit widget, if one exists.

Parameters
void.
Returns
leResult.
Here is the call graph for this function:

◆ leEdit_StartEdit()

leResult leEdit_StartEdit ( )

Send start edit command.

Passes a 'start edit' command to the current edit widget, if one exists.

Parameters
void.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.
Here is the call graph for this function:

◆ leGetColorMode()

LIB_EXPORT leColorMode leGetColorMode ( )

Get color mode.

Gets the the color mode of the current context.

Parameters
void.
Returns
the color mode of the current context.

◆ leGetDefaultScheme()

LIB_EXPORT leScheme* leGetDefaultScheme ( )

Get default scheme.

Returns the pointer to the current default scheme.

Parameters
void.
Returns
void.

◆ leGetEditWidget()

LIB_EXPORT leEditWidget* leGetEditWidget ( )

Get edit widget.

Edit widgets are widgets that inherit the 'edit widget' API function list. These widgets are capable of receiving edit events from other widgets that are edit event broadcasters. A broadcaster could be a 'key pad' and a receiver could be a 'text edit' box.

Parameters
void.
Returns
leEditWidget pointer.
Here is the caller graph for this function:

◆ leGetFocusWidget()

LIB_EXPORT leWidget* leGetFocusWidget ( )

Get focus widget.

The focus widget is the widget that is currently receiving all input events. This can happen when the user initiates a touch down event on the widget and is currently dragging their finger on the display. The widget will receive all touch moved events until a touch up event is received.

Parameters
void.
Returns
void.

◆ leGetLayerColorMode()

LIB_EXPORT leColorMode leGetLayerColorMode ( uint32_t  lyrIdx)

Get layer color mode.

Gets the the layer color mode

Parameters
lyrIdxis the index of the layer to query
Returns
the color mode of layer.

◆ leGetLayerRenderHorizontal()

leBool leGetLayerRenderHorizontal ( uint32_t  lyrIdx)

Get layer render direction.

Gets the the layer render direction

Parameters
lyrIdxis the index of the layer to query
Returns
true if the layer is set to render horizontally.

◆ leGetStringLanguage()

LIB_EXPORT uint32_t leGetStringLanguage ( )

Get language index.

Returns the language index of the current context.

uint32_t idx = leGetStringLanguage();
Parameters
void.
Returns
void.
Here is the caller graph for this function:

◆ leGetStringTable()

LIB_EXPORT leStringTable* leGetStringTable ( )

Get string table.

Get a pointer to the leStringTable structure that maintains the strings, associated fonts, etc.

Parameters
void.
Returns
leStringTable pointer.

◆ leInitialize()

leResult leInitialize ( const gfxDisplayDriver *  dispDriver,
const gfxGraphicsProcessor *  gpuDriver 
)

Initialize Legato library.

This function performs basic initialization of the Legato library state. It accepts and intializes a display controller driver specified by dispDriver

Precondition
Must be called before any other library operations are performed.
leResult res = leInitialize(dispDriver);
Parameters
dispDriveris the display controller driver.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leIsDrawing()

LIB_EXPORT leBool leIsDrawing ( )

Check active screen drawing state.

Indicates if the library currently drawing a frame. Because frame updates can asynchronous to making changes to the UI state it is best to only make updates to the state of a widget only when the layer is not drawing.

Parameters
void.
Returns
true.

◆ leRedrawAll()

LIB_EXPORT void leRedrawAll ( )

Redraw All.

Forces the library to redraw the currently active scene in its entirety.

Parameters
void.
Returns
void.
Here is the caller graph for this function:

◆ leRemoveRootWidget()

LIB_EXPORT leResult leRemoveRootWidget ( leWidget wgt,
uint32_t  layer 
)

Remove root widget to layer.

Remove the root widget wgt from the layer layer. The library maintains a static list of widgets that are considered to be scene roots. The library treats these roots as layers and the display driver may configure itself to render these roots to different hardware layers. This API adds a child widget to one of the static roots.

leResult res = leRemoveRootWidget(wgt, layer);
Parameters
void.
Returns
leResult.

◆ leSetEditWidget()

LIB_EXPORT leResult leSetEditWidget ( leEditWidget widget)

Set edit widget.

Sets the active edit widget to widget. Edit widgets are widgets that inherit the 'edit widget' API function list. These widgets are capable of receiving edit events from other widgets that are edit event broadcasters. A broadcaster could be a 'key pad' and a receiver could be a 'text edit' box.

leEditWidget* widget = leSetEditWidget(widget);
Parameters
void.
Returns
leEditWidget pointer.

◆ leSetFocusWidget()

LIB_EXPORT leResult leSetFocusWidget ( leWidget widget)

Get language by index.

Sets the focus widget to widget.

uint32_t id;
Parameters
void.
Returns
void.

◆ leSetLanguageChangedCallback()

LIB_EXPORT leResult leSetLanguageChangedCallback ( leLanguageChangedCallback_FnPtr  cb)

Set language change callback.

Sets the callback function to cb to handle the language change event.

Parameters
cbis the new callback function.
Returns
leResult.

◆ leSetLayerColorMode()

leResult leSetLayerColorMode ( uint32_t  lyrIdx,
leColorMode  mode 
)

Set layer color mode.

Sets the the layer color mode at index

leResult res = leGetLayerColorMode(0, LE_RGB_565);
Parameters
lyrIdxis the index of the layer to query
modeis the color mode to set
Returns
result.

◆ leSetLayerRenderHorizontal()

leResult leSetLayerRenderHorizontal ( uint32_t  lyrIdx,
leBool  horz 
)

Set layer render direction.

Sets the the layer render direction at index. By default a layer is rendered from top-down with dirty rectangles sliced favoring height. In horizontal mode layers are rendered from left to right with rectangles sliced favoring width. This can help reduce tearing for scenes that have horizontal movement.

Parameters
lyrIdxis the index of the layer to modify
trueif the layer should use horizontal mode
Returns
result.

◆ leSetStringLanguage()

LIB_EXPORT void leSetStringLanguage ( uint32_t  id)

Get language by index.

Returns the language at the location specified by idx.

uint32_t id;
Parameters
void.
Returns
void.

◆ leSetStringTable()

LIB_EXPORT void leSetStringTable ( const leStringTable table)

Set string table.

Set string table to table.

Parameters
tableis pointer to a string table.
Returns
void.
Here is the call graph for this function:

◆ leShutdown()

LIB_EXPORT void leShutdown ( )

Shutdown Legato library.

Shutdowns the active Legato library state.

Returns
void.

◆ leUpdate()

LIB_EXPORT leResult leUpdate ( uint32_t  dt)

Shutdown Legato library.

Shutdown the Legato library in dt milliseconds after the last leUpdate() was called. If the value of dt is zero then time-dependent features will not advance. the active Legato library state. This function updates the active Legato library context state. It performs event processing as well as servicing of the widget paint loop. It should be called often.

uint32_t dt=2000;
leResult res = leUpdateleShutdown(dt);
Parameters
dtis a delta time.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.
Here is the call graph for this function:

◆ leWidgetIsInScene()

leBool leWidgetIsInScene ( const leWidget wgt)

Determines whether the widget is in the scene.

Determines if wgt is in he current scheme. Searches the active scene for a given widget.

Parameters
void.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.
leSetLayerRenderHorizontal
leResult leSetLayerRenderHorizontal(uint32_t lyrIdx, leBool horz)
Set layer render direction.
Definition: legato_state.c:421
leShutdown
LIB_EXPORT void leShutdown()
Shutdown Legato library.
Definition: legato_state.c:289
leEditWidget
Definition: legato_editwidget.h:91
leResult
leResult
This enum represents function call results.
Definition: legato_common.h:134
leColorMode
leColorMode
This enum represents the supported RGB color formats.
Definition: legato_color.h:146
leAddRootWidget
LIB_EXPORT leResult leAddRootWidget(leWidget *wgt, uint32_t layer)
Add root widget to layer.
Definition: legato_state.c:566
leGetLayerColorMode
LIB_EXPORT leColorMode leGetLayerColorMode(uint32_t lyrIdx)
Get layer color mode.
Definition: legato_state.c:394
leSetEditWidget
LIB_EXPORT leResult leSetEditWidget(leEditWidget *widget)
Set edit widget.
Definition: legato_state.c:526
leRedrawAll
LIB_EXPORT void leRedrawAll()
Redraw All.
Definition: legato_state.c:548
leGetFocusWidget
LIB_EXPORT leWidget * leGetFocusWidget()
Get focus widget.
Definition: legato_state.c:490
leEdit_Append
void leEdit_Append(leString *str)
Send start edit command.
Definition: legato_state.c:725
leEdit_Backspace
void leEdit_Backspace()
Send backspace command.
Definition: legato_state.c:735
leString
This struct represents a string.
Definition: legato_string.h:108
leBool
leBool
This enum represents booleans.
Definition: legato_common.h:157
leGetEditWidget
LIB_EXPORT leEditWidget * leGetEditWidget()
Get edit widget.
Definition: legato_state.c:521
leEdit_Accept
void leEdit_Accept()
Send accept command.
Definition: legato_state.c:705
leEdit_StartEdit
leResult leEdit_StartEdit()
Send start edit command.
Definition: legato_state.c:675
leGetStringTable
LIB_EXPORT leStringTable * leGetStringTable()
Get string table.
Definition: legato_state.c:437
leRemoveRootWidget
LIB_EXPORT leResult leRemoveRootWidget(leWidget *wgt, uint32_t layer)
Remove root widget to layer.
Definition: legato_state.c:577
leIsDrawing
LIB_EXPORT leBool leIsDrawing()
Check active screen drawing state.
Definition: legato_state.c:561
leGetLayerRenderHorizontal
leBool leGetLayerRenderHorizontal(uint32_t lyrIdx)
Get layer render direction.
Definition: legato_state.c:413
leWidgetIsInScene
leBool leWidgetIsInScene(const leWidget *wgt)
Determines whether the widget is in the scene.
Definition: legato_state.c:596
leGetStringLanguage
LIB_EXPORT uint32_t leGetStringLanguage()
Get language index.
Definition: legato_state.c:449
leGetColorMode
LIB_EXPORT leColorMode leGetColorMode()
Get color mode.
leWidget
Used to define a widget.
Definition: legato_widget.h:623
leEdit_Clear
void leEdit_Clear()
Send clear command.
Definition: legato_state.c:695
leSetStringLanguage
LIB_EXPORT void leSetStringLanguage(uint32_t id)
Get language by index.
Definition: legato_state.c:469
leScheme
Definition: legato_scheme.h:154
leSetStringTable
LIB_EXPORT void leSetStringTable(const leStringTable *table)
Set string table.
Definition: legato_state.c:442
leEdit_EndEdit
void leEdit_EndEdit()
Send end edit command.
Definition: legato_state.c:685
leGetDefaultScheme
LIB_EXPORT leScheme * leGetDefaultScheme()
Get default scheme.
Definition: legato_state.c:485
leStringTable
This struct represents string a string table.
Definition: legato_stringtable.h:80
leEdit_Set
void leEdit_Set(leString *str)
Send set command.
Definition: legato_state.c:715
leSetLanguageChangedCallback
LIB_EXPORT leResult leSetLanguageChangedCallback(leLanguageChangedCallback_FnPtr cb)
Set language change callback.
leLanguageChangedCallback_FnPtr
void(* leLanguageChangedCallback_FnPtr)(uint32_t)
This function pointer represents a language change callback.
Definition: legato_state.h:48
leSetFocusWidget
LIB_EXPORT leResult leSetFocusWidget(leWidget *widget)
Get language by index.
Definition: legato_state.c:495
leInitialize
leResult leInitialize(const gfxDisplayDriver *dispDriver, const gfxGraphicsProcessor *gpuDriver)
Initialize Legato library.
Definition: legato_state.c:228