GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_progress_bar_create.c Lines: 18 18 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
/**   Progress Bar Management (Progress Bar)                              */
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_progress_bar.h"
30
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gx_progress_bar_create                             PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This service creates a progress bar.                                */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    progress_bar                          Progress Bar control block    */
49
/*    name                                  Name of prompt                */
50
/*    parent                                Parent widget control block   */
51
/*    progress_bar_info                     Pointer to progress bar info  */
52
/*    style                                 Style of progress bar         */
53
/*    progress_bar_id                       Application-defined ID of     */
54
/*                                            progress bar                */
55
/*    size                                  Dimensions of progress bar    */
56
/*                                                                        */
57
/*  OUTPUT                                                                */
58
/*                                                                        */
59
/*    status                                Completion status             */
60
/*                                                                        */
61
/*  CALLS                                                                 */
62
/*                                                                        */
63
/*    _gx_widget_create                     Create the underlying widget  */
64
/*    _gx_widget_link                       Link the widget to its parent */
65
/*                                                                        */
66
/*  CALLED BY                                                             */
67
/*                                                                        */
68
/*    Application Code                                                    */
69
/*                                                                        */
70
/**************************************************************************/
71
552
UINT  _gx_progress_bar_create(GX_PROGRESS_BAR *progress_bar,
72
                              GX_CONST GX_CHAR *name, GX_WIDGET *parent,
73
                              GX_PROGRESS_BAR_INFO *progress_bar_info, ULONG style,
74
                              USHORT progress_bar_id,
75
                              GX_CONST GX_RECTANGLE *size)
76
{
77
78
    /* Call the widget create function.  */
79
552
    _gx_widget_create((GX_WIDGET *)progress_bar, name, GX_NULL, style, progress_bar_id, size);
80
81
    /* Populate the rest of progress bar control block - overriding as necessary.  */
82
552
    progress_bar -> gx_widget_type = GX_TYPE_PROGRESS_BAR;
83
552
    progress_bar -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_progress_bar_draw;
84
552
    progress_bar -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_progress_bar_event_process;
85
86
552
    if (progress_bar_info)
87
    {
88
551
        progress_bar -> gx_progress_bar_info = *progress_bar_info;
89
    }
90
    else
91
    {
92
1
        progress_bar -> gx_progress_bar_info.gx_progress_bar_info_max_val = 100;
93
1
        progress_bar -> gx_progress_bar_info.gx_progress_bar_info_min_val = 0;
94
1
        progress_bar -> gx_progress_bar_info.gx_progress_bar_info_current_val = 0;
95
1
        progress_bar -> gx_progress_bar_info.gx_progress_bar_font_id = GX_FONT_ID_DEFAULT;
96
1
        progress_bar -> gx_progress_bar_info.gx_progress_bar_normal_text_color = GX_COLOR_ID_TEXT;
97
1
        progress_bar -> gx_progress_bar_info.gx_progress_bar_selected_text_color = GX_COLOR_ID_SELECTED_TEXT;
98
1
        progress_bar -> gx_progress_bar_info.gx_progress_bar_disabled_text_color = GX_COLOR_ID_DISABLED_TEXT;
99
1
        progress_bar -> gx_progress_bar_info.gx_progress_bar_fill_pixelmap = GX_PIXELMAP_NULL;
100
    }
101
102
    /* Determine if a parent widget was provided.  */
103
552
    if (parent)
104
    {
105
549
        _gx_widget_link(parent, (GX_WIDGET *)progress_bar);
106
    }
107
108
    /* Return the completion status from widget create.  */
109
552
    return(GX_SUCCESS);
110
}
111