diff options
author | Matthias Clasen <mclasen@redhat.com> | 2013-09-29 13:43:27 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2013-10-06 23:31:17 -0400 |
commit | 943d575ec3a99a5715de8552006ec2079e17c85a (patch) | |
tree | ac30153a1acde857d1b103e3b4b4736bb009f7b6 /docs/tools | |
parent | 8a85371901a4f76fff1298da072615f149b83439 (diff) | |
download | gtk+-943d575ec3a99a5715de8552006ec2079e17c85a.tar.gz |
Add GtkFlowBox
GtkFlowBox is a container that its children in a reflowing
grid, which can be oriented horizontally or vertically.
It is similar to GtkListBox in that the children can
be sorted and filtered, and by requiring a dedicated child
widget type, GtkFlowBoxChild. It is similar to GtkTreeView
in that is supports a full set of selection modes, including
rubberband selection.
This is the culmination of work that has happened in the
egg-list-box module, and earlier in libegg. The origins of
this code are the EggSpreadTable in libegg, which was written
by Tristan van Berkom. It was moved to egg-list-box and
renamed EggFlowBox by Jon McCann, and I gave it some finishing
touched in the flowbox-improvements branch of that module.
Diffstat (limited to 'docs/tools')
-rw-r--r-- | docs/tools/widgets.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c index 04af08b4fc..76bd20e2ad 100644 --- a/docs/tools/widgets.c +++ b/docs/tools/widgets.c @@ -1430,12 +1430,56 @@ create_list_box (void) return info; } +static WidgetInfo * +create_flow_box (void) +{ + GtkWidget *widget; + GtkWidget *box; + GtkWidget *vbox; + GtkWidget *child; + GtkWidget *button; + WidgetInfo *info; + + widget = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN); + + box = gtk_flow_box_new (); + gtk_flow_box_set_min_children_per_line (GTK_FLOW_BOX (box), 2); + gtk_flow_box_set_max_children_per_line (GTK_FLOW_BOX (box), 2); + gtk_flow_box_set_selection_mode (GTK_FLOW_BOX (box), GTK_SELECTION_BROWSE); + button = gtk_label_new ("Child One"); + gtk_container_add (GTK_CONTAINER (box), button); + button = gtk_button_new_with_label ("Child Two"); + gtk_container_add (GTK_CONTAINER (box), button); + child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); + gtk_container_add (GTK_CONTAINER (child), gtk_label_new ("Child Three")); + button = gtk_check_button_new (); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); + gtk_container_add (GTK_CONTAINER (child), button); + gtk_container_add (GTK_CONTAINER (box), child); + gtk_flow_box_select_child (GTK_FLOW_BOX (box), + GTK_FLOW_BOX_CHILD (gtk_widget_get_parent (child))); + + gtk_container_add (GTK_CONTAINER (widget), box); + + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + + gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Flow Box"), + FALSE, FALSE, 0); + info = new_widget_info ("flow-box", vbox, ASIS); + info->no_focus = FALSE; + + return info; +} + GList * get_all_widgets (void) { GList *retval = NULL; retval = g_list_prepend (retval, create_list_box()); + retval = g_list_prepend (retval, create_flow_box()); retval = g_list_prepend (retval, create_headerbar ()); retval = g_list_prepend (retval, create_placessidebar ()); retval = g_list_prepend (retval, create_stack ()); |