1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
10 /**************************************************************************/
11
12
13 /**************************************************************************/
14 /**************************************************************************/
15 /** */
16 /** GUIX Component */
17 /** */
18 /** Horizontal List (List) */
19 /** */
20 /**************************************************************************/
21
22 #define GX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "gx_api.h"
28 #include "gx_widget.h"
29 #include "gx_window.h"
30 #include "gx_system.h"
31 #include "gx_scrollbar.h"
32
33 /**************************************************************************/
34 /* */
35 /* FUNCTION RELEASE */
36 /* */
37 /* _gx_vetical_list_create PORTABLE C */
38 /* 6.1.10 */
39 /* AUTHOR */
40 /* */
41 /* Kenneth Maxwell, Microsoft Corporation */
42 /* */
43 /* DESCRIPTION */
44 /* */
45 /* This service creates a horizontal list. */
46 /* */
47 /* INPUT */
48 /* */
49 /* horizontal_list horizontal list widget control */
50 /* block */
51 /* name Name of horizontal list */
52 /* parent Pointer to parent widget */
53 /* total_rows Total number of rows in */
54 /* horizontal list */
55 /* callback Function called to create */
56 /* new widgets when the list */
57 /* is scrolled. */
58 /* style Style of scrollbar widget */
59 /* horizontal_list_id Application-defined ID of */
60 /* horizontal list */
61 /* size Dimensions of horizontal list */
62 /* */
63 /* OUTPUT */
64 /* */
65 /* status Completion status */
66 /* */
67 /* CALLS */
68 /* */
69 /* _gx_window_create Create the underlying window */
70 /* _gx_widget_link Link the widget to its parent */
71 /* */
72 /* CALLED BY */
73 /* */
74 /* Application Code */
75 /* */
76 /* RELEASE HISTORY */
77 /* */
78 /* DATE NAME DESCRIPTION */
79 /* */
80 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
81 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
82 /* resulting in version 6.1 */
83 /* 01-31-2022 Ting Zhu Modified comment(s), */
84 /* initialized new horizontal */
85 /* list control block member, */
86 /* resulting in version 6.1.10 */
87 /* */
88 /**************************************************************************/
_gx_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)89 UINT _gx_horizontal_list_create(GX_HORIZONTAL_LIST *horizontal_list,
90 GX_CONST GX_CHAR *name,
91 GX_WIDGET *parent, INT total_columns,
92 VOID (*callback)(GX_HORIZONTAL_LIST *, GX_WIDGET *, INT),
93 ULONG style, USHORT horizontal_list_id,
94 GX_CONST GX_RECTANGLE *size)
95 {
96
97 /* Call the widget create function. */
98 _gx_window_create((GX_WINDOW *)horizontal_list, name, GX_NULL, style, horizontal_list_id, size);
99
100 horizontal_list -> gx_widget_type = GX_TYPE_HORIZONTAL_LIST;
101 horizontal_list -> gx_widget_status |= GX_STATUS_NAV_PARENT;
102 horizontal_list -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_horizontal_list_event_process;
103
104 horizontal_list -> gx_horizontal_list_total_columns = total_columns;
105 horizontal_list -> gx_horizontal_list_top_index = 0;
106 horizontal_list -> gx_horizontal_list_pen_index = -1;
107 horizontal_list -> gx_horizontal_list_child_width = 1;
108 horizontal_list -> gx_horizontal_list_selected = 0;
109 horizontal_list -> gx_horizontal_list_callback = callback;
110 horizontal_list -> gx_horizontal_list_visible_columns = 0;
111 horizontal_list -> gx_horizontal_list_child_count = 0;
112 horizontal_list -> gx_window_scroll_info_get = _gx_horizontal_list_scroll_info_get;
113 horizontal_list -> gx_horizontal_list_idle_child_list = GX_NULL;
114
115 /* Determine if a parent widget was provided. */
116 if (parent)
117 {
118 _gx_widget_link(parent, (GX_WIDGET *)horizontal_list);
119 }
120
121 /* Return completion status. */
122 return(GX_SUCCESS);
123 }
124
125