MPLABĀ® Harmony Graphics Suite
legato_radiobutton_group.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_radiobutton_group.h
32 
33  Summary:
34 
35 
36  Description:
37  This module implements functions to control a radio button group.
38 *******************************************************************************/
39 
46 #ifndef LEGATO_RADIOBUTTON_GROUP_H
47 #define LEGATO_RADIOBUTTON_GROUP_H
48 
50 
51 #if LE_RADIOBUTTON_WIDGET_ENABLED == 1
52 
54 
55 // *****************************************************************************
56 // *****************************************************************************
57 // Section: Data Types and Constants
58 // *****************************************************************************
59 // *****************************************************************************
60 
61 
62 typedef struct leRadioButtonGroup leRadioButtonGroup;
63 typedef struct leRadioButtonWidget leRadioButtonWidget;
64 
65 
66 // *****************************************************************************
67 /* Structure
68  leRadioButtonGroup
69 
70  Summary:
71  Defines the structure used for the Radio Button group.
72 
73  Description:
74  Defines the parameters required for a Radio Button group.
75  Marks the current selected Radio button within the group
76 
77  Remarks:
78  None.
79 
80 */
86 typedef struct leRadioButtonGroup
87 {
88  leArray buttonList;
89 
90  leBool initialized;
91  leRadioButtonWidget* selected;
92 
93 } leRadioButtonGroup;
94 
95 // *****************************************************************************
96 // *****************************************************************************
97 // Section: Routines
98 // *****************************************************************************
99 // *****************************************************************************
100 
101 /* Function:
102  leResult leRadioButtonGroup_Create(leRadioButtonGroup** grp)
103 
104  Summary:
105  This function creates a GFX_GOL_RADIOBUTTON group with the
106  provided button list.
107 
108  Description:
109  This function creates a GFX_GOL_RADIOBUTTON group with the
110  given pointer and the button list provided within the leRadioButtonGroup object.
111 
112  Parameters:
113  leRadioButtnGroup **
114 
115  Returns:
116  leResult
117 
118 */
129 LIB_EXPORT leResult leRadioButtonGroup_Create(leRadioButtonGroup** grp);
130 
131 /* Function:
132  void leRadioButtonGroup_Destroy(leRadioButtonGroup* grp)
133 
134  Summary:
135  This function destroys the GFX_GOL_RADIOBUTTON group
136 
137  Description:
138  This function destroys he GFX_GOL_RADIOBUTTON group with the
139  given pointer. It frees the memory allocated to the button group and clears the button list.
140 
141  Parameters:
142  leRadioButtnGroup *
143 
144  Returns:
145  void
146 
147 */
158 LIB_EXPORT void leRadioButtonGroup_Destroy(leRadioButtonGroup* grp);
159 
160 /* Function:
161  leResult leRadioButtonGroup_AddButton(leRadioButtonGroup* grp,
162  leRadioButtonWidget* btn)
163 
164  Summary:
165  Add a button widget to the button list of the selected Radio button group.
166 
167  Description:
168  Add a button widget to the button list of the selected Radio button group.
169  The function makes sure the radio button grp is valid and the button widget to be added is not already a part of the group.
170  The button is then added as the last button in the group button list
171 
172  Parameters:
173  leRadioButtnGroup *
174  leRadioButtonWidget*
175 
176  Returns:
177  leResult
178 
179 */
190 LIB_EXPORT leResult leRadioButtonGroup_AddButton(leRadioButtonGroup* grp,leRadioButtonWidget* btn);
191 
192 /* Function:
193  leResult leRadioButtonGroup_RemoveButton(leRadioButtonGroup* grp,
194  leRadioButtonWidget* btn);
195 
196  Summary:
197  Remove a button widget to the button list of the selected Radio button group.
198 
199  Description:
200  Remove a button widget to the button list of the selected Radio button group.
201  The function makes sure the radio button grp is valid and the button widget to be removed is a part of the group.
202  The button is then removed properly making sure to handle the list correctly. If the list size is 0, the group is destroyed.
203 
204  Parameters:
205  leRadioButtnGroup *
206  leRadioButtonWidget*
207 
208  Returns:
209  leResult
210 
211 */
222 LIB_EXPORT leResult leRadioButtonGroup_RemoveButton(leRadioButtonGroup* grp,
223  leRadioButtonWidget* btn);
224 
225 /* Function:
226  leResult leRadioButtonGroup_SelectButton(leRadioButtonGroup* grp,
227  leRadioButtonWidget* btn)
228 
229  Summary:
230  Select the button widget specified from the button list for the Radio button group.
231 
232  Description:
233  Select the button widget specified from the button list for the Radio button group.
234  The function makes sure the specified button widget is a part of the group.
235  It deselects the currently selected button widget and reassigns the focus to the button widget specified.
236 
237  Parameters:
238  leRadioButtnGroup *
239  leRadioButtonWidget*
240 
241  Returns:
242  leResult
243 
244 */
257 LIB_EXPORT leResult leRadioButtonGroup_SelectButton(leRadioButtonGroup* grp,
258  leRadioButtonWidget* btn);
259 
260 
261 #endif // LE_RADIOBUTTON_WIDGET_ENABLED
262 #endif /* LEGATO_RADIOBUTTON_GROUP_H */
legato_math.h
Defines common math functions for general use.
legato_error.h
Error functions, macros and definitions.
legato_widget_radiobutton.h
Radiobutton functions and definitions.
leResult
leResult
This enum represents function call results.
Definition: legato_common.h:134
lePercentWholeRounded
LIB_EXPORT uint32_t lePercentWholeRounded(uint32_t l, uint32_t r)
Calculate percent whole rounded.
Definition: legato_math.c:204
leLerp
LIB_EXPORT int32_t leLerp(int32_t x, int32_t y, uint32_t per)
Calculates a linear interpolation of an integer based on a percentage between two signed points.
Definition: legato_math.c:290
leEllipsePoint
LIB_EXPORT leResult leEllipsePoint(int32_t t, int32_t a, int32_t b, int32_t theta, lePoint *p)
Calculates points in an arc.
Definition: legato_math.c:132
leRect
This struct represents a rectangle.
Definition: legato_common.h:405
legato_memory.h
Memory functions and definitions.
leArray_Find
int32_t leArray_Find(const leArray *arr, void *val)
Find a first index of value.
Definition: legato_array.c:242
lePercentOf
LIB_EXPORT uint32_t lePercentOf(uint32_t num, uint32_t percent)
Calculate percent of a number.
Definition: legato_math.c:218
leArray_PushBack
leResult leArray_PushBack(leArray *arr, void *val)
Push value on back.
Definition: legato_array.c:147
legato_renderer.h
leArray
This struct represents a array.
Definition: legato_array.h:61
legato_widget.h
Legato widget definitions.
legato_array.h
An array implementation for storing pointers.
leArray_Create
leResult leArray_Create(leArray *arr)
Create a new array.
Definition: legato_array.c:73
legato_widget_radial_menu.h
Radial menu functions and definitions.
leBool
leBool
This enum represents booleans.
Definition: legato_common.h:157
leUtils_PointToScreenSpace
void leUtils_PointToScreenSpace(const leWidget *widget, lePoint *pnt)
Converts a point from widget space into screen space.
Definition: legato_utils.c:75
LE_FALSE
@ LE_FALSE
Definition: legato_common.h:158
legato_utils.h
General internal utilities for the library.
legato_string.h
Fixed string functions and definitions.
leArray_Clear
leResult leArray_Clear(leArray *arr)
Clear array.
Definition: legato_array.c:279
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.h
The header file joins all header files used in the graphics object library.
legato_radiobutton_group.h
Radiobutton widget functions and definitions.
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
legato_common.h
Common macros and definitions used by Legato.
leArray_Remove
leResult leArray_Remove(leArray *arr, void *val)
Remove value.
Definition: legato_array.c:207
lePoint
This structure represents a integer Cartesian point.
Definition: legato_common.h:357
leList_Get
void * leList_Get(const leList *list, uint32_t idx)
Get a value from the list.
Definition: legato_list.c:181