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