GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_string_scroll_wheel_event_process.c Lines: 19 19 100.0 %
Date: 2024-12-05 08:52:37 Branches: 12 12 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
/**   String Scroll Wheel Management (Scroll Wheel)                       */
18
/**                                                                       */
19
/**************************************************************************/
20
21
#define GX_SOURCE_CODE
22
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_scroll_wheel.h"
28
#include "gx_system.h"
29
30
/**************************************************************************/
31
/*                                                                        */
32
/*  FUNCTION                                               RELEASE        */
33
/*                                                                        */
34
/*    _gx_string_scroll_wheel_event_process               PORTABLE C      */
35
/*                                                           6.1          */
36
/*  AUTHOR                                                                */
37
/*                                                                        */
38
/*    Kenneth Maxwell, Microsoft Corporation                              */
39
/*                                                                        */
40
/*  DESCRIPTION                                                           */
41
/*                                                                        */
42
/*    This function processes the comming events for a string scroll      */
43
/*    wheel widget.                                                       */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    wheel                                 Text scroll wheel control     */
48
/*                                            block                       */
49
/*    event_ptr                             Event to be processed         */
50
/*                                                                        */
51
/*  OUTPUT                                                                */
52
/*                                                                        */
53
/*    status                                Completion status             */
54
/*                                                                        */
55
/*  CALLS                                                                 */
56
/*                                                                        */
57
/*    _gx_system_memory_free                Memory free function          */
58
/*    _gx_scroll_wheel_event_process        Default event process         */
59
/*  CALLED BY                                                             */
60
/*                                                                        */
61
/*    Application Code                                                    */
62
/*    GUIX Internal Code                                                  */
63
/*                                                                        */
64
/*  RELEASE HISTORY                                                       */
65
/*                                                                        */
66
/*    DATE              NAME                      DESCRIPTION             */
67
/*                                                                        */
68
/*  09-30-2020     Kenneth Maxwell          Initial Version 6.1           */
69
/*                                                                        */
70
/**************************************************************************/
71
476
UINT _gx_string_scroll_wheel_event_process(GX_STRING_SCROLL_WHEEL *wheel, GX_EVENT *event_ptr)
72
{
73
74
476
    switch (event_ptr -> gx_event_type)
75
    {
76
8
    case GX_EVENT_DELETE:
77
8
        if (wheel -> gx_widget_style & GX_STYLE_TEXT_COPY)
78
        {
79
7
            if (wheel -> gx_string_scroll_wheel_string_list)
80
            {
81
3
                if (!_gx_system_memory_free)
82
                {
83
1
                    return GX_SYSTEM_MEMORY_ERROR;
84
                }
85
2
                _gx_system_memory_free((void *)wheel -> gx_string_scroll_wheel_string_list);
86
2
                wheel -> gx_string_scroll_wheel_string_list = GX_NULL;
87
            }
88
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
89
6
            if (wheel -> gx_string_scroll_wheel_string_list_deprecated)
90
            {
91
2
                if (!_gx_system_memory_free)
92
                {
93
1
                    return GX_SYSTEM_MEMORY_ERROR;
94
                }
95
96
1
                _gx_system_memory_free((void *)wheel -> gx_string_scroll_wheel_string_list_deprecated);
97
1
                wheel -> gx_string_scroll_wheel_string_list_deprecated = GX_NULL;
98
            }
99
#endif
100
5
            wheel -> gx_string_scroll_wheel_string_list_buffer_size = 0;
101
        }
102
6
        break;
103
104
468
    default:
105
        /* Do nothing. */
106
468
        break;
107
    }
108
109
474
    return _gx_text_scroll_wheel_event_process((GX_TEXT_SCROLL_WHEEL*)wheel, event_ptr);;
110
}
111