 |
MPLABĀ® Harmony Graphics Suite
|
Go to the documentation of this file.
47 #ifndef LEGATO_WIDGET_H
48 #define LEGATO_WIDGET_H
57 #define DEFAULT_BORDER_MARGIN 4
93 #if LE_ARC_WIDGET_ENABLED == 1
96 #if LE_BARGRAPH_WIDGET_ENABLED == 1
99 #if LE_BUTTON_WIDGET_ENABLED == 1
102 #if LE_CHECKBOX_WIDGET_ENABLED == 1
105 #if LE_CIRCLE_WIDGET_ENABLED == 1
108 #if LE_CIRCULARGAUGE_WIDGET_ENABLED == 1
109 LE_WIDGET_CIRCULAR_GAUGE,
111 #if LE_CIRCULARSLIDER_WIDGET_ENABLED == 1
112 LE_WIDGET_CIRCULAR_SLIDER,
114 #if LE_DRAWSURFACE_WIDGET_ENABLED == 1
115 LE_WIDGET_DRAWSURFACE,
117 #if LE_IMAGE_WIDGET_ENABLED == 1
120 #if LE_IMAGEROTATE_WIDGET_ENABLED == 1
121 LE_WIDGET_IMAGEROTATE,
123 #if LE_IMAGESCALE_WIDGET_ENABLED == 1
124 LE_WIDGET_IMAGESCALE,
126 #if LE_IMAGESEQUENCE_WIDGET_ENABLED == 1
127 LE_WIDGET_IMAGESEQUENCE,
129 #if LE_GRADIENT_WIDGET_ENABLED == 1
132 #if LE_GROUPBOX_WIDGET_ENABLED == 1
135 #if LE_KEYPAD_WIDGET_ENABLED == 1 && LE_BUTTON_WIDGET_ENABLED == 1
138 #if LE_LABEL_WIDGET_ENABLED == 1
141 #if LE_LINE_WIDGET_ENABLED == 1
144 #if LE_LINEGRAPH_WIDGET_ENABLED == 1
145 LE_WIDGET_LINE_GRAPH,
147 #if LE_LIST_WIDGET_ENABLED == 1 && LE_SCROLLBAR_WIDGET_ENABLED == 1
150 #if LE_LISTWHEEL_WIDGET_ENABLED == 1
153 #if LE_PIECHART_WIDGET_ENABLED == 1
156 #if LE_PROGRESSBAR_WIDGET_ENABLED == 1
157 LE_WIDGET_PROGRESSBAR,
159 #if LE_RADIALMENU_WIDGET_ENABLED == 1
160 LE_WIDGET_RADIAL_MENU,
162 #if LE_RADIOBUTTON_WIDGET_ENABLED == 1
163 LE_WIDGET_RADIOBUTTON,
165 #if LE_RECTANGLE_WIDGET_ENABLED == 1
168 #if LE_SCROLLBAR_WIDGET_ENABLED == 1
171 #if LE_SLIDER_WIDGET_ENABLED == 1
174 #if LE_TEXTFIELD_WIDGET_ENABLED == 1
177 #if LE_TOUCHTEST_WIDGET_ENABLED == 1
180 #if LE_WINDOW_WIDGET_ENABLED == 1
249 LE_WIDGET_BORDER_NONE,
250 LE_WIDGET_BORDER_LINE,
251 LE_WIDGET_BORDER_BEVEL,
252 LE_WIDGET_BORDER_LAST = LE_WIDGET_BORDER_BEVEL
278 LE_WIDGET_DIRTY_STATE_CLEAN,
279 LE_WIDGET_DIRTY_STATE_CHILD,
280 LE_WIDGET_DIRTY_STATE_DIRTY,
304 LE_WIDGET_DRAW_STATE_READY,
305 LE_WIDGET_DRAW_STATE_DONE,
477 #define LE_WIDGET_VTABLE(THIS_TYPE) \
478 leWidgetType (*getType)(const THIS_TYPE* _this); \
479 int32_t (*getX)(const THIS_TYPE* _this); \
480 leResult (*setX)(THIS_TYPE* _this, int32_t x); \
481 int32_t (*getY)(const THIS_TYPE* _this); \
482 leResult (*setY)(THIS_TYPE* _this, int32_t y); \
483 leResult (*setPosition)(THIS_TYPE* _this, int32_t x, int32_t y); \
484 leResult (*translate)(THIS_TYPE* _this, int32_t x, int32_t y); \
485 uint32_t (*getWidth)(const THIS_TYPE* _this); \
486 leResult (*setWidth)(THIS_TYPE* _this, uint32_t w); \
487 uint32_t (*getHeight)(const THIS_TYPE* _this); \
488 leResult (*setHeight)(THIS_TYPE* _this, uint32_t h); \
489 leResult (*setSize)(THIS_TYPE* _this, uint32_t w, uint32_t h); \
490 leResult (*resize)(THIS_TYPE* _this, int32_t w, int32_t h); \
491 leBool (*getAlphaEnabled)(const THIS_TYPE* _this); \
492 leBool (*getCumulativeAlphaEnabled)(const THIS_TYPE* _this); \
493 leResult (*setAlphaEnabled)(THIS_TYPE* _this, leBool enbl); \
494 uint32_t (*getAlphaAmount)(const THIS_TYPE* _this); \
495 uint32_t (*getCumulativeAlphaAmount)(const THIS_TYPE* _this); \
496 leResult (*setAlphaAmount)(THIS_TYPE* _this, uint32_t a); \
497 leBool (*isOpaque)(const THIS_TYPE* _this); \
498 leBool (*getEnabled)(const THIS_TYPE* _this); \
499 leResult (*setEnabled)(THIS_TYPE* _this, leBool enbl); \
500 leBool (*getVisible)(const THIS_TYPE* _this); \
501 leResult (*setVisible)(THIS_TYPE* _this, leBool vis); \
502 leRect (*localRect)(const THIS_TYPE* _this); \
503 leRect (*rectToParent)(const THIS_TYPE* _this); \
504 leRect (*rectToScreen)(const THIS_TYPE* _this); \
505 leResult (*addChild)(THIS_TYPE* _this, leWidget* chld); \
506 leResult (*insertChild)(THIS_TYPE* _this, leWidget* chld, uint32_t idx); \
507 leResult (*removeChild)(THIS_TYPE* _this, leWidget* chld); \
508 leResult (*removeChildAt)(THIS_TYPE* _this, uint32_t idx); \
509 void (*removeAllChildren)(THIS_TYPE* _this); \
510 leWidget* (*getRootWidget)(const THIS_TYPE* _this); \
511 leResult (*setParent)(THIS_TYPE* _this, leWidget* pnt); \
512 uint32_t (*getChildCount)(const THIS_TYPE* _this); \
513 leWidget* (*getChildAtIndex)(const THIS_TYPE* _this, uint32_t idx); \
514 uint32_t (*getIndexOfChild)(const THIS_TYPE* _this, const leWidget* chld); \
515 leBool (*containsDescendant)(const THIS_TYPE* _this, const leWidget* wgt); \
516 leScheme* (*getScheme)(const THIS_TYPE* _this); \
517 leResult (*setScheme)(THIS_TYPE* _this, const leScheme* schm); \
518 leBorderType (*getBorderType)(const THIS_TYPE* _this); \
519 leResult (*setBorderType)(THIS_TYPE* _this, leBorderType type); \
520 leBackgroundType (*getBackgroundType)(const THIS_TYPE* _this); \
521 leResult (*setBackgroundType)(THIS_TYPE* _this, leBackgroundType type); \
522 leHAlignment (*getHAlignment)(const THIS_TYPE* _this); \
523 leResult (*setHAlignment)(THIS_TYPE* _this, leHAlignment halgn); \
524 leVAlignment (*getVAlignment)(const THIS_TYPE* _this); \
525 leResult (*setVAlignment)(THIS_TYPE* _this, leVAlignment valgn); \
526 leMargin (*getMargins)(const THIS_TYPE* _this); \
527 leResult (*setMargins)(THIS_TYPE* _this, uint32_t l, uint32_t t, uint32_t r, uint32_t b); \
528 uint32_t (*getCornerRadius)(const THIS_TYPE* _this); \
529 leResult (*setCornerRadius)(THIS_TYPE* _this, uint32_t rad); \
530 leBool (*hasFocus)(const THIS_TYPE* _this); \
531 leResult (*setFocus)(THIS_TYPE* _this); \
533 void (*invalidate)(const THIS_TYPE* _this); \
534 void (*invalidateContents)(const THIS_TYPE* _this); \
535 leResult (*installEventFilter)(THIS_TYPE* _this, leWidgetEventFilter fltr); \
536 leResult (*removeEventFilter)(THIS_TYPE* _this, leWidgetEventFilter fltr); \
537 void (*update)(THIS_TYPE* _this, uint32_t dt); \
539 void (*moveEvent)(THIS_TYPE* _this, leWidget_MoveEvent* evt); \
540 void (*resizeEvent)(THIS_TYPE* _this, leWidget_ResizeEvent* evt); \
541 void (*focusGainedEvent)(THIS_TYPE* _this); \
542 void (*focusLostEvent)(THIS_TYPE* _this); \
543 void (*languageChangeEvent)(THIS_TYPE* _this); \
544 void (*touchDownEvent)(THIS_TYPE* _this, leWidgetEvent_TouchDown* evt); \
545 void (*touchUpEvent)(THIS_TYPE* _this, leWidgetEvent_TouchUp* evt); \
546 void (*touchMoveEvent)(THIS_TYPE* _this, leWidgetEvent_TouchMove* evt); \
548 void (*_destructor)(THIS_TYPE* _this); \
550 void (*_handleEvent)(THIS_TYPE* _this, leEvent* evt); \
551 void (*_validateChildren)(THIS_TYPE* _this); \
552 void (*_increaseDirtyState)(THIS_TYPE* _this, uint32_t state); \
553 void (*_setDirtyState)(THIS_TYPE* _this, uint32_t state); \
554 void (*_clearDirtyState)(THIS_TYPE* _this); \
555 void (*_invalidateBorderAreas)(const THIS_TYPE* _this); \
556 void (*_damageArea)(const THIS_TYPE* _this, leRect* rect); \
557 void (*_paint)(THIS_TYPE* _this); \
559 typedef struct leWidgetVTable
568 typedef void (*leWidget_DrawFunction_FnPtr)(
void*);
572 LE_WIDGET_ENABLED = 0x1,
573 LE_WIDGET_VISIBLE = 0x2,
574 LE_WIDGET_ALPHAENABLED = 0x4,
575 LE_WIDGET_ISROOT = 0x8,
576 LE_WIDGET_IGNOREEVENTS = 0x10,
577 LE_WIDGET_IGNOREPICK = 0x20
580 typedef struct leWidgetStyle
582 uint8_t backgroundType;
587 uint8_t cornerRadius;
590 typedef struct leWidgetStatus
624 const leWidgetVTable* fn;
633 leWidgetStatus status;
640 leWidget_DrawFunction_FnPtr drawFunc;
2779 void _leWidget_ValidateChildren(
leWidget*);
2780 void _leWidget_IncreaseDirtyState(
leWidget*, uint32_t);
2781 void _leWidget_SetDirtyState(
leWidget*, uint32_t);
2782 void _leWidget_ClearDirtyState(
leWidget*);
2783 void _leWidget_InvalidateBorderAreas(
const leWidget*);
2790 void _leWidget_FocusLostEvent(
leWidget*);
2791 void _leWidget_FocusGainedEvent(
leWidget*);
2792 void _leWidget_LanguageChangeEvent(
leWidget*);
Defines common math functions for general use.
Error functions, macros and definitions.
leResult
This enum represents function call results.
Definition: legato_common.h:134
LIB_EXPORT uint32_t lePercentWholeRounded(uint32_t l, uint32_t r)
Calculate percent whole rounded.
Definition: legato_math.c:204
@ LE_WIDGET_EVENT_MOVED
Definition: legato_event.h:75
leResult leArray_RemoveAt(leArray *arr, uint32_t idx)
Remove value at index.
Definition: legato_array.c:197
This struct represents a rectangle.
Definition: legato_common.h:405
uint8_t left
Definition: legato_common.h:232
@ LE_EVENT_TOUCH_DOWN
Definition: legato_event.h:68
leEventID
This enum represents valid event IDs.
Definition: legato_event.h:65
uint32_t size
Definition: legato_array.h:63
LIB_EXPORT leResult leSetEditWidget(leEditWidget *widget)
Set edit widget.
Definition: legato_state.c:526
This enum presents a event. An event contains valid event ids.
Definition: legato_event.h:88
Memory functions and definitions.
@ LE_EVENT_TOUCH_UP
Definition: legato_event.h:69
Legato event definitions.
int32_t leArray_Find(const leArray *arr, void *val)
Find a first index of value.
Definition: legato_array.c:242
LIB_EXPORT uint32_t lePercentOf(uint32_t num, uint32_t percent)
Calculate percent of a number.
Definition: legato_math.c:218
leResult leArray_PushBack(leArray *arr, void *val)
Push value on back.
Definition: legato_array.c:147
leHAlignment
This enum represents the horizontal alignment mode of objects.
Definition: legato_common.h:206
LIB_EXPORT leWidget * leGetFocusWidget()
Get focus widget.
Definition: legato_state.c:490
@ LE_VALIGN_MIDDLE
Definition: legato_common.h:183
LIB_EXPORT leBool leRectIntersects(const leRect *l_rect, const leRect *r_rect)
Determines if two rectangles are intersecting.
Definition: legato_rect.c:51
@ LE_HALIGN_CENTER
Definition: legato_common.h:208
This struct represents a array.
Definition: legato_array.h:61
This struct represents a rectange array.
Definition: legato_rectarray.h:71
An array implementation for storing pointers.
void ** values
Definition: legato_array.h:62
leResult leArray_Create(leArray *arr)
Create a new array.
Definition: legato_array.c:73
@ LE_WIDGET_EVENT_FOCUS_LOST
Definition: legato_event.h:78
leResult leArray_InsertAt(leArray *arr, uint32_t idx, void *val)
Insert value at index.
Definition: legato_array.c:174
leBool
This enum represents booleans.
Definition: legato_common.h:157
@ LE_WIDGET_EVENT_PAINT
Definition: legato_event.h:74
@ LE_FALSE
Definition: legato_common.h:158
@ LE_WIDGET_EVENT_RESIZED
Definition: legato_event.h:76
LIB_EXPORT leEditWidget * leGetEditWidget()
Get edit widget.
Definition: legato_state.c:521
leBool leUtils_ChildIntersectsParent(const leWidget *parent, const leWidget *child)
Determines if parent and child intersect.
Definition: legato_utils.c:166
@ LE_EVENT_TOUCH_MOVE
Definition: legato_event.h:70
General internal utilities for the library.
leWidget * focus
Definition: legato_state.h:78
leBool leWidgetIsInScene(const leWidget *wgt)
Determines whether the widget is in the scene.
Definition: legato_state.c:596
leEventID id
Definition: legato_event.h:89
leResult leArray_Clear(leArray *arr)
Clear array.
Definition: legato_array.c:279
Schemes support various properties that make it possible to customize the color of widgets.
void leUtils_RectToScreenSpace(const leWidget *widget, leRect *rect)
Convert rectangle from widget local space to screen space.
Definition: legato_utils.c:151
Rectangle functions and definitions.
This struct represents the four margin settings for objects.
Definition: legato_common.h:231
uint8_t right
Definition: legato_common.h:234
Definition: legato_scheme.h:154
@ LE_WIDGET_EVENT_FOCUS_GAINED
Definition: legato_event.h:77
void * leArray_Get(const leArray *arr, uint32_t idx)
Get entry at index.
Definition: legato_array.c:224
uint8_t top
Definition: legato_common.h:233
@ LE_TRUE
Definition: legato_common.h:159
Common macros and definitions used by Legato.
uint32_t widgetIDs
Definition: legato_state.h:73
leResult leArray_Remove(leArray *arr, void *val)
Remove value.
Definition: legato_array.c:207
uint8_t bottom
Definition: legato_common.h:235
LIB_EXPORT leResult leSetFocusWidget(leWidget *widget)
Get language by index.
Definition: legato_state.c:495
leVAlignment
This enum represents the vertical alignment mode of objects.
Definition: legato_common.h:181