PageRenderTime 28ms CodeModel.GetById 20ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/src/ui/Combo.hx

http://github.com/blackdog66/bdog-gtk
Haxe | 34 lines | 26 code | 8 blank | 0 comment | 0 complexity | a84cb8c60053aab73d0a869dbaccb4c1 MD5 | raw file
 1
 2package ui;
 3
 4import gtk.Model;
 5import gtk.Gtk;
 6import gtk.Glade;
 7
 8class Combo extends Widget {
 9
10  public function new(id:String) {
11    super(id);
12  }
13    
14  public static function
15  fromGlade(glade:GladeXml,name:String,fn:Combo->Void) {
16    Ui.getGladeWidget(glade,name,function(w) {
17        fn(new Combo(w));
18      });
19  }
20  
21  public function
22  selectedIndex(fn:Int->Void) {
23    Gtk.comboBoxGetActive(id,fn);
24  }
25
26  public function
27  selected(fn:String->Void) {
28    Gtk.comboBoxGetActiveText(id,fn);
29  }
30
31  public function onChange(fn:CallBack) {
32    Ui.event(this,changed,fn);
33  }
34}