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_progress_bar.h"
29 
30 /* Bring in externs for caller checking code.  */
31 GX_CALLER_CHECKING_EXTERNS
32 
33 /**************************************************************************/
34 /*                                                                        */
35 /*  FUNCTION                                               RELEASE        */
36 /*                                                                        */
37 /*    _gxe_progress_bar_create                            PORTABLE C      */
38 /*                                                           6.1          */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Kenneth Maxwell, Microsoft Corporation                              */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    This function checks for errors in the progress bar create call.    */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    progress_bar                          Progress Bar control block    */
50 /*    name                                  Name of prompt                */
51 /*    parent                                Parent widget control block   */
52 /*    progress_bar_info                     Pointer to progress bar info  */
53 /*    style                                 Style of progress bar         */
54 /*    progress_bar_id                       Application-defined ID of     */
55 /*                                            progress bar                */
56 /*    size                                  Dimensions of progress bar    */
57 /*                                                                        */
58 /*  OUTPUT                                                                */
59 /*                                                                        */
60 /*    status                                Completion status             */
61 /*                                                                        */
62 /*  CALLS                                                                 */
63 /*                                                                        */
64 /*    _gx_progress_bar_create               Actual progress bar create    */
65 /*                                             call                       */
66 /*                                                                        */
67 /*  CALLED BY                                                             */
68 /*                                                                        */
69 /*    Application Code                                                    */
70 /*                                                                        */
71 /*  RELEASE HISTORY                                                       */
72 /*                                                                        */
73 /*    DATE              NAME                      DESCRIPTION             */
74 /*                                                                        */
75 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
76 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
77 /*                                            resulting in version 6.1    */
78 /*                                                                        */
79 /**************************************************************************/
_gxe_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,UINT progress_bar_control_block_size)80 UINT  _gxe_progress_bar_create(GX_PROGRESS_BAR *progress_bar, GX_CONST GX_CHAR *name,
81                                GX_WIDGET *parent,
82                                GX_PROGRESS_BAR_INFO *progress_bar_info, ULONG style,
83                                USHORT progress_bar_id,
84                                GX_CONST GX_RECTANGLE *size,
85                                UINT progress_bar_control_block_size)
86 {
87 UINT status;
88 
89     /* Check for invalid caller.  */
90     GX_INIT_AND_THREADS_CALLER_CHECKING
91 
92     /* Check for invalid pointer.  */
93     if ((progress_bar == GX_NULL) || (size == GX_NULL))
94     {
95         return(GX_PTR_ERROR);
96     }
97 
98     /* Check for invalid widget control block size.  */
99     if (progress_bar_control_block_size != sizeof(GX_PROGRESS_BAR))
100     {
101         return(GX_INVALID_SIZE);
102     }
103 
104     /* Check for widget already created.  */
105     if (progress_bar -> gx_widget_type != 0)
106     {
107         return(GX_ALREADY_CREATED);
108     }
109 
110     /* Check for invalid parent widget.  */
111     if (parent && (parent -> gx_widget_type == 0))
112     {
113         return(GX_INVALID_WIDGET);
114     }
115 
116     /* Call actual progress bar create function.  */
117     status = _gx_progress_bar_create(progress_bar, name, parent, progress_bar_info, style, progress_bar_id, size);
118 
119     /* Return completion status.  */
120     return status;
121 }
122 
123