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 #include "gx_utility.h"
29 #include "gx_system.h"
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _gx_text_scroll_wheel_dynamic_bidi_text_delete      PORTABLE C      */
36 /*                                                           6.1          */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Kenneth Maxwell, Microsoft Corporation                              */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function releases dynamic bi-directional text of text scroll   */
44 /*    widget.                                                             */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    wheel                                 Scroll wheel control block    */
49 /*                                                                        */
50 /*  OUTPUT                                                                */
51 /*                                                                        */
52 /*    status                                Completion status             */
53 /*                                                                        */
54 /*  CALLS                                                                 */
55 /*                                                                        */
56 /*    _gx_utility_bidi_resolved_text_info_delete                          */
57 /*                                          Release resolved bidi text    */
58 /*    _gx_system_memory_free                Release memory                */
59 /*                                                                        */
60 /*  CALLED BY                                                             */
61 /*                                                                        */
62 /*    Application Code                                                    */
63 /*                                                                        */
64 /*  RELEASE HISTORY                                                       */
65 /*                                                                        */
66 /*    DATE              NAME                      DESCRIPTION             */
67 /*                                                                        */
68 /*  09-30-2020     Kenneth Maxwell          Initial Version 6.1           */
69 /*                                                                        */
70 /**************************************************************************/
71 #ifdef GX_DYNAMIC_BIDI_TEXT_SUPPORT
_gx_text_scroll_wheel_dynamic_bidi_text_delete(GX_TEXT_SCROLL_WHEEL * wheel)72 UINT  _gx_text_scroll_wheel_dynamic_bidi_text_delete(GX_TEXT_SCROLL_WHEEL *wheel)
73 {
74 UINT status = GX_SUCCESS;
75 INT  row;
76 
77     if (wheel -> gx_text_scroll_wheel_bidi_resolved_text_info)
78     {
79         for (row = 0; row < wheel -> gx_scroll_wheel_total_rows; row++)
80         {
81             if(wheel->gx_text_scroll_wheel_bidi_resolved_text_info[row])
82             {
83                 status = _gx_utility_bidi_resolved_text_info_delete(&wheel -> gx_text_scroll_wheel_bidi_resolved_text_info[row]);
84 
85                 if(status != GX_SUCCESS)
86                 {
87                     return status;
88                 }
89             }
90         }
91 
92         if (!_gx_system_memory_free)
93         {
94             return GX_SYSTEM_MEMORY_ERROR;
95         }
96 
97         _gx_system_memory_free(wheel -> gx_text_scroll_wheel_bidi_resolved_text_info);
98         wheel -> gx_text_scroll_wheel_bidi_resolved_text_info = NULL;
99     }
100 
101     /* Return completion status.  */
102     return status;
103 }
104 #endif
105 
106