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
   | public class Valide.SmartVPaned : Gtk.VPaned
{
  private Gtk.HBox hbox;
  private Gtk.Widget child;
  private const int DEFAULT_SIZE = 700;
 
  [Callback]
  private void expande (Gtk.Button sender)
  {
    if (this.child.visible == true)
    {
      this.child.visible = false;
      sender.image = new Gtk.Image.from_stock (Gtk.STOCK_GO_UP, Gtk.IconSize.SMALL_TOOLBAR);
      this.position = Window.get_instance ().default_height;
    }
    else
    {
      this.child.visible = true;
      sender.image = new Gtk.Image.from_stock (Gtk.STOCK_GO_DOWN, Gtk.IconSize.SMALL_TOOLBAR);
      this.position = this.DEFAULT_SIZE;
    }
  }
 
  construct
  {
    this.hbox = new Gtk.HBox (false, 0);
 
    Gtk.VBox vbox = new Gtk.VBox (false, 0);
    this.hbox.pack_start (vbox, false, false, 0);
 
    Gtk.Button button = new Gtk.Button ();
    button.relief = Gtk.ReliefStyle.NONE;
    button.image = new Gtk.Image.from_stock (Gtk.STOCK_GO_DOWN, Gtk.IconSize.SMALL_TOOLBAR);
    button.clicked += this.expande;
 
    vbox.pack_start (button, false, false, 0);
    this.position = this.DEFAULT_SIZE;
  }
 
  public void show ()
  {
    base.show ();
    this.position = this.DEFAULT_SIZE;
  }
 
  public void add2 (Gtk.Widget child)
  {
    this.child = child;
    base.add2 (this.hbox);
    this.hbox.pack_start (this.child, true, true, 0);
    this.position = this.DEFAULT_SIZE;
  }
} | 
Partager