[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 !
//====================================================================== // pags.vala - Converting text to rendered image files of the text. // It may e.g.
using Gtk; using Cairo; namespace Egg { public class ClockFace : DrawingArea { private Time time; private int minute_offset; private bool dragging; public signal void time_changed (int hour, int minute); public ClockFace () { add_events (Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK | Gdk.EventMask.POINTER_MOTION_MASK); update (); // update the clock once a second Timeout.add (1000, update); }
/* Cairo in Vala sample code */ using Gtk; using Cairo; public class CairoSample : Gtk.Window { private const int SIZE = 30; construct { this.title = "Cairo Vala Demo"; this.destroy += Gtk.main_quit; this.set_default_size (450, 550); this.create_widgets (); } private void create_widgets () { var drawing_area = new DrawingArea (); drawing_area.expose_event += this.on_expose; this.add (drawing_area); } private bool on_expose (DrawingArea da, Gdk.EventExpose event) { var ctx = Gd