"Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
"id" : "WindowLeftTree",
"items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "add",
- "bool always_show_image" : true,
- "bool hexpand" : true,
- "items" : [
- {
- "$ xns" : "Gtk",
- "* pack" : "set_image",
- "utf8 icon_name" : "list-add",
- "xtype" : "Image"
- }
- ],
- "listeners" : {
- "clicked" : [
- " ( ) => {",
- " ",
- "",
- " \t_this.main_window.windowstate.showAddObject(this.el);",
- " ",
- "}"
- ]
- },
- "string label" : "Add Child Element",
- "xtype" : "Button"
- },
{
"$ xns" : "Gtk",
"* init" : [
],
"* pack" : "add",
"Gtk.ShadowType shadow_type" : "Gtk.ShadowType.IN",
+ "id" : "viewwin",
"items" : [
{
"# bool blockChanges" : false,
"",
" //Gtk.drag_dest_set_target_list(this.el, Builder.Application.targetList);",
" //Gtk.drag_dest_add_text_targets(this.el);",
+ " ",
+ " ",
+ " ",
+ " ",
"}",
""
],
"* pack" : "add",
+ "Boolean id" : "view",
"bool button_is_pressed" : false,
"bool expand" : true,
+ "bool headers_visible" : false,
"bool key_is_pressed" : false,
- "gboolean headers_visible" : true,
- "id" : "view",
"items" : [
{
"# DialogTemplateSelect template_select" : "null",
"# string activePath" : "\"\"",
- "$ columns" : "typeof(string),typeof(string),typeof(Object),typeof(Gdk.Pixbuf)",
+ "$ columns" : [
+ "typeof(string),",
+ "typeof(string),",
+ "typeof(Object),",
+ "typeof(Gdk.Pixbuf),",
+ "typeof(Gdk.Pixbuf)"
+ ],
"$ listAllTypes" : [
"function() {",
" var s = this.get('/LeftTree.view').selection;",
"* pack" : "set_model",
"currentTree" : false,
"id" : "model",
- "n_columns" : 4,
+ "n_columns" : 5,
"xtype" : "TreeStore",
"| JsRender.Node pathToNode" : [
"(string path) {",
" var clsb = clsname.split(\".\");",
" var sub = clsb.length > 1 ? clsb[1].down() : \"\";",
" ",
- " ",
+ " var addi = ic.load_icon(\"list-add\", 16,0);",
" 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.el.set_value(iter, 2,o);",
" this.el.set_value(iter, 3,pix); ",
- "",
+ " \tthis.el.set_value(iter, 4,addi); ",
" ",
"",
"}"
"| void load" : [
"(Gee.ArrayList<JsRender.Node> tr, Gtk.TreeIter? iter) ",
"{",
+ " ",
+ " \t",
" Gtk.TreeIter citer;",
" //this.insert(citer,iter,0);",
" ",
" }",
" // if it's still null?",
" if (f.tree == null) {",
+ "\t\t_this.main_window.windowstate.showAddObject(_this.view.el);",
+ " ",
" return;",
" }",
" ",
" //this.get('/Window.leftvpaned').el.set_position(200);",
" }",
" ",
+ " ",
+ " while (Gtk.events_pending()) {",
+ " Gtk.main_iteration();",
+ " }",
+ "",
+ " _this.maincol.el.set_max_width(_this.viewwin.el.get_allocated_width() - 32);",
+ " ",
+ " ",
+ " ",
" return;",
" ",
" ",
]
},
{
+ "$ Gtk.TreeViewColumnSizing sizing" : "Gtk.TreeViewColumnSizing.FIXED",
"$ xns" : "Gtk",
"* init" : [
" this.el.add_attribute(_this.renderer.el , \"markup\", 0 );",
" "
],
"* pack" : "append_column",
+ "bool expand" : true,
+ "bool resizable" : true,
+ "id" : "maincol",
"items" : [
{
"$ xns" : "Gtk",
"xtype" : "CellRendererText"
}
],
- "utf8 title" : "test",
+ "utf8 title" : "Node",
+ "xtype" : "TreeViewColumn"
+ },
+ {
+ "$ Gtk.TreeViewColumnSizing sizing" : "Gtk.TreeViewColumnSizing.FIXED",
+ "$ xns" : "Gtk",
+ "* init" : [
+ " this.el.add_attribute(_this.addiconrender.el , \"pixbuf\", 4 );",
+ " "
+ ],
+ "* pack" : "append_column",
+ "bool expand" : false,
+ "int max_width" : 24,
+ "items" : [
+ {
+ "$ xns" : "Gtk",
+ "* pack" : "pack_start,true",
+ "id" : "addiconrender",
+ "int width" : 16,
+ "xtype" : "CellRendererPixbuf"
+ }
+ ],
+ "utf8 title" : "Add",
"xtype" : "TreeViewColumn"
}
],
" return true;",
" }",
" ",
- "\t",
- " ",
- " if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) {",
- " //print(\"click\" + ev.type);",
- " return false;",
+ "\tif (ev.type != Gdk.EventType.BUTTON_PRESS) {",
+ "\t\treturn false;",
+ "\t}",
+ " if (_this.model.el.iter_n_children(null) < 1) {",
+ "\t _this.main_window.windowstate.showAddObject(_this.view.el);",
+ "\t return true;",
" }",
+ " ",
+ " ",
" Gtk.TreePath res;",
- " if (!_this.view.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {",
+ " Gtk.TreeViewColumn col;",
+ " if (!_this.view.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, out col, null, null) ) {",
" return true;",
" }",
" ",
- "",
+ " if (col.title == \"Add\") {",
+ " _this.main_window.windowstate.leftTreeBeforeChange();",
+ " this.el.get_selection().select_path(res);",
+ " \t_this.main_window.windowstate.showAddObject(this.el);",
+ " \treturn true;",
+ " }",
+ " ",
+ "\tif ( ev.button != 3) {",
+ " //print(\"click\" + ev.type);",
+ " return false;",
+ " }",
" _this.main_window.windowstate.leftTreeBeforeChange();",
"",
" ",
" ",
" this.el.get_selection().select_path(res);",
" ",
+ " ",
+ " ",
" //if (!this.get('/LeftTreeMenu').el) { ",
" // this.get('/LeftTreeMenu').init(); ",
" // }",
"xtype" : "Menu"
}
],
+ "listeners" : {
+ "size_allocate" : [
+ "(allocation) => {",
+ "",
+ "\t ",
+ "\t//GLib.debug(\"Got allocation width of scrolled view %d\", allocation.width );",
+ "\t_this.maincol.el.set_max_width(allocation.width - 32);",
+ "}",
+ ""
+ ]
+ },
"xtype" : "ScrolledWindow"
}
],
}
return _WindowLeftTree;
}
+ public Xcls_viewwin viewwin;
public Xcls_view view;
public Xcls_model model;
+ public Xcls_maincol maincol;
public Xcls_iconrender iconrender;
public Xcls_renderer renderer;
+ public Xcls_addiconrender addiconrender;
public Xcls_LeftTreeMenu LeftTreeMenu;
// my vars (def)
this.main_window = null;
// set gobject values
- var child_0 = new Xcls_Button2( _this );
+ var child_0 = new Xcls_viewwin( _this );
child_0.ref();
this.el.add ( child_0.el );
- var child_1 = new Xcls_ScrolledWindow4( _this );
- child_1.ref();
- this.el.add ( child_1.el );
}
// user defined functions
public JsRender.JsRender getActiveFile () {
return this.main_window.windowstate.file;
}
- public class Xcls_Button2 : Object
- {
- public Gtk.Button el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Button2(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- this.el = new Gtk.Button();
-
- // my vars (dec)
-
- // set gobject values
- this.el.hexpand = true;
- this.el.always_show_image = true;
- this.el.label = "Add Child Element";
- var child_0 = new Xcls_Image3( _this );
- child_0.ref();
- this.el.set_image ( child_0.el );
-
- //listeners
- this.el.clicked.connect( ( ) => {
-
-
- _this.main_window.windowstate.showAddObject(this.el);
-
- });
- }
-
- // user defined functions
- }
- public class Xcls_Image3 : Object
- {
- public Gtk.Image el;
- private Xcls_WindowLeftTree _this;
-
-
- // my vars (def)
-
- // ctor
- public Xcls_Image3(Xcls_WindowLeftTree _owner )
- {
- _this = _owner;
- this.el = new Gtk.Image();
-
- // my vars (dec)
-
- // set gobject values
- this.el.icon_name = "list-add";
- }
-
- // user defined functions
- }
-
-
- public class Xcls_ScrolledWindow4 : Object
+ public class Xcls_viewwin : Object
{
public Gtk.ScrolledWindow el;
private Xcls_WindowLeftTree _this;
// my vars (def)
// ctor
- public Xcls_ScrolledWindow4(Xcls_WindowLeftTree _owner )
+ public Xcls_viewwin(Xcls_WindowLeftTree _owner )
{
_this = _owner;
+ _this.viewwin = this;
this.el = new Gtk.ScrolledWindow( null, null );
// my vars (dec)
// init method
this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+
+ //listeners
+ this.el.size_allocate.connect( (allocation) => {
+
+
+ //GLib.debug("Got allocation width of scrolled view %d", allocation.width );
+ _this.maincol.el.set_max_width(allocation.width - 32);
+ });
}
// user defined functions
this.el.expand = true;
this.el.tooltip_column = 1;
this.el.enable_tree_lines = true;
- this.el.headers_visible = true;
+ this.el.headers_visible = false;
var child_0 = new Xcls_model( _this );
child_0.ref();
this.el.set_model ( child_0.el );
- var child_1 = new Xcls_TreeViewColumn7( _this );
+ var child_1 = new Xcls_maincol( _this );
child_1.ref();
this.el.append_column ( child_1.el );
+ var child_2 = new Xcls_TreeViewColumn8( _this );
+ child_2.ref();
+ this.el.append_column ( child_2.el );
// init method
//Gtk.drag_dest_set_target_list(this.el, Builder.Application.targetList);
//Gtk.drag_dest_add_text_targets(this.el);
+
+
+
+
}
//listeners
return true;
}
-
-
- if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) {
- //print("click" + ev.type);
- return false;
+ if (ev.type != Gdk.EventType.BUTTON_PRESS) {
+ return false;
+ }
+ if (_this.model.el.iter_n_children(null) < 1) {
+ _this.main_window.windowstate.showAddObject(_this.view.el);
+ return true;
}
+
+
Gtk.TreePath res;
- if (!_this.view.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {
+ Gtk.TreeViewColumn col;
+ if (!_this.view.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, out col, null, null) ) {
return true;
}
-
+ if (col.title == "Add") {
+ _this.main_window.windowstate.leftTreeBeforeChange();
+ this.el.get_selection().select_path(res);
+ _this.main_window.windowstate.showAddObject(this.el);
+ return true;
+ }
+
+ if ( ev.button != 3) {
+ //print("click" + ev.type);
+ return false;
+ }
_this.main_window.windowstate.leftTreeBeforeChange();
this.el.get_selection().select_path(res);
+
+
//if (!this.get('/LeftTreeMenu').el) {
// this.get('/LeftTreeMenu').init();
// }
{
_this = _owner;
_this.model = this;
- this.el = new Gtk.TreeStore.newv( { typeof(string),typeof(string),typeof(Object),typeof(Gdk.Pixbuf) } );
+ this.el = new Gtk.TreeStore.newv( { typeof(string),
+typeof(string),
+typeof(Object),
+typeof(Gdk.Pixbuf),
+typeof(Gdk.Pixbuf) } );
// my vars (dec)
this.template_select = null;
}
// if it's still null?
if (f.tree == null) {
+ _this.main_window.windowstate.showAddObject(_this.view.el);
+
return;
}
//this.get('/Window.leftvpaned').el.set_position(200);
}
+
+ while (Gtk.events_pending()) {
+ Gtk.main_iteration();
+ }
+
+ _this.maincol.el.set_max_width(_this.viewwin.el.get_allocated_width() - 32);
+
+
+
return;
var clsb = clsname.split(".");
var sub = clsb.length > 1 ? clsb[1].down() : "";
-
+ var addi = ic.load_icon("list-add", 16,0);
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.el.set_value(iter, 2,o);
this.el.set_value(iter, 3,pix);
-
+ this.el.set_value(iter, 4,addi);
}
}
public void load (Gee.ArrayList<JsRender.Node> tr, Gtk.TreeIter? iter)
{
+
+
Gtk.TreeIter citer;
//this.insert(citer,iter,0);
}
}
- public class Xcls_TreeViewColumn7 : Object
+ public class Xcls_maincol : Object
{
public Gtk.TreeViewColumn el;
private Xcls_WindowLeftTree _this;
// my vars (def)
// ctor
- public Xcls_TreeViewColumn7(Xcls_WindowLeftTree _owner )
+ public Xcls_maincol(Xcls_WindowLeftTree _owner )
{
_this = _owner;
+ _this.maincol = this;
this.el = new Gtk.TreeViewColumn();
// my vars (dec)
// set gobject values
- this.el.title = "test";
+ this.el.title = "Node";
+ this.el.sizing = Gtk.TreeViewColumnSizing.FIXED;
+ this.el.expand = true;
+ this.el.resizable = true;
var child_0 = new Xcls_iconrender( _this );
child_0.ref();
this.el.pack_start ( child_0.el , false );
}
+ public class Xcls_TreeViewColumn8 : Object
+ {
+ public Gtk.TreeViewColumn el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_TreeViewColumn8(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.TreeViewColumn();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.max_width = 24;
+ this.el.title = "Add";
+ this.el.sizing = Gtk.TreeViewColumnSizing.FIXED;
+ this.el.expand = false;
+ var child_0 = new Xcls_addiconrender( _this );
+ child_0.ref();
+ this.el.pack_start ( child_0.el , true );
+
+ // init method
+
+ this.el.add_attribute(_this.addiconrender.el , "pixbuf", 4 );
+ }
+
+ // user defined functions
+ }
+ public class Xcls_addiconrender : Object
+ {
+ public Gtk.CellRendererPixbuf el;
+ private Xcls_WindowLeftTree _this;
+
+
+ // my vars (def)
+
+ // ctor
+ public Xcls_addiconrender(Xcls_WindowLeftTree _owner )
+ {
+ _this = _owner;
+ _this.addiconrender = this;
+ this.el = new Gtk.CellRendererPixbuf();
+
+ // my vars (dec)
+
+ // set gobject values
+ this.el.width = 16;
+ }
+
+ // user defined functions
+ }
+
+
public class Xcls_LeftTreeMenu : Object
{