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 /** Button Management (Button) */ 18 /** */ 19 /**************************************************************************/ 20 21 #define GX_SOURCE_CODE 22 23 24 /* Include necessary system files. */ 25 26 #include "gx_api.h" 27 #include "gx_button.h" 28 #include "gx_utility.h" 29 #include "gx_system.h" 30 31 /**************************************************************************/ 32 /* */ 33 /* FUNCTION RELEASE */ 34 /* */ 35 /* _gx_text_button_event_process PORTABLE C */ 36 /* 6.1 */ 37 /* AUTHOR */ 38 /* */ 39 /* Kenneth Maxwell, Microsoft Corporation */ 40 /* */ 41 /* DESCRIPTION */ 42 /* */ 43 /* This function processes events for the specified text button. */ 44 /* */ 45 /* INPUT */ 46 /* */ 47 /* button Pointer to text button */ 48 /* control block */ 49 /* event_ptr Incoming event to process */ 50 /* */ 51 /* OUTPUT */ 52 /* */ 53 /* status Completion status */ 54 /* */ 55 /* CALLS */ 56 /* */ 57 /* _gx_utility_bidi_resolved_text_info_delete */ 58 /* Delete dynamic bidi text */ 59 /* _gx_button_event_process Default widget event process */ 60 /* */ 61 /* CALLED BY */ 62 /* */ 63 /* Application Code */ 64 /* GUIX Internal Code */ 65 /* */ 66 /* RELEASE HISTORY */ 67 /* */ 68 /* DATE NAME DESCRIPTION */ 69 /* */ 70 /* 09-30-2020 Kenneth Maxwell Initial Version 6.1 */ 71 /* 06-02-2021 Kenneth Maxwell Modified comment(s), */ 72 /* eliminate fall-through, */ 73 /* resulting in version 6.1.7 */ 74 /* */ 75 /**************************************************************************/ _gx_text_button_event_process(GX_TEXT_BUTTON * button,GX_EVENT * event_ptr)76UINT _gx_text_button_event_process(GX_TEXT_BUTTON *button, GX_EVENT *event_ptr) 77 { 78 79 /* Process relative to the type of event. */ 80 switch (event_ptr -> gx_event_type) 81 { 82 case GX_EVENT_DELETE: 83 if ((button -> gx_widget_style & GX_STYLE_TEXT_COPY) && button -> gx_text_button_string.gx_string_ptr) 84 { 85 if (!_gx_system_memory_free) 86 { 87 return GX_SYSTEM_MEMORY_ERROR; 88 } 89 _gx_system_memory_free((void *)button -> gx_text_button_string.gx_string_ptr); 90 button -> gx_text_button_string.gx_string_ptr = GX_NULL; 91 button -> gx_text_button_string.gx_string_length = 0; 92 } 93 #if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT) 94 if (button -> gx_text_button_bidi_resolved_text_info) 95 { 96 _gx_utility_bidi_resolved_text_info_delete(&button -> gx_text_button_bidi_resolved_text_info); 97 } 98 #endif 99 break; 100 101 default: 102 103 /* Do nothing. */ 104 break; 105 } 106 107 /* Return completion status. */ 108 return _gx_button_event_process((GX_BUTTON*)button, event_ptr); 109 } 110 111