[gnome-devel-docs] demos: separator C example



commit aa1dbbab0814fc18e60c7fa85ef83fccf31befe5
Author: Tiffany Ann Antopolski <tiffany antopolski gmail com>
Date:   Tue Jul 2 17:17:17 2013 -0400

    demos: separator C example

 platform-demos/C/samples/separator.c |   51 ++++++++++++++++++++++++++++++++++
 platform-demos/C/separator.c.page    |   44 +++++++++++++++++++++++++++++
 platform-demos/Makefile.am           |    2 +
 3 files changed, 97 insertions(+), 0 deletions(-)
---
diff --git a/platform-demos/C/samples/separator.c b/platform-demos/C/samples/separator.c
new file mode 100644
index 0000000..bc8124d
--- /dev/null
+++ b/platform-demos/C/samples/separator.c
@@ -0,0 +1,51 @@
+#include <gtk/gtk.h>
+
+static void
+activate (GtkApplication *app,
+          gpointer        user_data)
+{
+  GtkWidget *grid;
+  GtkWidget *window;
+  GtkWidget *label1;
+  GtkWidget *label2;
+  GtkWidget *label3;
+  GtkWidget *hseparator;
+  GtkWidget *vseparator;
+
+  window = gtk_application_window_new (app);
+  gtk_window_set_title (GTK_WINDOW (window), "Separator Example");
+
+  label1 = gtk_label_new ("Below, a horizontal separator.");
+  label2 = gtk_label_new ("On the right, a vertical separator.");
+  label3 = gtk_label_new ("On the left, a vertical separator.");
+
+  vseparator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
+  hseparator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+
+  grid = gtk_grid_new ();
+
+  gtk_grid_attach (GTK_GRID (grid), label1, 0, 0, 3, 1);
+  gtk_grid_attach (GTK_GRID (grid), hseparator, 0, 1, 3, 1);
+  gtk_grid_attach (GTK_GRID (grid), label2, 0, 2, 1, 1);
+  gtk_grid_attach (GTK_GRID (grid), vseparator, 1, 2, 1, 1);
+  gtk_grid_attach (GTK_GRID (grid), label3, 2, 2, 1, 1);
+
+  gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);
+
+  gtk_container_add (GTK_CONTAINER (window), grid);
+
+  gtk_widget_show_all (window);
+}
+
+int
+main (int argc, char **argv)
+{
+  GtkApplication *app;
+  int status;
+
+  app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
+  g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
+  status = g_application_run (G_APPLICATION (app), argc, argv);
+  g_object_unref (app);
+  return status;
+}
diff --git a/platform-demos/C/separator.c.page b/platform-demos/C/separator.c.page
new file mode 100644
index 0000000..09425af
--- /dev/null
+++ b/platform-demos/C/separator.c.page
@@ -0,0 +1,44 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<page xmlns="http://projectmallard.org/1.0/";
+      xmlns:xi="http://www.w3.org/2001/XInclude";
+      type="guide" style="task"
+      id="separator.c">
+  <info>
+    <title type="text">Seperator (C)</title>
+    <link type="guide" xref="beginner.c#ornaments"/>
+    <link type="seealso" xref="grid.c"/>
+    <revision version="0.1" date="2013-07-02" status="review"/>
+
+    <credit type="author copyright">
+      <name>Tiffany Antopolski</name>
+      <email>tiffany antopolski gmail com</email>
+      <years>2013</years>
+    </credit>
+
+    <desc>A separator widget</desc>
+  </info>
+
+  <title>Separator</title>
+
+  <media type="image" mime="image/png" src="media/separator.png"/>
+  <p>A horizontal and a vertical separator divide some labels.</p>
+
+  <links type="section"/>
+
+  <section id="code">
+    <title>Code used to generate this example</title>
+    <code mime="text/x-csrc" style="numbered"><xi:include href="samples/separator.c" 
parse="text"><xi:fallback/></xi:include></code>
+  </section>
+
+  <section id="reference">
+    <title>API Reference</title>
+    <p>In this sample we used the following:</p>
+    <list>
+      <item><p><link 
href="http://developer.gnome.org/gtk3/unstable/GtkApplicationWindow.html";>GtkApplicationWindow</link></p></item>
+      <item><p><link 
href="http://developer.gnome.org/gtk3/unstable/GtkSeparator.html";>GtkSeparator</link></p></item>
+      <item><p><link href="http://developer.gnome.org/gtk3/unstable/GtkGrid.html";>GtkGrid</link></p></item>
+      <item><p><link href="http://developer.gnome.org/gtk3/unstable/GtkLabel.html";>GtkLabel</link></p></item>
+    </list>
+  </section>
+
+</page>
diff --git a/platform-demos/Makefile.am b/platform-demos/Makefile.am
index 4326b6a..83cd62f 100644
--- a/platform-demos/Makefile.am
+++ b/platform-demos/Makefile.am
@@ -154,6 +154,7 @@ demo_sources =      \
        samples/scrolledwindow.js               \
        samples/scrolledwindow.py               \
        samples/scrolledwindow.vala             \
+       samples/separator.c                     \
        samples/separator.py                    \
        samples/separator.vala                  \
        samples/spinbutton.c                    \
@@ -426,6 +427,7 @@ HELP_FILES =                                \
        scrolledwindow.js.page          \
        scrolledwindow.py.page          \
        scrolledwindow.vala.page        \
+       separator.c.page                \
        separator.py.page               \
        separator.vala.page             \
        set-up-gedit.js.page            \


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