GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_horizontal_list_create.c Lines: 18 18 100.0 %
Date: 2024-12-05 08:52:37 Branches: 2 2 100.0 %

Line Branch Exec Source
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_widget.h"
28
#include "gx_window.h"
29
#include "gx_system.h"
30
#include "gx_scrollbar.h"
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gx_vetical_list_create                             PORTABLE C      */
37
/*                                                           6.1.10       */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This service creates a horizontal list.                             */
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_rows                            Total number of rows in       */
53
/*                                        horizontal list                 */
54
/*    callback                            Function called to create       */
55
/*                                          new widgets when the list     */
56
/*                                          is scrolled.                  */
57
/*    style                                 Style of scrollbar widget     */
58
/*    horizontal_list_id                    Application-defined ID of     */
59
/*                                        horizontal list                 */
60
/*    size                                Dimensions of horizontal list   */
61
/*                                                                        */
62
/*  OUTPUT                                                                */
63
/*                                                                        */
64
/*    status                                Completion status             */
65
/*                                                                        */
66
/*  CALLS                                                                 */
67
/*                                                                        */
68
/*    _gx_window_create                     Create the underlying window  */
69
/*    _gx_widget_link                       Link the widget to its parent */
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
/*  01-31-2022     Ting Zhu                 Modified comment(s),          */
83
/*                                            initialized new horizontal  */
84
/*                                            list control block member,  */
85
/*                                            resulting in version 6.1.10 */
86
/*                                                                        */
87
/**************************************************************************/
88
619
UINT  _gx_horizontal_list_create(GX_HORIZONTAL_LIST *horizontal_list,
89
                                 GX_CONST GX_CHAR *name,
90
                                 GX_WIDGET *parent, INT total_columns,
91
                                 VOID (*callback)(GX_HORIZONTAL_LIST *, GX_WIDGET *, INT),
92
                                 ULONG style, USHORT horizontal_list_id,
93
                                 GX_CONST GX_RECTANGLE *size)
94
{
95
96
    /* Call the widget create function.  */
97
619
    _gx_window_create((GX_WINDOW *)horizontal_list, name, GX_NULL, style, horizontal_list_id, size);
98
99
619
    horizontal_list -> gx_widget_type =       GX_TYPE_HORIZONTAL_LIST;
100
619
    horizontal_list -> gx_widget_status |=    GX_STATUS_NAV_PARENT;
101
619
    horizontal_list -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_horizontal_list_event_process;
102
103
619
    horizontal_list -> gx_horizontal_list_total_columns = total_columns;
104
619
    horizontal_list -> gx_horizontal_list_top_index = 0;
105
619
    horizontal_list -> gx_horizontal_list_pen_index = -1;
106
619
    horizontal_list -> gx_horizontal_list_child_width = 1;
107
619
    horizontal_list -> gx_horizontal_list_selected = 0;
108
619
    horizontal_list -> gx_horizontal_list_callback = callback;
109
619
    horizontal_list -> gx_horizontal_list_visible_columns = 0;
110
619
    horizontal_list -> gx_horizontal_list_child_count = 0;
111
619
    horizontal_list -> gx_window_scroll_info_get = _gx_horizontal_list_scroll_info_get;
112
619
    horizontal_list -> gx_horizontal_list_idle_child_list = GX_NULL;
113
114
    /* Determine if a parent widget was provided.  */
115
619
    if (parent)
116
    {
117
618
        _gx_widget_link(parent, (GX_WIDGET *)horizontal_list);
118
    }
119
120
    /* Return completion status.  */
121
619
    return(GX_SUCCESS);
122
}
123