GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_drop_list_event_process.c Lines: 22 22 100.0 %
Date: 2024-12-05 08:52:37 Branches: 9 9 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 Management (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
#include "gx_drop_list.h"
32
33
34
#define GX_FLICK_TIMER 1001
35
36
/**************************************************************************/
37
/*                                                                        */
38
/*  FUNCTION                                               RELEASE        */
39
/*                                                                        */
40
/*    _gx_drop_list_event_process                         PORTABLE C      */
41
/*                                                           6.1          */
42
/*  AUTHOR                                                                */
43
/*                                                                        */
44
/*    Kenneth Maxwell, Microsoft Corporation                              */
45
/*                                                                        */
46
/*  DESCRIPTION                                                           */
47
/*                                                                        */
48
/*    This service processes an event for the vertical list.              */
49
/*                                                                        */
50
/*  INPUT                                                                 */
51
/*                                                                        */
52
/*    drop_list                             Drop list widget control block*/
53
/*    event_ptr                             Pointer to event to process   */
54
/*                                                                        */
55
/*  OUTPUT                                                                */
56
/*                                                                        */
57
/*    status                                Completion status             */
58
/*                                                                        */
59
/*  CALLS                                                                 */
60
/*                                                                        */
61
/*    _gx_vertical_list_selected_set        Set the list entry at the     */
62
/*                                          current list index            */
63
/*    _gx_drop_list_close                   Close a drop list             */
64
/*    _gx_drop_list_open                    Open a drop list              */
65
/*    _gx_first_client_child_get            Get the first client child    */
66
/*    _gx_widget_event_process              Process events for the        */
67
/*                                          specified window              */
68
/*                                                                        */
69
/*  CALLED BY                                                             */
70
/*                                                                        */
71
/*    Application Code                                                    */
72
/*                                                                        */
73
/*  RELEASE HISTORY                                                       */
74
/*                                                                        */
75
/*    DATE              NAME                      DESCRIPTION             */
76
/*                                                                        */
77
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
78
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
79
/*                                            resulting in version 6.1    */
80
/*                                                                        */
81
/**************************************************************************/
82
83
212
UINT _gx_drop_list_event_process(GX_DROP_LIST *drop_list, GX_EVENT *event_ptr)
84
{
85
GX_WIDGET *widget;
86
87
212
    widget = (GX_WIDGET *)drop_list;
88
89

212
    switch (event_ptr -> gx_event_type)
90
    {
91
124
    case GX_EVENT_SHOW:
92
124
        _gx_widget_event_process(widget, event_ptr);
93
124
        break;
94
95
36
    case GX_EVENT_HIDE:
96
36
        if (drop_list -> gx_drop_list_popup_open)
97
        {
98
1
            _gx_drop_list_close(drop_list);
99
        }
100
36
        _gx_widget_event_process(widget, event_ptr);
101
36
        break;
102
103
10
    case GX_SIGNAL(ID_DROP_LIST_BUTTON, GX_EVENT_CLICKED):
104
10
        if (drop_list -> gx_drop_list_popup_open)
105
        {
106
2
            _gx_drop_list_close(drop_list);
107
        }
108
        else
109
        {
110
8
            _gx_drop_list_open(drop_list);
111
        }
112
10
        break;
113
114
15
    case GX_EVENT_CLOSE_POPUP:
115
15
        _gx_drop_list_close(drop_list);
116
15
        break;
117
118
27
    default:
119
27
        return _gx_widget_event_process(widget, event_ptr);
120
    }
121
185
    return(GX_SUCCESS);
122
}
123