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.Box( Gtk.Orientation.VERTICAL, 0 );
33 var child_0 = new Xcls_viewbox( _this );
35 this.el.pack_start ( child_0.el , true,true,0 );
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.Box( Gtk.Orientation.VERTICAL, 0 );
79 var child_0 = new Xcls_ScrolledWindow3( _this );
81 this.el.pack_start ( child_0.el , true,true,0 );
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);
114 // user defined functions
116 public class Xcls_TreeView4 : Object
118 public Gtk.TreeView el;
119 private Xcls_RightPalete _this;
123 public string dragData;
126 public Xcls_TreeView4(Xcls_RightPalete _owner )
129 this.el = new Gtk.TreeView();
133 // set gobject values
134 this.el.enable_tree_lines = true;
135 this.el.headers_visible = true;
136 var child_0 = new Xcls_model( _this );
138 this.el.set_model ( child_0.el );
139 var child_1 = new Xcls_TreeViewColumn6( _this );
141 this.el.append_column ( child_1.el );
146 this.el.set_size_request(150,-1);
147 // set_reorderable: [1]
149 var description = new Pango.FontDescription();
150 description.set_size(8000);
151 this.el.override_font(description);
153 var selection = this.el.get_selection();
154 selection.set_mode( Gtk.SelectionMode.SINGLE);
155 // this.selection.signal['changed'].connect(function() {
156 // _view.listeners['cursor-changed'].apply(_view, [ _view, '']);
158 // see: http://live.gnome.org/GnomeLove/DragNDropTutorial
160 Gtk.drag_source_set (
161 this.el, /* widget will be drag-able */
162 Gdk.ModifierType.BUTTON1_MASK, /* modifier that will start a drag */
163 BuilderApplication.targetList, /* lists of target to support */
164 Gdk.DragAction.COPY /* what to do with data after dropped */
166 //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);
168 // Gtk.drag_source_set_target_list(this.el, Application.targetList);
169 // Gtk.drag_source_add_text_targets(this.el);
174 this.el.button_press_event.connect( ( event) => {
176 // if (!this.get('/Editor').save()) {
177 // // popup!! - click handled..
182 this.el.drag_begin.connect( ( ctx) => {
183 // we could fill this in now...
184 // Seed.print('SOURCE: drag-begin');
189 var s = this.el.get_selection();
192 s.get_selected(out mod, out iter);
193 var path = mod.get_path(iter);
195 /// pix is a surface..
196 var pix = this.el.create_row_drag_icon ( path);
199 Gtk.drag_set_icon_surface (ctx, pix);
203 _this.model.el.get_value(iter, 0, out value);
205 this.dragData = (string) value;
210 this.el.drag_end.connect( ( drag_context) => {
211 print("SOURCE: drag-end\n");
214 //this.dropList = null;
215 _this.drag_end(); // call signal..
216 //this.get('/LeftTree.view').highlight(false);
219 this.el.drag_data_get.connect( (drag_context, selection_data, info, time) => {
220 //Seed.print('Palete: drag-data-get: ' + target_type);
221 if (this.dragData.length < 1 ) {
225 print("setting drag data to %s\n", this.dragData);
226 // selection_data.set_text(this.dragData ,this.dragData.length);
227 selection_data.set (selection_data.get_target (), 8, (uchar[]) this.dragData.to_utf8 ());
229 //this.el.dragData = "TEST from source widget";
235 // user defined functions
237 public class Xcls_model : Object
239 public Gtk.ListStore el;
240 private Xcls_RightPalete _this;
246 public Xcls_model(Xcls_RightPalete _owner )
250 this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
254 // set gobject values
257 // user defined functions
258 public string getValue (Gtk.TreeIter iter, int col) {
260 this.el.get_value(iter, col , out gval);
267 public class Xcls_TreeViewColumn6 : Object
269 public Gtk.TreeViewColumn el;
270 private Xcls_RightPalete _this;
276 public Xcls_TreeViewColumn6(Xcls_RightPalete _owner )
279 this.el = new Gtk.TreeViewColumn();
283 // set gobject values
284 this.el.title = "Drag to add Object";
285 var child_0 = new Xcls_txtrender( _this );
287 this.el.pack_start ( child_0.el , true );
291 this.el.add_attribute(_this.txtrender.el , "markup", 0 );
294 // user defined functions
296 public class Xcls_txtrender : Object
298 public Gtk.CellRendererText el;
299 private Xcls_RightPalete _this;
305 public Xcls_txtrender(Xcls_RightPalete _owner )
308 _this.txtrender = this;
309 this.el = new Gtk.CellRendererText();
313 // set gobject values
316 // user defined functions