MPLABĀ® Harmony Graphics Suite
legato_widget_circle.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright (C) 2020 Microchip Technology Inc. and its subsidiaries.
3 *
4 * Subject to your compliance with these terms, you may use Microchip software
5 * and any derivatives exclusively with Microchip products. It is your
6 * responsibility to comply with third party license terms applicable to your
7 * use of third party software (including open source software) that may
8 * accompany Microchip software.
9 *
10 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
11 * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
12 * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
13 * PARTICULAR PURPOSE.
14 *
15 * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
16 * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
17 * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
18 * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
19 * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
20 * ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
21 * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
22 *******************************************************************************/
23 
24 /*******************************************************************************
25  Module for Microchip Graphics Library - Legato User Interface Library
26 
27  Company:
28  Microchip Technology Inc.
29 
30  File Name:
31  legato_widget_circle.h
32 
33  Summary:
34 
35 
36  Description:
37  This module implements circle drawing widget functions.
38 *******************************************************************************/
39 
46 #ifndef LEGATO_CIRCLE_H
47 #define LEGATO_CIRCLE_H
48 
50 
51 #if LE_CIRCLE_WIDGET_ENABLED == 1
52 
54 
55 // *****************************************************************************
56 // *****************************************************************************
57 // Section: Data Types and Constants
58 // *****************************************************************************
59 // *****************************************************************************
60 
61 /* internal use only */typedef struct leCircleWidget leCircleWidget;
66 
67 #define LE_CIRCLEWIDGET_VTABLE(THIS_TYPE) \
68  LE_WIDGET_VTABLE(THIS_TYPE) \
69  \
70  lePoint (*getOrigin)(const THIS_TYPE* _this); \
71  leResult (*setOrigin)(THIS_TYPE* _this, const lePoint org); \
72  int32_t (*getOriginX)(const THIS_TYPE* _this); \
73  leResult (*setOriginX)(THIS_TYPE* _this, const int32_t x); \
74  int32_t (*getOriginY)(const THIS_TYPE* _this); \
75  leResult (*setOriginY)(THIS_TYPE* _this, const int32_t y); \
76  uint32_t (*getRadius)(const THIS_TYPE* _this); \
77  leResult (*setRadius)(THIS_TYPE* _this, uint32_t rad); \
78  uint32_t (*getThickness)(const THIS_TYPE* _this); \
79  leResult (*setThickness)(THIS_TYPE* _this, uint32_t thk); \
80  leBool (*getFilled)(const THIS_TYPE* _this); \
81  leResult (*setFilled)(THIS_TYPE* _this, leBool fill); \
82 
83 typedef struct leCircleWidgetVTable
84 {
85  LE_CIRCLEWIDGET_VTABLE(leCircleWidget)
86 } leCircleWidgetVTable;
87 
93 // *****************************************************************************
94 /* Structure:
95  leCircleWidget
96 
97  Summary:
98  Implementation of a circle widget.
99 
100  Description:
101  A circle widget draws a circle of the specified origin and radius inside
102  the widget bounds. All coordinates are expressed in local widget space.
103 
104  The color of the circle is determined by the widget scheme's 'foreground'
105  color.
106 
107  Remarks:
108  None.
109 */
110 typedef struct leCircleWidget
111 {
112  leWidget widget; // base widget header
113 
114  const leCircleWidgetVTable* fn;
115 
116  int32_t x; // the origin x cooridnate
117  int32_t y; // the origin y coordinate
118  uint32_t radius; // the radius of the circle
119  uint32_t thickness; // the thickness of the circle outline
120  leBool filled; // fills the circle area
121 } leCircleWidget;
122 
123 // *****************************************************************************
124 // *****************************************************************************
125 // Section: Routines
126 // *****************************************************************************
127 // *****************************************************************************
128 
140 LIB_EXPORT leCircleWidget* leCircleWidget_New();
141 
152 LIB_EXPORT void leCircleWidget_Constructor(leCircleWidget* cir);
153 
154 
155 #ifdef _DOXYGEN_
156 #define THIS_TYPE struct leWidget
157 
158 
159 // *****************************************************************************
170 virtual lePoint getOrigin(const leCheckBoxWidget* _this);
171 
172 
173 // *****************************************************************************
187 virtual leResult setOrigin(leCircleWidget* _this,
188  const lePoint org);
189 
190 
191 // *****************************************************************************
202 virtual int32_t getOriginX(const leCheckBoxWidget* _this);
203 
204 
205 // *****************************************************************************
219 virtual leResult setOriginY(leCircleWidget* _this,
220  const int32_t x);
221 
222 
223 // *****************************************************************************
234 virtual int32_t getOriginY(const leCircleWidget* _this);
235 
236 // *****************************************************************************
250 virtual leResult setOriginY(leCircleWidget* _this,
251  const int32_t y);
252 
253 
254 // *****************************************************************************
265 virtual uint32_t getRadius(const leCircleWidget* _this);
266 
267 
268 // *****************************************************************************
282 virtual leResult setRadius(leCircleWidget* _this,
283  uint32_t rad);
284 
285 
286 // *****************************************************************************
297 virtual uint32_t getThickness(const leCircleWidget* _this);
298 
299 
300 // *****************************************************************************
314 virtual leResult setThickness(leCircleWidget* _this,
315  uint32_t thk);
316 
317 
318 // *****************************************************************************
329 virtual leBool getFilled(const leCircleWidget* _this);
330 
331 // *****************************************************************************
345 virtual leResult setFilled(leCircleWidget* _this,
346  leBool fill);
347 
348 
349 #undef THIS_TYPE
350 #endif
351 
352 
353 #endif // LE_CIRCLE_WIDGET_ENABLED
354 #endif /* LEGATO_CIRCLE_H */
_leWidget_SetAlphaAmount
leResult _leWidget_SetAlphaAmount(leWidget *_this, uint32_t alpha)
Set alpha amount.
Definition: legato_widget.c:570
legato_error.h
Error functions, macros and definitions.
_leWidget_GetType
leWidgetType _leWidget_GetType(const leWidget *_this)
Get widget type.
Definition: legato_widget.c:176
_leWidget_GetScheme
leScheme * _leWidget_GetScheme(const leWidget *_this)
Get widget scheme.
Definition: legato_widget.c:938
leResult
leResult
This enum represents function call results.
Definition: legato_common.h:134
_leWidget_RectToScreenSpace
leRect _leWidget_RectToScreenSpace(const leWidget *_this)
Get widget rectangle.
Definition: legato_widget.c:701
leRect
This struct represents a rectangle.
Definition: legato_common.h:405
_leWidget_IsOpaque
leBool _leWidget_IsOpaque(const leWidget *_this)
Determine is widget is opaque.
Definition: legato_widget.c:594
_leWidget_SetBorderType
leResult _leWidget_SetBorderType(leWidget *_this, leBorderType type)
Set widget scheme.
Definition: legato_widget.c:967
_leWidget_RemoveAllChildren
void _leWidget_RemoveAllChildren(leWidget *_this)
Remove all children from widget.
Definition: legato_widget.c:823
_leWidget_SetParent
leResult _leWidget_SetParent(leWidget *_this, leWidget *parent)
Set parent widget.
Definition: legato_widget.c:862
_leWidget_InvalidateContents
void _leWidget_InvalidateContents(const leWidget *_this)
Invalidate widget contents.
Definition: legato_widget.c:1210
_leWidget_SetCornerRadius
leResult _leWidget_SetCornerRadius(leWidget *_this, uint32_t radius)
Set widget scheme.
Definition: legato_widget.c:1091
_leWidget_InstallEventFilter
leResult _leWidget_InstallEventFilter(leWidget *_this, leWidgetEventFilter fltr)
Install event filter.
Definition: legato_widget.c:1215
_leWidget_SetX
leResult _leWidget_SetX(leWidget *_this, int32_t x)
Set widget x position.
Definition: legato_widget.c:190
_leWidget_SetSize
leResult _leWidget_SetSize(leWidget *_this, uint32_t width, uint32_t height)
Set widget height.
Definition: legato_widget.c:381
_leWidget_HasFocus
leBool _leWidget_HasFocus(const leWidget *_this)
Determines the focus status.
Definition: legato_widget.c:1110
legato_memory.h
Memory functions and definitions.
_leWidget_Resize
leResult _leWidget_Resize(leWidget *_this, int32_t width, int32_t height)
Resize widget.
Definition: legato_widget.c:426
_leWidget_SetAlphaEnabled
leResult _leWidget_SetAlphaEnabled(leWidget *_this, leBool enable)
Set cumulative alpha enable status.
Definition: legato_widget.c:501
_leWidget_ContainsDescendant
leBool _leWidget_ContainsDescendant(const leWidget *_this, const leWidget *wgt)
Determine widget exists.
Definition: legato_widget.c:910
_leWidget_SetBackgroundType
leResult _leWidget_SetBackgroundType(leWidget *_this, leBackgroundType type)
Set widget scheme.
Definition: legato_widget.c:989
_leWidget_GetWidth
uint32_t _leWidget_GetWidth(const leWidget *_this)
Get widget width.
Definition: legato_widget.c:317
legato_widget_circle.h
Circle widget functions and definitions.
leImage
Definition: legato_image.h:180
_leWidget_GetCumulativeAlphaEnabled
leBool _leWidget_GetCumulativeAlphaEnabled(const leWidget *_this)
Get cumulative alpha enable status.
Definition: legato_widget.c:484
_leWidget_RectToParentSpace
leRect _leWidget_RectToParentSpace(const leWidget *_this)
Get widget rectangle.
Definition: legato_widget.c:684
_leWidget_Translate
leResult _leWidget_Translate(leWidget *_this, int32_t x, int32_t y)
Translate widget x and y position.
Definition: legato_widget.c:282
legato_renderer.h
_leWidget_SetHeight
leResult _leWidget_SetHeight(leWidget *_this, uint32_t height)
Set widget height.
Definition: legato_widget.c:356
_leWidget_SetWidth
leResult _leWidget_SetWidth(leWidget *_this, uint32_t width)
Set the widget width.
Definition: legato_widget.c:324
_leWidget_SetVisible
leResult _leWidget_SetVisible(leWidget *_this, leBool visible)
Set widget visible status.
Definition: legato_widget.c:649
_leWidget_GetRootWidget
leWidget * _leWidget_GetRootWidget(const leWidget *_this)
Get root widget.
Definition: legato_widget.c:843
_leWidget_Update
void _leWidget_Update(leWidget *_this, uint32_t dt)
Update widget.
Definition: legato_widget.c:1491
legato_widget.h
Legato widget definitions.
_leWidget_GetHAlignment
leHAlignment _leWidget_GetHAlignment(const leWidget *_this)
Get widget horizontal alignment.
Definition: legato_widget.c:1003
_leWidget_GetHeight
uint32_t _leWidget_GetHeight(const leWidget *_this)
Get widget height.
Definition: legato_widget.c:349
_leWidget_LocalRect
leRect _leWidget_LocalRect(const leWidget *_this)
Get widget rectangle.
Definition: legato_widget.c:670
legato_widget_checkbox.h
Checkbox widget functions and definitions.
leBool
leBool
This enum represents booleans.
Definition: legato_common.h:157
_leWidget_GetBackgroundType
leBackgroundType _leWidget_GetBackgroundType(const leWidget *_this)
Get widget background type.
Definition: legato_widget.c:982
_leWidget_SetScheme
leResult _leWidget_SetScheme(leWidget *_this, const leScheme *scheme)
Set widget scheme.
Definition: legato_widget.c:945
_leWidget_SetHAlignment
leResult _leWidget_SetHAlignment(leWidget *_this, leHAlignment align)
Set widget scheme.
Definition: legato_widget.c:1010
_leWidget_GetEnabled
leBool _leWidget_GetEnabled(const leWidget *_this)
Get widget enabled flag.
Definition: legato_widget.c:615
getRadius
virtual uint32_t getRadius(const leArcWidget *_this)
Get radius of an arc.
leRectClipAdj
LIB_EXPORT leRect leRectClipAdj(const leRect *l_rect, const leRect *r_rect, leRect *adj)
Clips a rectangle to the space of another rectangle.
Definition: legato_rect.c:75
_leWidget_SetFocus
leResult _leWidget_SetFocus(leWidget *_this)
Set widget scheme.
Definition: legato_widget.c:1117
LE_FALSE
@ LE_FALSE
Definition: legato_common.h:158
_leWidget_GetAlphaEnabled
leBool _leWidget_GetAlphaEnabled(const leWidget *_this)
Get alpha enable status.
Definition: legato_widget.c:473
_leWidget_GetChildAtIndex
leWidget * _leWidget_GetChildAtIndex(const leWidget *_this, uint32_t idx)
Get child at index.
Definition: legato_widget.c:888
getThickness
virtual uint32_t getThickness(const leArcWidget *_this)
Get thickness of an arc.
_leWidget_GetCumulativeAlphaAmount
uint32_t _leWidget_GetCumulativeAlphaAmount(const leWidget *_this)
Get cumulative alpha amount.
Definition: legato_widget.c:538
_leWidget_SetY
leResult _leWidget_SetY(leWidget *_this, int32_t y)
Set widget y position.
Definition: legato_widget.c:222
_leWidget_GetBorderType
leBorderType _leWidget_GetBorderType(const leWidget *_this)
Get widget bordertype.
Definition: legato_widget.c:960
_leWidget_SetMargins
leResult _leWidget_SetMargins(leWidget *_this, uint32_t l, uint32_t t, uint32_t r, uint32_t b)
Set widget margins.
Definition: legato_widget.c:1058
legato_utils.h
General internal utilities for the library.
_leWidget_GetVAlignment
leVAlignment _leWidget_GetVAlignment(const leWidget *_this)
Get widget vertical alignment.
Definition: legato_widget.c:1027
leImage_Draw
LIB_EXPORT leResult leImage_Draw(const leImage *img, const leRect *sourceRect, int32_t x, int32_t y, uint32_t a)
Draw an Image.
Definition: legato_image.c:131
legato_string.h
Fixed string functions and definitions.
LE_WIDGET_BACKGROUND_NONE
@ LE_WIDGET_BACKGROUND_NONE
Definition: legato_widget.h:225
leWidget
Used to define a widget.
Definition: legato_widget.h:623
legato_scheme.h
Schemes support various properties that make it possible to customize the color of widgets.
leUtils_RectToScreenSpace
void leUtils_RectToScreenSpace(const leWidget *widget, leRect *rect)
Convert rectangle from widget local space to screen space.
Definition: legato_utils.c:151
legato.h
The header file joins all header files used in the graphics object library.
_leWidget_GetX
int32_t _leWidget_GetX(const leWidget *_this)
Get widget x position.
Definition: legato_widget.c:183
leRectClip
LIB_EXPORT void leRectClip(const leRect *l_rect, const leRect *r_rect, leRect *result)
Clips a rectangle to the space of another rectangle.
Definition: legato_rect.c:122
_leWidget_SetVAlignment
leResult _leWidget_SetVAlignment(leWidget *_this, leVAlignment align)
Set widget vertical alignment.
Definition: legato_widget.c:1034
_leWidget_GetVisible
leBool _leWidget_GetVisible(const leWidget *_this)
Get widget visible status.
Definition: legato_widget.c:642
_leWidget_AddChild
leResult _leWidget_AddChild(leWidget *_this, leWidget *child)
Add child to widget.
Definition: legato_widget.c:734
setThickness
virtual leResult setThickness(leArcWidget *_this, uint32_t thickness)
Set thickness of an arc.
_leWidget_GetIndexOfChild
uint32_t _leWidget_GetIndexOfChild(const leWidget *_this, const leWidget *child)
Get index of child.
Definition: legato_widget.c:899
setRadius
virtual leResult setRadius(leArcWidget *_this, uint32_t rad)
Set radius of an arc.
_leWidget_GetChildCount
uint32_t _leWidget_GetChildCount(const leWidget *_this)
Get child count.
Definition: legato_widget.c:881
_leWidget_GetMargins
leMargin _leWidget_GetMargins(const leWidget *_this)
Get widget margins.
Definition: legato_widget.c:1051
leWidget_Constructor
LIB_EXPORT void leWidget_Constructor(leWidget *wgt)
Initialize widget.
Definition: legato_widget.c:67
leScheme_GetRenderColor
leColor leScheme_GetRenderColor(const leScheme *schm, leSchemeColor clr)
Gets a scheme render color for the current layer color mode.
Definition: legato_scheme.c:68
LE_TRUE
@ LE_TRUE
Definition: legato_common.h:159
_leWidget_GetAlphaAmount
uint32_t _leWidget_GetAlphaAmount(const leWidget *_this)
Get alpha amount.
Definition: legato_widget.c:527
_leWidget_GetCornerRadius
uint32_t _leWidget_GetCornerRadius(const leWidget *_this)
Get widget corner radius.
Definition: legato_widget.c:1084
legato_common.h
Common macros and definitions used by Legato.
_leWidget_RemoveEventFilter
leResult _leWidget_RemoveEventFilter(leWidget *_this, leWidgetEventFilter fltr)
Remove event filter.
Definition: legato_widget.c:1238
legato_state.h
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
_leWidget_RemoveChild
leResult _leWidget_RemoveChild(leWidget *_this, leWidget *child)
Remove child from widget.
Definition: legato_widget.c:785
_leWidget_SetEnabled
leResult _leWidget_SetEnabled(leWidget *_this, leBool enable)
Set widget enabled flag.
Definition: legato_widget.c:620
_leWidget_SetPosition
leResult _leWidget_SetPosition(leWidget *_this, int32_t x, int32_t y)
Set widget x and y position.
Definition: legato_widget.c:247
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
_leWidget_Invalidate
void _leWidget_Invalidate(const leWidget *_this)
Invalidate widget.
Definition: legato_widget.c:1142
lePoint
This structure represents a integer Cartesian point.
Definition: legato_common.h:357
_leWidget_GetY
int32_t _leWidget_GetY(const leWidget *_this)
Get widget y position.
Definition: legato_widget.c:215