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