Attribute changed old-javascript
[app.Builder.js] / old-javascript / XObjectBase / GtkTreeView.js
1
2 //<Script type="Text/javascript">
3
4 XObject = imports.XObject.XObject
5  
6 GObject = imports.gi.GObject;
7
8 // tree view column.. should really have a better way to determin stuff..
9
10 GtkTreeView = XObject.define(
11     function(cfg)
12     {
13         
14         
15         var clean_cfg = XObject.extend({
16             font         :  false,
17             drag_source : false,
18             drag_dest   : false //,
19        //     selection : false,
20         }, cfg);
21         
22         delete clean_cfg.font;
23         delete clean_cfg.selection;
24         delete clean_cfg.drag_source;
25         delete clean_cfg.drag_dest;
26          
27         
28         XObject.call(this, clean_cfg);
29         
30         this.config = cfg;
31         
32         // this is an example...
33         
34         
35     }, 
36     XObject,
37     {
38         selection : false,
39         
40         init : function() 
41         {
42             
43             XObject.prototype.init.call(this);
44             
45             
46             
47             
48              
49             if (this.config.font) {
50                 var description = new Pango.FontDescription.c_new();
51                 description.set_size(this.config.font.size);
52                 this.el.modify_font(description);
53             }
54             
55           
56              
57             if (this.config.drag_source) {
58                 var ds = this.config.drag_source;
59                 
60                 this.el.drag_source_set(             // widget will be drag-able 
61                     ds.modifier, //Gdk.ModifierType.BUTTON1_MASK,       // modifier that will start a drag 
62                     null,            // lists of target to support 
63                     0,              // size of list 
64                     ds.action   ////Gdk.DragAction.COPY   | Gdk.DragAction.MOVE
65                                 // what to do with data after dropped 
66                 );
67                 
68                 this.el.drag_source_set_target_list(
69                         ds.targetList // probably imports.Window.targetList;
70                         //this.get('/Window').targetList
71                 );
72                 this.el.drag_source_add_text_targets();
73             }
74             
75             if (this.config.drag_dest) {
76                 
77                 var ds = this.config.drag_dest;
78                 
79                 this.el.drag_dest_set
80                 (
81                     ds.modifier, // Gtk.DestDefaults.MOTION  | Gtk.DestDefaults.HIGHLIGHT,
82                     null,            // lists of target to support 
83                     0,              // size of list 
84                     ds.action //Gdk.DragAction.COPY   | Gdk.DragAction.MOVE       // what to do with data after dropped 
85                 );
86                 
87                 this.el.drag_source_add_text_targets();
88                 this.el.drag_dest_set_target_list(
89                     ds.targetList
90                             //this.get('/Window').targetList
91                 );
92                 this.el.drag_dest_add_text_targets();
93             }
94              
95         }
96                                                                                   
97              
98  
99          
100     }
101 ); 
102
103 GtkTreeView.config = {
104     //selection   : { << just need to add a treeselection..
105     //    type : 'Gtk.TreeSelection'
106     //},
107     font         : {
108         type : 'Pango.FontDescription'
109     },
110     drag_source : {
111         type : 'Gtk.TreeDragSource' // these are realy interfaces...
112     },
113     
114     drag_dest   : {
115         type : 'Gtk.TreeDragDest'
116     }
117     
118     
119 };
120
121