diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-08-26 19:48:29 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-08-26 20:00:03 -0400 |
commit | 29f5cdda100ef24b0e8b7415d78a58649988a05c (patch) | |
tree | 8a7bd1a72600d66bcf76a208e8737fde95574644 | |
parent | 0f1c4a303e76502fd94c6a9f7fda77141f47b91e (diff) | |
download | gtk+-29f5cdda100ef24b0e8b7415d78a58649988a05c.tar.gz |
testflowbox: Add an example with buttons
This example populates a flow box with buttons, and makes the
flow box children unfocusable, with the intention that the focus
moves directly between the buttons. Currently, keynav does not
work at all in this case.
-rw-r--r-- | tests/testflowbox.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/testflowbox.c b/tests/testflowbox.c index 4efc9b726c..ad181219f5 100644 --- a/tests/testflowbox.c +++ b/tests/testflowbox.c @@ -22,7 +22,8 @@ enum { FOCUS_ITEMS, WRAPPY_ITEMS, STOCK_ITEMS, - IMAGE_ITEMS + IMAGE_ITEMS, + BUTTON_ITEMS }; #define INITIAL_HALIGN GTK_ALIGN_FILL @@ -74,6 +75,7 @@ populate_flowbox_focus (GtkFlowBox *flowbox) { sensitive = TRUE; frame = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_container_add (GTK_CONTAINER (frame), box); @@ -112,6 +114,22 @@ populate_flowbox_focus (GtkFlowBox *flowbox) } static void +populate_flowbox_buttons (GtkFlowBox *flowbox) +{ + GtkWidget *widget; + gint i; + + for (i = 0; i < 50; i++) + { + widget = gtk_button_new_with_label ("Button"); + gtk_widget_show (widget); + gtk_container_add (GTK_CONTAINER (flowbox), widget); + widget = gtk_widget_get_parent (widget); + gtk_widget_set_can_focus (widget, FALSE); + } +} + +static void populate_flowbox_wrappy (GtkFlowBox *flowbox) { GtkWidget *widget, *frame; @@ -235,6 +253,8 @@ populate_items (GtkFlowBox *flowbox) populate_flowbox_stock (flowbox); else if (items_type == IMAGE_ITEMS) populate_flowbox_images (flowbox); + else if (items_type == BUTTON_ITEMS) + populate_flowbox_buttons (flowbox); } static void @@ -642,6 +662,7 @@ create_window (void) gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Wrappy"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Stock"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Images"); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Buttons"); gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0); gtk_widget_show (widget); |