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
8 static int main (string[] args) {
10 new Xcls_WindowAddProp();
11 WindowAddProp.show_all();
18 public static Xcls_WindowAddProp WindowAddProp;
20 public class Xcls_WindowAddProp : Object
22 public Gtk.ScrolledWindow el;
23 private Xcls_WindowAddProp _this;
25 public Xcls_model model;
26 public Xcls_namecol namecol;
27 public Xcls_namerender namerender;
30 public signal void select(string key, string type, string skel, string etype);
33 public Xcls_WindowAddProp()
37 this.el = new Gtk.ScrolledWindow( null, null );
42 this.el.shadow_type = Gtk.ShadowType.IN;
43 var child_0 = new Xcls_TreeView2( _this );
45 this.el.add ( child_0.el );
48 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
52 // userdefined functions
54 this.model.el.clear();
57 public void show(Palete.Palete pal, string etype, string xtype) {
58 this.model.el.clear();
61 var elementList = pal.getPropertiesFor( xtype,etype);
64 //print ("GOT " + elementList.length + " items for " + fullpath + "|" + type);
65 // console.dump(elementList);
67 var miter = elementList.map_iterator();
68 while (miter.next()) {
69 var p = miter.get_value();
71 this.model.el.append(out iter);
73 this.model.el.set(iter,
76 2, "<b>" + p.name +"</b> <i>"+p.type+"</i>\n" +
77 GLib.Markup.escape_text(p.doctxt),
79 4, "<b>" + p.name +"</b> <span size=\"small\"><i>"+p.type+"</i></span>",
84 this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
88 // skip |xns - no return type
89 public class Xcls_TreeView2 : Object
91 public Gtk.TreeView el;
92 private Xcls_WindowAddProp _this;
98 public Xcls_TreeView2(Xcls_WindowAddProp _owner )
101 this.el = new Gtk.TreeView();
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 );
111 this.el.set_model ( child_0.el );
112 var child_1 = new Xcls_namecol( _this );
114 this.el.append_column ( child_1.el );
118 var description = new Pango.FontDescription();
119 description.set_size(8000);
120 this.el.modify_font(description);
122 this.el.get_selection().set_mode( Gtk.SelectionMode.SINGLE);
131 this.el.row_activated.connect( (path, column) => {
138 m.el.get_iter(out iter,path);
144 var key = m.getValue(iter, 0);
146 var type = m.getValue(iter, 1);
147 var skel = m.getValue(iter, 3);
148 var etype = m.getValue(iter, 5);
151 _this.select(key,etype == "signals" ? "" : type,skel, etype);
157 // userdefined functions
159 // skip |xns - no return type
161 public class Xcls_model : Object
163 public Gtk.ListStore el;
164 private Xcls_WindowAddProp _this;
170 public Xcls_model(Xcls_WindowAddProp _owner )
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)
184 // set gobject values
187 // userdefined functions
188 public string getValue(Gtk.TreeIter iter, int col)
192 this.el.get_value(iter, col, out value);
194 return (string)value;
198 // skip |xns - no return type
200 public class Xcls_namecol : Object
202 public Gtk.TreeViewColumn el;
203 private Xcls_WindowAddProp _this;
209 public Xcls_namecol(Xcls_WindowAddProp _owner )
212 _this.namecol = this;
213 this.el = new Gtk.TreeViewColumn();
217 // set gobject values
218 var child_0 = new Xcls_namerender( _this );
220 this.el.pack_start ( child_0.el , true );
223 this.el.add_attribute(_this.namerender.el , "markup", 4 );
227 // userdefined functions
229 // skip |xns - no return type
231 public class Xcls_namerender : Object
233 public Gtk.CellRendererText el;
234 private Xcls_WindowAddProp _this;
240 public Xcls_namerender(Xcls_WindowAddProp _owner )
243 _this.namerender = this;
244 this.el = new Gtk.CellRendererText();
248 // set gobject values
251 // userdefined functions
253 // skip |xns - no return type