GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_vertical_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
/**   Vertical 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 vertical list.                               */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    vertical_list                         Vertical list control block   */
50
/*    name                                  Name of vertical list         */
51
/*    parent                                Pointer to parent widget      */
52
/*    total_rows                            Total number of rows in       */
53
/*                                            vertical list               */
54
/*    callback                              User-specified Callback       */
55
/*                                            function                    */
56
/*    style                                 Style of scrollbar widget     */
57
/*    vertical_list_id                      Application-defined ID of     */
58
/*                                            vertical list               */
59
/*    size                                  Dimensions of vertical list   */
60
/*                                                                        */
61
/*  OUTPUT                                                                */
62
/*                                                                        */
63
/*    status                                Completion status             */
64
/*                                                                        */
65
/*  CALLS                                                                 */
66
/*                                                                        */
67
/*    _gx_window_create                     Create the underlying window  */
68
/*    _gx_widget_link                       Link the widget to its parent */
69
/*                                                                        */
70
/*  CALLED BY                                                             */
71
/*                                                                        */
72
/*    Application Code                                                    */
73
/*                                                                        */
74
/**************************************************************************/
75
1164
UINT  _gx_vertical_list_create(GX_VERTICAL_LIST *vertical_list,
76
                               GX_CONST GX_CHAR *name,
77
                               GX_WIDGET *parent, INT total_rows,
78
                               VOID (*callback)(GX_VERTICAL_LIST *, GX_WIDGET *, INT),
79
                               ULONG style, USHORT vertical_list_id,
80
                               GX_CONST GX_RECTANGLE *size)
81
{
82
83
    /* Call the widget create function.  */
84
1164
    _gx_window_create((GX_WINDOW *)vertical_list, name, GX_NULL, style, vertical_list_id, size);
85
86
1164
    vertical_list -> gx_widget_type =       GX_TYPE_VERTICAL_LIST;
87
1164
    vertical_list -> gx_widget_status |=    GX_STATUS_NAV_PARENT;
88
1164
    vertical_list -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_vertical_list_event_process;
89
90
1164
    vertical_list -> gx_vertical_list_total_rows = total_rows;
91
1164
    vertical_list -> gx_vertical_list_top_index = 0;
92
1164
    vertical_list -> gx_vertical_list_pen_index = -1;
93
1164
    vertical_list -> gx_vertical_list_child_height = 1;
94
1164
    vertical_list -> gx_vertical_list_selected = 0;
95
1164
    vertical_list -> gx_vertical_list_callback = callback;
96
1164
    vertical_list -> gx_vertical_list_visible_rows = 0;
97
1164
    vertical_list -> gx_vertical_list_child_count = 0;
98
1164
    vertical_list -> gx_window_scroll_info_get = (VOID (*)(struct GX_WINDOW_STRUCT *, ULONG, GX_SCROLL_INFO *))_gx_vertical_list_scroll_info_get;
99
1164
    vertical_list -> gx_vertical_list_idle_child_list = GX_NULL;
100
101
    /* Determine if a parent widget was provided.  */
102
1164
    if (parent)
103
    {
104
601
        _gx_widget_link((GX_WIDGET *)parent, (GX_WIDGET *)vertical_list);
105
    }
106
107
    /* Return completion status.  */
108
1164
    return(GX_SUCCESS);
109
}
110