3535/* FUNCTION RELEASE */
3636/* */
3737/* _gx_horizontal_list_scroll_info_get PORTABLE C */
38- /* 6.1 */
38+ /* 6.x */
3939/* AUTHOR */
4040/* */
4141/* Kenneth Maxwell, Microsoft Corporation */
6969/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
7070/* 09-30-2020 Kenneth Maxwell Modified comment(s), */
7171/* resulting in version 6.1 */
72+ /* xx-xx-xxxx Ting Zhu Modified comments(s), */
73+ /* improved the calculation of */
74+ /* the maximum scrolling value.*/
75+ /* resulting in version 6.x */
7276/* */
7377/**************************************************************************/
7478VOID _gx_horizontal_list_scroll_info_get (GX_WINDOW * win , ULONG style , GX_SCROLL_INFO * info )
7579{
7680INT value ;
77- GX_WIDGET * topchild ;
78-
81+ GX_WIDGET * child ;
7982GX_HORIZONTAL_LIST * list = (GX_HORIZONTAL_LIST * )win ;
83+ GX_VALUE width ;
84+
8085
8186 GX_PARAMETER_NOT_USED (style );
8287
83- info -> gx_scroll_maximum = (list -> gx_horizontal_list_total_columns * list -> gx_horizontal_list_child_width - 1 );
88+ if (list -> gx_horizontal_list_callback )
89+ {
90+ /* If list callback is set, children winthin the list should share the same width. */
91+ info -> gx_scroll_maximum = (list -> gx_horizontal_list_total_columns * list -> gx_horizontal_list_child_width - 1 );
92+ }
93+ else
94+ {
95+ info -> gx_scroll_maximum = 0 ;
96+
97+ child = _gx_widget_first_client_child_get ((GX_WIDGET * )list );
98+ while (child )
99+ {
100+ _gx_widget_width_get (child , & width );
101+ info -> gx_scroll_maximum += width ;
102+ child = _gx_widget_next_client_child_get (child );
103+ }
104+ }
84105 info -> gx_scroll_minimum = 0 ;
85106 info -> gx_scroll_visible = (GX_VALUE )(list -> gx_window_client .gx_rectangle_right - list -> gx_window_client .gx_rectangle_left + 1 );
86107
@@ -96,11 +117,11 @@ GX_HORIZONTAL_LIST *list = (GX_HORIZONTAL_LIST *)win;
96117
97118 if (list -> gx_horizontal_list_top_index >= 0 )
98119 {
99- topchild = _gx_widget_first_client_child_get ((GX_WIDGET * )win );
120+ child = _gx_widget_first_client_child_get ((GX_WIDGET * )win );
100121
101- if (topchild )
122+ if (child )
102123 {
103- value += win -> gx_window_client .gx_rectangle_left - topchild -> gx_widget_size .gx_rectangle_left ;
124+ value += win -> gx_window_client .gx_rectangle_left - child -> gx_widget_size .gx_rectangle_left ;
104125 }
105126 }
106127
0 commit comments