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 /** Scroll Management (Scroll) */ 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_scrollbar.h" 29 30 31 /**************************************************************************/ 32 /* */ 33 /* FUNCTION RELEASE */ 34 /* */ 35 /* _gx_scrollbar_limit_check PORTABLE C */ 36 /* 6.1 */ 37 /* AUTHOR */ 38 /* */ 39 /* Kenneth Maxwell, Microsoft Corporation */ 40 /* */ 41 /* DESCRIPTION */ 42 /* */ 43 /* Check the scrollbar assigned value and make sure it is within the */ 44 /* range limits. */ 45 /* */ 46 /* INPUT */ 47 /* */ 48 /* scrollbar Scrollbar control block */ 49 /* */ 50 /* OUTPUT */ 51 /* */ 52 /* status Completion status */ 53 /* */ 54 /* CALLS */ 55 /* */ 56 /* None */ 57 /* */ 58 /* CALLED BY */ 59 /* */ 60 /* Application Code */ 61 /* */ 62 /* RELEASE HISTORY */ 63 /* */ 64 /* DATE NAME DESCRIPTION */ 65 /* */ 66 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ 67 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ 68 /* resulting in version 6.1 */ 69 /* */ 70 /**************************************************************************/ _gx_scrollbar_limit_check(GX_SCROLLBAR * scrollbar)71UINT _gx_scrollbar_limit_check(GX_SCROLLBAR *scrollbar) 72 { 73 74 if (scrollbar -> gx_scrollbar_info.gx_scroll_value > 75 ((scrollbar -> gx_scrollbar_info.gx_scroll_maximum - scrollbar -> gx_scrollbar_info.gx_scroll_visible) + 1)) 76 { 77 scrollbar -> gx_scrollbar_info.gx_scroll_value = 78 (scrollbar -> gx_scrollbar_info.gx_scroll_maximum - scrollbar -> gx_scrollbar_info.gx_scroll_visible) + 1; 79 } 80 81 if (scrollbar -> gx_scrollbar_info.gx_scroll_value < scrollbar -> gx_scrollbar_info.gx_scroll_minimum) 82 { 83 scrollbar -> gx_scrollbar_info.gx_scroll_value = scrollbar -> gx_scrollbar_info.gx_scroll_minimum; 84 } 85 86 return(GX_SUCCESS); 87 } 88 89