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