GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_horizontal_list_create.c Lines: 18 18 100.0 %
Date: 2026-03-06 19:21:09 Branches: 2 2 100.0 %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 * Copyright (c) 2026-present Eclipse ThreadX contributors
4
 *
5
 * This program and the accompanying materials are made available under the
6
 * terms of the MIT License which is available at
7
 * https://opensource.org/licenses/MIT.
8
 *
9
 * SPDX-License-Identifier: MIT
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
/**************************************************************************/
77
619
UINT  _gx_horizontal_list_create(GX_HORIZONTAL_LIST *horizontal_list,
78
                                 GX_CONST GX_CHAR *name,
79
                                 GX_WIDGET *parent, INT total_columns,
80
                                 VOID (*callback)(GX_HORIZONTAL_LIST *, GX_WIDGET *, INT),
81
                                 ULONG style, USHORT horizontal_list_id,
82
                                 GX_CONST GX_RECTANGLE *size)
83
{
84
85
    /* Call the widget create function.  */
86
619
    _gx_window_create((GX_WINDOW *)horizontal_list, name, GX_NULL, style, horizontal_list_id, size);
87
88
619
    horizontal_list -> gx_widget_type =       GX_TYPE_HORIZONTAL_LIST;
89
619
    horizontal_list -> gx_widget_status |=    GX_STATUS_NAV_PARENT;
90
619
    horizontal_list -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_horizontal_list_event_process;
91
92
619
    horizontal_list -> gx_horizontal_list_total_columns = total_columns;
93
619
    horizontal_list -> gx_horizontal_list_top_index = 0;
94
619
    horizontal_list -> gx_horizontal_list_pen_index = -1;
95
619
    horizontal_list -> gx_horizontal_list_child_width = 1;
96
619
    horizontal_list -> gx_horizontal_list_selected = 0;
97
619
    horizontal_list -> gx_horizontal_list_callback = callback;
98
619
    horizontal_list -> gx_horizontal_list_visible_columns = 0;
99
619
    horizontal_list -> gx_horizontal_list_child_count = 0;
100
619
    horizontal_list -> gx_window_scroll_info_get = _gx_horizontal_list_scroll_info_get;
101
619
    horizontal_list -> gx_horizontal_list_idle_child_list = GX_NULL;
102
103
    /* Determine if a parent widget was provided.  */
104
619
    if (parent)
105
    {
106
618
        _gx_widget_link(parent, (GX_WIDGET *)horizontal_list);
107
    }
108
109
    /* Return completion status.  */
110
619
    return(GX_SUCCESS);
111
}
112