GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_slider_travel_get.c Lines: 15 15 100.0 %
Date: 2024-12-05 08:52:37 Branches: 2 2 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
/**   Prompt Management (Slider)                                          */
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_display.h"
28
#include "gx_context.h"
29
#include "gx_widget.h"
30
#include "gx_utility.h"
31
#include "gx_slider.h"
32
33
34
35
/**************************************************************************/
36
/*                                                                        */
37
/*  FUNCTION                                               RELEASE        */
38
/*                                                                        */
39
/*    _gx_slider_travel_get                               PORTABLE C      */
40
/*                                                           6.1          */
41
/*  AUTHOR                                                                */
42
/*                                                                        */
43
/*    Kenneth Maxwell, Microsoft Corporation                              */
44
/*                                                                        */
45
/*  DESCRIPTION                                                           */
46
/*                                                                        */
47
/*    This service gets the slider travel.                                */
48
/*                                                                        */
49
/*                                                                        */
50
/*  INPUT                                                                 */
51
/*                                                                        */
52
/*    slider                                Slider control block          */
53
/*    info                                  Pointer to slider info        */
54
/*                                            structure                   */
55
/*    return_min_travel                     Pointer to destination for    */
56
/*                                            for minimum travel value    */
57
/*    return_max_travel                     Pointer to destination for    */
58
/*                                            for maximum travel value    */
59
/*                                                                        */
60
/*  OUTPUT                                                                */
61
/*                                                                        */
62
/*    status                                Completion status             */
63
/*                                                                        */
64
/*  CALLS                                                                 */
65
/*                                                                        */
66
/*    None                                                                */
67
/*                                                                        */
68
/*  CALLED BY                                                             */
69
/*                                                                        */
70
/*    Application Code                                                    */
71
/*    GUIX Internal Code                                                  */
72
/*                                                                        */
73
/*  RELEASE HISTORY                                                       */
74
/*                                                                        */
75
/*    DATE              NAME                      DESCRIPTION             */
76
/*                                                                        */
77
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
78
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
79
/*                                            resulting in version 6.1    */
80
/*                                                                        */
81
/**************************************************************************/
82
286316
UINT _gx_slider_travel_get(GX_SLIDER *slider, GX_SLIDER_INFO *info, INT *return_min_travel, INT *return_max_travel)
83
{
84
286316
INT mintravel = 0;
85
286316
INT maxtravel = 0;
86
87
286316
    if (slider -> gx_widget_style & GX_STYLE_SLIDER_VERTICAL)
88
    {
89
42784
        mintravel = slider -> gx_widget_size.gx_rectangle_top;
90
42784
        maxtravel = slider -> gx_widget_size.gx_rectangle_bottom;
91
92
42784
        mintravel += info -> gx_slider_info_max_travel;
93
42784
        maxtravel -= info -> gx_slider_info_min_travel;
94
    }
95
    else
96
    {
97
243532
        mintravel = slider -> gx_widget_size.gx_rectangle_left;
98
243532
        maxtravel = slider -> gx_widget_size.gx_rectangle_right;
99
100
243532
        mintravel += info -> gx_slider_info_min_travel;
101
243532
        maxtravel -= info -> gx_slider_info_max_travel;
102
    }
103
104
286316
    *return_min_travel = mintravel;
105
286316
    *return_max_travel = maxtravel;
106
107
286316
    return(GX_SUCCESS);
108
}
109