[gtk+] testflowbox: Add an example with buttons
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] testflowbox: Add an example with buttons
- Date: Thu, 27 Aug 2015 00:24:08 +0000 (UTC)
commit 29f5cdda100ef24b0e8b7415d78a58649988a05c
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Aug 26 19:48:29 2015 -0400
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.
tests/testflowbox.c | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/tests/testflowbox.c b/tests/testflowbox.c
index 4efc9b7..ad18121 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]