1 static Xcls_PopoverAddProp _PopoverAddProp;
3 public class Xcls_PopoverAddProp : Object
6 private Xcls_PopoverAddProp _this;
8 public static Xcls_PopoverAddProp singleton()
10 if (_PopoverAddProp == null) {
11 _PopoverAddProp= new Xcls_PopoverAddProp();
13 return _PopoverAddProp;
15 public Xcls_model model;
16 public Xcls_namecol namecol;
17 public Xcls_namerender namerender;
18 public Xcls_type type;
19 public Xcls_typerender typerender;
20 public Xcls_from from;
21 public Xcls_fromrender fromrender;
24 public JsRender.NodePropType ptype;
25 public signal void select (JsRender.NodeProp prop);
26 public Xcls_MainWindow mainwindow;
30 public Xcls_PopoverAddProp()
33 this.el = new Gtk.Popover( null );
39 this.el.width_request = 900;
40 this.el.height_request = 800;
41 this.el.hexpand = false;
43 this.el.position = Gtk.PositionType.RIGHT;
44 var child_0 = new Xcls_ScrolledWindow2( _this );
46 this.el.add ( child_0.el );
49 // user defined functions
50 public void show (Palete.Palete pal, JsRender.NodePropType ptype, string xtype, Gtk.Widget onbtn) {
52 /// what does this do?
53 //if (this.prop_or_listener != "" && this.prop_or_listener == prop_or_listener) {
54 // this.prop_or_listener = "";
63 this.model.el.clear();
66 var elementList = pal.getPropertiesFor( xtype, ptype);
68 //print ("GOT " + elementList.length + " items for " + fullpath + "|" + type);
69 // console.dump(elementList);
71 var miter = elementList.map_iterator();
72 while (miter.next()) {
73 var p = miter.get_value();
75 this.model.el.append(out iter);
77 var prop = p.toNodeProp();
81 this.model.el.set(iter,
83 1, prop.to_property_option_markup(),
84 2, prop.to_property_option_tooltip(),
91 this.model.el.set_sort_column_id(3,Gtk.SortType.ASCENDING);
97 this.mainwindow.el.get_size(out w, out h);
99 // left tree = 250, editor area = 500?
103 this.el.set_size_request( 450, h);
107 if (this.el.relative_to == null) {
108 this.el.set_relative_to(onbtn);
112 while(Gtk.events_pending()) {
113 Gtk.main_iteration(); // why?
115 // this.hpane.el.set_position( 0);
117 public void clear () {
118 this.model.el.clear();
120 public void hide () {
121 this.ptype = JsRender.NodePropType.NONE;
124 public class Xcls_ScrolledWindow2 : Object
126 public Gtk.ScrolledWindow el;
127 private Xcls_PopoverAddProp _this;
133 public Xcls_ScrolledWindow2(Xcls_PopoverAddProp _owner )
136 this.el = new Gtk.ScrolledWindow( null, null );
140 // set gobject values
141 this.el.shadow_type = Gtk.ShadowType.IN;
142 var child_0 = new Xcls_TreeView3( _this );
144 this.el.add ( child_0.el );
148 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
151 // user defined functions
153 public class Xcls_TreeView3 : Object
155 public Gtk.TreeView el;
156 private Xcls_PopoverAddProp _this;
162 public Xcls_TreeView3(Xcls_PopoverAddProp _owner )
165 this.el = new Gtk.TreeView();
169 // set gobject values
170 this.el.tooltip_column = 2;
171 this.el.enable_tree_lines = true;
172 this.el.headers_visible = true;
173 var child_0 = new Xcls_model( _this );
175 this.el.set_model ( child_0.el );
176 var child_1 = new Xcls_namecol( _this );
178 this.el.append_column ( child_1.el );
179 var child_2 = new Xcls_type( _this );
181 this.el.append_column ( child_2.el );
182 var child_3 = new Xcls_from( _this );
184 this.el.append_column ( child_3.el );
189 var description = new Pango.FontDescription();
190 description.set_size(10000);
191 this.el.override_font(description);
193 this.el.get_selection().set_mode( Gtk.SelectionMode.SINGLE);
202 this.el.row_activated.connect( (path, column) => {
209 m.el.get_iter(out iter,path);
212 var prop = m.getValue(iter);
224 // user defined functions
226 public class Xcls_model : Object
228 public Gtk.ListStore el;
229 private Xcls_PopoverAddProp _this;
235 public Xcls_model(Xcls_PopoverAddProp _owner )
239 this.el = new Gtk.ListStore( 6,
240 typeof(JsRender.NodeProp), // 0 real key
241 typeof(string), // text display
242 typeof(string), // tooltip
243 typeof(string), // sortable string
244 typeof(string), // prop type
245 typeof(string) // from interface
247 // add later? source?
249 typeof(string), // 0 real key
250 typeof(string), // 1 real type
251 typeof(string), // 2 docs ?
252 typeof(string), // 3 visable desc
253 typeof(string), // 4 function desc
254 typeof(string) // 5 element type (event|prop)
259 // set gobject values
262 // user defined functions
263 public JsRender.NodeProp getValue (Gtk.TreeIter iter)
267 this.el.get_value(iter, 0, out value);
269 return (JsRender.NodeProp)value;
274 public class Xcls_namecol : Object
276 public Gtk.TreeViewColumn el;
277 private Xcls_PopoverAddProp _this;
283 public Xcls_namecol(Xcls_PopoverAddProp _owner )
286 _this.namecol = this;
287 this.el = new Gtk.TreeViewColumn();
291 // set gobject values
292 this.el.sort_column_id = 3;
293 this.el.title = "Double click to add";
294 var child_0 = new Xcls_namerender( _this );
296 this.el.pack_start ( child_0.el , true );
300 this.el.add_attribute(_this.namerender.el , "markup", 1 );
303 // user defined functions
305 public class Xcls_namerender : Object
307 public Gtk.CellRendererText el;
308 private Xcls_PopoverAddProp _this;
314 public Xcls_namerender(Xcls_PopoverAddProp _owner )
317 _this.namerender = this;
318 this.el = new Gtk.CellRendererText();
322 // set gobject values
325 // user defined functions
329 public class Xcls_type : Object
331 public Gtk.TreeViewColumn el;
332 private Xcls_PopoverAddProp _this;
338 public Xcls_type(Xcls_PopoverAddProp _owner )
342 this.el = new Gtk.TreeViewColumn();
346 // set gobject values
347 this.el.sort_column_id = 4;
348 this.el.title = "Type";
349 var child_0 = new Xcls_typerender( _this );
351 this.el.pack_start ( child_0.el , true );
355 this.el.add_attribute(_this.typerender.el , "text", 1 );
358 // user defined functions
360 public class Xcls_typerender : Object
362 public Gtk.CellRendererText el;
363 private Xcls_PopoverAddProp _this;
369 public Xcls_typerender(Xcls_PopoverAddProp _owner )
372 _this.typerender = this;
373 this.el = new Gtk.CellRendererText();
377 // set gobject values
380 // user defined functions
384 public class Xcls_from : Object
386 public Gtk.TreeViewColumn el;
387 private Xcls_PopoverAddProp _this;
393 public Xcls_from(Xcls_PopoverAddProp _owner )
397 this.el = new Gtk.TreeViewColumn();
401 // set gobject values
402 this.el.sort_column_id = 5;
403 this.el.title = "From";
404 var child_0 = new Xcls_fromrender( _this );
406 this.el.pack_start ( child_0.el , true );
410 this.el.add_attribute(_this.fromrender.el , "text", 5);
413 // user defined functions
415 public class Xcls_fromrender : Object
417 public Gtk.CellRendererText el;
418 private Xcls_PopoverAddProp _this;
424 public Xcls_fromrender(Xcls_PopoverAddProp _owner )
427 _this.fromrender = this;
428 this.el = new Gtk.CellRendererText();
432 // set gobject values
435 // user defined functions