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