1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 10 /**************************************************************************/ 11 12 13 /**************************************************************************/ 14 /**************************************************************************/ 15 /** */ 16 /** GUIX Component */ 17 /** */ 18 /** Horizontal List (List) */ 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_window.h" 30 #include "gx_system.h" 31 #include "gx_scrollbar.h" 32 33 /**************************************************************************/ 34 /* */ 35 /* FUNCTION RELEASE */ 36 /* */ 37 /* _gx_horizontal_list_scroll_info_get PORTABLE C */ 38 /* 6.1 */ 39 /* AUTHOR */ 40 /* */ 41 /* Kenneth Maxwell, Microsoft Corporation */ 42 /* */ 43 /* DESCRIPTION */ 44 /* */ 45 /* This function gets the scrollbar information. */ 46 /* */ 47 /* INPUT */ 48 /* */ 49 /* win Pointer to window */ 50 /* style Style */ 51 /* info Information of scrollbar */ 52 /* */ 53 /* OUTPUT */ 54 /* */ 55 /* None */ 56 /* */ 57 /* CALLS */ 58 /* */ 59 /* _gx_first_client_child_get Get the first client child */ 60 /* */ 61 /* CALLED BY */ 62 /* */ 63 /* Application Code */ 64 /* */ 65 /* RELEASE HISTORY */ 66 /* */ 67 /* DATE NAME DESCRIPTION */ 68 /* */ 69 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ 70 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ 71 /* resulting in version 6.1 */ 72 /* */ 73 /**************************************************************************/ _gx_horizontal_list_scroll_info_get(GX_WINDOW * win,ULONG style,GX_SCROLL_INFO * info)74VOID _gx_horizontal_list_scroll_info_get(GX_WINDOW *win, ULONG style, GX_SCROLL_INFO *info) 75 { 76 INT value; 77 GX_WIDGET *topchild; 78 79 GX_HORIZONTAL_LIST *list = (GX_HORIZONTAL_LIST *)win; 80 81 GX_PARAMETER_NOT_USED(style); 82 83 info -> gx_scroll_maximum = (list -> gx_horizontal_list_total_columns * list -> gx_horizontal_list_child_width - 1); 84 info -> gx_scroll_minimum = 0; 85 info -> gx_scroll_visible = (GX_VALUE)(list -> gx_window_client.gx_rectangle_right - list -> gx_window_client.gx_rectangle_left + 1); 86 87 if (info -> gx_scroll_maximum <= info -> gx_scroll_visible) 88 { 89 info -> gx_scroll_value = 0; 90 info -> gx_scroll_increment = 0; 91 info -> gx_scroll_maximum = info -> gx_scroll_visible; 92 return; 93 } 94 95 value = list -> gx_horizontal_list_top_index * list -> gx_horizontal_list_child_width; 96 97 if (list -> gx_horizontal_list_top_index >= 0) 98 { 99 topchild = _gx_widget_first_client_child_get((GX_WIDGET *)win); 100 101 if (topchild) 102 { 103 value += win -> gx_window_client.gx_rectangle_left - topchild -> gx_widget_size.gx_rectangle_left; 104 } 105 } 106 107 if (value < info -> gx_scroll_minimum) 108 { 109 value = info -> gx_scroll_minimum; 110 } 111 else 112 { 113 if (value > info -> gx_scroll_maximum - info -> gx_scroll_visible + 1) 114 { 115 value = info -> gx_scroll_maximum - info -> gx_scroll_visible + 1; 116 } 117 } 118 119 info -> gx_scroll_value = value; 120 info -> gx_scroll_increment = list -> gx_horizontal_list_child_width / 2; 121 } 122 123