MPLABĀ® Harmony Graphics Suite  GFX v3.13.0
Legato API Documentation
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 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
58 
59 // *****************************************************************************
60 // *****************************************************************************
61 // Section: Data Types and Constants
62 // *****************************************************************************
63 // *****************************************************************************
64 
65 
66 typedef struct leRadioButtonGroup leRadioButtonGroup;
67 typedef struct leRadioButtonWidget leRadioButtonWidget;
68 
69 
70 // *****************************************************************************
71 /* Structure
72  leRadioButtonGroup
73 
74  Summary:
75  Defines the structure used for the Radio Button group.
76 
77  Description:
78  Defines the parameters required for a Radio Button group.
79  Marks the current selected Radio button within the group
80 
81  Remarks:
82  None.
83 
84 */
90 typedef struct leRadioButtonGroup
91 {
92  leArray buttonList;
93 
94  leBool initialized;
95  leRadioButtonWidget* selected;
96 
97 } leRadioButtonGroup;
98 
99 // *****************************************************************************
100 // *****************************************************************************
101 // Section: Routines
102 // *****************************************************************************
103 // *****************************************************************************
104 
105 /* Function:
106  leResult leRadioButtonGroup_Create(leRadioButtonGroup** grp)
107 
108  Summary:
109  This function creates a GFX_GOL_RADIOBUTTON group with the
110  provided button list.
111 
112  Description:
113  This function creates a GFX_GOL_RADIOBUTTON group with the
114  given pointer and the button list provided within the leRadioButtonGroup object.
115 
116  Parameters:
117  leRadioButtnGroup **
118 
119  Returns:
120  leResult
121 
122 */
133 leResult leRadioButtonGroup_Create(leRadioButtonGroup** grp);
134 
135 /* Function:
136  void leRadioButtonGroup_Destroy(leRadioButtonGroup* grp)
137 
138  Summary:
139  This function destroys the radio button group
140 
141  Description:
142  This function destroys he radio button group with the
143  given pointer. It frees the memory allocated to the button group and clears the button list.
144 
145  Parameters:
146  leRadioButtnGroup *
147 
148  Returns:
149  void
150 
151 */
162 void leRadioButtonGroup_Destroy(leRadioButtonGroup* grp);
163 
164 /* Function:
165  leResult leRadioButtonGroup_AddButton(leRadioButtonGroup* grp,
166  leRadioButtonWidget* btn)
167 
168  Summary:
169  Add a button widget to the button list of the selected Radio button group.
170 
171  Description:
172  Add a button widget to the button list of the selected Radio button group.
173  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.
174  The button is then added as the last button in the group button list
175 
176  Parameters:
177  leRadioButtnGroup *
178  leRadioButtonWidget*
179 
180  Returns:
181  leResult
182 
183 */
194 leResult leRadioButtonGroup_AddButton(leRadioButtonGroup* grp, leRadioButtonWidget* btn);
195 
196 /* Function:
197  leResult leRadioButtonGroup_RemoveButton(leRadioButtonGroup* grp,
198  leRadioButtonWidget* btn);
199 
200  Summary:
201  Remove a button widget to the button list of the selected Radio button group.
202 
203  Description:
204  Remove a button widget to the button list of the selected Radio button group.
205  The function makes sure the radio button grp is valid and the button widget to be removed is a part of the group.
206  The button is then removed properly making sure to handle the list correctly. If the list size is 0, the group is destroyed.
207 
208  Parameters:
209  leRadioButtnGroup *
210  leRadioButtonWidget*
211 
212  Returns:
213  leResult
214 
215 */
226 leResult leRadioButtonGroup_RemoveButton(leRadioButtonGroup* grp,
227  leRadioButtonWidget* btn);
228 
229 /* Function:
230  leResult leRadioButtonGroup_SelectButton(leRadioButtonGroup* grp,
231  leRadioButtonWidget* btn)
232 
233  Summary:
234  Select the button widget specified from the button list for the Radio button group.
235 
236  Description:
237  Select the button widget specified from the button list for the Radio button group.
238  The function makes sure the specified button widget is a part of the group.
239  It deselects the currently selected button widget and reassigns the focus to the button widget specified.
240 
241  Parameters:
242  leRadioButtnGroup *
243  leRadioButtonWidget*
244 
245  Returns:
246  leResult
247 
248 */
261 leResult leRadioButtonGroup_SelectButton(leRadioButtonGroup* grp,
262  leRadioButtonWidget* btn);
263 
264 #ifdef __cplusplus
265 }
266 #endif
267 
268 #endif // LE_RADIOBUTTON_WIDGET_ENABLED
269 #endif /* LEGATO_RADIOBUTTON_GROUP_H */
Common macros and definitions used by Legato.
leResult
This enum represents function call results.
Definition: legato_common.h:123
This struct represents a array.
Definition: legato_array.h:64
An array implementation for storing pointers.
leBool
This enum represents booleans.
Definition: legato_common.h:146