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 /** Vertical List (List) */
18 /** */
19 /**************************************************************************/
20
21 #define GX_SOURCE_CODE
22
23
24 /* Include necessary system files. */
25
26 #include "gx_api.h"
27 #include "gx_window.h"
28
29 GX_CALLER_CHECKING_EXTERNS
30
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _gxe_vertical_list_create PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* Kenneth Maxwell, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function checks for errors in the vertical list create */
44 /* function call. */
45 /* */
46 /* INPUT */
47 /* */
48 /* vertical_list Vertical list control block */
49 /* name Name of vertical list */
50 /* parent Pointer to parent widget */
51 /* total_rows Total number of rows in */
52 /* vertical list */
53 /* callback User-specified Callback */
54 /* function */
55 /* style Style of scrollbar widget */
56 /* vertical_list_id Application-defined ID of */
57 /* vertical list */
58 /* size Dimensions of vertical list */
59 /* vertical_list_control_block_size Size of the vertical list */
60 /* control block */
61 /* */
62 /* OUTPUT */
63 /* */
64 /* status Completion status */
65 /* */
66 /* CALLS */
67 /* */
68 /* _gx_vertical_list_create Actual vertical list create */
69 /* function */
70 /* */
71 /* CALLED BY */
72 /* */
73 /* Application Code */
74 /* */
75 /* RELEASE HISTORY */
76 /* */
77 /* DATE NAME DESCRIPTION */
78 /* */
79 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
80 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
81 /* resulting in version 6.1 */
82 /* */
83 /**************************************************************************/
_gxe_vertical_list_create(GX_VERTICAL_LIST * vertical_list,GX_CONST GX_CHAR * name,GX_WIDGET * parent,INT total_rows,VOID (* callback)(GX_VERTICAL_LIST *,GX_WIDGET *,INT),ULONG style,USHORT vertical_list_id,GX_CONST GX_RECTANGLE * size,UINT vertical_list_control_block_size)84 UINT _gxe_vertical_list_create(GX_VERTICAL_LIST *vertical_list, GX_CONST GX_CHAR *name,
85 GX_WIDGET *parent, INT total_rows,
86 VOID (*callback)(GX_VERTICAL_LIST *, GX_WIDGET *, INT),
87 ULONG style, USHORT vertical_list_id, GX_CONST GX_RECTANGLE *size,
88 UINT vertical_list_control_block_size)
89 {
90 UINT status;
91
92 /* Check for appropriate caller. */
93 GX_INIT_AND_THREADS_CALLER_CHECKING
94
95 /* Check for invalid input pointers. */
96 if ((vertical_list == GX_NULL) || (size == GX_NULL))
97 {
98 return GX_PTR_ERROR;
99 }
100
101 if (vertical_list_control_block_size != sizeof(GX_VERTICAL_LIST))
102 {
103 return(GX_INVALID_SIZE);
104 }
105
106 /* Check for id is created. */
107 if (vertical_list -> gx_widget_type != 0)
108 {
109 return(GX_ALREADY_CREATED);
110 }
111
112 /* Check for valid number of rows . */
113 if (total_rows <= 0)
114 {
115 return GX_INVALID_VALUE;
116 }
117
118 /* Check for invalid widget. */
119 if (parent && (parent -> gx_widget_type == 0))
120 {
121 return GX_INVALID_WIDGET;
122 }
123
124 /* Call the actual vertical list create function. */
125 status = _gx_vertical_list_create(vertical_list, name, parent, total_rows, callback, style, vertical_list_id, size);
126
127 /* Return completion status. */
128 return status;
129 }
130
131