GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_scrollbar_reset.c Lines: 11 11 100.0 %
Date: 2024-12-05 08:52:37 Branches: 16 16 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
/**   Scrollbar Management (Scrollbar)                                    */
18
/**                                                                       */
19
/**************************************************************************/
20
21
#define GX_SOURCE_CODE
22
23
/* Include necessary system files.  */
24
25
#include "gx_api.h"
26
#include "gx_scrollbar.h"
27
28
/* Bring in externs for caller checking code.  */
29
GX_CALLER_CHECKING_EXTERNS
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _gxe_scrollbar_reset                                PORTABLE C      */
36
/*                                                           6.3.0        */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Kenneth Maxwell, Microsoft Corporation                              */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This service checks errors in the scrollbar reset function call.    */
44
/*                                                                        */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    scrollbar                             Scrollbar control block       */
49
/*    info                                  Pointer to GX_SCROLL          */
50
/*                                            structure that defines the  */
51
/*                                            scrollbar limits, current   */
52
/*                                            value, and step/increment.  */
53
/*                                                                        */
54
/*  OUTPUT                                                                */
55
/*                                                                        */
56
/*    status               Completion status                              */
57
/*                                                                        */
58
/*  CALLS                                                                 */
59
/*                                                                        */
60
/*    _gx_scrollbar_reset     The actual function                         */
61
/*                                                                        */
62
/*  CALLED BY                                                             */
63
/*                                                                        */
64
/*    Application Code                                                    */
65
/*                                                                        */
66
/*  RELEASE HISTORY                                                       */
67
/*                                                                        */
68
/*    DATE              NAME                      DESCRIPTION             */
69
/*                                                                        */
70
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
71
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
72
/*                                            resulting in version 6.1    */
73
/*  10-31-2023     Ting Zhu                 Modified comment(s),          */
74
/*                                            resulting in version 6.3.0  */
75
/*                                                                        */
76
/**************************************************************************/
77
15
UINT _gxe_scrollbar_reset(GX_SCROLLBAR *scrollbar, GX_SCROLL_INFO *info)
78
{
79
UINT status;
80
81
    /* Check for appropriate caller.  */
82

15
    GX_INIT_AND_THREADS_CALLER_CHECKING
83
84
    /* Check for invalid input pointers.  */
85
13
    if ((scrollbar == GX_NULL))
86
    {
87
2
        return(GX_PTR_ERROR);
88
    }
89
90
    /* Check for invalid widget.  */
91
11
    if (scrollbar -> gx_widget_type == 0)
92
    {
93
2
        return(GX_INVALID_WIDGET);
94
    }
95
96
    /* Check for valid scroll info.  */
97

9
    if ((info != GX_NULL) && ((info -> gx_scroll_value > info -> gx_scroll_maximum) ||
98
2
                              (info -> gx_scroll_value < info -> gx_scroll_minimum)))
99
    {
100
2
        return(GX_INVALID_VALUE);
101
    }
102
103
    /* Call the actual function.  */
104
7
    status = _gx_scrollbar_reset(scrollbar, info);
105
106
    /* Return successful completion.  */
107
7
    return(status);
108
}
109