GtkGridView — A widget for displaying grids
GtkWidget * | gtk_grid_view_new () |
void | gtk_grid_view_set_model () |
GtkSelectionModel * | gtk_grid_view_get_model () |
void | gtk_grid_view_set_max_columns () |
guint | gtk_grid_view_get_max_columns () |
void | gtk_grid_view_set_min_columns () |
guint | gtk_grid_view_get_min_columns () |
void | gtk_grid_view_set_single_click_activate () |
gboolean | gtk_grid_view_get_single_click_activate () |
void | gtk_grid_view_set_enable_rubberband () |
gboolean | gtk_grid_view_get_enable_rubberband () |
void | gtk_grid_view_set_factory () |
GtkListItemFactory * | gtk_grid_view_get_factory () |
gboolean | enable-rubberband | Read / Write |
GtkListItemFactory * | factory | Read / Write |
guint | max-columns | Read / Write |
guint | min-columns | Read / Write |
GtkSelectionModel * | model | Read / Write |
gboolean | single-click-activate | Read / Write |
void | activate | Run Last |
list.activate-item | u |
GObject ╰── GInitiallyUnowned ╰── GtkWidget ╰── GtkListBase ╰── GtkGridView
GtkGridView implements GtkAccessible, GtkBuildable, GtkConstraintTarget, GtkOrientable and GtkScrollable.
#include <gtk/gtk.h>
GtkGridView is a widget to present a view into a large dynamic grid of items.
GtkGridView uses its factory to generate one child widget for each visible item and shows them in a grid. The orientation of the grid view determines if the grid reflows vertically or horizontally.
GtkGridView allows the user to select items according to the selection characteristics of the model. For models that allow multiple selected items, it is possible to turn on _rubberband selection_, using “enable-rubberband”.
To learn more about the list widget framework, see the overview.
gridview ├── child │ ├── child │ ┊ ╰── [rubberband]
GtkGridView uses a single CSS node with name gridview. Each child uses a single CSS node with name child. For rubberband selection, a subnode with name rubberband is used.
GtkGridView uses the GTK_ACCESSIBLE_ROLE_GRID role, and the items use the GTK_ACCESSIBLE_ROLE_GRID_CELL role.
GtkWidget * gtk_grid_view_new (GtkSelectionModel *model
,GtkListItemFactory *factory
);
Creates a new GtkGridView that uses the given factory
for mapping items to widgets.
The function takes ownership of the arguments, so you can write code like
grid_view = gtk_grid_view_new (
create_model()
,
gtk_builder_list_item_factory_new_from_resource ("/resource.ui"));
model | the model to use, or | [allow-none][transfer full] |
factory | The factory to populate items with, or | [allow-none][transfer full] |
a new GtkGridView using the given model
and factory
void gtk_grid_view_set_model (GtkGridView *self
,GtkSelectionModel *model
);
Sets the GtkSelectionModel to use for
self | ||
model | the model to use or | [allow-none][transfer none] |
GtkSelectionModel *
gtk_grid_view_get_model (GtkGridView *self
);
Gets the model that's currently used to read the items displayed.
self |
The model in use.
[nullable][transfer none]
void gtk_grid_view_set_max_columns (GtkGridView *self
,guint max_columns
);
Sets the maximum number of columns to use. This number must be at least 1.
If max_columns
is smaller than the minimum set via gtk_grid_view_set_min_columns()
, that value is used instead.
self | ||
max_columns | The maximum number of columns |
guint
gtk_grid_view_get_max_columns (GtkGridView *self
);
Gets the maximum number of columns that the grid will use.
self |
The maximum number of columns
void gtk_grid_view_set_min_columns (GtkGridView *self
,guint min_columns
);
Sets the minimum number of columns to use. This number must be at least 1.
If min_columns
is smaller than the minimum set via gtk_grid_view_set_max_columns()
, that value is ignored.
self | ||
min_columns | The minimum number of columns |
guint
gtk_grid_view_get_min_columns (GtkGridView *self
);
Gets the minimum number of columns that the grid will use.
self |
The minimum number of columns
void gtk_grid_view_set_single_click_activate (GtkGridView *self
,gboolean single_click_activate
);
Sets whether items should be activated on single click and selected on hover.
self | ||
single_click_activate |
|
gboolean
gtk_grid_view_get_single_click_activate
(GtkGridView *self
);
Returns whether items will be activated on single click and selected on hover.
self |
TRUE
if items are activated on single click
void gtk_grid_view_set_enable_rubberband (GtkGridView *self
,gboolean enable_rubberband
);
Sets whether selections can be changed by dragging with the mouse.
self | ||
enable_rubberband |
|
gboolean
gtk_grid_view_get_enable_rubberband (GtkGridView *self
);
Returns whether rows can be selected by dragging with the mouse.
self |
TRUE
if rubberband selection is enabled
void gtk_grid_view_set_factory (GtkGridView *self
,GtkListItemFactory *factory
);
Sets the GtkListItemFactory to use for populating list items.
self | ||
factory | the factory to use or | [allow-none][transfer none] |
GtkListItemFactory *
gtk_grid_view_get_factory (GtkGridView *self
);
Gets the factory that's currently used to populate list items.
self |
The factory in use.
[nullable][transfer none]
typedef struct _GtkGridView GtkGridView;
GtkGridView is a list widget implementation that arranges its items in a grid.
“enable-rubberband”
property“enable-rubberband” gboolean
Allow rubberband selection
Owner: GtkGridView
Flags: Read / Write
Default value: FALSE
“factory”
property“factory” GtkListItemFactory *
Factory for populating list items
Owner: GtkGridView
Flags: Read / Write
“max-columns”
property“max-columns” guint
Maximum number of columns per row
If this number is smaller than GtkGridView:min-columns, that value is used instead.
Owner: GtkGridView
Flags: Read / Write
Allowed values: >= 1
Default value: 7
“min-columns”
property“min-columns” guint
Minimum number of columns per row
Owner: GtkGridView
Flags: Read / Write
Allowed values: >= 1
Default value: 1
“model”
property“model” GtkSelectionModel *
Model for the items displayed
Owner: GtkGridView
Flags: Read / Write
“single-click-activate”
property“single-click-activate” gboolean
Activate rows on single click and select them on hover
Owner: GtkGridView
Flags: Read / Write
Default value: FALSE
“activate”
signalvoid user_function (GtkGridView *self, guint position, gpointer user_data)
The ::activate signal is emitted when a cell has been activated by the user, usually via activating the GtkGridView|list.activate-item action.
This allows for a convenient way to handle activation in a gridview. See GtkListItem:activatable for details on how to use this signal.
self | The GtkGridView | |
position | position of item to activate | |
user_data | user data set when the signal handler was connected. |
Flags: Run Last
“list.activate-item”
actionActivates the item given in position
by emitting the GtkGridView::activate signal.
Parameter type: u
position | position of item to activate |
© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk4/4.0/GtkGridView.html