1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" type="guide" style="task" id="window.vala" xml:lang="el">
<info>
<link type="guide" xref="beginner.vala#windows"/>
<revision version="0.1" date="2012-04-07" status="draft"/>
<credit type="author copyright">
<name>Tiffany Antopolski</name>
<email>tiffany.antopolski@gmail.com</email>
<years>2012</years>
</credit>
<desc>A toplevel window which can contain other widgets.</desc>
</info>
<title>Window</title>
<media type="image" mime="image/png" src="media/window.png"/>
<p>A toplevel window with destroy signal hooked up.</p>
<code mime="text/x-vala" style="numbered"><![CDATA[
int main (string[] args) {
Gtk.init (ref args);
var window = new Gtk.Window ();
window.title = "Welcome to GNOME";
/*
The following 3 lines are included here to introduce
you to ways you can adjust the toplevel window to suit
your needs. Uncomment them to see what they do.
*/
//window.border_width = 10;
//window.set_default_size (350, 70);
//window.window_position = Gtk.WindowPosition.CENTER;
/*The destroy signal is emitted when the x
in the top right of the window is clicked.*/
window.destroy.connect (Gtk.main_quit);
/*The show () method only shows the widget it is called on.
If the widget has children (for example a label or a button,
the method show_all () should be used to show the widget and
the child widgets.*/
window.show ();
Gtk.main ();
return 0;
}
]]></code>
<p>
In this sample we used the following:
</p>
<list>
<item><p>The widget <link href="http://www.valadoc.org/#!api=gtk+-3.0/Gtk.Window">Gtk.Window</link></p></item>
<item><p>The enum <link href="http://references.valadoc.org/#!api=gtk+-3.0/Gtk.WindowPosition">Gtk.WindowPosition</link></p></item>
<item><p>The method <link href="http://www.valadoc.org/#!api=gtk+-3.0/Gtk.Window.set_default_size">set_default_size</link></p></item>
<item><p><link href="http://valadoc.org/#!api=gtk+-3.0/Gtk.Container.border_width">border_width</link></p></item>
<item><p><link href="http://valadoc.org/#!api=gtk+-3.0/Gtk.Window.window_position">window_position</link></p></item>
</list>
</page>
|