Top |
Functions
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 () |
Properties
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 |
Implemented Interfaces
GtkGridView implements GtkAccessible, GtkBuildable, GtkConstraintTarget, GtkOrientable and GtkScrollable.
Description
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.
CSS nodes
1 2 3 4 5 6 7 |
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.
Accessibility
GtkGridView uses the GTK_ACCESSIBLE_ROLE_GRID role, and the items use the GTK_ACCESSIBLE_ROLE_GRID_CELL role.
Functions
gtk_grid_view_new ()
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"));
gtk_grid_view_set_model ()
void gtk_grid_view_set_model (GtkGridView *self
,GtkSelectionModel *model
);
Sets the GtkSelectionModel to use for
gtk_grid_view_get_model ()
GtkSelectionModel *
gtk_grid_view_get_model (GtkGridView *self
);
Gets the model that's currently used to read the items displayed.
gtk_grid_view_set_max_columns ()
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.
gtk_grid_view_get_max_columns ()
guint
gtk_grid_view_get_max_columns (GtkGridView *self
);
Gets the maximum number of columns that the grid will use.
gtk_grid_view_set_min_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.
gtk_grid_view_get_min_columns ()
guint
gtk_grid_view_get_min_columns (GtkGridView *self
);
Gets the minimum number of columns that the grid will use.
gtk_grid_view_set_single_click_activate ()
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.
gtk_grid_view_get_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.
gtk_grid_view_set_enable_rubberband ()
void gtk_grid_view_set_enable_rubberband (GtkGridView *self
,gboolean enable_rubberband
);
Sets whether selections can be changed by dragging with the mouse.
gtk_grid_view_get_enable_rubberband ()
gboolean
gtk_grid_view_get_enable_rubberband (GtkGridView *self
);
Returns whether rows can be selected by dragging with the mouse.
gtk_grid_view_set_factory ()
void gtk_grid_view_set_factory (GtkGridView *self
,GtkListItemFactory *factory
);
Sets the GtkListItemFactory to use for populating list items.
gtk_grid_view_get_factory ()
GtkListItemFactory *
gtk_grid_view_get_factory (GtkGridView *self
);
Gets the factory that's currently used to populate list items.
Property Details
The “enable-rubberband”
property
“enable-rubberband” gboolean
Allow rubberband selection
Owner: GtkGridView
Flags: Read / Write
Default value: FALSE
The “factory”
property
“factory” GtkListItemFactory *
Factory for populating list items
Owner: GtkGridView
Flags: Read / Write
The “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
The “min-columns”
property
“min-columns” guint
Minimum number of columns per row
Owner: GtkGridView
Flags: Read / Write
Allowed values: >= 1
Default value: 1
The “model”
property
“model” GtkSelectionModel *
Model for the items displayed
Owner: GtkGridView
Flags: Read / Write
Signal Details
The “activate”
signal
void 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.
Parameters
self |
The GtkGridView |
|
position |
position of item to activate |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last