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 
31 /* Bring in externs for caller checking code.  */
32 GX_CALLER_CHECKING_EXTERNS
33 
34 /**************************************************************************/
35 /*                                                                        */
36 /*  FUNCTION                                               RELEASE        */
37 /*                                                                        */
38 /*    _gxe_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 the prompt create function.          */
47 /*                                                                        */
48 /*  INPUT                                                                 */
49 /*                                                                        */
50 /*    prompt                                Prompt control block          */
51 /*    name                                  Name of prompt                */
52 /*    parent                                Parent widget control block   */
53 /*    text_id                               Resource string id            */
54 /*    style                                 Style of prompt               */
55 /*    prompt_id                             Application-defined ID of     */
56 /*                                            prompt.                     */
57 /*    size                                  Prompt size                   */
58 /*    prompt_control_block_size             Size of the prompt control    */
59 /*                                            block                       */
60 /*                                                                        */
61 /*  OUTPUT                                                                */
62 /*                                                                        */
63 /*    status                                Completion status             */
64 /*                                                                        */
65 /*  CALLS                                                                 */
66 /*                                                                        */
67 /*   _gx_prompt_create                     the actual function            */
68 /*                                                                        */
69 /*  CALLED BY                                                             */
70 /*                                                                        */
71 /*    Application Code                                                    */
72 /*                                                                        */
73 /*  RELEASE HISTORY                                                       */
74 /*                                                                        */
75 /*    DATE              NAME                      DESCRIPTION             */
76 /*                                                                        */
77 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
78 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
79 /*                                            resulting in version 6.1    */
80 /*                                                                        */
81 /**************************************************************************/
_gxe_prompt_create(GX_PROMPT * prompt,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_RESOURCE_ID text_id,ULONG style,USHORT prompt_id,GX_CONST GX_RECTANGLE * size,UINT prompt_control_block_size)82 UINT  _gxe_prompt_create(GX_PROMPT *prompt, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
83                          GX_RESOURCE_ID text_id, ULONG style, USHORT prompt_id,
84                          GX_CONST GX_RECTANGLE *size, UINT prompt_control_block_size)
85 {
86 
87 UINT status;
88 
89     /* Check for appropriate caller.  */
90     GX_INIT_AND_THREADS_CALLER_CHECKING
91 
92     /* Check error for valid pointer. */
93     if ((prompt == GX_NULL) || (size == GX_NULL))
94     {
95         return(GX_PTR_ERROR);
96     }
97 
98     /* Check for widget already created.  */
99     if (prompt -> gx_widget_type != 0)
100     {
101         return(GX_ALREADY_CREATED);
102     }
103 
104     /* Check for invalid control block size. */
105     if (prompt_control_block_size != sizeof(GX_PROMPT))
106     {
107         return(GX_INVALID_SIZE);
108     }
109 
110     status = _gx_prompt_create(prompt, name, parent, text_id, style, prompt_id, size);
111     return(status);
112 }
113 
114