/**************** 2024-01-06 À la chasse aux widgets ! ****************/ /* in > 01/GTK4/tree (learning)/The_Gnome_way/demos/gtk-demo */ /* */ /* tree_store() listview_words() editable_cells() search_entry2() */ /* dnd()(= drag and drop) entry_undo() expander() textundo() */ /* scale() (= scale entries from bars) font_features() hypertext() */ /* iconview_edit() (= drag and drop icons) image_scaling() infobar() */ /* links() listbox_controls() list_store() listview_colors() */ /* listview_selections() mask(NULL) and more... */ /* */ /******************************************************************************/ /*************** The basic ideas behind list views: *******************/ /* */ /* The data for items is provided in the form of a model containing objects */ /* Widgets are created just for the viewable range of items */ /* Widgets can be recycled by binding them to different items */ /* Avoid iterating over all items in the model as much as possible, and */ /* just deal with the items in the visible range which are bound to widgets */ /* from https://blog.gtk.org/2020/06/07/scalable-lists-in-gtk-4/ */ /* */ /******************************************************************************/ // GtkListItemFactory is the object that is tasked with creating widgets // for the items in the model. // One implementations of this factory, GtkBuilderListItemFactory, // is using ui files as templates for the list item widgets. /*************** A B O U T T R E E S **************************/ /* */ /* https://docs.gtk.org/gtk4/ */ /* https://docs.gtk.org/gtk4/getting_started.html */ /* https://toshiocp.github.io/Gtk4-tutorial/sec29.html <<< TODO (tuto) */ /* Keep the "comparison chart of equivalent functionalities" (link below) */ /* https://docs.gtk.org/gtk4/section-list-widget.html */ /* https://en.wikibooks.org/wiki/GTK%2B_By_Example/Tree_View */ /* https://gnome.pages.gitlab.gnome.org/libsoup/gio/GListModel.html */ /* https://docs.gtk.org/gio/iface.ListModel.html < +++ */ /* */ /* https://docs.gtk.org/gtk4/class.TreeListModel.html (easy to find) */ /* https://developer-old.gnome.org/gtk4/stable/GtkTreeView.html (vieux...) */ /* get-path-at-pos(x,y) <> finds the path at these window coordinates. */ /* https://blog.gtk.org/2020/09/08/on-list-models/ */ /* */ /******************************************************************************/ /*.............................................................................. * * >>> GtkStringList <<< * * GtkStringList is a list model that wraps an array of strings. * The objects in the model are of type GtkStringObject * and have a “string” property that can be used inside expressions. * Use it where/when you would typically use a char*[], but need a list model. * * Every item in a model has a position (= unsigned integer) * "factories" takes care of mapping the items of the model * to widgets that can be shown in the view * by creating a listitem for each item that is currently in use. * List items are always GtkListItem instances. Widgets can be recycled. * * GtkStringList can only handle strings. * It is backed by a dynamically allocated array. * GListStore is backed by a balanced tree. * * GTK provides functionality to make lists look and behave like trees * by using the GtkTreeListModel and the GtkTreeExpander widget. * * Widgets are styleable using GTK CSS. Use the .rich-list style class. * * GListModel is an interface that represents a mutable list of GObjects. * *............................................................................*/