GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_slider_draw.c Lines: 13 13 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
/**   Slider Management (Slider)                                          */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_system.h"
28
#include "gx_display.h"
29
#include "gx_context.h"
30
#include "gx_widget.h"
31
#include "gx_slider.h"
32
33
34
/**************************************************************************/
35
/*                                                                        */
36
/*  FUNCTION                                               RELEASE        */
37
/*                                                                        */
38
/*    _gx_slider_draw                                     PORTABLE C      */
39
/*                                                           6.1          */
40
/*  AUTHOR                                                                */
41
/*                                                                        */
42
/*    Kenneth Maxwell, Microsoft Corporation                              */
43
/*                                                                        */
44
/*  DESCRIPTION                                                           */
45
/*                                                                        */
46
/*    This service draws the specified slider.                            */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    slider                                Widget control block          */
51
/*                                                                        */
52
/*  OUTPUT                                                                */
53
/*                                                                        */
54
/*    None                                                                */
55
/*                                                                        */
56
/*  CALLS                                                                 */
57
/*                                                                        */
58
/*    _gx_system_color_get                  Get the color by resource ID  */
59
/*    _gx_widget_border_draw                Draw border                   */
60
/*    _gx_slider_tickmarks_draw             Draw tickmarks                */
61
/*    _gx_slider_needle_draw                Draw the slider needle        */
62
/*    _gx_widget_children_draw              Draw children widgets         */
63
/*                                                                        */
64
/*  CALLED BY                                                             */
65
/*                                                                        */
66
/*    Application Code                                                    */
67
/*    GUIX Internal Code                                                  */
68
/*                                                                        */
69
/**************************************************************************/
70
125775
VOID  _gx_slider_draw(GX_SLIDER *slider)
71
{
72
GX_RESOURCE_ID fill;
73
74
125775
    if (slider -> gx_widget_style & GX_STYLE_ENABLED)
75
    {
76
125769
        if (slider -> gx_widget_style & GX_STYLE_DRAW_SELECTED)
77
        {
78
18020
            fill = slider -> gx_widget_selected_fill_color;
79
        }
80
        else
81
        {
82
107749
            fill = slider -> gx_widget_normal_fill_color;
83
        }
84
    }
85
    else
86
    {
87
6
        fill = slider -> gx_widget_disabled_fill_color;
88
    }
89
90
125775
    _gx_widget_border_draw((GX_WIDGET *)slider, GX_COLOR_ID_BUTTON_BORDER, fill, fill, GX_TRUE);
91
92
    /* draw the scale */
93
94
125775
    if (slider -> gx_widget_style & GX_STYLE_SHOW_TICKMARKS)
95
    {
96
123845
        _gx_slider_tickmarks_draw((GX_SLIDER *)slider);
97
    }
98
99
125775
    if (slider -> gx_widget_style & GX_STYLE_SHOW_NEEDLE)
100
    {
101
125772
        _gx_slider_needle_draw((GX_SLIDER *)slider);
102
    }
103
104
    /* Draw children widgets of prompt widget.  */
105
125775
    _gx_widget_children_draw((GX_WIDGET *)slider);
106
125775
}
107