GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_menu_event_process.c Lines: 10 10 100.0 %
Date: 2024-12-05 08:52:37 Branches: 6 6 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
/**   Menu Management (Menu)                                              */
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_prompt.h"
29
#include "gx_menu.h"
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _gx_menu_event_process                              PORTABLE C      */
36
/*                                                           6.1.3        */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Kenneth Maxwell, Microsoft Corporation                              */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This function processes events for the specified menu.              */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    menu                                  Pointer to menu control       */
48
/*                                            block                       */
49
/*    event_ptr                             Incoming event to process     */
50
/*                                                                        */
51
/*  OUTPUT                                                                */
52
/*                                                                        */
53
/*    status                                Completion status             */
54
/*                                                                        */
55
/*  CALLS                                                                 */
56
/*                                                                        */
57
/*    _gx_widget_delete                     Delete a widget               */
58
/*    _gx_prompt_event_process              Default prompt event process  */
59
/*                                                                        */
60
/*  CALLED BY                                                             */
61
/*                                                                        */
62
/*    Application Code                                                    */
63
/*    GUIX Internal Code                                                  */
64
/*                                                                        */
65
/*  RELEASE HISTORY                                                       */
66
/*                                                                        */
67
/*    DATE              NAME                      DESCRIPTION             */
68
/*                                                                        */
69
/*  12-31-2020     Kenneth Maxwell          Initial Version 6.1.3         */
70
/*                                                                        */
71
/**************************************************************************/
72
840
UINT  _gx_menu_event_process(GX_MENU *menu, GX_EVENT *event_ptr)
73
{
74
75
    /* Process relative to the type of event.  */
76
840
    switch (event_ptr -> gx_event_type)
77
    {
78
30
    case GX_EVENT_DELETE:
79
30
        if (menu -> gx_menu_list.gx_widget_first_child &&
80
25
            (menu -> gx_menu_list.gx_widget_parent == GX_NULL))
81
        {
82
24
            _gx_widget_delete((GX_WIDGET *)&menu -> gx_menu_list);
83
        }
84
30
        break;
85
86
810
    default:
87
88
        /* Do nothing.  */
89
810
        break;
90
    }
91
92
    /* Return completion status.  */
93
840
    return _gx_prompt_event_process((GX_PROMPT *)menu, event_ptr);
94
}
95