GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_widget_type_find.c Lines: 9 9 100.0 %
Date: 2026-03-06 19:21:09 Branches: 4 4 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_widget.h"
29
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _gx_widget_type_find                                PORTABLE C      */
36
/*                                                           6.1          */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Kenneth Maxwell, Microsoft Corporation                              */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This service searches for a widget of the requested type.           */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    parent                                Pointer to parent widget to   */
48
/*                                          start search from             */
49
/*    widget_type                           Widget type                   */
50
/*    return_widget                         Pointer to destination for    */
51
/*                                            found widget                */
52
/*                                                                        */
53
/*  OUTPUT                                                                */
54
/*                                                                        */
55
/*    status                                Completion status             */
56
/*                                                                        */
57
/*  CALLS                                                                 */
58
/*                                                                        */
59
/*    None                                                                */
60
/*                                                                        */
61
/*  CALLED BY                                                             */
62
/*                                                                        */
63
/*    Application Code                                                    */
64
/*                                                                        */
65
/**************************************************************************/
66
718
UINT _gx_widget_type_find(GX_WIDGET *parent, USHORT type, GX_WIDGET **return_widget)
67
{
68
GX_WIDGET *child;
69
70
718
    child = parent -> gx_widget_first_child;
71
72
4390
    while (child)
73
    {
74
4239
        if (child -> gx_widget_type == type)
75
        {
76
567
            *return_widget = child;
77
567
            return(GX_SUCCESS);
78
        }
79
3672
        child = child -> gx_widget_next;
80
    }
81
82
151
    *return_widget = GX_NULL;
83
151
    return(GX_NOT_FOUND);
84
}
85