GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_tree_view_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
/**   Tree View Management (Tree View)                                    */
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
#include "gx_widget.h"
29
#include "gx_tree_view.h"
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _gx_tree_view_create                                PORTABLE C      */
36
/*                                                           6.1          */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Kenneth Maxwell, Microsoft Corporation                              */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This function creates an tree view.                                 */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    tree                                  Pointer to the tree view      */
48
/*                                            control block               */
49
/*    name                                  Name of the tree view         */
50
/*    parent                                Parent widget control block   */
51
/*    style                                 Style of the widget           */
52
/*    tree_menu_id                          Application-defined ID of     */
53
/*                                          the tree view                 */
54
/*    size                                  Tree view size                */
55
/*                                                                        */
56
/*  OUTPUT                                                                */
57
/*                                                                        */
58
/*    status                                Completion status             */
59
/*                                                                        */
60
/*  CALLS                                                                 */
61
/*                                                                        */
62
/*    _gx_window_create                     Create a window               */
63
/*    _gx_widget_link                       Link a widget to its parent   */
64
/*                                                                        */
65
/*  CALLED BY                                                             */
66
/*                                                                        */
67
/*    Application Code                                                    */
68
/*                                                                        */
69
/*  RELEASE HISTORY                                                       */
70
/*                                                                        */
71
/*    DATE              NAME                      DESCRIPTION             */
72
/*                                                                        */
73
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
74
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
75
/*                                            fixed compiler warnings,    */
76
/*                                            resulting in version 6.1    */
77
/*                                                                        */
78
/**************************************************************************/
79
544
UINT  _gx_tree_view_create(GX_TREE_VIEW *tree, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
80
                           ULONG style, USHORT tree_menu_id, GX_CONST GX_RECTANGLE *size)
81
{
82
83
    /* Call the window create function.  */
84
544
    _gx_window_create((GX_WINDOW *)tree, name, GX_NULL, style, tree_menu_id, size);
85
86
    /* Populate the rest of the tree view control block - overriding as necessary.  */
87
544
    tree -> gx_widget_type = GX_TYPE_TREE_VIEW;
88
544
    tree -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_tree_view_event_process;
89
544
    tree -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_tree_view_draw;
90
544
    tree -> gx_window_scroll_info_get = (VOID (*)(struct GX_WINDOW_STRUCT *, ULONG, GX_SCROLL_INFO *))(void (*)(void))_gx_tree_view_scroll_info_get;
91
544
    tree -> gx_tree_view_collapse_pixelmap_id = 0;
92
544
    tree -> gx_tree_view_expand_pixelmap_id = 0;
93
544
    tree -> gx_tree_view_root_line_color = GX_COLOR_ID_SHADOW;
94
544
    tree -> gx_tree_view_indentation = 22;
95
544
    tree -> gx_tree_view_x_shift = 0;
96
544
    tree -> gx_tree_view_y_shift = 0;
97
544
    tree -> gx_tree_view_tree_width = 0;
98
544
    tree -> gx_tree_view_tree_height = 0;
99
544
    tree -> gx_tree_view_selected = GX_NULL;
100
101
    /* Determine if a parent widget was provided.  */
102
544
    if (parent)
103
    {
104
542
        _gx_widget_link(parent, (GX_WIDGET *)tree);
105
    }
106
107
    /* Return completion status code. */
108
544
    return(GX_SUCCESS);
109
}
110