MPLABĀ® Harmony Graphics Suite  GFX v3.13.0
Legato API Documentation
legato_state.h File Reference
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
 
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 enum leLayerClearMode leLayerClearMode
 
typedef struct leLayerState leLayerState
 
typedef struct leState leState
 This struct represents the state of the library. More...
 

Enumerations

enum  leLayerClearMode { LE_LAYERCLEARMODE_DEFAULT, LE_LAYERCLEARMODE_DISABLE, LE_LAYERCLEARMODE_FORCE }
 

Functions

leResult leInitialize (const gfxDisplayDriver *dispDriver, const gfxGraphicsProcessor *gpuDriver)
 Initialize Legato library. More...
 
void leShutdown (void)
 Shutdown Legato library. More...
 
leResult leUpdate (uint32_t dt)
 Shutdown Legato library. More...
 
uint32_t leLayerCount (void)
 
int32_t leAddLayer (void)
 
leResult leRemoveLayer (uint32_t idx)
 
leLayerStateleGetLayerState (uint32_t idx)
 
leColorMode leGetLayerColorMode (uint32_t lyrIdx)
 Get layer color mode. More...
 
leResult leSetLayerColorMode (uint32_t lyrIdx, leColorMode mode)
 Set layer color mode. More...
 
leResult leAddRootWidget (leWidget *wgt, uint32_t layer)
 Add root widget to layer. More...
 
leResult leRemoveRootWidget (leWidget *wgt, uint32_t layer)
 Remove root widget to layer. More...
 
leBool leGetLayerRenderHorizontal (uint32_t lyrIdx)
 Get layer render direction. More...
 
leResult leSetLayerRenderHorizontal (uint32_t lyrIdx, leBool horz)
 Set layer render direction. More...
 
leLayerClearMode leGetLayerClearMode (uint32_t lyrIdx)
 Get layer clear mode. More...
 
leResult leSetLayerClearMode (uint32_t lyrIdx, leLayerClearMode mode)
 Set layer clear mode. More...
 
leStringTableleGetStringTable (void)
 Get string table. More...
 
void leSetStringTable (const leStringTable *table)
 Set string table. More...
 
uint32_t leGetStringLanguage (void)
 Get language index. More...
 
void leSetStringLanguage (uint32_t id)
 Get language by index. More...
 
leSchemeleGetDefaultScheme (void)
 Get default scheme. More...
 
leWidgetleGetFocusWidget (void)
 Get focus widget. More...
 
leResult leSetFocusWidget (leWidget *widget)
 Get language by index. More...
 
leEditWidgetleGetEditWidget (void)
 Get edit widget. More...
 
leResult leSetEditWidget (leEditWidget *widget)
 Set edit widget. More...
 
leResult leSetLanguageChangedCallback (leLanguageChangedCallback_FnPtr cb)
 Set language change callback. More...
 
void leRedrawAll (void)
 Redraw All. More...
 
leBool leIsDrawing (void)
 Check active screen drawing state. More...
 
leBool leWidgetIsInScene (const leWidget *wgt)
 Determines whether the widget is in the scene. More...
 
int32_t leGetWidgetLayer (const leWidget *wgt)
 
leResult leEdit_StartEdit (void)
 Send start edit command. More...
 
void leEdit_EndEdit (void)
 Send end edit command. More...
 
void leEdit_Clear (void)
 Send clear command. More...
 
void leEdit_Accept (void)
 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 (void)
 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()

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 ( void  )

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.

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

◆ leEdit_Backspace()

void leEdit_Backspace ( void  )

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 ( void  )

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 ( void  )

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 ( void  )

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:

◆ leGetDefaultScheme()

leScheme* leGetDefaultScheme ( void  )

Get default scheme.

Returns the pointer to the current default scheme.

Parameters
void.
Returns
void.

◆ leGetEditWidget()

leEditWidget* leGetEditWidget ( void  )

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()

leWidget* leGetFocusWidget ( void  )

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.

◆ leGetLayerClearMode()

leLayerClearMode leGetLayerClearMode ( uint32_t  lyrIdx)

Get layer clear mode.

Gets the the layer clear mode

leLayerClearMode mode = leGetLayerClearMode(0);
Parameters
lyrIdxis the index of the layer to query
Returns
the clear mode of layer.

◆ leGetLayerColorMode()

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()

uint32_t leGetStringLanguage ( void  )

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()

leStringTable* leGetStringTable ( void  )

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()

leBool leIsDrawing ( void  )

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()

void leRedrawAll ( void  )

Redraw All.

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

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

◆ leRemoveRootWidget()

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()

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()

leResult leSetFocusWidget ( leWidget widget)

Get language by index.

Sets the focus widget to widget.

uint32_t id;
Parameters
void.
Returns
void.

◆ leSetLanguageChangedCallback()

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.

◆ leSetLayerClearMode()

leResult leSetLayerClearMode ( uint32_t  lyrIdx,
leLayerClearMode  mode 
)

Set layer clear mode.

Sets the the layer clear mode at index

leResult res = leSetLayerColorMode(0, LE_LAYERCLEARMODE_FORCE);
Parameters
lyrIdxis the index of the layer to modify
modeis the clear mode to set
Returns
result.

◆ 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()

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.
Here is the call graph for this function:

◆ leSetStringTable()

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()

void leShutdown ( void  )

Shutdown Legato library.

Shutdowns the active Legato library state.

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

◆ leUpdate()

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.