GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_widget_back_attach.c Lines: 7 7 100.0 %
Date: 2026-03-06 19:21:09 Branches: 2 2 100.0 %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 * Copyright (c) 2026-present Eclipse ThreadX contributors
4
 *
5
 * This program and the accompanying materials are made available under the
6
 * terms of the MIT License which is available at
7
 * https://opensource.org/licenses/MIT.
8
 *
9
 * SPDX-License-Identifier: MIT
10
 **************************************************************************/
11
12
13
/**************************************************************************/
14
/**************************************************************************/
15
/**                                                                       */
16
/** GUIX Component                                                        */
17
/**                                                                       */
18
/**   Widget Management (Widget)                                          */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
27
#include "gx_api.h"
28
#include "gx_system.h"
29
#include "gx_widget.h"
30
#include "gx_utility.h"
31
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gx_widget_back_attach                              PORTABLE C      */
38
/*                                                           6.1          */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This function attaches a widget to the parent, in the back of the   */
46
/*    Z order.                                                            */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    parent                                Parent widget control block   */
51
/*    child                                 child widget control block    */
52
/*                                                                        */
53
/*  OUTPUT                                                                */
54
/*                                                                        */
55
/*    status                                Completion status             */
56
/*                                                                        */
57
/*  CALLS                                                                 */
58
/*                                                                        */
59
/*    GX_ENTER_CRITICAL                     Obtain GUIX system lock       */
60
/*    _gx_widget_detach                     Detach widget                 */
61
/*    _gx_widget_back_link                  Link widget in back           */
62
/*    GX_EXIT_CRITICAL                      Release GUIX system lock      */
63
/*                                                                        */
64
/*  CALLED BY                                                             */
65
/*                                                                        */
66
/*    Application Code                                                    */
67
/*    GUIX Internal Code                                                  */
68
/*                                                                        */
69
/**************************************************************************/
70
71
559
UINT  _gx_widget_back_attach(GX_WIDGET *parent, GX_WIDGET *child)
72
{
73
    /* lock access to GUIX */
74
559
    GX_ENTER_CRITICAL
75
76
559
    if (child -> gx_widget_parent)
77
    {
78
4
        _gx_widget_detach(child);
79
    }
80
559
    _gx_widget_back_link(parent, child);
81
82
    /* Release the protection.  */
83
559
    GX_EXIT_CRITICAL
84
85
    /* Return successful status.  */
86
559
    return(GX_SUCCESS);
87
}
88