GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_scrollbar_reset.c Lines: 11 11 100.0 %
Date: 2026-03-06 19:21:09 Branches: 6 6 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
/**   Scrollbar Management (Scrollbar)                                    */
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_scrollbar.h"
29
30
/**************************************************************************/
31
/*                                                                        */
32
/*  FUNCTION                                               RELEASE        */
33
/*                                                                        */
34
/*    _gx_scrollbar_reset                                 PORTABLE C      */
35
/*                                                           6.1          */
36
/*  AUTHOR                                                                */
37
/*                                                                        */
38
/*    Kenneth Maxwell, Microsoft Corporation                              */
39
/*                                                                        */
40
/*  DESCRIPTION                                                           */
41
/*                                                                        */
42
/*    This service resets the scrollbar.                                  */
43
/*                                                                        */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    scrollbar                             Scrollbar control block       */
48
/*    info                                  Pointer to GX_SCROLL          */
49
/*                                            structure that defines the  */
50
/*                                            scrollbar limits, current   */
51
/*                                            value, and step or          */
52
/*                                            increment.                  */
53
/*                                                                        */
54
/*  OUTPUT                                                                */
55
/*                                                                        */
56
/*    status                                Completion status             */
57
/*                                                                        */
58
/*  CALLS                                                                 */
59
/*                                                                        */
60
/*    [gx_window_scroll_info_get]           Get the window scroll info    */
61
/*    _gx_scrollbar_size_update             Update the scroll size        */
62
/*    _gx_scrollbar_thumb_position_calculate                              */
63
/*                                          Calculate the scrollbar thumb */
64
/*                                          position                      */
65
/*    _gx_system_dirty_mark                 Mark system block dirty       */
66
/*                                                                        */
67
/*  CALLED BY                                                             */
68
/*                                                                        */
69
/*    Application Code                                                    */
70
/*                                                                        */
71
/**************************************************************************/
72
6797
UINT _gx_scrollbar_reset(GX_SCROLLBAR *scrollbar, GX_SCROLL_INFO *info)
73
{
74
GX_WINDOW *win;
75
76
6797
    if (info)
77
    {
78
1
        scrollbar -> gx_scrollbar_info = *info;
79
    }
80
    else
81
    {
82
6796
        win = (GX_WINDOW *)scrollbar -> gx_widget_parent;
83
84
6796
        if (win)
85
        {
86
6794
            win -> gx_window_scroll_info_get(win, scrollbar -> gx_widget_style, &scrollbar -> gx_scrollbar_info);
87
        }
88
    }
89
6797
    _gx_scrollbar_size_update(scrollbar);
90
6797
    _gx_scrollbar_thumb_position_calculate(scrollbar);
91
92
6797
    if (scrollbar -> gx_widget_status & GX_STATUS_VISIBLE)
93
    {
94
6714
        _gx_system_dirty_mark((GX_WIDGET *)scrollbar);
95
    }
96
97
6797
    return(GX_SUCCESS);
98
}
99