6 "@ void after_node_change" : "(JsRender.Node? node)",
7 "@ void before_node_change" : "(JsRender.Node? node)",
8 "@ void drag_end" : "()",
9 "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
10 "Xcls_MainWindow mainwindow" : "",
11 "bool active" : false,
12 "bool hexpand" : false,
14 "id" : "PopoverAddObject",
15 "int height_request" : 800,
16 "int width_request" : 900,
19 "$ shadow_type" : "Gtk.ShadowType.IN",
22 " this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
23 " this.el.set_size_request(-1,200);",
30 "# string dragData" : "",
31 "$ enable_tree_lines" : true,
32 "$ headers_visible" : true,
36 " this.el.set_size_request(150,-1);",
37 " // set_reorderable: [1]",
39 " var description = new Pango.FontDescription();",
40 " description.set_size(10000);",
41 " this.el.override_font(description);",
43 " var selection = this.el.get_selection();",
44 " selection.set_mode( Gtk.SelectionMode.SINGLE);",
45 " // this.selection.signal['changed'].connect(function() {",
46 " // _view.listeners['cursor-changed'].apply(_view, [ _view, '']);",
48 " // see: http://live.gnome.org/GnomeLove/DragNDropTutorial",
50 " Gtk.drag_source_set (",
51 " this.el, /* widget will be drag-able */",
52 " Gdk.ModifierType.BUTTON1_MASK, /* modifier that will start a drag */",
53 " BuilderApplication.targetList, /* lists of target to support */",
54 " Gdk.DragAction.COPY /* what to do with data after dropped */",
56 " //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);",
58 " // Gtk.drag_source_set_target_list(this.el, Application.targetList);",
59 " // Gtk.drag_source_add_text_targets(this.el); ",
67 "$ columns" : "typeof(string),typeof(string),typeof(Gdk.Pixbuf)",
69 "* pack" : "set_model",
72 "xtype" : "ListStore",
73 "| string getValue" : [
74 " (Gtk.TreeIter iter, int col) {",
76 "\tthis.el.get_value(iter, col , out gval);",
77 "\treturn (string)gval;",
85 "this.el.add_attribute(_this.txtrender.el , \"markup\", 1 );",
86 "this.el.add_attribute(_this.iconrender.el , \"pixbuf\", 2 );",
89 "* pack" : "append_column",
93 "* pack" : "pack_start,true",
95 "xtype" : "CellRendererPixbuf"
99 "* pack" : "pack_start,true",
101 "xtype" : "CellRendererText"
104 "utf8 title" : "Drag to add Object",
105 "xtype" : "TreeViewColumn"
109 "button_press_event" : [
112 " //\tif (!this.get('/Editor').save()) {",
113 " //\t // popup!! - click handled.. ",
114 "// \t return true;",
121 " // we could fill this in now...",
122 "// Seed.print('SOURCE: drag-begin');",
126 " Gtk.TreeIter iter;",
127 " var s = this.el.get_selection();",
129 " Gtk.TreeModel mod;",
130 " s.get_selected(out mod, out iter);",
131 " var path = mod.get_path(iter);",
133 " /// pix is a surface..",
134 " var pix = this.el.create_row_drag_icon ( path);",
137 " Gtk.drag_set_icon_surface (ctx, pix);",
138 " GLib.Value value;",
141 " _this.model.el.get_value(iter, 0, out value);",
143 " this.dragData = (string) value;",
150 "(drag_context, selection_data, info, time) => {",
151 " \t//Seed.print('Palete: drag-data-get: ' + target_type);",
152 " if (this.dragData.length < 1 ) {",
156 " GLib.debug(\"setting drag data to %s\\n\", this.dragData);",
157 " // selection_data.set_text(this.dragData ,this.dragData.length);",
158 " selection_data.set (selection_data.get_target (), 8, (uchar[]) this.dragData.to_utf8 ());",
160 " //this.el.dragData = \"TEST from source widget\";",
166 "( drag_context) => {",
167 " \t GLib.debug(\"SOURCE: drag-end (call listener on this)\\n\");",
169 "\tthis.dragData = \"\";",
170 "\t//this.dropList = null;",
171 "\t_this.drag_end(); // call signal..",
172 "\t//this.get('/LeftTree.view').highlight(false);",
180 "xtype" : "ScrolledWindow"
186 " this.model.el.clear();",
198 "(Palete.Palete pal, string cls, Gtk.Widget onbtn) {",
203 " var tr = pal.getChildList(cls);",
204 " this.model.el.clear();",
207 " Gtk.TreeIter citer;",
208 " var ic = Gtk.IconTheme.get_default();",
209 " Gdk.Pixbuf pixdef = null;",
211 "\t\tpixdef = ic.load_icon(\"emblem-new\", 16,0);",
212 "\t} catch (Error e) {",
215 " for(var i =0 ; i < tr.length; i++) {",
216 " this.model.el.append(out citer); ",
217 " var dname = tr[i];",
218 " var clsname = dname;",
219 " if (dname.contains(\":\")) {",
220 "\t\t\tvar ar = dname.split(\":\");",
221 "\t\t\tdname = \"<b>\" + ar[1] +\"</b> - <i>\"+ar[0]+\"</i>\";",
222 "\t\t\tclsname = ar[0]; /// possibly?",
225 " this.model.el.set_value(citer, 0, tr[i] ); // used data. ",
226 " this.model.el.set_value(citer, 1, dname ); // displayed value.",
228 " var clsb = clsname.split(\".\");",
229 " var sub = clsb.length > 1 ? clsb[1].down() : \"\";",
231 " var pix = pixdef;",
232 " var fn = \"/usr/share/glade/pixmaps/hicolor/16x16/actions/widget-gtk-\" + sub + \".png\";",
233 " if (FileUtils.test (fn, FileTest.IS_REGULAR)) {",
235 "\t \tpix = new Gdk.Pixbuf.from_file (fn);",
236 " \t} catch (Error e) {}",
241 " this.model.el.set_value(citer, 2, pix );",
245 " this.model.el.set_sort_column_id(1,Gtk.SortType.ASCENDING);",
249 " // set size up...",
251 " this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);",
253 " this.mainwindow.el.get_size(out w, out h);",
255 " // left tree = 250, editor area = 500?",
258 "\t// max hieght ...",
259 " this.el.set_size_request( 350, h); // full height?",
263 " if (this.el.relative_to == null) {",
264 " this.el.set_relative_to(onbtn);",
266 " this.el.show_all();",
268 " while(Gtk.events_pending()) { ",
269 " Gtk.main_iteration();",
271 " // this.hpane.el.set_position( 0);",
278 "name" : "PopoverAddObject",
280 "path" : "/home/alan/gitlive/roobuilder/src/Builder4/PopoverAddObject.bjs",