MPLABĀ® Harmony Graphics Suite
Macros | Typedefs | Functions
legato_utils.h File Reference

General internal utilities for the library. More...

#include "gfx/legato/common/legato_common.h"
Include dependency graph for legato_utils.h:

Go to the source code of this file.

Macros

#define LE_TEST_FLAG(val, flag)   ((val & flag) > 0)
 

Typedefs

typedef struct leWidget leWidget
 Used to define a widget. More...
 
typedef struct leList leList
 

Functions

leWidgetleUtils_PickFromWidget (const leWidget *wgt, int32_t x, int32_t y)
 Finds the top-most visible widget in a layer at the given coordinates. More...
 
void leUtils_PointToScreenSpace (const leWidget *widget, lePoint *pnt)
 Converts a point from widget space into screen space. More...
 
void leUtils_PointScreenToLocalSpace (const leWidget *widget, lePoint *pnt)
 Convert point from layer space into the local space of a widget. More...
 
void leUtils_ClipRectToParent (const leWidget *widget, leRect *rect)
 Clips a rectangle to the parent of a widge. More...
 
void leUtils_RectToParentSpace (const leWidget *widget, leRect *rect)
 Convert rectangle from widget local space to widget parent space. More...
 
void leUtils_RectFromParentSpace (const leWidget *widget, leRect *rect)
 Convert rectangle from widget parent space to widget local space. More...
 
void leUtils_RectToScreenSpace (const leWidget *widget, leRect *rect)
 Convert rectangle from widget local space to screen space. More...
 
leBool leUtils_ChildIntersectsParent (const leWidget *parent, const leWidget *child)
 Determines if parent and child intersect. More...
 
leWidgetleUtils_GetNextHighestWidget (const leWidget *wgt)
 Get next highest Z order widget in the tree from 'wgt'. More...
 
void leUtils_ArrangeRectangle (leRect *sub, leRect obj, leRect bounds, leHAlignment hAlignment, leVAlignment vAlignment, leRelativePosition position, uint8_t leftMargin, uint8_t topMargin, uint8_t rightMargin, uint8_t bottomMargin, uint16_t rectMargin)
 Calculates the position of a rectangle within the given bound. More...
 
void leUtils_ArrangeRectangleRelative (leRect *sub, leRect obj, leRect bounds, leHAlignment hAlignment, leVAlignment vAlignment, leRelativePosition position, uint8_t leftMargin, uint8_t topMargin, uint8_t rightMargin, uint8_t bottomMargin, uint16_t rectMargin)
 Calculates the position of a rectangle within the given bounds. More...
 

Detailed Description

General internal utilities for the library.

Typedef Documentation

◆ leWidget

typedef struct leWidget leWidget

Used to define a widget.

Function Documentation

◆ leUtils_ArrangeRectangle()

void leUtils_ArrangeRectangle ( leRect sub,
leRect  obj,
leRect  bounds,
leHAlignment  hAlignment,
leVAlignment  vAlignment,
leRelativePosition  position,
uint8_t  leftMargin,
uint8_t  topMargin,
uint8_t  rightMargin,
uint8_t  bottomMargin,
uint16_t  rectMargin 
)

Calculates the position of a rectangle within the given bound.

Calculates the position of a rectangle within the given bounds and in accordance with the given parameters. A use case for this is when an image and a text rectangle must be arranged in a button box. This version of the algorithm will calculate the location of the image rectangle.

Parameters
widgetposition.
rectposition.
Returns
void.

◆ leUtils_ArrangeRectangleRelative()

void leUtils_ArrangeRectangleRelative ( leRect sub,
leRect  obj,
leRect  bounds,
leHAlignment  hAlignment,
leVAlignment  vAlignment,
leRelativePosition  position,
uint8_t  leftMargin,
uint8_t  topMargin,
uint8_t  rightMargin,
uint8_t  bottomMargin,
uint16_t  rectMargin 
)

Calculates the position of a rectangle within the given bounds.

Calculates the position of a rectangle within the given bounds and in accordance with the given parameters. A use case for this is when an image and a text rectangle must be arranged in a button box. This version of the algorithm will calculate the location of the image rectangle.

Remarks
The x and y position of sub will be manipulated by this function. The dimensions of the rectangle should be set before calling and should remain unchanged after execution.
Parameters
widgetposition.
rectposition.
Returns
void.

◆ leUtils_ChildIntersectsParent()

leBool leUtils_ChildIntersectsParent ( const leWidget parent,
const leWidget child 
)

Determines if parent and child intersect.

Determines if parent and child intersects.

const leWidget* parent;
const leWidget* child;
Parameters
widgetthe parent widget.
childthe child widget.
Returns
void.
Here is the call graph for this function:

◆ leUtils_ClipRectToParent()

void leUtils_ClipRectToParent ( const leWidget widget,
leRect rect 
)

Clips a rectangle to the parent of a widge.

Clips a rectangle rect to parent of widget.

const leWidget* widget;
leRect* rect;
Parameters
widgetposition.
rectposition.
Returns
void.
Here is the call graph for this function:

◆ leUtils_GetNextHighestWidget()

leWidget* leUtils_GetNextHighestWidget ( const leWidget wgt)

Get next highest Z order widget in the tree from 'wgt'.

Gets the next the highest Z order widget in the tree widget.

Parameters
widgetposition.
rectposition.
Returns
the next highest widget or NULL if 'wgt' is already the highest.

◆ leUtils_PickFromWidget()

leWidget* leUtils_PickFromWidget ( const leWidget wgt,
int32_t  x,
int32_t  y 
)

Finds the top-most visible widget in a layer at the given coordinates.

Finds the top-most visible widget in wgt at the given coordinates x and y.

leWidget* wdt = leUtils_PickFromWidget(wgt, x, y);
Parameters
wgtthe widget to pick from
xposition.
yposition.
Returns
the result widget.
Here is the call graph for this function:

◆ leUtils_PointScreenToLocalSpace()

void leUtils_PointScreenToLocalSpace ( const leWidget widget,
lePoint pnt 
)

Convert point from layer space into the local space of a widget.

Converts pnt corresponding to layer space to widget space.

const leWidget* widget;
lePoint* pnt;
Parameters
widgetposition.
pntposition.
Returns
void.

◆ leUtils_PointToScreenSpace()

void leUtils_PointToScreenSpace ( const leWidget widget,
lePoint pnt 
)

Converts a point from widget space into screen space.

Converts point corresponding to widget space to screen space.

const leWidget* widget;
lePoint* pnt;
Parameters
widgetthe subject widget.
pntthe point to convert.
Returns
void.

◆ leUtils_RectFromParentSpace()

void leUtils_RectFromParentSpace ( const leWidget widget,
leRect rect 
)

Convert rectangle from widget parent space to widget local space.

Converts rect to widget space.

const leWidget* widget;
leRect* rect;
Parameters
widgetposition.
rectposition.
Returns
void.

◆ leUtils_RectToParentSpace()

void leUtils_RectToParentSpace ( const leWidget widget,
leRect rect 
)

Convert rectangle from widget local space to widget parent space.

Converts rect from widget space to parent space.

Remarks
Widget must be a child of a layer for this to function.
const leWidget* widget;
leRect* rect;
Parameters
widgetposition.
rectposition.
Returns
void.

◆ leUtils_RectToScreenSpace()

void leUtils_RectToScreenSpace ( const leWidget widget,
leRect rect 
)

Convert rectangle from widget local space to screen space.

Converts rect from widget space to screen space.

const leWidget* widget;
leRect* rect;
Parameters
widgetposition.
rectposition.
Returns
void.
leUtils_PointScreenToLocalSpace
void leUtils_PointScreenToLocalSpace(const leWidget *widget, lePoint *pnt)
Convert point from layer space into the local space of a widget.
Definition: legato_utils.c:90
leRect
This struct represents a rectangle.
Definition: legato_common.h:405
leUtils_RectToParentSpace
void leUtils_RectToParentSpace(const leWidget *widget, leRect *rect)
Convert rectangle from widget local space to widget parent space.
Definition: legato_utils.c:131
leUtils_PointToScreenSpace
void leUtils_PointToScreenSpace(const leWidget *widget, lePoint *pnt)
Converts a point from widget space into screen space.
Definition: legato_utils.c:75
leUtils_ChildIntersectsParent
leBool leUtils_ChildIntersectsParent(const leWidget *parent, const leWidget *child)
Determines if parent and child intersect.
Definition: legato_utils.c:166
leUtils_PickFromWidget
leWidget * leUtils_PickFromWidget(const leWidget *wgt, int32_t x, int32_t y)
Finds the top-most visible widget in a layer at the given coordinates.
Definition: legato_utils.c:34
leWidget
Used to define a widget.
Definition: legato_widget.h:623
leUtils_ClipRectToParent
void leUtils_ClipRectToParent(const leWidget *widget, leRect *rect)
Clips a rectangle to the parent of a widge.
Definition: legato_utils.c:112
leUtils_GetNextHighestWidget
leWidget * leUtils_GetNextHighestWidget(const leWidget *wgt)
Get next highest Z order widget in the tree from 'wgt'.
Definition: legato_utils.c:182
leUtils_ArrangeRectangle
void leUtils_ArrangeRectangle(leRect *sub, leRect obj, leRect bounds, leHAlignment hAlignment, leVAlignment vAlignment, leRelativePosition position, uint8_t leftMargin, uint8_t topMargin, uint8_t rightMargin, uint8_t bottomMargin, uint16_t rectMargin)
Calculates the position of a rectangle within the given bound.
Definition: legato_utils.c:213
leUtils_ArrangeRectangleRelative
void leUtils_ArrangeRectangleRelative(leRect *sub, leRect obj, leRect bounds, leHAlignment hAlignment, leVAlignment vAlignment, leRelativePosition position, uint8_t leftMargin, uint8_t topMargin, uint8_t rightMargin, uint8_t bottomMargin, uint16_t rectMargin)
Calculates the position of a rectangle within the given bounds.
Definition: legato_utils.c:286
lePoint
This structure represents a integer Cartesian point.
Definition: legato_common.h:357