/*************************************************************************** * 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 */ /** */ /** Widget Management (Widget) */ /** */ /**************************************************************************/ #define GX_SOURCE_CODE /* Include necessary system files. */ #include "gx_api.h" #include "gx_system.h" #include "gx_widget.h" #include "gx_utility.h" /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _gx_widget_attach PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* Kenneth Maxwell, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function attached a widget to it's parent, putting the child */ /* in front of all siblings. */ /* */ /* INPUT */ /* */ /* parent Parent widget control block */ /* child child widget control block */ /* */ /* OUTPUT */ /* */ /* status Completion status */ /* */ /* CALLS */ /* */ /* _gx_system_lock Obtain GUIX system lock */ /* _gx_widget_detach Detach from current parent */ /* _gx_widget_link Link widget */ /* _gx_system_unlock Release GUIX system lock */ /* */ /* CALLED BY */ /* */ /* Application Code */ /* GUIX Internal Code */ /* */ /* RELEASE HISTORY */ /* */ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ /* resulting in version 6.1 */ /* */ /**************************************************************************/ UINT _gx_widget_attach(GX_WIDGET *parent, GX_WIDGET *child) { /* lock access to GUIX */ GX_ENTER_CRITICAL if (child -> gx_widget_parent) { _gx_widget_detach(child); } _gx_widget_link(parent, child); child -> gx_widget_status &= ~GX_STATUS_HIDDEN; /* Release the protection. */ GX_EXIT_CRITICAL /* Return successful status. */ return(GX_SUCCESS); }