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 |
|
|
/** Widget Management (Widget) */ |
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 |
|
|
|
29 |
|
|
/* Bring in externs for caller checking code. */ |
30 |
|
|
GX_CALLER_CHECKING_EXTERNS |
31 |
|
|
|
32 |
|
|
/**************************************************************************/ |
33 |
|
|
/* */ |
34 |
|
|
/* FUNCTION RELEASE */ |
35 |
|
|
/* */ |
36 |
|
|
/* _gxe_widget_create PORTABLE C */ |
37 |
|
|
/* 6.1 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* This function checks for errors in the widget create function call. */ |
45 |
|
|
/* */ |
46 |
|
|
/* INPUT */ |
47 |
|
|
/* */ |
48 |
|
|
/* widget Widget control block */ |
49 |
|
|
/* name Name of widget */ |
50 |
|
|
/* parent Parent widget control block */ |
51 |
|
|
/* style Style of widget */ |
52 |
|
|
/* Id Application-defined ID of */ |
53 |
|
|
/* the widget */ |
54 |
|
|
/* size Widget size */ |
55 |
|
|
/* */ |
56 |
|
|
/* OUTPUT */ |
57 |
|
|
/* */ |
58 |
|
|
/* status Completion status */ |
59 |
|
|
/* */ |
60 |
|
|
/* CALLS */ |
61 |
|
|
/* */ |
62 |
|
|
/* _gx_widget_create Actual widget create function */ |
63 |
|
|
/* */ |
64 |
|
|
/* CALLED BY */ |
65 |
|
|
/* */ |
66 |
|
|
/* Application Code */ |
67 |
|
|
/* */ |
68 |
|
|
/* RELEASE HISTORY */ |
69 |
|
|
/* */ |
70 |
|
|
/* DATE NAME DESCRIPTION */ |
71 |
|
|
/* */ |
72 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
73 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
74 |
|
|
/* resulting in version 6.1 */ |
75 |
|
|
/* */ |
76 |
|
|
/**************************************************************************/ |
77 |
|
9 |
UINT _gxe_widget_create(GX_WIDGET *widget, GX_CONST GX_CHAR *name, GX_WIDGET *parent, |
78 |
|
|
ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size, UINT widget_block_size) |
79 |
|
|
{ |
80 |
|
|
UINT status; |
81 |
|
|
|
82 |
|
|
/* Check for appropriate caller. */ |
83 |
✓✓✓✓ ✓✓ |
9 |
GX_INIT_AND_THREADS_CALLER_CHECKING |
84 |
|
|
|
85 |
|
|
/* Check for invalid input pointers. */ |
86 |
✓✓✓✓
|
7 |
if ((widget == GX_NULL) || (size == GX_NULL)) |
87 |
|
|
{ |
88 |
|
2 |
return(GX_PTR_ERROR); |
89 |
|
|
} |
90 |
|
|
|
91 |
|
|
/* Check for widget already created. */ |
92 |
✓✓ |
5 |
if (widget -> gx_widget_type != 0) |
93 |
|
|
{ |
94 |
|
1 |
return(GX_ALREADY_CREATED); |
95 |
|
|
} |
96 |
|
|
|
97 |
|
|
/* Check for invalid parent widget. */ |
98 |
✓✓✓✓
|
4 |
if (parent && (parent -> gx_widget_type == 0)) |
99 |
|
|
{ |
100 |
|
1 |
return(GX_INVALID_WIDGET); |
101 |
|
|
} |
102 |
|
|
|
103 |
|
|
/* Check for invalid control block size. */ |
104 |
✓✓ |
3 |
if (widget_block_size != sizeof(GX_WIDGET)) |
105 |
|
|
{ |
106 |
|
1 |
return(GX_INVALID_SIZE); |
107 |
|
|
} |
108 |
|
|
|
109 |
|
|
/* Call actual widget create function. */ |
110 |
|
2 |
status = _gx_widget_create(widget, name, parent, style, Id, size); |
111 |
|
|
|
112 |
|
|
/* Return completion status. */ |
113 |
|
2 |
return(status); |
114 |
|
|
} |
115 |
|
|
|