GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_radial_progress_bar_info_set.c Lines: 10 10 100.0 %
Date: 2024-12-05 08:52:37 Branches: 6 6 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
/**   Progress Bar Management (Radial Progress Bar)                       */
18
/**                                                                       */
19
/**************************************************************************/
20
21
#define GX_SOURCE_CODE
22
23
/* Include necessary system files.  */
24
25
#include "gx_api.h"
26
#include "gx_system.h"
27
#include "gx_widget.h"
28
#include "gx_radial_progress_bar.h"
29
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _gx_radial_progress_bar_info_set                    PORTABLE C      */
36
/*                                                           6.1          */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Kenneth Maxwell, Microsoft Corporation                              */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This function reset the information structure of a radial progress  */
44
/*      bar                                                               */
45
/*                                                                        */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    bar                                   Radial proress bar control    */
50
/*                                            block                       */
51
/*    info                                  Radial progess bar info block */
52
/*                                                                        */
53
/*  OUTPUT                                                                */
54
/*                                                                        */
55
/*    status                                Completion status             */
56
/*                                                                        */
57
/*  CALLS                                                                 */
58
/*                                                                        */
59
/*    _gx_radial_progrss_bar_size_update    Update the size of the        */
60
/*                                            progress bar                */
61
/*    _gx_system_dirty_mark                 Mark the widget as dirty      */
62
/*                                                                        */
63
/*  CALLED BY                                                             */
64
/*                                                                        */
65
/*    Application Code                                                    */
66
/*    GUIX Internal Code                                                  */
67
/*                                                                        */
68
/*  RELEASE HISTORY                                                       */
69
/*                                                                        */
70
/*    DATE              NAME                      DESCRIPTION             */
71
/*                                                                        */
72
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
73
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
74
/*                                            resulting in version 6.1    */
75
/*                                                                        */
76
/**************************************************************************/
77
946
UINT _gx_radial_progress_bar_info_set(GX_RADIAL_PROGRESS_BAR *bar, GX_RADIAL_PROGRESS_BAR_INFO *info)
78
{
79
80
    /* Copy the new info.  */
81
946
    bar -> gx_radial_progress_bar_info = *info;
82
83
946
    if (info -> gx_radial_progress_bar_info_anchor_val < 0)
84
    {
85
1
        bar -> gx_radial_progress_bar_info.gx_radial_progress_bar_info_anchor_val = 0;
86
    }
87
945
    else if (info -> gx_radial_progress_bar_info_anchor_val > 360)
88
    {
89
1
        bar -> gx_radial_progress_bar_info.gx_radial_progress_bar_info_anchor_val = 360;
90
    }
91
92
    /* Calculate radial progress bar.  */
93
946
    _gx_radial_progress_bar_size_update(bar);
94
95
946
    if (bar -> gx_widget_status & GX_STATUS_VISIBLE)
96
    {
97
        /* Mark the widget area as dirty.  */
98
945
        _gx_system_dirty_mark((GX_WIDGET *)bar);
99
    }
100
101
946
    return(GX_SUCCESS);
102
}
103