Skip to content

Add API to center listview/columnview items when scrolling to

Nelson Ben requested to merge list_widgets_add_centeing_api into main
Add API to center listview/columnview items when scrolling

 · A new GtkScrollInfoCenter enum with the different center flags to use
   in scroll_to() functions:

     GTK_SCROLL_INFO_CENTER_ROW: This will center the target
       row item along the visible part of list. If target
       row is already visible, will do nothing.

     GTK_SCROLL_INFO_CENTER_ROW_ALWAYS: Like `GTK_SCROLL_INFO_CENTER_ROW`
       but will work even if target row is already visible.

     GTK_SCROLL_INFO_CENTER_COL: When scrolling to a column
       item in a columnview, this will center it across the
       visible part of list. If target column is already
       visible, will do nothing.

     GTK_SCROLL_INFO_CENTER_COL_ALWAYS: Like `GTK_SCROLL_INFO_CENTER_COL`
       but will work even if target column is already visible.

 · A new GtkScrollInfo public field called `center_flags` to
     store how we want to center target row/column as a set of
     the new GtkScrollInfoCenter enum values.

 · Action "list.scroll-to-item" gains a new GtkScrollInfoCenter
   flag parameter named @center_flags, but ensuring that the
   previous action with no parameter keeps working.

Some widgets are also added to gtk4-demo program to easily
test/demo the scrolling_to() functionality, it's in the panel
"Lists -> Characters" and can be directly run with:

  gtk4-demo --run=listview_ucd
Edited by Nelson Ben

Merge request reports