|
Packit |
1470ea |
|
|
Packit |
1470ea |
<page xmlns="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" xmlns:xi="http://www.w3.org/2001/XInclude" type="guide" style="task" id="statusbar.vala" xml:lang="fr">
|
|
Packit |
1470ea |
<info>
|
|
Packit |
1470ea |
<title type="text">Statusbar (Vala)</title>
|
|
Packit |
1470ea |
<link type="guide" xref="beginner.vala#display-widgets"/>
|
|
Packit |
1470ea |
<link type="seealso" xref="grid.vala"/>
|
|
Packit |
1470ea |
<link type="seealso" xref="button.vala"/>
|
|
Packit |
1470ea |
<link type="seealso" xref="label.vala"/>
|
|
Packit |
1470ea |
<revision version="0.1" date="2012-05-08" status="draft"/>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<credit type="author copyright">
|
|
Packit |
1470ea |
<name>Tiffany Antopolski</name>
|
|
Packit |
1470ea |
<email its:translate="no">tiffany.antopolski@gmail.com</email>
|
|
Packit |
1470ea |
<years>2012</years>
|
|
Packit |
1470ea |
</credit>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<desc>Rapporte les messages d'information d'importance mineure pour l'utilisateur</desc>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
|
|
Packit |
1470ea |
<mal:name>Luc Rebert,</mal:name>
|
|
Packit |
1470ea |
<mal:email>traduc@rebert.name</mal:email>
|
|
Packit |
1470ea |
<mal:years>2011</mal:years>
|
|
Packit |
1470ea |
</mal:credit>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
|
|
Packit |
1470ea |
<mal:name>Alain Lojewski,</mal:name>
|
|
Packit |
1470ea |
<mal:email>allomervan@gmail.com</mal:email>
|
|
Packit |
1470ea |
<mal:years>2011-2012</mal:years>
|
|
Packit |
1470ea |
</mal:credit>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
|
|
Packit |
1470ea |
<mal:name>Luc Pionchon</mal:name>
|
|
Packit |
1470ea |
<mal:email>pionchon.luc@gmail.com</mal:email>
|
|
Packit |
1470ea |
<mal:years>2011</mal:years>
|
|
Packit |
1470ea |
</mal:credit>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
|
|
Packit |
1470ea |
<mal:name>Bruno Brouard</mal:name>
|
|
Packit |
1470ea |
<mal:email>annoa.b@gmail.com</mal:email>
|
|
Packit |
1470ea |
<mal:years>2011-12</mal:years>
|
|
Packit |
1470ea |
</mal:credit>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
|
|
Packit |
1470ea |
<mal:name>Luis Menina</mal:name>
|
|
Packit |
1470ea |
<mal:email>liberforce@freeside.fr</mal:email>
|
|
Packit |
1470ea |
<mal:years>2014</mal:years>
|
|
Packit |
1470ea |
</mal:credit>
|
|
Packit |
1470ea |
</info>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<title>Barre de statut</title>
|
|
Packit |
1470ea |
<media type="image" mime="image/png" src="media/statusbar.png"/>
|
|
Packit |
1470ea |
Cette barre de statut vous indique ce qui se passe.
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
public class MyWindow : Gtk.ApplicationWindow {
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
Gtk.Statusbar statusbar;
|
|
Packit |
1470ea |
uint context_id;
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
internal MyWindow (MyApplication app) {
|
|
Packit |
1470ea |
Object (application: app, title: "Statusbar Example");
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
statusbar = new Gtk.Statusbar ();
|
|
Packit |
1470ea |
context_id = statusbar.get_context_id ("example");
|
|
Packit |
1470ea |
statusbar.push (context_id, "Waiting for you to do something...");
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
//set the default size of the window
|
|
Packit |
1470ea |
this.set_default_size (200, 100);
|
|
Packit |
1470ea |
var grid = new Gtk.Grid ();
|
|
Packit |
1470ea |
var label = new Gtk.Label ("Press any key or ");
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
grid.attach (label, 0, 0, 1, 1);
|
|
Packit |
1470ea |
label.show ();
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
var button = new Gtk.Button.with_label ("click me.");
|
|
Packit |
1470ea |
grid.attach_next_to (button, label, Gtk.PositionType.RIGHT, 1, 1);
|
|
Packit |
1470ea |
button.show ();
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
grid.attach (statusbar, 0, 1, 2, 1);
|
|
Packit |
1470ea |
statusbar.show ();
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
grid.set_column_spacing (5);
|
|
Packit |
1470ea |
grid.set_column_homogeneous (true);
|
|
Packit |
1470ea |
grid.set_row_homogeneous (true);
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
this.add (grid);
|
|
Packit |
1470ea |
grid.show ();
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
button.clicked.connect(button_clicked_cb);
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Since the key-press-event is a signal received by the window, we don't need to connect
|
|
Packit |
1470ea |
the window to a callback function. We can just override key_press_event. */
|
|
Packit |
1470ea |
protected override bool key_press_event (Gdk.EventKey event) {
|
|
Packit |
1470ea |
statusbar.push (context_id, Gdk.keyval_name(event.keyval) + " key was pressed.");
|
|
Packit |
1470ea |
return true;
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
void button_clicked_cb (Gtk.Button button) {
|
|
Packit |
1470ea |
statusbar.push (context_id, "You clicked the button.");
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
public class MyApplication : Gtk.Application {
|
|
Packit |
1470ea |
protected override void activate () {
|
|
Packit |
1470ea |
new MyWindow (this).show ();
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
internal MyApplication () {
|
|
Packit |
1470ea |
Object (application_id: "org.example.status");
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
public int main (string[] args) {
|
|
Packit |
1470ea |
return new MyApplication ().run (args);
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
Dans cet exemple, les éléments suivants sont utilisés :
|
|
Packit |
1470ea |
<list>
|
|
Packit |
1470ea |
<item><link href="http://www.valadoc.org/gtk+-3.0/Gtk.Statusbar.html">Gtk.Statusbar</link> </item>
|
|
Packit |
1470ea |
</list>
|
|
Packit |
1470ea |
</page>
|