GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_button_siblings_deselect.c Lines: 12 12 100.0 %
Date: 2026-03-06 19:21:09 Branches: 8 8 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
/**   Button Management (Button)                                          */
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
#include "gx_button.h"
30
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gx_button_siblings_deselect                        PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This function deselects all sibling buttons of the caller that      */
45
/*    have GX_STYLE_BUTTON_RADIO style.                                   */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    button                                Button control block          */
50
/*                                                                        */
51
/*  OUTPUT                                                                */
52
/*                                                                        */
53
/*    None                                                                */
54
/*                                                                        */
55
/*  CALLS                                                                 */
56
/*                                                                        */
57
/*    [gx_button_deselect_handler]          Widget-provided deselect      */
58
/*                                            handler routine             */
59
/*                                                                        */
60
/*  CALLED BY                                                             */
61
/*                                                                        */
62
/*    _gx_button_select                                                   */
63
/*                                                                        */
64
/**************************************************************************/
65
72
VOID  _gx_button_siblings_deselect(GX_BUTTON *button)
66
{
67
GX_WIDGET *parent;
68
GX_WIDGET *test;
69
GX_WIDGET *widget;
70
GX_BUTTON *sibling;
71
72
72
    widget = (GX_WIDGET *)button;
73
72
    parent = widget -> gx_widget_parent;
74
72
    test = parent -> gx_widget_first_child;
75
76
531
    while (test)
77
    {
78
        /* not the incoming widget? */
79
459
        if (test != widget)
80
        {
81
            /* is this widget a button? */
82
387
            if (test -> gx_widget_status & GX_STATUS_BUTTON_DERIVED)
83
            {
84
250
                sibling = (GX_BUTTON *)test;
85
86
                /* is this a pushed radio button?  */
87
250
                if ((test -> gx_widget_style & (GX_STYLE_BUTTON_RADIO | GX_STYLE_BUTTON_PUSHED)) ==
88
                    (GX_STYLE_BUTTON_RADIO | GX_STYLE_BUTTON_PUSHED))
89
                {
90
65
                    sibling -> gx_button_deselect_handler(test, GX_TRUE);
91
                }
92
            }
93
        }
94
459
        test = test -> gx_widget_next;
95
    }
96
72
}
97