Attribute changed old-javascript
[app.Builder.js] / old-javascript / Builder4 / WindowAddProp.vala
1 /* -- to compile
2 valac  --pkg gio-2.0  --pkg posix  --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0  --pkg  libwnck-3.0 \
3     /tmp/WindowAddProp.vala  -o /tmp/WindowAddProp
4 */
5
6
7 /* -- to test class
8 static int main (string[] args) {
9     Gtk.init (ref args);
10     new Xcls_WindowAddProp();
11     WindowAddProp.show_all();
12      Gtk.main ();
13     return 0;
14 }
15 */
16
17
18 public static Xcls_WindowAddProp  WindowAddProp;
19
20 public class Xcls_WindowAddProp : Object 
21 {
22     public Gtk.ScrolledWindow el;
23     private Xcls_WindowAddProp  _this;
24
25     public Xcls_model model;
26     public Xcls_namecol namecol;
27     public Xcls_namerender namerender;
28
29         // my vars
30     public signal void select(string key, string type, string skel, string etype);
31
32         // ctor 
33     public Xcls_WindowAddProp()
34     {
35         _this = this;
36         WindowAddProp = this;
37         this.el = new Gtk.ScrolledWindow( null, null );
38
39         // my vars
40
41         // set gobject values
42         this.el.shadow_type = Gtk.ShadowType.IN;
43         var child_0 = new Xcls_TreeView2( _this );
44         child_0.ref();
45         this.el.add (  child_0.el  );
46
47         // init method 
48             this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
49          
50     }
51
52     // userdefined functions 
53     public void clear() {
54             this.model.el.clear();
55         
56         }
57     public void show(Palete.Palete pal, string etype, string xtype) {
58             this.model.el.clear();
59         
60             Gtk.TreeIter iter;
61             var elementList = pal.getPropertiesFor( xtype,etype);
62             
63             
64             //print ("GOT " + elementList.length + " items for " + fullpath + "|" + type);
65                    // console.dump(elementList);
66                    
67             var miter = elementList.map_iterator();
68             while (miter.next()) {
69                var p = miter.get_value();
70                 
71                 this.model.el.append(out iter);
72         
73                 this.model.el.set(iter,
74                         0,  p.name, 
75                         1, p.type,
76                         2, "<b>" + p.name +"</b> <i>"+p.type+"</i>\n" + 
77                                 GLib.Markup.escape_text(p.doctxt),
78                         3, p.sig,
79                         4, "<b>" + p.name +"</b> <span size=\"small\"><i>"+p.type+"</i></span>",
80                         5, etype,
81                         -1
82                 );
83             }
84             this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
85                                      
86         }
87
88     // skip |xns - no return type
89     public class Xcls_TreeView2 : Object 
90     {
91         public Gtk.TreeView el;
92         private Xcls_WindowAddProp  _this;
93
94
95             // my vars
96
97             // ctor 
98         public Xcls_TreeView2(Xcls_WindowAddProp _owner )
99         {
100             _this = _owner;
101             this.el = new Gtk.TreeView();
102
103             // my vars
104
105             // set gobject values
106             this.el.enable_tree_lines = true;
107             this.el.headers_visible = false;
108             this.el.tooltip_column = 2;
109             var child_0 = new Xcls_model( _this );
110             child_0.ref();
111             this.el.set_model (  child_0.el  );
112             var child_1 = new Xcls_namecol( _this );
113             child_1.ref();
114             this.el.append_column (  child_1.el  );
115
116             // init method 
117             {  
118                    var description = new Pango.FontDescription();
119                  description.set_size(8000);
120                 this.el.modify_font(description);     
121                                 
122                 this.el.get_selection().set_mode( Gtk.SelectionMode.SINGLE);
123              
124             
125                 
126               
127                 
128             }
129
130             // listeners 
131             this.el.row_activated.connect( (path, column)  => {
132             
133                     Gtk.TreeIter iter;
134             
135             
136                     var m = _this.model;
137                     
138                     m.el.get_iter(out iter,path);
139                     
140                     
141                     // var val = "";
142                     
143                     
144                     var key = m.getValue(iter, 0);
145                     
146                     var type = m.getValue(iter, 1);
147                     var skel = m.getValue(iter, 3);
148                     var etype = m.getValue(iter, 5);
149                     
150                     
151                     _this.select(key,etype == "signals" ? "" : type,skel, etype);
152                     
153             }
154              );
155         }
156
157         // userdefined functions 
158
159         // skip |xns - no return type
160     }
161     public class Xcls_model : Object 
162     {
163         public Gtk.ListStore el;
164         private Xcls_WindowAddProp  _this;
165
166
167             // my vars
168
169             // ctor 
170         public Xcls_model(Xcls_WindowAddProp _owner )
171         {
172             _this = _owner;
173             _this.model = this;
174             this.el = new Gtk.ListStore( 6, typeof(string),  // 0 real key
175 typeof(string), // 1 real type
176 typeof(string), // 2 docs ?
177 typeof(string), // 3 visable desc
178 typeof(string), // 4 function desc
179 typeof(string) // 5 element type (event|prop)
180          );
181
182             // my vars
183
184             // set gobject values
185         }
186
187         // userdefined functions 
188         public string getValue(Gtk.TreeIter iter, int col)
189             {
190             
191                 GLib.Value value;
192                 this.el.get_value(iter, col, out value);
193             
194                 return (string)value;
195                 
196             }
197
198         // skip |xns - no return type
199     }
200     public class Xcls_namecol : Object 
201     {
202         public Gtk.TreeViewColumn el;
203         private Xcls_WindowAddProp  _this;
204
205
206             // my vars
207
208             // ctor 
209         public Xcls_namecol(Xcls_WindowAddProp _owner )
210         {
211             _this = _owner;
212             _this.namecol = this;
213             this.el = new Gtk.TreeViewColumn();
214
215             // my vars
216
217             // set gobject values
218             var child_0 = new Xcls_namerender( _this );
219             child_0.ref();
220             this.el.pack_start (  child_0.el , true );
221
222             // init method 
223               this.el.add_attribute(_this.namerender.el , "markup", 4  );
224              
225         }
226
227         // userdefined functions 
228
229         // skip |xns - no return type
230     }
231     public class Xcls_namerender : Object 
232     {
233         public Gtk.CellRendererText el;
234         private Xcls_WindowAddProp  _this;
235
236
237             // my vars
238
239             // ctor 
240         public Xcls_namerender(Xcls_WindowAddProp _owner )
241         {
242             _this = _owner;
243             _this.namerender = this;
244             this.el = new Gtk.CellRendererText();
245
246             // my vars
247
248             // set gobject values
249         }
250
251         // userdefined functions 
252
253         // skip |xns - no return type
254     }
255 }