1 /***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the MIT License which is available at
6 * https://opensource.org/licenses/MIT.
7 *
8 * SPDX-License-Identifier: MIT
9 **************************************************************************/
10
11
12 /**************************************************************************/
13 /**************************************************************************/
14 /** */
15 /** GUIX Component */
16 /** */
17 /** Progress Bar Management (Radial Progress Bar) */
18 /** */
19 /**************************************************************************/
20
21 #define GX_SOURCE_CODE
22
23
24 /* Include necessary system files. */
25
26 #include "gx_api.h"
27 #include "gx_widget.h"
28 #include "gx_utility.h"
29 #include "gx_radial_progress_bar.h"
30
31
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _gx_radial_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 radial progress bar. */
45 /* */
46 /* INPUT */
47 /* */
48 /* progress_bar Progress Bar control block */
49 /* name Name of radial progress bar */
50 /* parent Pointer to parent widget */
51 /* info Pointer to radial progress */
52 /* bar info. */
53 /* style Style of radial progress bar */
54 /* id Application-defined ID of */
55 /* 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_radial_progress_bar_create(GX_RADIAL_PROGRESS_BAR * progress_bar,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_RADIAL_PROGRESS_BAR_INFO * info,ULONG style,USHORT id)79 UINT _gx_radial_progress_bar_create(GX_RADIAL_PROGRESS_BAR *progress_bar,
80 GX_CONST GX_CHAR *name,
81 GX_WIDGET *parent,
82 GX_RADIAL_PROGRESS_BAR_INFO *info,
83 ULONG style,
84 USHORT id)
85 {
86
87 GX_RECTANGLE size;
88
89 _gx_utility_rectangle_define(&size, 0, 0, 0, 0);
90
91 /* Call the widget create function. */
92 _gx_widget_create((GX_WIDGET *)progress_bar, name, GX_NULL, style, id, &size);
93
94 /* Populate the rest of radial progress bar control block - overriding as necessary. */
95 progress_bar -> gx_radial_progress_bar_info = *info;
96 progress_bar -> gx_widget_type = GX_TYPE_RADIAL_PROGRESS_BAR;
97 progress_bar -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_radial_progress_bar_draw;
98 progress_bar -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_radial_progress_bar_event_process;
99
100 #if defined(GX_BRUSH_ALPHA_SUPPORT)
101 memset(&progress_bar -> gx_radial_progress_bar_canvas, 0, sizeof(GX_CANVAS));
102 #endif
103
104 _gx_radial_progress_bar_size_update(progress_bar);
105
106 /* we want this widget to be notified on resize/shift */
107 progress_bar -> gx_widget_status |= GX_STATUS_RESIZE_NOTIFY;
108
109 /* Determine if a parent widget was provided. */
110 if (parent)
111 {
112 _gx_widget_link(parent, (GX_WIDGET *)progress_bar);
113 }
114
115 /* Return the completion status from widget create. */
116 return(GX_SUCCESS);
117 }
118
119