1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
10 /**************************************************************************/
11
12
13 /**************************************************************************/
14 /**************************************************************************/
15 /** */
16 /** GUIX Component */
17 /** */
18 /** Progress Bar Management (Progress Bar) */
19 /** */
20 /**************************************************************************/
21
22 #define GX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "gx_api.h"
28 #include "gx_widget.h"
29 #include "gx_progress_bar.h"
30
31
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _gx_progress_bar_create PORTABLE C */
37 /* 6.1 */
38 /* AUTHOR */
39 /* */
40 /* Kenneth Maxwell, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This service creates a progress bar. */
45 /* */
46 /* INPUT */
47 /* */
48 /* progress_bar Progress Bar control block */
49 /* name Name of prompt */
50 /* parent Parent widget control block */
51 /* progress_bar_info Pointer to progress bar info */
52 /* style Style of progress bar */
53 /* progress_bar_id Application-defined ID of */
54 /* progress bar */
55 /* size Dimensions of progress bar */
56 /* */
57 /* OUTPUT */
58 /* */
59 /* status Completion status */
60 /* */
61 /* CALLS */
62 /* */
63 /* _gx_widget_create Create the underlying widget */
64 /* _gx_widget_link Link the widget to its parent */
65 /* */
66 /* CALLED BY */
67 /* */
68 /* Application Code */
69 /* */
70 /* RELEASE HISTORY */
71 /* */
72 /* DATE NAME DESCRIPTION */
73 /* */
74 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
75 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
76 /* resulting in version 6.1 */
77 /* */
78 /**************************************************************************/
_gx_progress_bar_create(GX_PROGRESS_BAR * progress_bar,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_PROGRESS_BAR_INFO * progress_bar_info,ULONG style,USHORT progress_bar_id,GX_CONST GX_RECTANGLE * size)79 UINT _gx_progress_bar_create(GX_PROGRESS_BAR *progress_bar,
80 GX_CONST GX_CHAR *name, GX_WIDGET *parent,
81 GX_PROGRESS_BAR_INFO *progress_bar_info, ULONG style,
82 USHORT progress_bar_id,
83 GX_CONST GX_RECTANGLE *size)
84 {
85
86 /* Call the widget create function. */
87 _gx_widget_create((GX_WIDGET *)progress_bar, name, GX_NULL, style, progress_bar_id, size);
88
89 /* Populate the rest of progress bar control block - overriding as necessary. */
90 progress_bar -> gx_widget_type = GX_TYPE_PROGRESS_BAR;
91 progress_bar -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_progress_bar_draw;
92 progress_bar -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_progress_bar_event_process;
93
94 if (progress_bar_info)
95 {
96 progress_bar -> gx_progress_bar_info = *progress_bar_info;
97 }
98 else
99 {
100 progress_bar -> gx_progress_bar_info.gx_progress_bar_info_max_val = 100;
101 progress_bar -> gx_progress_bar_info.gx_progress_bar_info_min_val = 0;
102 progress_bar -> gx_progress_bar_info.gx_progress_bar_info_current_val = 0;
103 progress_bar -> gx_progress_bar_info.gx_progress_bar_font_id = GX_FONT_ID_DEFAULT;
104 progress_bar -> gx_progress_bar_info.gx_progress_bar_normal_text_color = GX_COLOR_ID_TEXT;
105 progress_bar -> gx_progress_bar_info.gx_progress_bar_selected_text_color = GX_COLOR_ID_SELECTED_TEXT;
106 progress_bar -> gx_progress_bar_info.gx_progress_bar_disabled_text_color = GX_COLOR_ID_DISABLED_TEXT;
107 progress_bar -> gx_progress_bar_info.gx_progress_bar_fill_pixelmap = GX_PIXELMAP_NULL;
108 }
109
110 /* Determine if a parent widget was provided. */
111 if (parent)
112 {
113 _gx_widget_link(parent, (GX_WIDGET *)progress_bar);
114 }
115
116 /* Return the completion status from widget create. */
117 return(GX_SUCCESS);
118 }
119
120