using Gtk; public class Toolbar : Window { VBox vbox; ActionGroup actionGroup; UIManager uimanger; public Toolbar() { vbox = new VBox(true, 8); this.add(vbox); this.set_title("Toolbar Example"); this.set_position(WindowPosition.CENTER_ALWAYS); this.destroy.connect(Gtk.main_quit); // create actions for the tool bar buttons Action quitAction = new Action("QuitAction", "Quit", "Exit application", Gtk.STOCK_QUIT); // connect to the action quitAction.activate.connect(HandleQuitAction); // add action to action group actionGroup = new Ac
[indent=4] /* Build with valac --pkg gtk+-2.0 --pkg cairo yourfile.gs */ uses Gtk Cairo class TransparentWindow : Gtk.Window init this.type = Gtk.WindowType.TOPLEVEL /* Set the title is useless !
[indent=4] /* Build with valac --pkg gtk+-2.0 colorselectiondialog.gs */ uses Gtk init Gtk.init (ref args) var test = new TestWindow () test.show_all () Gtk.main () class TestWindow : Window label : Label init title = "Test Gtk.ColorSelectionDialog !" default_height = 70 default_width = 140 window_position = WindowPosition.CENTER destroy += Gtk.main_quit label = new Label("I'm a simple label !!!") var button = new Button.with_label("Change Text Color") button.clicked += ch
[indent=4] /* Build with valac --pkg gtk+-2.0 --pkg pango fontselectiondialog.gs */ uses Gtk Pango init Gtk.init (ref args) var test = new TestWindow () test.show_all () Gtk.main () class TestWindow : Window label : Label init title = "Test Gtk.FontSelectionDialog !" default_height = 70 default_width = 140 window_position = WindowPosition.CENTER destroy += Gtk.main_quit label = new Label("I'm a simple label !!!") var button = new Button.with_label("Change Text Font")
[indent=4] /* Build with valac --pkg gtk+-2.0 yourfile.gs */ uses Gtk init Gtk.init (ref args) var test = new StatusIconTest () test.show_all () Gtk.main () class StatusIconTest : Window trayicon : StatusIcon menu : Menu init title = "StatusIcon" window_position = WindowPosition.CENTER set_resizable(false) destroy += exit_app var label = new Label("Look the house in your taskbar !!!") var hbox = new HBox (false, 0) hbox.pack_start (label, false, true, 0) add (hbox)
[indent=4] /* Build with valac --pkg gtk+-2.0 --pkg libnotify yourfile.gs */ uses Gtk Notify init Gtk.init (ref args) var test = new NotifyTest () Notify.init("test") test.show_all () test.low_clicked () test.normal_clicked () test.critical_clicked () Gtk.main () class NotifyTest : Window init title = "Simple Notify Test" default_height = 45 default_width = 115 window_position = WindowPosition.CENTER destroy += exit_app var low_button = new Button.with_label("LOW")
[indent=4] /* Build with valac --pkg gtk+-2.0 yourfile.gs */ uses Gtk init Gtk.init (ref args) var test = new NotebookTest () test.show_all () Gtk.main () class NotebookTest : Window notebook : Notebook delete_button : ToolButton status_bar : Statusbar init title = "Simple Notebook Test" default_height = 350 default_width = 500 window_position = WindowPosition.CENTER destroy += on_exit_clicked var toolbar = new Toolbar () var new_button = new ToolButton.from_stock (STOCK_
[indent=4] /* Build with valac --pkg gtk+-2.0 --pkg gtksourceview-2.0 --pkg pango nicedit.gs */ uses Gtk Pango init Gtk.init (ref args) var test = new NicEdit () test.open_file(args[1]) test.show_all () Gtk.main () class NicEdit : Window toolbar : Toolbar text_view : SourceView status_bar : Statusbar status_bar2 : Statusbar status_hbox : HBox scrool : ScrolledWindow document_modified : bool = false separator_menu_item : SeparatorMenuItem image_menu_item : ImageMenuItem image_menu_item2 : ImageMen
[indent=4] /* Build with valac --pkg gtk+-2.0 yourprogname.gs */ uses Gtk class MessageDialog : Window init title = "Simple Message Dialog Test" window_position = WindowPosition.CENTER default_height = 200 default_width = 350 destroy += Gtk.main_quit var vbox = new VBox (true, 5) var button1 = new Button.with_label("Question") button1.clicked += question_clicked var button2 = new Button.with_label("Information") button2.clicked += information_clicked var button3 = new Button.
Gdk.Pixbuf get_pixbuf_from_stock (string stock_id, Gtk.IconSize size) { Gdk.Pixbuf pixbuf; Gtk.Invisible w; w = new Gtk.Invisible (); pixbuf = w.render_icon (stock_id, size, "vala"); return pixbuf; }