Advertisement
Guest User

Untitled

a guest
Oct 10th, 2011
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vala 1.37 KB | None | 0 0
  1. class Test : Gtk.DrawingArea {
  2.  
  3.     public Test()
  4.     {
  5.         this.draw.connect(this.on_draw);
  6.     }
  7.  
  8.     private bool on_draw(Cairo.Context cairo_cx)
  9.     {
  10.  
  11.         var layout = new Pango.Layout(this.get_pango_context());
  12.         layout.set_text("Hi", "Hi".length);
  13.        
  14.         Meta.Theme theme = Meta.Theme.load("Adwaita");
  15.  
  16.         Meta.ButtonLayout button_layout = Meta.ButtonLayout();
  17.         button_layout.left_buttons[0] = Meta.ButtonFunction.CLOSE;
  18.        
  19.         Meta.ButtonState[] button_states = {Meta.ButtonState.NORMAL};
  20.        
  21.         theme.draw_frame(this, cairo_cx,
  22.                             Meta.FrameType.NORMAL,
  23.                             Meta.FrameFlags.HAS_FOCUS,
  24.                             400,
  25.                             50,
  26.                             layout,
  27.                             20,
  28.                             button_layout,
  29.                             button_states,
  30.                             Gtk.IconTheme.get_default().load_icon("folder", 16, Gtk.IconLookupFlags.FORCE_SVG),
  31.                             Gtk.IconTheme.get_default().load_icon("folder", 16, Gtk.IconLookupFlags.FORCE_SVG));
  32.         return false;
  33.     }
  34. }
  35.  
  36. public int main(string[] args) {
  37.     Gtk.init(ref args);
  38.    
  39.     var t = new Test();
  40.     var w = new Gtk.Window();
  41.     w.add(t);
  42.    
  43.     w.show_all();
  44.     Gtk.main();
  45.     return 0;
  46. }
  47.  
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement