GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_checkbox_select.c Lines: 10 10 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
/**   Button Management (Checkbox)                                        */
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
#include "gx_system.h"
31
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gx_checkbox_select                                 PORTABLE C      */
38
/*                                                           6.1          */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This function deselects one button, invalidating and eventing as    */
46
/*    necessary.                                                          */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    checkbox                              Checkbox control block        */
51
/*                                                                        */
52
/*  OUTPUT                                                                */
53
/*                                                                        */
54
/*    status                                Completion status             */
55
/*                                                                        */
56
/*  CALLS                                                                 */
57
/*                                                                        */
58
/*    _gx_widget_event_generate             Generate event to notify      */
59
/*                                             parent widget              */
60
/*    _gx_system_dirty_mark                 Set the dirty flag            */
61
/*                                                                        */
62
/*  CALLED BY                                                             */
63
/*                                                                        */
64
/*    Application Code                                                    */
65
/*                                                                        */
66
/**************************************************************************/
67
55
UINT  _gx_checkbox_select(GX_CHECKBOX *checkbox)
68
{
69
55
GX_WIDGET *widget = (GX_WIDGET *)checkbox;
70
71
55
    if (checkbox -> gx_widget_style & GX_STYLE_ENABLED)
72
    {
73
54
        if (!(checkbox -> gx_widget_style & GX_STYLE_BUTTON_PUSHED))
74
        {
75
28
            checkbox -> gx_widget_style |= GX_STYLE_BUTTON_PUSHED;
76
28
            _gx_widget_event_generate(widget, GX_EVENT_TOGGLE_ON, 0);
77
        }
78
        else
79
        {
80
26
            checkbox -> gx_widget_style &= ~GX_STYLE_BUTTON_PUSHED;
81
26
            _gx_widget_event_generate(widget, GX_EVENT_TOGGLE_OFF, 0);
82
        }
83
84
        /* Mark as dirty.  */
85
54
        _gx_system_dirty_mark(widget);
86
87
    }
88
89
55
    return(GX_SUCCESS);
90
}