GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_widget_back_attach.c Lines: 7 7 100.0 %
Date: 2024-12-05 08:52:37 Branches: 2 2 100.0 %

Line Branch Exec Source
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
/**   Widget Management (Widget)                                          */
18
/**                                                                       */
19
/**************************************************************************/
20
21
#define GX_SOURCE_CODE
22
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_system.h"
28
#include "gx_widget.h"
29
#include "gx_utility.h"
30
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gx_widget_back_attach                              PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This function attaches a widget to the parent, in the back of the   */
45
/*    Z order.                                                            */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    parent                                Parent widget control block   */
50
/*    child                                 child widget control block    */
51
/*                                                                        */
52
/*  OUTPUT                                                                */
53
/*                                                                        */
54
/*    status                                Completion status             */
55
/*                                                                        */
56
/*  CALLS                                                                 */
57
/*                                                                        */
58
/*    _gx_system_lock                       Obtain GUIX system lock       */
59
/*    _gx_widget_detach                     Detach widget                 */
60
/*    _gx_widget_back_link                  Link widget in back           */
61
/*    _gx_system_unlock                     Release GUIX system lock      */
62
/*                                                                        */
63
/*  CALLED BY                                                             */
64
/*                                                                        */
65
/*    Application Code                                                    */
66
/*    GUIX Internal Code                                                  */
67
/*                                                                        */
68
/*  RELEASE HISTORY                                                       */
69
/*                                                                        */
70
/*    DATE              NAME                      DESCRIPTION             */
71
/*                                                                        */
72
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
73
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
74
/*                                            resulting in version 6.1    */
75
/*                                                                        */
76
/**************************************************************************/
77
78
559
UINT  _gx_widget_back_attach(GX_WIDGET *parent, GX_WIDGET *child)
79
{
80
    /* lock access to GUIX */
81
559
    GX_ENTER_CRITICAL
82
83
559
    if (child -> gx_widget_parent)
84
    {
85
4
        _gx_widget_detach(child);
86
    }
87
559
    _gx_widget_back_link(parent, child);
88
89
    /* Release the protection.  */
90
559
    GX_EXIT_CRITICAL
91
92
    /* Return successful status.  */
93
559
    return(GX_SUCCESS);
94
}
95