GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_popup_list_event_process.c Lines: 20 20 100.0 %
Date: 2026-03-06 19:21:09 Branches: 7 7 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
/**   Popup 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
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gx_popup_list_event_process                        PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This service processes an event for the vertical list.              */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    popup_list                            Popup List widget control     */
49
/*                                            block                       */
50
/*    event_ptr                             Pointer to event to process   */
51
/*                                                                        */
52
/*  OUTPUT                                                                */
53
/*                                                                        */
54
/*    status                                Completion status             */
55
/*                                                                        */
56
/*  CALLS                                                                 */
57
/*                                                                        */
58
/*    _gx_vertical_list_event_process       Process vertical list events  */
59
/*    [gx_widget_event_process_function]    Widget-specified event        */
60
/*                                            process routine             */
61
/*    _gx_system_dirty_mark                 Mark the widget dirty         */
62
/*                                                                        */
63
/*                                                                        */
64
/*  CALLED BY                                                             */
65
/*                                                                        */
66
/*    Application Code                                                    */
67
/*                                                                        */
68
/**************************************************************************/
69
70
355
UINT  _gx_popup_list_event_process(GX_POPUP_LIST *popup_list, GX_EVENT *event_ptr)
71
{
72
GX_WIDGET        *owner;
73
GX_EVENT          send_event;
74
75
355
GX_VERTICAL_LIST *list = &popup_list -> gx_popup_list_list;
76
77
355
    owner = popup_list -> gx_popup_list_owner;
78
79
355
    memset(&send_event, 0, sizeof(GX_EVENT));
80
81
355
    switch (event_ptr -> gx_event_type)
82
    {
83
11
    case GX_EVENT_FOCUS_LOST:
84
11
        send_event.gx_event_type = GX_EVENT_CLOSE_POPUP;
85
11
        owner -> gx_widget_event_process_function(owner, &send_event);
86
11
        break;
87
88
4
    case GX_EVENT_PEN_UP:
89
        /*Only close popup list after click event. If PEN_UP event is following PEN_DRAG, pen index is -1, and list should not be closed.*/
90
4
        if (list -> gx_vertical_list_pen_index >= 0)
91
        {
92
3
            send_event.gx_event_type = GX_EVENT_CLOSE_POPUP;
93
        }
94
4
        _gx_vertical_list_event_process(list, event_ptr);
95
4
        if (send_event.gx_event_type)
96
        {
97
3
            owner->gx_widget_event_process_function(owner, &send_event);
98
3
            _gx_system_dirty_mark(owner);
99
        }
100
4
        break;
101
102
340
    default:
103
340
        _gx_vertical_list_event_process(list, event_ptr);
104
    }
105
106
355
    return 0;
107
}
108