MPLABĀ® Harmony Graphics Suite  GFX v3.13.0
Legato API Documentation
legato_widget_progressbar.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_progressbar.h
32 
33  Summary:
34 
35 
36  Description:
37  This module implements progress bar widget functions.
38 *******************************************************************************/
45 #ifndef LEGATO_PROGRESSBAR_H
46 #define LEGATO_PROGRESSBAR_H
47 
49 
50 #if LE_PROGRESSBAR_WIDGET_ENABLED == 1
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
57 
58 // *****************************************************************************
59 // *****************************************************************************
60 // Section: Data Types and Constants
61 // *****************************************************************************
62 // *****************************************************************************
63 
64 // *****************************************************************************
65 /* Enumeration:
66  leProgressBarDirection
67 
68  Summary:
69  Defines the valid values for the progress bar widget fill directions.
70 
71  Description:
72 
73 
74  Remarks:
75  None.
76 */
82 typedef enum leProgressBarDirection
83 {
84  LE_PROGRESSBAR_DIRECTION_RIGHT,
85  LE_PROGRESSBAR_DIRECTION_UP,
86  LE_PROGRESSBAR_DIRECTION_LEFT,
87  LE_PROGRESSBAR_DIRECTION_DOWN
88 } leProgressBarDirection;
89 
90 /* internal use only */typedef struct leProgressBarWidget leProgressBar;
95 // DOM-IGNORE-END
96 
97 // *****************************************************************************
98 /* Function Pointer:
99  leProgressBar_ValueChangedEventCallback
100 
101  Summary:
102  Value changed event function callback type
103 */
113 typedef void (* leProgressBar_ValueChangedEventCallback)(leProgressBar*, uint32_t);
114 
115 /* internal use only */typedef struct leProgressBarWidget leProgressBarWidget;
120 
121 #define LE_PROGRESSBARWIDGET_VTABLE(THIS_TYPE) \
122  LE_WIDGET_VTABLE(THIS_TYPE) \
123  \
124  leProgressBarDirection (*getDirection)(const THIS_TYPE* _this); \
125  leResult (*setDirection)(THIS_TYPE* _this, leProgressBarDirection dir); \
126  uint32_t (*getValue)(const THIS_TYPE* _this); \
127  leResult (*setValue)(THIS_TYPE* _this, uint32_t value); \
128  leProgressBar_ValueChangedEventCallback (*getValueChangedEventCallback)(const THIS_TYPE* _this); \
129  leResult (*setValueChangedCallback)(THIS_TYPE* _this, leProgressBar_ValueChangedEventCallback cb); \
130 
131 typedef struct leProgressBarWidgetVTable
132 {
133  LE_PROGRESSBARWIDGET_VTABLE(leProgressBarWidget)
134 } leProgressBarWidgetVTable;
135 
141 // *****************************************************************************
148 typedef struct leProgressBarWidget
149 {
150  leWidget widget; // base widget class
151 
152  const leProgressBarWidgetVTable* fn;
153 
154  leProgressBarDirection direction; // the fill direction of the bar
155 
156  uint32_t value; // fill percentage
157 
158  leProgressBar_ValueChangedEventCallback cb; // value changed callback
159 } leProgressBarWidget;
160 
161 
162 // *****************************************************************************
163 // *****************************************************************************
164 // Section: Routines
165 // *****************************************************************************
166 // *****************************************************************************
167 
179 leProgressBarWidget* leProgressBarWidget_New(void);
180 
191 void leProgressBarWidget_Constructor(leProgressBarWidget* wgt);
192 
193 #ifdef _DOXYGEN_
194 #define THIS_TYPE struct leWidget
195 
196 // *****************************************************************************
207 virtual leProgressBarDirection getDirection(const leProgressBarWidget* _this);
208 
209 
210 // *****************************************************************************
224 virtual leResult setDirection(leProgressBarWidget* _this,
225  leProgressBarDirection dir);
226 
227 
228 
229 
230 // *****************************************************************************
241 virtual int32_t getValue(const leProgressBarWidget* _this);
242 
243 
244 // *****************************************************************************
258 virtual leResult setValue(leProgressBarWidget* _this,
259  uint32_t value);
260 
261 
272 virtual leProgressBar_ValueChangedEventCallback getValueChangedEventCallback
273  (const leProgressBarWidget* _this);
274 
288 virtual leResult setValueChangedCallback(leProgressBarWidget* _this,
289  leProgressBar_ValueChangedEventCallback cb);
290 
291 #undef THIS_TYPE
292 #endif
293 
294 #ifdef __cplusplus
295 }
296 #endif
297 
298 #endif // LE_PROGRESSBAR_WIDGET_ENABLED
299 #endif /* LEGATO_PROGRESSBAR_H */
Common macros and definitions used by Legato.
leResult
This enum represents function call results.
Definition: legato_common.h:123
Used to define a widget.
Definition: legato_widget.h:624
Legato widget definitions.
Definition: widget.py:1