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_pixelmap_prompt.h"
29 #include "gx_numeric_pixelmap_prompt.h"
30 
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _gx_numeric_pixelmap_prompt_create                  PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Kenneth Maxwell, Microsoft Corporation                              */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This function creates a numeric pixelmap prompt, which is a special */
45 /*    type of widget.                                                     */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    prompt                                Numeric Pixelmap Prompt       */
50 /*                                            control block               */
51 /*    name                                  Name of prompt                */
52 /*    parent                                Parent widget control block   */
53 /*    text_id                               Resource string id            */
54 /*    fill_id                               Pixelmap id for fill area     */
55 /*    style                                 Style of pixelmap prompt      */
56 /*    pixelmap_prompt_id                    Application-defined ID of     */
57 /*                                            numeric pixelmap prompt     */
58 /*    size                                  Dimemsions of numeric pixelmap*/
59 /*                                            prompt                      */
60 /*                                                                        */
61 /*  OUTPUT                                                                */
62 /*                                                                        */
63 /*    status                                Completion status             */
64 /*                                                                        */
65 /*  CALLS                                                                 */
66 /*                                                                        */
67 /*    _gx_pixelmap_prompt_create            Create a pixelmap prompt      */
68 /*    _gx_widget_link                       Link a widget to its parent   */
69 /*                                                                        */
70 /*  CALLED BY                                                             */
71 /*                                                                        */
72 /*    Application Code                                                    */
73 /*                                                                        */
74 /*  RELEASE HISTORY                                                       */
75 /*                                                                        */
76 /*    DATE              NAME                      DESCRIPTION             */
77 /*                                                                        */
78 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
79 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
80 /*                                            resulting in version 6.1    */
81 /*                                                                        */
82 /**************************************************************************/
_gx_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)83 UINT  _gx_numeric_pixelmap_prompt_create(GX_NUMERIC_PIXELMAP_PROMPT *prompt,
84                                          GX_CONST GX_CHAR *name, GX_WIDGET *parent,
85                                          GX_RESOURCE_ID text_id, GX_RESOURCE_ID fill_id,
86                                          ULONG style, USHORT pixelmap_prompt_id,
87                                          GX_CONST GX_RECTANGLE *size)
88 {
89 
90     /* Call the pixelmap prompt create function.  */
91     _gx_pixelmap_prompt_create((GX_PIXELMAP_PROMPT *)prompt, name, parent, text_id, fill_id, style, pixelmap_prompt_id, size);
92 
93     /* Populate the rest of numeric pixelmap prompt control block - overriding as necessary.  */
94     prompt -> gx_widget_type = GX_TYPE_NUMERIC_PIXELMAP_PROMPT;
95     prompt -> gx_numeric_pixelmap_prompt_format_function = _gx_numeric_pixelmap_prompt_format;
96 
97     /* Determine if a parent widget was provided.  */
98     if (parent)
99     {
100         _gx_widget_link(parent, (GX_WIDGET *)prompt);
101     }
102 
103     return(GX_SUCCESS);
104 }
105 
106