GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_text_scroll_wheel_callback_set.c Lines: 8 8 100.0 %
Date: 2024-12-05 08:52:37 Branches: 0 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
/**   Text 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
29
30
/**************************************************************************/
31
/*                                                                        */
32
/*  FUNCTION                                               RELEASE        */
33
/*                                                                        */
34
/*    _gx_text_scroll_wheel_callback_set                  PORTABLE C      */
35
/*                                                           6.1          */
36
/*  AUTHOR                                                                */
37
/*                                                                        */
38
/*    Kenneth Maxwell, Microsoft Corporation                              */
39
/*                                                                        */
40
/*  DESCRIPTION (deprecated)                                              */
41
/*                                                                        */
42
/*    This function updates the pointer to the callback function          */
43
/*    used to determine the string to be displayed at a give wheel row    */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    wheel                                 Text scroll wheel control     */
48
/*                                            block                       */
49
/*    callback                              Scroll wheel text get callback*/
50
/*                                                                        */
51
/*  OUTPUT                                                                */
52
/*                                                                        */
53
/*    status                                Completion status             */
54
/*                                                                        */
55
/*  CALLS                                                                 */
56
/*                                                                        */
57
/*    None                                                                */
58
/*                                                                        */
59
/*  CALLED BY                                                             */
60
/*                                                                        */
61
/*    Application Code                                                    */
62
/*                                                                        */
63
/*  RELEASE HISTORY                                                       */
64
/*                                                                        */
65
/*    DATE              NAME                      DESCRIPTION             */
66
/*                                                                        */
67
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
68
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
69
/*                                            added logic to delete       */
70
/*                                            dynamic bidi text,          */
71
/*                                            resulting in version 6.1    */
72
/*                                                                        */
73
/**************************************************************************/
74
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
75
9
UINT _gx_text_scroll_wheel_callback_set(GX_TEXT_SCROLL_WHEEL *wheel, GX_CONST GX_CHAR *(*callback)(GX_TEXT_SCROLL_WHEEL *, INT))
76
{
77
78
    /* Update event processing function pointer */
79
9
    wheel -> gx_text_scroll_wheel_text_get_deprecated = callback;
80
9
    wheel -> gx_text_scroll_wheel_text_get = GX_NULL;
81
82
#ifdef GX_DYNAMIC_BIDI_TEXT_SUPPORT
83
    _gx_text_scroll_wheel_dynamic_bidi_text_delete(wheel);
84
#endif  // GX_DYNAMIC_BIDI_TEXT_SUPPORT
85
86
9
    return(GX_SUCCESS);
87
}
88
#endif
89
90
/**************************************************************************/
91
/*                                                                        */
92
/*  FUNCTION                                               RELEASE        */
93
/*                                                                        */
94
/*    _gx_text_scroll_wheel_callback_set_ext              PORTABLE C      */
95
/*                                                           6.1          */
96
/*  AUTHOR                                                                */
97
/*                                                                        */
98
/*    Kenneth Maxwell, Microsoft Corporation                              */
99
/*                                                                        */
100
/*  DESCRIPTION                                                           */
101
/*                                                                        */
102
/*    This function updates the pointer to the callback function          */
103
/*    used to determine the string to be displayed at a give wheel row    */
104
/*                                                                        */
105
/*  INPUT                                                                 */
106
/*                                                                        */
107
/*    wheel                                 Text scroll wheel control     */
108
/*                                            block                       */
109
/*    callback                              Scroll wheel text get callback*/
110
/*                                                                        */
111
/*  OUTPUT                                                                */
112
/*                                                                        */
113
/*    status                                Completion status             */
114
/*                                                                        */
115
/*  CALLS                                                                 */
116
/*                                                                        */
117
/*    None                                                                */
118
/*                                                                        */
119
/*  CALLED BY                                                             */
120
/*                                                                        */
121
/*    Application Code                                                    */
122
/*                                                                        */
123
/*  RELEASE HISTORY                                                       */
124
/*                                                                        */
125
/*    DATE              NAME                      DESCRIPTION             */
126
/*                                                                        */
127
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
128
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
129
/*                                            added logic to delete       */
130
/*                                            dynamic bidi text,          */
131
/*                                            resulting in version 6.1    */
132
/*                                                                        */
133
/**************************************************************************/
134
92
UINT _gx_text_scroll_wheel_callback_set_ext(GX_TEXT_SCROLL_WHEEL *wheel, UINT (*callback)(GX_TEXT_SCROLL_WHEEL *, INT, GX_STRING *))
135
{
136
137
    /* Update event processing function pointer */
138
92
    wheel -> gx_text_scroll_wheel_text_get = callback;
139
#if defined(GX_ENABLE_DEPRECATED_STRING_API)
140
92
    wheel -> gx_text_scroll_wheel_text_get_deprecated = GX_NULL;
141
#endif
142
143
#ifdef GX_DYNAMIC_BIDI_TEXT_SUPPORT
144
    _gx_text_scroll_wheel_dynamic_bidi_text_delete(wheel);
145
#endif  // GX_DYNAMIC_BIDI_TEXT_SUPPORT
146
147
92
    return(GX_SUCCESS);
148
}
149