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 /** Horizontal 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_horizontal_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 horizontal list create */
44 /* function call. */
45 /* */
46 /* INPUT */
47 /* */
48 /* horizontal_list Horizontal list widget control*/
49 /* block */
50 /* name Name of horizontal list */
51 /* parent Pointer to parent widget */
52 /* total_columns Total number of columsn in */
53 /* horizontal list */
54 /* style Style of scrollbar widget */
55 /* horizontal_list_id Application-defined ID of */
56 /* horizontal list */
57 /* size Dimensions of horizontal list */
58 /* horizontal_list_control_block_size Size of the horizontal list */
59 /* control block */
60 /* */
61 /* OUTPUT */
62 /* */
63 /* status Completion status */
64 /* */
65 /* CALLS */
66 /* */
67 /* _gx_horizontal_list_create Actual horizontal list create */
68 /* function */
69 /* */
70 /* CALLED BY */
71 /* */
72 /* Application Code */
73 /* */
74 /* RELEASE HISTORY */
75 /* */
76 /* DATE NAME DESCRIPTION */
77 /* */
78 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
79 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
80 /* resulting in version 6.1 */
81 /* */
82 /**************************************************************************/
_gxe_horizontal_list_create(GX_HORIZONTAL_LIST * horizontal_list,GX_CONST GX_CHAR * name,GX_WIDGET * parent,INT total_columns,VOID (* callback)(GX_HORIZONTAL_LIST *,GX_WIDGET *,INT),ULONG style,USHORT horizontal_list_id,GX_CONST GX_RECTANGLE * size,UINT horizontal_list_control_block_size)83 UINT _gxe_horizontal_list_create(GX_HORIZONTAL_LIST *horizontal_list,
84 GX_CONST GX_CHAR *name,
85 GX_WIDGET *parent, INT total_columns,
86 VOID (*callback)(GX_HORIZONTAL_LIST *, GX_WIDGET *, INT),
87 ULONG style, USHORT horizontal_list_id,
88 GX_CONST GX_RECTANGLE *size,
89 UINT horizontal_list_control_block_size)
90 {
91 UINT status;
92
93 /* Check for appropriate caller. */
94 GX_INIT_AND_THREADS_CALLER_CHECKING
95
96 /* Check for invalid input pointers. */
97 if ((horizontal_list == GX_NULL) || (size == GX_NULL))
98 {
99 return GX_PTR_ERROR;
100 }
101
102 if (horizontal_list_control_block_size != sizeof(GX_HORIZONTAL_LIST))
103 {
104 return(GX_INVALID_SIZE);
105 }
106
107 /* Check for id is created. */
108 if (horizontal_list -> gx_widget_type != 0)
109 {
110 return GX_ALREADY_CREATED;
111 }
112
113 /* Check for valid number of rows . */
114 if (total_columns <= 0)
115 {
116 return GX_INVALID_VALUE;
117 }
118
119 /* Call the actual horizontal list create function. */
120 status = _gx_horizontal_list_create(horizontal_list, name, parent, total_columns, callback, style, horizontal_list_id, size);
121
122 /* Return completion status. */
123 return status;
124 }
125
126