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 /** Prompt Management (Prompt) */ 18 /** */ 19 /**************************************************************************/ 20 21 #define GX_SOURCE_CODE 22 23 24 /* Include necessary system files. */ 25 26 #include "gx_api.h" 27 #include "gx_widget.h" 28 #include "gx_prompt.h" 29 #include "gx_utility.h" 30 #include "gx_system.h" 31 32 /**************************************************************************/ 33 /* */ 34 /* FUNCTION RELEASE */ 35 /* */ 36 /* _gx_prompt_event_process PORTABLE C */ 37 /* 6.1 */ 38 /* AUTHOR */ 39 /* */ 40 /* Kenneth Maxwell, Microsoft Corporation */ 41 /* */ 42 /* DESCRIPTION */ 43 /* */ 44 /* This function processes events for the specified prompt. */ 45 /* */ 46 /* INPUT */ 47 /* */ 48 /* prompt Pointer to prompt control */ 49 /* block */ 50 /* event_ptr Incoming event to process */ 51 /* */ 52 /* OUTPUT */ 53 /* */ 54 /* status Completion status */ 55 /* */ 56 /* CALLS */ 57 /* */ 58 /* _gx_system_memory_free Release memory */ 59 /* _gx_utility_bidi_resolved_text_info_delete */ 60 /* Delete dynamic bidi text */ 61 /* _gx_widget_event_process Default widget event process */ 62 /* */ 63 /* CALLED BY */ 64 /* */ 65 /* Application Code */ 66 /* GUIX Internal Code */ 67 /* */ 68 /* RELEASE HISTORY */ 69 /* */ 70 /* DATE NAME DESCRIPTION */ 71 /* */ 72 /* 09-30-2020 Kenneth Maxwell Initial Version 6.1 */ 73 /* */ 74 /**************************************************************************/ _gx_prompt_event_process(GX_PROMPT * prompt,GX_EVENT * event_ptr)75UINT _gx_prompt_event_process(GX_PROMPT *prompt, GX_EVENT *event_ptr) 76 { 77 78 /* Process relative to the type of event. */ 79 switch (event_ptr -> gx_event_type) 80 { 81 case GX_EVENT_DELETE: 82 if ((prompt -> gx_widget_style & GX_STYLE_TEXT_COPY) && prompt -> gx_prompt_string.gx_string_ptr) 83 { 84 if (!_gx_system_memory_free) 85 { 86 return GX_SYSTEM_MEMORY_ERROR; 87 } 88 _gx_system_memory_free((void *)prompt -> gx_prompt_string.gx_string_ptr); 89 prompt -> gx_prompt_string.gx_string_ptr = GX_NULL; 90 prompt -> gx_prompt_string.gx_string_length = 0; 91 } 92 #if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT) 93 94 if (prompt -> gx_prompt_bidi_resolved_text_info) 95 { 96 _gx_utility_bidi_resolved_text_info_delete(&prompt -> gx_prompt_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_widget_event_process((GX_WIDGET*)prompt, event_ptr); 109 } 110 111