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_pixelmap_prompt.h"
30 
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _gx_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 pixelmap prompt, which is a special type of */
45 /*    widget.                                                             */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    prompt                                Prompt control block          */
50 /*    name                                  Name of prompt                */
51 /*    parent                                Parent widget control block   */
52 /*    text_id                               Resource string id            */
53 /*    fill_id                               pixelmap id for fill area     */
54 /*    style                                 Style of checkbox             */
55 /*    pixelmap_prompt_id                    Application-defined ID of     */
56 /*                                            pixelmap prompt             */
57 /*    size                                  Prompt size                   */
58 /*                                                                        */
59 /*  OUTPUT                                                                */
60 /*                                                                        */
61 /*    status                                Completion status             */
62 /*                                                                        */
63 /*  CALLS                                                                 */
64 /*                                                                        */
65 /*    _gx_prompt_create                     Create the underlying prompt  */
66 /*    _gx_widget_link                       Link the widget to its parent */
67 /*                                                                        */
68 /*  CALLED BY                                                             */
69 /*                                                                        */
70 /*    Application Code                                                    */
71 /*                                                                        */
72 /*  RELEASE HISTORY                                                       */
73 /*                                                                        */
74 /*    DATE              NAME                      DESCRIPTION             */
75 /*                                                                        */
76 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
77 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
78 /*                                            resulting in version 6.1    */
79 /*                                                                        */
80 /**************************************************************************/
_gx_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 pixelmap_prompt_id,GX_CONST GX_RECTANGLE * size)81 UINT  _gx_pixelmap_prompt_create(GX_PIXELMAP_PROMPT *prompt,
82                                  GX_CONST GX_CHAR *name, GX_WIDGET *parent,
83                                  GX_RESOURCE_ID text_id, GX_RESOURCE_ID fill_id,
84                                  ULONG style, USHORT pixelmap_prompt_id,
85                                  GX_CONST GX_RECTANGLE *size)
86 
87 {
88 
89     /* Call the base prompt create function.  */
90     _gx_prompt_create((GX_PROMPT *)prompt, name, GX_NULL, text_id, style, pixelmap_prompt_id, size);
91 
92     /* Populate the rest of prompt control block - overriding as necessary.  */
93     prompt -> gx_widget_type = GX_TYPE_PIXELMAP_PROMPT;
94     prompt -> gx_normal_fill_pixelmap_id = fill_id;
95     prompt -> gx_normal_left_pixelmap_id = 0;
96     prompt -> gx_normal_right_pixelmap_id = 0;
97 
98     prompt -> gx_selected_fill_pixelmap_id = 0;
99     prompt -> gx_selected_left_pixelmap_id = 0;
100     prompt -> gx_selected_right_pixelmap_id = 0;
101 
102     prompt -> gx_widget_draw_function =  (VOID (*)(GX_WIDGET *))_gx_pixelmap_prompt_draw;
103 
104     /* Determine if a parent widget was provided.  */
105     if (parent)
106     {
107         _gx_widget_link(parent, (GX_WIDGET *)prompt);
108     }
109 
110     /* Return the status from prompt create.  */
111     return(GX_SUCCESS);
112 }
113 
114