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_icon.h"
29
30 /* Bring in externs for caller checking code. */
31 GX_CALLER_CHECKING_EXTERNS
32
33 /**************************************************************************/
34 /* */
35 /* FUNCTION RELEASE */
36 /* */
37 /* _gxe_icon_create PORTABLE C */
38 /* 6.1 */
39 /* AUTHOR */
40 /* */
41 /* Kenneth Maxwell, Microsoft Corporation */
42 /* */
43 /* DESCRIPTION */
44 /* */
45 /* This function checks for errors in the icon create function call. */
46 /* */
47 /* INPUT */
48 /* */
49 /* icon Pointer to icon control block */
50 /* name Logical name of icon widget */
51 /* parent Pointer to the parent widget */
52 /* pixelmap_id Resource ID of pixelmap */
53 /* style Style of icon */
54 /* icon_id Application-definedID of icon */
55 /* x Starting x-coordinate position*/
56 /* y Starting y-coordinate position*/
57 /* button_control_block_size Size of the button control */
58 /* block */
59 /* */
60 /* */
61 /* OUTPUT */
62 /* */
63 /* status Completion status */
64 /* */
65 /* CALLS */
66 /* */
67 /* _gx_icon_create Actual icon create 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_icon_create(GX_ICON * icon,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_RESOURCE_ID pixelmap_id,ULONG style,USHORT icon_id,GX_VALUE x,GX_VALUE y,UINT icon_control_block_size)82 UINT _gxe_icon_create(GX_ICON *icon, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
83 GX_RESOURCE_ID pixelmap_id, ULONG style, USHORT icon_id,
84 GX_VALUE x, GX_VALUE y, UINT icon_control_block_size)
85 {
86 UINT status;
87
88 /* Check for appropriate caller. */
89 GX_INIT_AND_THREADS_CALLER_CHECKING
90
91 /* Check for invalid input pointers. */
92 if (icon == GX_NULL)
93 {
94 return(GX_PTR_ERROR);
95 }
96
97 if (icon_control_block_size != sizeof(GX_ICON))
98 {
99 return(GX_INVALID_SIZE);
100 }
101
102 /* Check for widget already created. */
103 if (icon -> gx_widget_type != 0)
104 {
105 return(GX_ALREADY_CREATED);
106 }
107
108 /* Call the actual icon create function. */
109 status = _gx_icon_create(icon, name, parent, pixelmap_id, style, icon_id, x, y);
110
111 /* Return completion status. */
112 return status;
113 }
114
115