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_from from;
22 public JsRender.NodePropType ptype;
23 public signal void select (JsRender.NodeProp prop);
24 public Xcls_MainWindow mainwindow;
28 public Xcls_PopoverAddProp()
31 this.el = new Gtk.Popover( null );
37 this.el.width_request = 900;
38 this.el.height_request = 800;
39 this.el.hexpand = false;
41 this.el.position = Gtk.PositionType.RIGHT;
42 var child_0 = new Xcls_ScrolledWindow2( _this );
44 this.el.add ( child_0.el );
47 // user defined functions
48 public void show (Palete.Palete pal, JsRender.NodePropType ptype, string xtype, Gtk.Widget onbtn) {
50 /// what does this do?
51 //if (this.prop_or_listener != "" && this.prop_or_listener == prop_or_listener) {
52 // this.prop_or_listener = "";
61 this.model.el.clear();
64 var elementList = pal.getPropertiesFor( xtype, ptype);
66 //print ("GOT " + elementList.length + " items for " + fullpath + "|" + type);
67 // console.dump(elementList);
69 var miter = elementList.map_iterator();
70 while (miter.next()) {
71 var p = miter.get_value();
73 this.model.el.append(out iter);
75 var prop = p.toNodeProp();
79 this.model.el.set(iter,
81 1, prop.to_property_option_markup(),
82 2, prop.to_property_option_tooltip(),
89 this.model.el.set_sort_column_id(3,Gtk.SortType.ASCENDING);
95 this.mainwindow.el.get_size(out w, out h);
97 // left tree = 250, editor area = 500?
101 this.el.set_size_request( 450, h);
105 if (this.el.relative_to == null) {
106 this.el.set_relative_to(onbtn);
110 while(Gtk.events_pending()) {
111 Gtk.main_iteration(); // why?
113 // this.hpane.el.set_position( 0);
115 public void clear () {
116 this.model.el.clear();
118 public void hide () {
119 this.ptype = JsRender.NodePropType.NONE;
122 public class Xcls_ScrolledWindow2 : Object
124 public Gtk.ScrolledWindow el;
125 private Xcls_PopoverAddProp _this;
131 public Xcls_ScrolledWindow2(Xcls_PopoverAddProp _owner )
134 this.el = new Gtk.ScrolledWindow( null, null );
138 // set gobject values
139 this.el.shadow_type = Gtk.ShadowType.IN;
140 var child_0 = new Xcls_TreeView3( _this );
142 this.el.add ( child_0.el );
146 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
149 // user defined functions
151 public class Xcls_TreeView3 : Object
153 public Gtk.TreeView el;
154 private Xcls_PopoverAddProp _this;
160 public Xcls_TreeView3(Xcls_PopoverAddProp _owner )
163 this.el = new Gtk.TreeView();
167 // set gobject values
168 this.el.tooltip_column = 2;
169 this.el.enable_tree_lines = true;
170 this.el.headers_visible = true;
171 var child_0 = new Xcls_model( _this );
173 this.el.set_model ( child_0.el );
174 var child_1 = new Xcls_namecol( _this );
176 this.el.append_column ( child_1.el );
177 var child_2 = new Xcls_type( _this );
179 this.el.append_column ( child_2.el );
180 var child_3 = new Xcls_from( _this );
182 this.el.append_column ( child_3.el );
187 var description = new Pango.FontDescription();
188 description.set_size(10000);
189 this.el.override_font(description);
191 this.el.get_selection().set_mode( Gtk.SelectionMode.SINGLE);
200 this.el.row_activated.connect( (path, column) => {
207 m.el.get_iter(out iter,path);
210 var prop = m.getValue(iter);
222 // user defined functions
224 public class Xcls_model : Object
226 public Gtk.ListStore el;
227 private Xcls_PopoverAddProp _this;
233 public Xcls_model(Xcls_PopoverAddProp _owner )
237 this.el = new Gtk.ListStore( 6,
238 typeof(JsRender.NodeProp), // 0 real key
239 typeof(string), // text display
240 typeof(string), // tooltip
241 typeof(string), // sortable string
242 typeof(string), // prop type
243 typeof(string) // from interface
245 // add later? source?
247 typeof(string), // 0 real key
248 typeof(string), // 1 real type
249 typeof(string), // 2 docs ?
250 typeof(string), // 3 visable desc
251 typeof(string), // 4 function desc
252 typeof(string) // 5 element type (event|prop)
257 // set gobject values
260 // user defined functions
261 public JsRender.NodeProp getValue (Gtk.TreeIter iter)
265 this.el.get_value(iter, 0, out value);
267 return (JsRender.NodeProp)value;
272 public class Xcls_namecol : Object
274 public Gtk.TreeViewColumn el;
275 private Xcls_PopoverAddProp _this;
281 public Xcls_namecol(Xcls_PopoverAddProp _owner )
284 _this.namecol = this;
285 this.el = new Gtk.TreeViewColumn();
289 // set gobject values
290 this.el.title = "Double click to add";
291 var child_0 = new Xcls_namerender( _this );
293 this.el.pack_start ( child_0.el , true );
297 this.el.add_attribute(_this.namerender.el , "markup", 1 );
300 // user defined functions
302 public class Xcls_namerender : Object
304 public Gtk.CellRendererText el;
305 private Xcls_PopoverAddProp _this;
311 public Xcls_namerender(Xcls_PopoverAddProp _owner )
314 _this.namerender = this;
315 this.el = new Gtk.CellRendererText();
319 // set gobject values
322 // user defined functions
326 public class Xcls_type : Object
328 public Gtk.TreeView el;
329 private Xcls_PopoverAddProp _this;
336 public Xcls_type(Xcls_PopoverAddProp _owner )
340 this.el = new Gtk.TreeView();
345 // set gobject values
346 var child_0 = new Xcls_CellRendererText8( _this );
348 this.el.composite_name ( child_0.el );
352 this.el.add_attribute(_this.typerender.el , "markup", 1 );
355 // user defined functions
357 public class Xcls_CellRendererText8 : Object
359 public Gtk.CellRendererText el;
360 private Xcls_PopoverAddProp _this;
366 public Xcls_CellRendererText8(Xcls_PopoverAddProp _owner )
369 this.el = new Gtk.CellRendererText();
373 // set gobject values
376 // user defined functions
380 public class Xcls_from : Object
382 public Gtk.TreeViewColumn el;
383 private Xcls_PopoverAddProp _this;
389 public Xcls_from(Xcls_PopoverAddProp _owner )
393 this.el = new Gtk.TreeViewColumn();
397 // set gobject values
398 this.el.sort_column_id = 4;
399 this.el.title = "From";
403 this.el.add_attribute(_this.typerender.el , "markup", 1 );
406 // user defined functions