GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_drop_list_open.c Lines: 18 18 100.0 %
Date: 2024-12-05 08:52:37 Branches: 4 4 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
/**   Drop 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_drop_list.h"
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gx_drop_list_open                                  PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This service opens a drop list.                                     */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    drop_list                             Drop list control block       */
49
/*                                                                        */
50
/*  OUTPUT                                                                */
51
/*                                                                        */
52
/*    status                                Completion status             */
53
/*                                                                        */
54
/*  CALLS                                                                 */
55
/*                                                                        */
56
/*    _gx_window_root_find                  Find the root window          */
57
/*    _gx_widget_resize                     Resize a widget               */
58
/*    _gx_vertical_list_children_position   Position the children for     */
59
/*                                          the vertical list             */
60
/*    _gx_widget_link                       Link the widget to its root   */
61
/*    _gx_system_focus_claim                Claim the input focus         */
62
/*                                                                        */
63
/*  CALLED BY                                                             */
64
/*                                                                        */
65
/*    _gx_drop_list_event_process                                         */
66
/*                                                                        */
67
/*  RELEASE HISTORY                                                       */
68
/*                                                                        */
69
/*    DATE              NAME                      DESCRIPTION             */
70
/*                                                                        */
71
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
72
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
73
/*                                            resulting in version 6.1    */
74
/*                                                                        */
75
/**************************************************************************/
76
20
UINT _gx_drop_list_open(GX_DROP_LIST *drop_list)
77
{
78
GX_WINDOW_ROOT   *root;
79
GX_WIDGET        *child;
80
GX_RECTANGLE      size;
81
20
GX_VERTICAL_LIST *list = &drop_list -> gx_drop_list_popup.gx_popup_list_list;
82
83
20
    if (list -> gx_widget_status & GX_STATUS_VISIBLE)
84
    {
85
2
        drop_list -> gx_drop_list_popup_open = GX_TRUE;
86
2
        return(GX_SUCCESS);
87
    }
88
18
    _gx_window_root_find((GX_WIDGET *)drop_list, &root);
89
90
18
    size = drop_list -> gx_widget_size;
91
18
    size.gx_rectangle_top = (GX_VALUE)(size.gx_rectangle_bottom + 1);
92
18
    size.gx_rectangle_bottom = (GX_VALUE)(size.gx_rectangle_top + drop_list -> gx_drop_list_open_height);
93
18
    _gx_widget_resize((GX_WIDGET *)list, &size);
94
18
    _gx_vertical_list_children_position(list);
95
18
    _gx_widget_link((GX_WIDGET *)drop_list -> gx_widget_parent, (GX_WIDGET *)list);
96
97
18
    _gx_vertical_list_selected_widget_get(list, &child);
98
18
    if (child)
99
    {
100
17
        child -> gx_widget_style |= GX_STYLE_DRAW_SELECTED;
101
    }
102
103
18
    drop_list -> gx_drop_list_popup_open = GX_TRUE;
104
18
    _gx_system_focus_claim((GX_WIDGET *)list);
105
106
18
    return(GX_SUCCESS);
107
}
108