MPLABĀ® Harmony Graphics Suite  GFX v3.13.0
Legato API Documentation
legato_widget_window.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_window.h
32 
33  Summary:
34  Window Widget
35 
36  Description:
37  This module implements window container widget functions.
38 *******************************************************************************/
39 
46 #ifndef LEGATO_WINDOW_H
47 #define LEGATO_WINDOW_H
48 
50 
51 #if LE_WINDOW_WIDGET_ENABLED == 1
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
60 
61 // *****************************************************************************
62 // *****************************************************************************
63 // Section: Data Types and Constants
64 // *****************************************************************************
65 // *****************************************************************************
66 
67 /* internal use only */typedef struct leWindowWidget leWindowWidget;
72 
73 #define LE_WINDOWWIDGET_VTABLE(THIS_TYPE) \
74  LE_WIDGET_VTABLE(THIS_TYPE) \
75  uint32_t (*getTitleHeight)(const THIS_TYPE* _this); \
76  leResult (*setTitleHeight)(THIS_TYPE* _this, uint32_t ht); \
77  leString* (*getString)(const THIS_TYPE* _this); \
78  leResult (*setString)(THIS_TYPE* _this, const leString* str); \
79  leImage* (*getIcon)(const THIS_TYPE* _this); \
80  leResult (*setIcon)(THIS_TYPE* _this, const leImage* img); \
81  uint32_t (*getIconMargin)(const THIS_TYPE* _this); \
82  leResult (*setIconMargin)(THIS_TYPE* _this, uint32_t mg); \
83 
84 typedef struct leWindowWidgetVTable
85 {
86  LE_WINDOWWIDGET_VTABLE(leWindowWidget)
87 } leWindowWidgetVTable;
88 
94 // *****************************************************************************
95 /* Structure:
96  leWindowWidget
97 
98  Summary:
99  Implementation of a window widget struct
100 
101  Description:
102  A window widget is an extension of a basic panel. It adds a title bar
103  with text and an icon.
104 
105  Remarks:
106  None.
107 */
113 typedef struct leWindowWidget
114 {
115  leWidget widget; // base widget class
116 
117  const leWindowWidgetVTable* fn;
118 
119  uint32_t titleHeight; // title height
120  const leString* title; // title text
121 
122  const leImage* icon; // title icon
123  uint32_t iconMargin; // title icon margin
124 } leWindowWidget;
125 
126 
127 // *****************************************************************************
128 // *****************************************************************************
129 // Section: Routines
130 // *****************************************************************************
131 // *****************************************************************************
132 
144 leWindowWidget* leWindowWidget_New(void);
145 
156 void leWindowWidget_Constructor(leWindowWidget* wgt);
157 
158 #ifdef _DOXYGEN_
159 #define THIS_TYPE struct leWidget
160 
161 // *****************************************************************************
172 virtual uint32_t getTitleHeight(const leWindowWidget* _this);
173 
174 // *****************************************************************************
187 virtual leResult setTitleHeight(leWindowWidget* _this,
188  uint32_t ht);
189 
190 // *****************************************************************************
201 virtual leString* getString(const leWindowWidget* _this);
202 
203 // *****************************************************************************
217 virtual leResult setString(leWindowWidget* _this,
218  const leString* str);
219 
220 
221 // *****************************************************************************
232 virtual leImage* getIcon(const leWindowWidget* _this);
233 
234 // *****************************************************************************
246 virtual leResult setIcon(leWindowWidget* _this,
247  const leImage* img);
248 
249 // *****************************************************************************
260 virtual uint32_t getIconMargin(const leWindowWidget* _this);
261 
262 // *****************************************************************************
275 virtual leResult setIconMargin(const leWindowWidget* this, uint32_t mg);
276 
277 
278 #undef THIS_TYPE
279 #endif
280 
281 #ifdef __cplusplus
282 }
283 #endif
284 
285 #endif // LE_WINDOW_WIDGET_ENABLED
286 #endif /* LEGATO_WINDOW_H */
Common macros and definitions used by Legato.
Image functions and defintions.
Definition: legato_image.h:181
This struct represents a string.
Definition: legato_string.h:107
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
Fixed string functions and definitions.