[gtk+] Add an example for a hig-style toolbar



commit e79348eafefc86ce7c8f812e8f1c3d0118b6f9e8
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Aug 15 23:22:00 2014 -0400

    Add an example for a hig-style toolbar

 tests/Makefile.am    |    1 +
 tests/testtoolbar2.c |   40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0bc2cb0..374fddb 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -104,6 +104,7 @@ noinst_PROGRAMS =  $(TEST_PROGS)    \
        teststatusicon                  \
        teststockbuttonmenu             \
        testtoolbar                     \
+       testtoolbar2                    \
        stresstest-toolbar              \
        testtreechanging                \
        testtreeedit                    \
diff --git a/tests/testtoolbar2.c b/tests/testtoolbar2.c
new file mode 100644
index 0000000..211958f
--- /dev/null
+++ b/tests/testtoolbar2.c
@@ -0,0 +1,40 @@
+#include <gtk/gtk.h>
+
+int main (int argc, char *argv[])
+{
+  GtkWidget *window;
+  GtkWidget *box;
+  GtkWidget *frame;
+  GtkWidget *box3;
+  GtkWidget *view;
+  GtkWidget *button;
+
+  gtk_init (NULL, NULL);
+
+  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
+  box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+  gtk_container_add (GTK_CONTAINER (window), box);
+  frame = gtk_frame_new (NULL);
+  gtk_container_add (GTK_CONTAINER (box), frame);
+  view = gtk_text_view_new ();
+  gtk_widget_set_vexpand (view, TRUE);
+  gtk_container_add (GTK_CONTAINER (box), view);
+  box3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+  g_object_set (box3, "margin", 10, NULL);
+  gtk_style_context_add_class (gtk_widget_get_style_context (box3), GTK_STYLE_CLASS_LINKED);
+  button = gtk_button_new_from_icon_name ("document-new-symbolic", GTK_ICON_SIZE_BUTTON);
+  gtk_container_add (GTK_CONTAINER (box3), button);
+  button = gtk_button_new_from_icon_name ("document-open-symbolic", GTK_ICON_SIZE_BUTTON);
+  gtk_container_add (GTK_CONTAINER (box3), button);
+  button = gtk_button_new_from_icon_name ("document-save-symbolic", GTK_ICON_SIZE_BUTTON);
+  gtk_container_add (GTK_CONTAINER (box3), button);
+
+  gtk_container_add (GTK_CONTAINER (frame), box3);
+  
+  gtk_widget_show_all (GTK_WIDGET (window));
+
+  gtk_main ();
+
+  return 0;
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]