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 /** Tree View Management (Tree View) */
18 /** */
19 /**************************************************************************/
20
21 #define GX_SOURCE_CODE
22
23
24 /* Include necessary system files. */
25
26 #include "gx_api.h"
27 #include "gx_tree_view.h"
28
29 /* Bring in externs for caller checking code. */
30 GX_CALLER_CHECKING_EXTERNS
31
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _gxe_tree_view_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 tree view create function call. */
45 /* */
46 /* INPUT */
47 /* */
48 /* tree Pointer to the tree view */
49 /* control block */
50 /* name Name of the tree view */
51 /* parent Parent widget control block */
52 /* style Style of the widget */
53 /* tree_id Application-defined ID of */
54 /* the tree view */
55 /* size Tree view size */
56 /* control_block_size Control block size */
57 /* */
58 /* OUTPUT */
59 /* */
60 /* status Completion status */
61 /* */
62 /* CALLS */
63 /* */
64 /* _gx_tree_view_create Actual tree view create */
65 /* function call */
66 /* */
67 /* CALLED BY */
68 /* */
69 /* Application Code */
70 /* */
71 /* RELEASE HISTORY */
72 /* */
73 /* DATE NAME DESCRIPTION */
74 /* */
75 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
76 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
77 /* resulting in version 6.1 */
78 /* */
79 /**************************************************************************/
_gxe_tree_view_create(GX_TREE_VIEW * tree,GX_CONST GX_CHAR * name,GX_WIDGET * parent,ULONG style,USHORT tree_id,GX_CONST GX_RECTANGLE * size,UINT control_block_size)80 UINT _gxe_tree_view_create(GX_TREE_VIEW *tree, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
81 ULONG style, USHORT tree_id, GX_CONST GX_RECTANGLE *size, UINT control_block_size)
82 {
83 UINT status;
84
85 /* Check for appropriate caller. */
86 GX_INIT_AND_THREADS_CALLER_CHECKING
87
88 /* Check for invalid input pointers. */
89 if ((!tree) || (!size))
90 {
91 return(GX_PTR_ERROR);
92 }
93
94 /* Check for widget already created. */
95 if (tree -> gx_widget_type != 0)
96 {
97 return(GX_ALREADY_CREATED);
98 }
99
100 /* Check for invalid control block size. */
101 if (control_block_size != sizeof(GX_TREE_VIEW))
102 {
103 return(GX_INVALID_SIZE);
104 }
105
106 /* Check for invalid parent widget. */
107 if (parent && (parent -> gx_widget_type == 0))
108 {
109 return(GX_INVALID_WIDGET);
110 }
111
112 /* Call actual tree view create function. */
113 status = _gx_tree_view_create(tree, name, parent, style, tree_id, size);
114
115 return(status);
116 }
117
118