XObjectBase/GtkListStore.js
[app.Builder.js] / XObjectBase / GtkListStore.js
1
2 //<Script type="Text/javascript">
3
4 XObject = imports.XObject.XObject
5  
6 GObject = imports.gi.GObject;
7 //GtkClutter.Embed..
8 Gtk= imports.gi.Gtk;
9
10 // children are not added at init / but at show stage..
11 // listener is added on show..
12 // we should really add a hock to destroy it..
13 GtkListStore = XObject.define(
14     function(cfg) {
15         XObject.call(this, cfg);
16         // this is an example...
17        
18     }, 
19     XObject,
20     {
21         pack : 'set_model',
22         init : function() 
23         {
24             XObject.prototype.init.call(this);
25             this.el.set_column_types ( 6, [
26                 GObject.TYPE_STRING, 
27                 GObject.TYPE_STRING, 
28                 GObject.TYPE_STRING, 
29                 GObject.TYPE_STRING, 
30                 GObject.TYPE_STRING, 
31                 GObject.TYPE_STRING 
32             ] );
33             
34         },
35         append : function( values ) {
36             var iter = new Gtk.TreeIter();
37             this.el.append(iter);
38             for (var i = 0; i < values.length; i++) {
39                 this.el.set_value(iter,i,values[i]);
40             }
41             
42         },
43         getValue  : function ( path, col)
44         {
45             var iter = new Gtk.TreeIter();
46             this.el.get_iter (iter, path) ;
47             var gval = new GObject.Value('');
48             this.el.get_value( iter, col, gval)
49             return gval.value;
50         },
51         setValue  : function ( path, col, val)
52         {
53             //this.el.set_value(iter,i,values[i]);
54         }
55                 
56         
57     }
58 );