/*************************************************************************** * Copyright (c) 2024 Microsoft Corporation * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ /** */ /** GUIX Component */ /** */ /** Text Button Management (Button) */ /** */ /**************************************************************************/ #define GX_SOURCE_CODE /* Include necessary system files. */ #include "gx_api.h" #include "gx_system.h" #include "gx_button.h" #include "gx_utility.h" /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _gx_text_button_text_id_set PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* Kenneth Maxwell, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function assigns a text ID to the specified button. */ /* */ /* */ /* INPUT */ /* */ /* button Button control block */ /* text_id Resource ID of the text string*/ /* */ /* OUTPUT */ /* */ /* status Completion status */ /* */ /* CALLS */ /* */ /* _gx_system_dirty_mark Mark this prompt as dirty */ /* */ /* CALLED BY */ /* */ /* Application Cdoe */ /* */ /* RELEASE HISTORY */ /* */ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ /* added logic to delete */ /* dynamic bidi text, */ /* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _gx_text_button_text_id_set(GX_TEXT_BUTTON *button, GX_RESOURCE_ID text_id) { button -> gx_text_button_text_id = text_id; if (button -> gx_widget_style & GX_STYLE_TEXT_COPY) { if (button -> gx_text_button_string.gx_string_ptr) { _gx_system_memory_free((void *)button -> gx_text_button_string.gx_string_ptr); } } button -> gx_text_button_string.gx_string_ptr = GX_NULL; button -> gx_text_button_string.gx_string_length = 0; #if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT) if (button -> gx_text_button_bidi_resolved_text_info) { _gx_utility_bidi_resolved_text_info_delete(&button -> gx_text_button_bidi_resolved_text_info); } #endif if (button -> gx_widget_status & GX_STATUS_VISIBLE) { _gx_system_dirty_mark((GX_WIDGET *)button); } return(GX_SUCCESS); }