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 /**   Numeric Pixelmap 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_numeric_pixelmap_prompt.h"
29 #include "gx_system.h"
30 
31 /* Bring in externs for caller checking code.  */
32 GX_CALLER_CHECKING_EXTERNS
33 
34 /**************************************************************************/
35 /*                                                                        */
36 /*  FUNCTION                                               RELEASE        */
37 /*                                                                        */
38 /*    _gxe_numeric_pixelmap_prompt_create                 PORTABLE C      */
39 /*                                                           6.1          */
40 /*  AUTHOR                                                                */
41 /*                                                                        */
42 /*    Kenneth Maxwell, Microsoft Corporation                              */
43 /*                                                                        */
44 /*  DESCRIPTION                                                           */
45 /*                                                                        */
46 /*    This function checks errors in numeric prompt create function.      */
47 /*                                                                        */
48 /*  INPUT                                                                 */
49 /*                                                                        */
50 /*    prompt                                Numeric Pixelmap Prompt       */
51 /*                                            control block               */
52 /*    name                                  Name of the widget            */
53 /*    parent                                Parent widget control block   */
54 /*    text_id                               Resource string id            */
55 /*    fill_id                               Pixelmap id for fill area     */
56 /*    style                                 Style of the widget           */
57 /*    pixelmap_prompt_id                    Application-defined ID of     */
58 /*                                            the widget                  */
59 /*    size                                  Dimemsions of the widget      */
60 /*    control_block_size                    The size of the widget control*/
61 /*                                            structure in bytes          */
62 /*                                                                        */
63 /*  OUTPUT                                                                */
64 /*                                                                        */
65 /*    status                                Completion status             */
66 /*                                                                        */
67 /*  CALLS                                                                 */
68 /*                                                                        */
69 /*   _gx_numeric_pixelmap_prompt_create     Actual numeric pixelmap prompt*/
70 /*                                            create call                 */
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_numeric_pixelmap_prompt_create(GX_NUMERIC_PIXELMAP_PROMPT * prompt,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_RESOURCE_ID text_id,GX_RESOURCE_ID fill_id,ULONG style,USHORT pixelmap_prompt_id,GX_CONST GX_RECTANGLE * size,UINT control_block_size)85 UINT  _gxe_numeric_pixelmap_prompt_create(GX_NUMERIC_PIXELMAP_PROMPT *prompt,
86                                           GX_CONST GX_CHAR *name, GX_WIDGET *parent,
87                                           GX_RESOURCE_ID text_id, GX_RESOURCE_ID fill_id,
88                                           ULONG style, USHORT pixelmap_prompt_id,
89                                           GX_CONST GX_RECTANGLE *size,
90                                           UINT control_block_size)
91 {
92 
93 UINT status;
94 
95     /* Check for appropriate caller.  */
96     GX_INIT_AND_THREADS_CALLER_CHECKING
97 
98     /* Check error for valid pointer. */
99     if ((prompt == GX_NULL) || (size == GX_NULL))
100     {
101         return(GX_PTR_ERROR);
102     }
103 
104     /* Check for widget already created.  */
105     if (prompt -> gx_widget_type != 0)
106     {
107         return(GX_ALREADY_CREATED);
108     }
109 
110     if (control_block_size != sizeof(GX_NUMERIC_PIXELMAP_PROMPT))
111     {
112         return(GX_INVALID_SIZE);
113     }
114 
115     /* Call actual numeric pixelmap prompt create. */
116     status = _gx_numeric_pixelmap_prompt_create(prompt, name, parent, text_id, fill_id, style, pixelmap_prompt_id, size);
117 
118     return(status);
119 }
120 
121