1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** GUIX Component                                                        */
17 /**                                                                       */
18 /**   Prompt Management (Prompt)                                          */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_widget.h"
29 #include "gx_prompt.h"
30 #include "gx_pixelmap_prompt.h"
31 
32 
33 /**************************************************************************/
34 /*                                                                        */
35 /*  FUNCTION                                               RELEASE        */
36 /*                                                                        */
37 /*    _gx_pixelmap_prompt_create                          PORTABLE C      */
38 /*                                                           6.1          */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Kenneth Maxwell, Microsoft Corporation                              */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    This function creates a pixelmap prompt, which is a special type of */
46 /*    widget.                                                             */
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 /*    fill_id                               pixelmap id for fill area     */
55 /*    style                                 Style of checkbox             */
56 /*    pixelmap_prompt_id                    Application-defined ID of     */
57 /*                                            pixelmap prompt             */
58 /*    size                                  Prompt size                   */
59 /*                                                                        */
60 /*  OUTPUT                                                                */
61 /*                                                                        */
62 /*    status                                Completion status             */
63 /*                                                                        */
64 /*  CALLS                                                                 */
65 /*                                                                        */
66 /*    _gx_prompt_create                     Create the underlying prompt  */
67 /*    _gx_widget_link                       Link the widget to its parent */
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 /**************************************************************************/
_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)82 UINT  _gx_pixelmap_prompt_create(GX_PIXELMAP_PROMPT *prompt,
83                                  GX_CONST GX_CHAR *name, GX_WIDGET *parent,
84                                  GX_RESOURCE_ID text_id, GX_RESOURCE_ID fill_id,
85                                  ULONG style, USHORT pixelmap_prompt_id,
86                                  GX_CONST GX_RECTANGLE *size)
87 
88 {
89 
90     /* Call the base prompt create function.  */
91     _gx_prompt_create((GX_PROMPT *)prompt, name, GX_NULL, text_id, style, pixelmap_prompt_id, size);
92 
93     /* Populate the rest of prompt control block - overriding as necessary.  */
94     prompt -> gx_widget_type = GX_TYPE_PIXELMAP_PROMPT;
95     prompt -> gx_normal_fill_pixelmap_id = fill_id;
96     prompt -> gx_normal_left_pixelmap_id = 0;
97     prompt -> gx_normal_right_pixelmap_id = 0;
98 
99     prompt -> gx_selected_fill_pixelmap_id = 0;
100     prompt -> gx_selected_left_pixelmap_id = 0;
101     prompt -> gx_selected_right_pixelmap_id = 0;
102 
103     prompt -> gx_widget_draw_function =  (VOID (*)(GX_WIDGET *))_gx_pixelmap_prompt_draw;
104 
105     /* Determine if a parent widget was provided.  */
106     if (parent)
107     {
108         _gx_widget_link(parent, (GX_WIDGET *)prompt);
109     }
110 
111     /* Return the status from prompt create.  */
112     return(GX_SUCCESS);
113 }
114 
115