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 /**   Prompt Management (Prompt)                                          */
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_prompt.h"
30 #include "gx_system.h"
31 #include "gx_pixelmap_prompt.h"
32 
33 /* Bring in externs for caller checking code.  */
34 GX_CALLER_CHECKING_EXTERNS
35 
36 /**************************************************************************/
37 /*                                                                        */
38 /*  FUNCTION                                               RELEASE        */
39 /*                                                                        */
40 /*    _gxe_pixelmap_prompt_create                         PORTABLE C      */
41 /*                                                           6.1          */
42 /*  AUTHOR                                                                */
43 /*                                                                        */
44 /*    Kenneth Maxwell, Microsoft Corporation                              */
45 /*                                                                        */
46 /*  DESCRIPTION                                                           */
47 /*                                                                        */
48 /*    This function checks errors in the pixelmap prompt create function. */
49 /*                                                                        */
50 /*  INPUT                                                                 */
51 /*                                                                        */
52 /*    prompt                                Prompt control block          */
53 /*    name                                  Name of prompt                */
54 /*    parent                                Parent widget control block   */
55 /*    text_id                               Resource string id            */
56 /*    left_id                               pixelmap id for left end      */
57 /*    fill_id                               pixelmap id for fill area     */
58 /*    style                                 Style of checkbox             */
59 /*    prompt_id                             Application-defined ID of     */
60 /*                                            pixelmap prompt             */
61 /*    size                                  Prompt size                   */
62 /*    pixelmap_prompt_control_block_size    Size of the pixelmap prompt   */
63 /*                                            control block               */
64 /*                                                                        */
65 /*  OUTPUT                                                                */
66 /*                                                                        */
67 /*    status                                Completion status             */
68 /*                                                                        */
69 /*  CALLS                                                                 */
70 /*                                                                        */
71 /*    _gx_pixelmap_prompt_create            The actual function           */
72 /*                                                                        */
73 /*  CALLED BY                                                             */
74 /*                                                                        */
75 /*    Application Code                                                    */
76 /*                                                                        */
77 /*  RELEASE HISTORY                                                       */
78 /*                                                                        */
79 /*    DATE              NAME                      DESCRIPTION             */
80 /*                                                                        */
81 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
82 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
83 /*                                            resulting in version 6.1    */
84 /*                                                                        */
85 /**************************************************************************/
_gxe_pixelmap_prompt_create(GX_PIXELMAP_PROMPT * prompt,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_RESOURCE_ID text_id,GX_RESOURCE_ID fill_id,ULONG style,USHORT prompt_id,GX_CONST GX_RECTANGLE * size,UINT pixelmap_prompt_control_block_size)86 UINT  _gxe_pixelmap_prompt_create(GX_PIXELMAP_PROMPT *prompt,
87                                   GX_CONST GX_CHAR *name,
88                                   GX_WIDGET *parent, GX_RESOURCE_ID text_id,
89                                   GX_RESOURCE_ID fill_id, ULONG style,
90                                   USHORT prompt_id,
91                                   GX_CONST GX_RECTANGLE *size,
92                                   UINT pixelmap_prompt_control_block_size)
93 {
94 
95 UINT status;
96 
97     /* Check for appropriate caller.  */
98     GX_INIT_AND_THREADS_CALLER_CHECKING
99 
100     /* Check for invalid input pointers.  */
101     if ((prompt == GX_NULL) || (size == GX_NULL))
102     {
103         return(GX_PTR_ERROR);
104     }
105 
106     /* Check for invalid widget control block size. */
107     if (pixelmap_prompt_control_block_size != sizeof(GX_PIXELMAP_PROMPT))
108     {
109         return(GX_INVALID_SIZE);
110     }
111 
112     /* Check for widget already created.  */
113     if (prompt -> gx_widget_type != 0)
114     {
115         return(GX_ALREADY_CREATED);
116     }
117 
118     status = _gx_pixelmap_prompt_create(prompt, name, parent, text_id, fill_id, style, prompt_id, size);
119     return(status);
120 }
121 
122