public class Xcls_PopoverAddObject : Object
{
- public Gtk.Popover el;
- private Xcls_PopoverAddObject _this;
-
- public static Xcls_PopoverAddObject singleton()
- {
- if (_PopoverAddObject == null) {
- _PopoverAddObject= new Xcls_PopoverAddObject();
- }
- return _PopoverAddObject;
- }
- public Xcls_model model;
- public Xcls_iconrender iconrender;
- public Xcls_txtrender txtrender;
-
- // my vars (def)
- public signal void before_node_change (JsRender.Node? node);
- public signal void after_node_change (JsRender.Node? node);
- public signal void drag_end ();
- public Xcls_MainWindow mainwindow;
- public bool active;
-
- // ctor
- public Xcls_PopoverAddObject()
- {
- _this = this;
- this.el = new Gtk.Popover( null );
-
- // my vars (dec)
- this.active = false;
-
- // set gobject values
- this.el.width_request = 900;
- this.el.height_request = 800;
- this.el.hexpand = false;
- this.el.modal = true;
- this.el.position = Gtk.PositionType.RIGHT;
- var child_0 = new Xcls_ScrolledWindow2( _this );
- child_0.ref();
- this.el.add ( child_0.el );
- }
-
- // user defined functions
- public void show (Palete.Palete pal, string cls, Gtk.Widget onbtn) {
-
-
-
-
-
- var tr = pal.getChildList(cls);
- this.model.el.clear();
-
-
- Gtk.TreeIter citer;
- var ic = Gtk.IconTheme.get_default();
- var pixdef = ic.load_icon("emblem-new", 16,0);
+ public Gtk.Popover el;
+ private Xcls_PopoverAddObject _this;
+
+ public static Xcls_PopoverAddObject singleton()
+ {
+ if (_PopoverAddObject == null) {
+ _PopoverAddObject= new Xcls_PopoverAddObject();
+ }
+ return _PopoverAddObject;
+ }
+ public Xcls_viewwin viewwin;
+ public Xcls_view view;
+ public Xcls_selmodel selmodel;
+ public Xcls_model model;
+ public Xcls_maincol maincol;
+
+ // my vars (def)
+ public signal void before_node_change (JsRender.Node? node);
+ public bool modal;
+ public signal void after_node_change (JsRender.Node? node);
+ public bool active;
+ public Xcls_MainWindow mainwindow;
+
+ // ctor
+ public Xcls_PopoverAddObject()
+ {
+ _this = this;
+ this.el = new Gtk.Popover();
+
+ // my vars (dec)
+ this.modal = true;
+ this.active = false;
+
+ // set gobject values
+ this.el.width_request = 900;
+ this.el.height_request = 800;
+ this.el.hexpand = false;
+ this.el.position = Gtk.PositionType.RIGHT;
+ new Xcls_viewwin( _this );
+ this.el.set_child ( _this.viewwin.el );
+ }
+
+ // user defined functions
+ public void a_clear () {
+ var m = (GLib.ListStore) _this.model.el.model;
+ m.remove_all();
+
+
+
+ }
+ public void show (Palete.Palete pal, string cls, Gtk.Widget onbtn) {
+
+
+
+ var tr = pal.getChildList(cls, false);
+ var m = (GLib.ListStore) _this.model.el.model;
+ m.remove_all();
+
+
+ // new version will not support properties here..
+ // they will be part of the properties, clicking will add a node..
+ // will change the return list above eventually?
+
+
+ foreach (var dname in tr) {
+
+
+ GLib.debug("add to model: %s", dname);
+ m.append(pal.fqnToNode(dname));
+ }
+ m.sort( (a, b) => {
+
+ return Posix.strcmp( ((JsRender.Node)a).fqn(), ((JsRender.Node)b).fqn());
+
+ });
+
+
+ var win = this.mainwindow.el;
+ //var w = win.get_width();
+ var h = win.get_height();
+
+
+ // left tree = 250, editor area = 500?
+
+ // min 450?
+ // max hieght ...
+ this.el.set_size_request( 350, h); // full height?
+
+ this.el.set_parent(onbtn);
+
+ //if (this.el.relative_to == null) {
+ //Gtk.Allocation rect;
+ //onbtn.get_allocation(out rect);
+ // this.el.set_pointing_to(rect);
+ //}
+ this.selmodel.el.set_selected(Gtk.INVALID_LIST_POSITION);
+ this.el.show();
+
+ }
+ public void hide () {
+
+ this.el.hide();
+ }
+ public class Xcls_viewwin : Object
+ {
+ public Gtk.ScrolledWindow el;
+ private Xcls_PopoverAddObject _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_viewwin(Xcls_PopoverAddObject _owner )
+ {
+ _this = _owner;
+ _this.viewwin = this;
+ this.el = new Gtk.ScrolledWindow();
+
+ // my vars (dec)
+
+ // set gobject values
+ new Xcls_view( _this );
+ this.el.set_child ( _this.view.el );
+
+ // init method
+
+ this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+ this.el.set_size_request(-1,200);
+ }
+
+ // user defined functions
+ }
+ public class Xcls_view : Object
+ {
+ public Gtk.ColumnView el;
+ private Xcls_PopoverAddObject _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_view(Xcls_PopoverAddObject _owner )
+ {
+ _this = _owner;
+ _this.view = this;
+ new Xcls_selmodel( _this );
+ this.el = new Gtk.ColumnView( _this.selmodel.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.hexpand = true;
+ this.el.vexpand = true;
+ var child_2 = new Xcls_DragSource3( _this );
+ child_2.ref();
+ this.el.add_controller( child_2.el );
+ new Xcls_maincol( _this );
+ this.el.append_column ( _this.maincol.el );
+ var child_4 = new Xcls_GestureClick8( _this );
+ child_4.ref();
+ this.el.add_controller( child_4.el );
+ }
+
+ // user defined functions
+ public Gtk.Widget? getWidgetAtRow (uint row) {
+ /*
+ // ?? could be done with model?
+
+ from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
+ var colview = gesture.widget;
+ var line_no = check_list_widget(colview, x,y);
+ if (line_no > -1) {
+ var item = colview.model.get_item(line_no);
+
+ }
+ */
+ GLib.debug("Get Widget At Row %d", (int)row);
+ var child = this.el.get_first_child();
+ var line_no = -1;
+ var reading_header = true;
+
+ while (child != null) {
+ GLib.debug("Got %s", child.get_type().name());
+ if (reading_header) {
+
+
+ if (child.get_type().name() != "GtkColumnListView") {
+ child = child.get_next_sibling();
+ continue;
+ }
+ child = child.get_first_child();
+ reading_header = false;
+ }
+ if (child.get_type().name() != "GtkColumnViewRowWidget") {
+ child = child.get_next_sibling();
+ continue;
+ }
+ line_no++;
+ if (line_no == row) {
+ GLib.debug("Returning widget %s", child.get_type().name());
+ return (Gtk.Widget)child;
+ }
+ child = child.get_next_sibling();
+ }
+ GLib.debug("Rturning null");
+ return null;
+
+ }
+ public int getRowAt (double x, double in_y, out string pos) {
+
+
+
+
+ /*
+
+ from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
+ var colview = gesture.widget;
+ var line_no = check_list_widget(colview, x,y);
+ if (line_no > -1) {
+ var item = colview.model.get_item(line_no);
+
+ }
+ */
+
+
+ //GLib.debug("offset = %d y = %d", (int) voff, (int) in_y);
+ var y = in_y + _this.viewwin.el.vadjustment.value;
+ var child = this.el.get_first_child();
+ //Gtk.Allocation alloc = { 0, 0, 0, 0 };
+ var line_no = -1;
+ var reading_header = true;
+ var real_y = 0;
+ var header_height = 0;
+ pos = "none";
+ var h = 0;
+ while (child != null) {
+ //GLib.debug("Got %s", child.get_type().name());
+ if (reading_header) {
+
+
+ if (child.get_type().name() != "GtkColumnListView") {
+ h += child.get_height();
+ child = child.get_next_sibling();
+ continue;
+ }
+ // should be columnlistview
+ child = child.get_first_child();
+ GLib.debug("header height=%d", h);
+ header_height = h;
+
+ reading_header = false;
+
+ }
+
+ if (child.get_type().name() != "GtkColumnViewRowWidget") {
+ child = child.get_next_sibling();
+ continue;
+ }
+
+ if (y < header_height) {
+ return -1;
+ }
+
+ line_no++;
+ var hh = child.get_height();
+ //child.get_allocation(out alloc);
+ //GLib.debug("got cell xy = %d,%d w,h= %d,%d", alloc.x, alloc.y, alloc.width, alloc.height);
+ //GLib.debug("row %d y= %d %s", line_no, (int) (header_height + alloc.y),
+
+ // child.visible ? "VIS" : "hidden");
+
+ if (y > (header_height + real_y) && y <= (header_height + real_y + hh) ) {
+ if (y > ( header_height + real_y + (hh * 0.8))) {
+ pos = "below";
+ } else if (y > ( header_height + real_y + (hh * 0.2))) {
+ pos = "over";
+ } else {
+ pos = "above";
+ }
+ GLib.debug("getRowAt return : %d, %s", line_no, pos);
+ return line_no;
+ }
+
+
+ if (real_y + hh > y) {
+ return -1;
+ }
+ real_y += hh;
+ child = child.get_next_sibling();
+ }
+ return -1;
+
+ }
+ public Gtk.Widget? getWidgetAt (double x, double in_y) {
+ /*
+
+ from https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
+ var colview = gesture.widget;
+ var line_no = check_list_widget(colview, x,y);
+ if (line_no > -1) {
+ var item = colview.model.get_item(line_no);
+
+ }
+ */
+ var y = in_y + _this.viewwin.el.vadjustment.value;
+ var child = this.el.get_first_child();
+ //Gtk.Allocation alloc = { 0, 0, 0, 0 };
+ var line_no = -1;
+ var reading_header = true;
+ var curr_y = 0;
+ var header_height = 0;
+ var h = 0;
+ while (child != null) {
+ //GLib.debug("Got %s", child.get_type().name());
+ if (reading_header) {
+
+
+ if (child.get_type().name() != "GtkColumnListView") {
+ h += child.get_height();
+ child = child.get_next_sibling();
+ continue;
+ }
+ // should be columnlistview
+ child = child.get_first_child();
+ GLib.debug("header height=%d", h);
+ header_height = h;
+
+ reading_header = false;
+
+ }
+ line_no++;
+
+ if (y < header_height) {
+ return null;
+ }
+
+ var hh = child.get_height();
+ //GLib.debug("got cell xy = %d,%d w,h= %d,%d", alloc.x, alloc.y, alloc.width, alloc.height);
+
+ if (y > curr_y && y <= header_height + hh + curr_y ) {
+ return (Gtk.Widget)child;
+ }
+ curr_y += hh ;
+
+ if (curr_y > y) {
+ return null;
+ }
+ child = child.get_next_sibling();
+ }
+ return null;
+
+ }
+ }
+ public class Xcls_DragSource3 : Object
+ {
+ public Gtk.DragSource el;
+ private Xcls_PopoverAddObject _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_DragSource3(Xcls_PopoverAddObject _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.DragSource();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.actions = Gdk.DragAction.COPY | Gdk.DragAction.MOVE ;
+
+ //listeners
+ this.el.prepare.connect( (x, y) => {
+
+
+
+ /// ( drag_context, data, info, time) => {
+
+
+ //print("drag-data-get");
+ var ndata = _this.selmodel.getSelectedNode();
+ if (ndata == null) {
+ GLib.debug("return empty string - no selection..");
+ return null;
+
+ }
+
+
+ //data.set_text(tp,tp.length);
+
+ var str = ndata.toJsonString();
+ GLib.debug("prepare store: %s", str);
+ GLib.Value ov = GLib.Value(typeof(string));
+ ov.set_string(str);
+ var cont = new Gdk.ContentProvider.for_value(ov);
+
+ //GLib.Value v = GLib.Value(typeof(string));
+ //var str = drop.read_text( [ "text/plain" ] 0);
+
+ //cont.get_value(ref v);
+ //GLib.debug("set %s", v.get_string());
+
+ return cont;
+
+ });
+ this.el.drag_begin.connect( ( drag ) => {
+ GLib.debug("SOURCE: drag-begin");
+
+ // find what is selected in our tree...
+ var data = _this.selmodel.getSelectedNode();
+ if (data == null) {
+ return ;
+ }
+
+ var xname = data.fqn();
+ GLib.debug ("XNAME IS %s", xname);
+
+ var widget = _this.view.getWidgetAtRow(_this.selmodel.el.selected);
+
+
+ var paintable = new Gtk.WidgetPaintable(widget);
+ this.el.set_icon(paintable, 0,0);
+
+
+ });
+ this.el.drag_end.connect( (drag, delete_data) => {
+ _this.hide();
+
+ });
+ }
+
+ // user defined functions
+ }
+
+ public class Xcls_selmodel : Object
+ {
+ public Gtk.SingleSelection el;
+ private Xcls_PopoverAddObject _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_selmodel(Xcls_PopoverAddObject _owner )
+ {
+ _this = _owner;
+ _this.selmodel = this;
+ new Xcls_model( _this );
+ this.el = new Gtk.SingleSelection( _this.model.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ public JsRender.Node? getSelectedNode () {
+ if (this.el.selected_item == null) {
+ return null;
+ }
+ var tr = (Gtk.TreeListRow)this.el.selected_item;
+ return (JsRender.Node)tr.get_item();
+
+ }
+ public JsRender.Node getNodeAt (uint row) {
+
+ var tr = (Gtk.TreeListRow)this.el.get_item(row);
+
+ var a = tr.get_item();;
+ GLib.debug("get_item (2) = %s", a.get_type().name());
+
+ return (JsRender.Node)tr.get_item();
+
+ }
+ }
+ public class Xcls_model : Object
+ {
+ public Gtk.TreeListModel el;
+ private Xcls_PopoverAddObject _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_model(Xcls_PopoverAddObject _owner )
+ {
+ _this = _owner;
+ _this.model = this;
+ this.el = new Gtk.TreeListModel(
+ new GLib.ListStore(typeof(JsRender.Node)), //..... << that's our store..
+ false, // passthru
+ true, // autexpand
+ (item) => {
+ return ((JsRender.Node)item).childstore;
- for(var i =0 ; i < tr.length; i++) {
- this.model.el.append(out citer);
- var dname = tr[i];
- var clsname = dname;
- if (dname.contains(":")) {
- var ar = dname.split(":");
- dname = "<b>" + ar[1] +"</b> - <i>"+ar[0]+"</i>";
- clsname = ar[0]; /// possibly?
- }
-
- this.model.el.set_value(citer, 0, tr[i] ); // used data.
- this.model.el.set_value(citer, 1, dname ); // displayed value.
-
- var clsb = clsname.split(".");
- var sub = clsb.length > 1 ? clsb[1].down() : "";
-
- var pix = pixdef;
- var fn = "/usr/share/glade/pixmaps/hicolor/16x16/actions/widget-gtk-" + sub + ".png";
- if (FileUtils.test (fn, FileTest.IS_REGULAR)) {
- pix = new Gdk.Pixbuf.from_file (fn);
- }
-
-
- this.model.el.set_value(citer, 2, pix );
-
-
- }
- this.model.el.set_sort_column_id(1,Gtk.SortType.ASCENDING);
-
-
-
-
-
- // set size up...
-
- this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
- int w,h;
- this.mainwindow.el.get_size(out w, out h);
-
- // left tree = 250, editor area = 500?
-
- // min 450?
- // max hieght ...
- this.el.set_size_request( 350, h); // full height?
+ }
-
- if (this.el.relative_to == null) {
- this.el.set_relative_to(onbtn);
- }
- this.el.show_all();
-
- while(Gtk.events_pending()) {
- Gtk.main_iteration();
- }
- // this.hpane.el.set_position( 0);
- }
- public void clear () {
- this.model.el.clear();
- }
- public void hide () {
-
- this.el.hide();
- }
- public class Xcls_ScrolledWindow2 : Object
- {
- public Gtk.ScrolledWindow el;
- private Xcls_PopoverAddObject _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_ScrolledWindow2(Xcls_PopoverAddObject _owner )
- {
- _this = _owner;
- this.el = new Gtk.ScrolledWindow( null, null );
-
- // my vars (dec)
-
- // set gobject values
- this.el.shadow_type = Gtk.ShadowType.IN;
- var child_0 = new Xcls_TreeView3( _this );
- child_0.ref();
- this.el.add ( child_0.el );
-
- // init method
-
- this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
- this.el.set_size_request(-1,200);
- }
-
- // user defined functions
- }
- public class Xcls_TreeView3 : Object
- {
- public Gtk.TreeView el;
- private Xcls_PopoverAddObject _this;
-
-
- // my vars (def)
- public string dragData;
-
- // ctor
- public Xcls_TreeView3(Xcls_PopoverAddObject _owner )
- {
- _this = _owner;
- this.el = new Gtk.TreeView();
-
- // my vars (dec)
-
- // set gobject values
- this.el.enable_tree_lines = true;
- this.el.headers_visible = true;
- var child_0 = new Xcls_model( _this );
- child_0.ref();
- this.el.set_model ( child_0.el );
- var child_1 = new Xcls_TreeViewColumn5( _this );
- child_1.ref();
- this.el.append_column ( child_1.el );
-
- // init method
-
- {
- this.el.set_size_request(150,-1);
- // set_reorderable: [1]
-
- var description = new Pango.FontDescription();
- description.set_size(10000);
- this.el.override_font(description);
-
- var selection = this.el.get_selection();
- selection.set_mode( Gtk.SelectionMode.SINGLE);
- // this.selection.signal['changed'].connect(function() {
- // _view.listeners['cursor-changed'].apply(_view, [ _view, '']);
- //});
- // see: http://live.gnome.org/GnomeLove/DragNDropTutorial
-
- Gtk.drag_source_set (
- this.el, /* widget will be drag-able */
- Gdk.ModifierType.BUTTON1_MASK, /* modifier that will start a drag */
- BuilderApplication.targetList, /* lists of target to support */
- Gdk.DragAction.COPY /* what to do with data after dropped */
- );
- //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);
-
- // Gtk.drag_source_set_target_list(this.el, Application.targetList);
- // Gtk.drag_source_add_text_targets(this.el);
-
- }
-
- //listeners
- this.el.button_press_event.connect( ( event) => {
-
- // if (!this.get('/Editor').save()) {
- // // popup!! - click handled..
- // return true;
- // }
- return false;
- });
- this.el.drag_begin.connect( ( ctx) => {
- // we could fill this in now...
- // Seed.print('SOURCE: drag-begin');
-
-
-
- Gtk.TreeIter iter;
- var s = this.el.get_selection();
-
- Gtk.TreeModel mod;
- s.get_selected(out mod, out iter);
- var path = mod.get_path(iter);
-
- /// pix is a surface..
- var pix = this.el.create_row_drag_icon ( path);
-
-
- Gtk.drag_set_icon_surface (ctx, pix);
- GLib.Value value;
-
-
- _this.model.el.get_value(iter, 0, out value);
-
- this.dragData = (string) value;
-
-
- return;
- });
- this.el.drag_data_get.connect( (drag_context, selection_data, info, time) => {
- //Seed.print('Palete: drag-data-get: ' + target_type);
- if (this.dragData.length < 1 ) {
- return;
- }
-
- GLib.debug("setting drag data to %s\n", this.dragData);
- // selection_data.set_text(this.dragData ,this.dragData.length);
- selection_data.set (selection_data.get_target (), 8, (uchar[]) this.dragData.to_utf8 ());
-
- //this.el.dragData = "TEST from source widget";
-
-
- });
- this.el.drag_end.connect( ( drag_context) => {
- GLib.debug("SOURCE: drag-end (call listener on this)\n");
-
- this.dragData = "";
- //this.dropList = null;
- _this.drag_end(); // call signal..
- //this.get('/LeftTree.view').highlight(false);
-
- });
- }
-
- // user defined functions
- }
- public class Xcls_model : Object
- {
- public Gtk.ListStore el;
- private Xcls_PopoverAddObject _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_model(Xcls_PopoverAddObject _owner )
- {
- _this = _owner;
- _this.model = this;
- this.el = new Gtk.ListStore.newv( { typeof(string),typeof(string),typeof(Gdk.Pixbuf) } );
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- public string getValue (Gtk.TreeIter iter, int col) {
- GLib.Value gval;
- this.el.get_value(iter, col , out gval);
- return (string)gval;
-
- }
- }
-
- public class Xcls_TreeViewColumn5 : Object
- {
- public Gtk.TreeViewColumn el;
- private Xcls_PopoverAddObject _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_TreeViewColumn5(Xcls_PopoverAddObject _owner )
- {
- _this = _owner;
- this.el = new Gtk.TreeViewColumn();
-
- // my vars (dec)
-
- // set gobject values
- this.el.title = "Drag to add Object";
- var child_0 = new Xcls_iconrender( _this );
- child_0.ref();
- this.el.pack_start ( child_0.el , true );
- var child_1 = new Xcls_txtrender( _this );
- child_1.ref();
- this.el.pack_start ( child_1.el , true );
-
- // init method
-
- this.el.add_attribute(_this.txtrender.el , "markup", 1 );
- this.el.add_attribute(_this.iconrender.el , "pixbuf", 2 );
- }
-
- // user defined functions
- }
- public class Xcls_iconrender : Object
- {
- public Gtk.CellRendererPixbuf el;
- private Xcls_PopoverAddObject _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_iconrender(Xcls_PopoverAddObject _owner )
- {
- _this = _owner;
- _this.iconrender = this;
- this.el = new Gtk.CellRendererPixbuf();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
- public class Xcls_txtrender : Object
- {
- public Gtk.CellRendererText el;
- private Xcls_PopoverAddObject _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_txtrender(Xcls_PopoverAddObject _owner )
- {
- _this = _owner;
- _this.txtrender = this;
- this.el = new Gtk.CellRendererText();
-
- // my vars (dec)
-
- // set gobject values
- }
-
- // user defined functions
- }
-
+);
+
+ // my vars (dec)
+
+ // set gobject values
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_maincol : Object
+ {
+ public Gtk.ColumnViewColumn el;
+ private Xcls_PopoverAddObject _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_maincol(Xcls_PopoverAddObject _owner )
+ {
+ _this = _owner;
+ _this.maincol = this;
+ var child_1 = new Xcls_SignalListItemFactory7( _this );
+ child_1.ref();
+ this.el = new Gtk.ColumnViewColumn( "Drag to add Object", child_1.el );
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.id = "maincol";
+ this.el.expand = true;
+ }
+
+ // user defined functions
+ }
+ public class Xcls_SignalListItemFactory7 : Object
+ {
+ public Gtk.SignalListItemFactory el;
+ private Xcls_PopoverAddObject _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_SignalListItemFactory7(Xcls_PopoverAddObject _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.SignalListItemFactory();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.setup.connect( (listitem) => {
+
+
+ var hbox = new Gtk.Box(Gtk.Orientation.HORIZONTAL,0);
+ var icon = new Gtk.Image();
+ var lbl = new Gtk.Label("");
+ lbl.use_markup = true;
+
+
+ lbl.justify = Gtk.Justification.LEFT;
+ lbl.xalign = 0;
+ lbl.margin_start = 4;
+ // listitem.activatable = true; ??
+
+ hbox.append(icon);
+ hbox.append(lbl);
+
+ ((Gtk.ListItem)listitem).set_child(hbox);
+
+ });
+ this.el.bind.connect( (listitem) => {
+ //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
+
+ //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
+
+
+ var hbox = (Gtk.Box) ((Gtk.ListItem)listitem).get_child();
+
+
+
+ var img = (Gtk.Image) hbox.get_first_child();
+ var lbl = (Gtk.Label) img.get_next_sibling();
+
+ var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
+
+
+
+ var node = (JsRender.Node) lr.get_item();
+
+ GLib.debug("node is %s", node.get_type().name());
+ GLib.debug("lbl is %s", lbl.get_type().name());
+ GLib.debug("node fqn %s", node.fqn());
+ // was item (1) in old layout
+
+
+ img.resource = node.iconResourceName;
+ lbl.label = node.fqn();
+ // lbl.tooltip_markup = node.nodeTip();
+
+
+ // bind image...
+
+ });
+ }
+
+ // user defined functions
+ }
+
+
+ public class Xcls_GestureClick8 : Object
+ {
+ public Gtk.GestureClick el;
+ private Xcls_PopoverAddObject _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_GestureClick8(Xcls_PopoverAddObject _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.GestureClick();
+
+ // my vars (dec)
+
+ // set gobject values
+
+ //listeners
+ this.el.pressed.connect( (n_press, x, y) => {
+ if (n_press < 2) { /// doubleclick?
+ return;
+ }
+ //var pos = "";
+ // find left tree selected node
+ var ws =_this.mainwindow.windowstate;
+ var lt = ws.left_tree;
+
+ var add = _this.selmodel.getSelectedNode().deepClone();
+ if (lt.model.el.n_items < 1) {
+ ws.file.tree = add;
+ add.updated_count++;
+ var m = (GLib.ListStore) lt.model.el.model;
+ m.append(add);
+ lt.model.selectNode(add);
+ lt.changed();
+ lt.node_selected(add);
+ return;
+ }
+ var addto = _this.mainwindow.windowstate.left_tree.selmodel.getSelectedNode();
+ //var row = _this.view.getRowAt(x,y, out pos);
+
+
+ addto.appendChild(add);
+ _this.mainwindow.windowstate.left_props.changed();
+ _this.mainwindow.windowstate.left_tree.model.selectNode(add);
+ });
+ }
+
+ // user defined functions
+ }