[gnome-devel-docs] demos: GtkSeparator exmaple for Vala



commit 814193bd394da99483d8f4b5286c1dabeb371b6b
Author: Tiffany Ann Antopolski <tiffany antopolski gmail com>
Date:   Tue Jun 18 18:49:57 2013 -0400

    demos: GtkSeparator exmaple for Vala

 platform-demos/C/samples/separator.vala |   43 ++++++++++++++++++++++++++++
 platform-demos/C/separator.vala.page    |   47 +++++++++++++++++++++++++++++++
 platform-demos/Makefile.am              |    2 +
 3 files changed, 92 insertions(+), 0 deletions(-)
---
diff --git a/platform-demos/C/samples/separator.vala b/platform-demos/C/samples/separator.vala
new file mode 100644
index 0000000..e5b6835
--- /dev/null
+++ b/platform-demos/C/samples/separator.vala
@@ -0,0 +1,43 @@
+/* This is the application. */
+public class Application : Gtk.Application {
+
+       public Application () {
+               Object (application_id: "org.example.window");
+       }
+
+       /* Override the 'activate' signal of GLib.Application,
+        * which is inherited by Gtk.Application. */
+       public override void activate () {
+
+               var window = new Gtk.Window ();
+               window.title = "Separator Example";
+
+               var label1 = new Gtk.Label ("Below, a horizontal separator.");
+               var label2 = new Gtk.Label ("On the right, a vertical separator.");
+               var label3 = new Gtk.Label ("On the left, a vertical separator.");
+
+               var hseparator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL);
+               var vseparator = new Gtk.Separator (Gtk.Orientation.VERTICAL);
+
+               var grid = new Gtk.Grid();
+
+               grid.attach (label1, 0, 0, 3, 1);
+               grid.attach (hseparator, 0, 1, 3, 1);
+               grid.attach (label2, 0, 2, 1, 1);
+               grid.attach (vseparator, 1, 2, 1, 1);
+               grid.attach (label3, 2, 2, 1, 1);
+
+               grid.set_column_homogeneous(true);
+
+               window.add (grid);
+               this.add_window (window);
+
+               window.show_all ();
+       }
+}
+
+/* The main function creates the application and runs it.*/
+int main (string[] args) {
+       var app = new Application ();
+       return app.run (args);
+}
diff --git a/platform-demos/C/separator.vala.page b/platform-demos/C/separator.vala.page
new file mode 100644
index 0000000..9176386
--- /dev/null
+++ b/platform-demos/C/separator.vala.page
@@ -0,0 +1,47 @@
+<?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.vala">
+  <info>
+    <title type="text">Seperator (Vala)</title>
+    <link type="guide" xref="beginner.vala#ornaments"/>
+    <link type="seealso" xref="grid.vala"/>
+    <link type="seealso" xref="label.vala"/>
+    <link type="seealso" xref="window.vala"/>
+    <revision version="0.1" date="2013-06-18" 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-csharp" style="numbered"><xi:include href="samples/separator.vala" 
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://www.valadoc.org/gtk+-3.0/Gtk.Application.html";>GtkApplication</link></p></item>
+      <item><p><link href="http://www.valadoc.org/gtk+-3.0/Gtk.Window.html";>GtkWindow</link></p></item>
+      <item><p><link href="http://www.valadoc.org/gtk+-3.0/Gtk.Separator.html";>GtkSeparator</link></p></item>
+      <item><p><link href="http://www.valadoc.org/gtk+-3.0/Gtk.Grid.html";>GtkGrid</link></p></item>
+      <item><p><link href="http://www.valadoc.org/gtk+-3.0/Gtk.Label.html";>GtkLabel</link></p></item>
+    </list>
+  </section>
+
+</page>
diff --git a/platform-demos/Makefile.am b/platform-demos/Makefile.am
index 3b88ad3..39b9a7b 100644
--- a/platform-demos/Makefile.am
+++ b/platform-demos/Makefile.am
@@ -145,6 +145,7 @@ demo_sources =      \
        samples/scrolledwindow.py               \
        samples/scrolledwindow.vala             \
        samples/separator.py                    \
+       samples/separator.vala                  \
        samples/spinbutton.c                    \
        samples/spinbutton.js                   \
        samples/spinbutton.py                   \
@@ -404,6 +405,7 @@ HELP_FILES =                                \
        scrolledwindow.py.page          \
        scrolledwindow.vala.page        \
        separator.py.page               \
+       separator.vala.page             \
        set-up-gedit.js.page            \
        signals-callbacks.py.page       \
        spinbutton.c.page               \


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