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_typerenderer typerenderer;
20 public Xcls_from from;
23 public JsRender.NodePropType ptype;
24 public signal void select (JsRender.NodeProp prop);
25 public Xcls_MainWindow mainwindow;
29 public Xcls_PopoverAddProp()
32 this.el = new Gtk.Popover( null );
38 this.el.width_request = 900;
39 this.el.height_request = 800;
40 this.el.hexpand = false;
42 this.el.position = Gtk.PositionType.RIGHT;
43 var child_0 = new Xcls_ScrolledWindow2( _this );
45 this.el.add ( child_0.el );
48 // user defined functions
49 public void show (Palete.Palete pal, JsRender.NodePropType ptype, string xtype, Gtk.Widget onbtn) {
51 /// what does this do?
52 //if (this.prop_or_listener != "" && this.prop_or_listener == prop_or_listener) {
53 // this.prop_or_listener = "";
62 this.model.el.clear();
65 var elementList = pal.getPropertiesFor( xtype, ptype);
67 //print ("GOT " + elementList.length + " items for " + fullpath + "|" + type);
68 // console.dump(elementList);
70 var miter = elementList.map_iterator();
71 while (miter.next()) {
72 var p = miter.get_value();
74 this.model.el.append(out iter);
76 var prop = p.toNodeProp();
80 this.model.el.set(iter,
82 1, prop.to_property_option_markup(),
83 2, prop.to_property_option_tooltip(),
90 this.model.el.set_sort_column_id(3,Gtk.SortType.ASCENDING);
96 this.mainwindow.el.get_size(out w, out h);
98 // left tree = 250, editor area = 500?
102 this.el.set_size_request( 450, h);
106 if (this.el.relative_to == null) {
107 this.el.set_relative_to(onbtn);
111 while(Gtk.events_pending()) {
112 Gtk.main_iteration(); // why?
114 // this.hpane.el.set_position( 0);
116 public void clear () {
117 this.model.el.clear();
119 public void hide () {
120 this.ptype = JsRender.NodePropType.NONE;
123 public class Xcls_ScrolledWindow2 : Object
125 public Gtk.ScrolledWindow el;
126 private Xcls_PopoverAddProp _this;
132 public Xcls_ScrolledWindow2(Xcls_PopoverAddProp _owner )
135 this.el = new Gtk.ScrolledWindow( null, null );
139 // set gobject values
140 this.el.shadow_type = Gtk.ShadowType.IN;
141 var child_0 = new Xcls_TreeView3( _this );
143 this.el.add ( child_0.el );
147 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
150 // user defined functions
152 public class Xcls_TreeView3 : Object
154 public Gtk.TreeView el;
155 private Xcls_PopoverAddProp _this;
161 public Xcls_TreeView3(Xcls_PopoverAddProp _owner )
164 this.el = new Gtk.TreeView();
168 // set gobject values
169 this.el.tooltip_column = 2;
170 this.el.enable_tree_lines = true;
171 this.el.headers_visible = true;
172 var child_0 = new Xcls_model( _this );
174 this.el.set_model ( child_0.el );
175 var child_1 = new Xcls_namecol( _this );
177 this.el.append_column ( child_1.el );
178 var child_2 = new Xcls_type( _this );
180 this.el.append_column ( child_2.el );
181 var child_3 = new Xcls_from( _this );
183 this.el.append_column ( child_3.el );
188 var description = new Pango.FontDescription();
189 description.set_size(10000);
190 this.el.override_font(description);
192 this.el.get_selection().set_mode( Gtk.SelectionMode.SINGLE);
201 this.el.row_activated.connect( (path, column) => {
208 m.el.get_iter(out iter,path);
211 var prop = m.getValue(iter);
223 // user defined functions
225 public class Xcls_model : Object
227 public Gtk.ListStore el;
228 private Xcls_PopoverAddProp _this;
234 public Xcls_model(Xcls_PopoverAddProp _owner )
238 this.el = new Gtk.ListStore( 6,
239 typeof(JsRender.NodeProp), // 0 real key
240 typeof(string), // text display
241 typeof(string), // tooltip
242 typeof(string), // sortable string
243 typeof(string), // prop type
244 typeof(string) // from interface
246 // add later? source?
248 typeof(string), // 0 real key
249 typeof(string), // 1 real type
250 typeof(string), // 2 docs ?
251 typeof(string), // 3 visable desc
252 typeof(string), // 4 function desc
253 typeof(string) // 5 element type (event|prop)
258 // set gobject values
261 // user defined functions
262 public JsRender.NodeProp getValue (Gtk.TreeIter iter)
266 this.el.get_value(iter, 0, out value);
268 return (JsRender.NodeProp)value;
273 public class Xcls_namecol : Object
275 public Gtk.TreeViewColumn el;
276 private Xcls_PopoverAddProp _this;
282 public Xcls_namecol(Xcls_PopoverAddProp _owner )
285 _this.namecol = this;
286 this.el = new Gtk.TreeViewColumn();
290 // set gobject values
291 this.el.title = "Double click to add";
292 var child_0 = new Xcls_namerender( _this );
294 this.el.pack_start ( child_0.el , true );
298 this.el.add_attribute(_this.namerender.el , "markup", 1 );
301 // user defined functions
303 public class Xcls_namerender : Object
305 public Gtk.CellRendererText el;
306 private Xcls_PopoverAddProp _this;
312 public Xcls_namerender(Xcls_PopoverAddProp _owner )
315 _this.namerender = this;
316 this.el = new Gtk.CellRendererText();
320 // set gobject values
323 // user defined functions
327 public class Xcls_type : Object
329 public Gtk.TreeViewColumn el;
330 private Xcls_PopoverAddProp _this;
336 public Xcls_type(Xcls_PopoverAddProp _owner )
340 this.el = new Gtk.TreeViewColumn();
344 // set gobject values
345 this.el.title = "Type";
346 var child_0 = new Xcls_typerenderer( _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_typerenderer : Object
359 public Gtk.CellRendererText el;
360 private Xcls_PopoverAddProp _this;
366 public Xcls_typerenderer(Xcls_PopoverAddProp _owner )
369 _this.typerenderer = this;
370 this.el = new Gtk.CellRendererText();
374 // set gobject values
377 // user defined functions
381 public class Xcls_from : Object
383 public Gtk.TreeViewColumn el;
384 private Xcls_PopoverAddProp _this;
390 public Xcls_from(Xcls_PopoverAddProp _owner )
394 this.el = new Gtk.TreeViewColumn();
398 // set gobject values
399 this.el.sort_column_id = 4;
400 this.el.title = "From";
404 this.el.add_attribute(_this.typerender.el , "markup", 1 );
407 // user defined functions