1 static Xcls_RightPalete _RightPalete;
3 public class Xcls_RightPalete : Object
6 private Xcls_RightPalete _this;
8 public static Xcls_RightPalete singleton()
10 if (_RightPalete == null) {
11 _RightPalete= new Xcls_RightPalete();
15 public Xcls_viewbox viewbox;
16 public Xcls_model model;
17 public Xcls_txtrender txtrender;
20 public signal void after_node_change(JsRender.Node? node) ;
21 public signal void before_node_change(JsRender.Node? node) ;
22 public signal void drag_end() ;
25 public Xcls_RightPalete()
28 this.el = new Gtk.VBox( true, 0 );
33 var child_0 = new Xcls_viewbox( _this );
35 this.el.add ( child_0.el );
38 // user defined functions
39 public void load (Palete.Palete pal, string cls ) {
41 // this.get('model').expanded();
43 var tr = pal.getChildList(cls);
44 this.model.el.clear();
49 for(var i =0 ; i < tr.length; i++) {
50 this.model.el.append(out citer);
52 this.model.el.set_value(citer, 0, tr[i] ); // title
55 this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
58 public void clear () {
59 this.model.el.clear();
61 public class Xcls_viewbox : Object
64 private Xcls_RightPalete _this;
70 public Xcls_viewbox(Xcls_RightPalete _owner )
74 this.el = new Gtk.VBox( true, 0 );
79 var child_0 = new Xcls_ScrolledWindow3( _this );
81 this.el.add ( child_0.el );
84 // user defined functions
86 public class Xcls_ScrolledWindow3 : Object
88 public Gtk.ScrolledWindow el;
89 private Xcls_RightPalete _this;
95 public Xcls_ScrolledWindow3(Xcls_RightPalete _owner )
98 this.el = new Gtk.ScrolledWindow( null, null );
102 // set gobject values
103 this.el.shadow_type = Gtk.ShadowType.IN;
104 var child_0 = new Xcls_TreeView4( _this );
106 this.el.add ( child_0.el );
110 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
111 this.el.set_size_request(-1,200); }
113 // user defined functions
115 public class Xcls_TreeView4 : Object
117 public Gtk.TreeView el;
118 private Xcls_RightPalete _this;
122 public string dragData;
125 public Xcls_TreeView4(Xcls_RightPalete _owner )
128 this.el = new Gtk.TreeView();
132 // set gobject values
133 this.el.enable_tree_lines = true;
134 this.el.headers_visible = false;
135 var child_0 = new Xcls_model( _this );
137 this.el.set_model ( child_0.el );
138 var child_1 = new Xcls_TreeViewColumn6( _this );
140 this.el.append_column ( child_1.el );
145 this.el.set_size_request(150,-1);
146 // set_reorderable: [1]
148 var description = new Pango.FontDescription();
149 description.set_size(8000);
150 this.el.modify_font(description);
152 var selection = this.el.get_selection();
153 selection.set_mode( Gtk.SelectionMode.SINGLE);
154 // this.selection.signal['changed'].connect(function() {
155 // _view.listeners['cursor-changed'].apply(_view, [ _view, '']);
157 // see: http://live.gnome.org/GnomeLove/DragNDropTutorial
159 Gtk.drag_source_set (
160 this.el, /* widget will be drag-able */
161 Gdk.ModifierType.BUTTON1_MASK, /* modifier that will start a drag */
162 Builder4.Application.targetList, /* lists of target to support */
163 Gdk.DragAction.COPY /* what to do with data after dropped */
165 //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);
167 // Gtk.drag_source_set_target_list(this.el, Application.targetList);
168 // Gtk.drag_source_add_text_targets(this.el);
172 this.el.button_press_event.connect( ( event) => {
174 // if (!this.get('/Editor').save()) {
175 // // popup!! - click handled..
180 this.el.drag_begin.connect( ( ctx) => {
181 // we could fill this in now...
182 // Seed.print('SOURCE: drag-begin');
187 var s = this.el.get_selection();
190 s.get_selected(out mod, out iter);
191 var path = mod.get_path(iter);
193 /// pix is a surface..
194 var pix = this.el.create_row_drag_icon ( path);
197 Gtk.drag_set_icon_surface (ctx, pix);
201 _this.model.el.get_value(iter, 0, out value);
203 this.dragData = (string) value;
208 this.el.drag_end.connect( ( drag_context) => {
209 print("SOURCE: drag-end\n");
212 //this.dropList = null;
213 _this.drag_end(); // call signal..
214 //this.get('/LeftTree.view').highlight(false);
217 this.el.drag_data_get.connect( (drag_context, selection_data, info, time) => {
218 //Seed.print('Palete: drag-data-get: ' + target_type);
219 if (this.dragData.length < 1 ) {
223 print("setting drag data to %s\n", this.dragData);
224 // selection_data.set_text(this.dragData ,this.dragData.length);
225 selection_data.set (selection_data.get_target (), 8, (uchar[]) this.dragData.to_utf8 ());
227 //this.el.dragData = "TEST from source widget";
233 // user defined functions
235 public class Xcls_model : Object
237 public Gtk.ListStore el;
238 private Xcls_RightPalete _this;
244 public Xcls_model(Xcls_RightPalete _owner )
248 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
252 // set gobject values
255 // user defined functions
256 public string getValue (Gtk.TreeIter iter, int col) {
258 this.el.get_value(iter, col , out gval);
264 public class Xcls_TreeViewColumn6 : Object
266 public Gtk.TreeViewColumn el;
267 private Xcls_RightPalete _this;
273 public Xcls_TreeViewColumn6(Xcls_RightPalete _owner )
276 this.el = new Gtk.TreeViewColumn();
280 // set gobject values
281 var child_0 = new Xcls_txtrender( _this );
283 this.el.pack_start ( child_0.el , true );
287 this.el.add_attribute(_this.txtrender.el , "markup", 0 ); }
289 // user defined functions
291 public class Xcls_txtrender : Object
293 public Gtk.CellRendererText el;
294 private Xcls_RightPalete _this;
300 public Xcls_txtrender(Xcls_RightPalete _owner )
303 _this.txtrender = this;
304 this.el = new Gtk.CellRendererText();
308 // set gobject values
311 // user defined functions