2 valac --pkg gio-2.0 --pkg posix --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0 --pkg libwnck-3.0 \
3 /tmp/ClutterFiles.vala -o /tmp/ClutterFiles
8 static int main (string[] args) {
10 new Xcls_ClutterFiles();
11 ClutterFiles.show_all();
18 public static Xcls_ClutterFiles ClutterFiles;
20 public class Xcls_ClutterFiles : Object
22 public Clutter.ScrollActor el;
23 private Xcls_ClutterFiles _this;
25 public Xcls_filelayout filelayout;
26 public Xcls_filelayout_manager filelayout_manager;
31 public Xcls_ClutterFiles()
35 this.el = new Clutter.ScrollActor();
40 this.el.reactive = true;
41 var child_0 = new Xcls_filelayout( _this );
43 this.el.add_child ( child_0.el );
46 this.el.scroll_event.connect( ( event) => {
48 //Sprint("scroll event");
49 var y = this.filelayout.el.y;
50 var dir = event.direction;
52 case Clutter.ScrollDirection.UP:
55 case Clutter.ScrollDirection.DOWN:
61 // range of scroll -- can go up -- eg.. -ve value.
65 // to work out the max -ve number
66 // height of filelayout
67 // height of scrollactor..
69 var last_child_bottom = this.filelayout.el.last_child.y + this.filelayout.el.last_child.height;
70 // if ( last_child_bottom - this.el.height > last_child_bottom);
75 print("\nlast child - this height = %f ==== new y %f\n ".printf(
76 last_child_bottom - this.el.height
78 // y = float.min(0, y); //??
79 print("scroll event of %f - new y = %f ".printf(event.y, y));
80 this.filelayout.el.y = y;
86 // userdefined functions
87 public void set_size(float w, float h) {
88 _this.filelayout_manager.el.max_column_width = w - 150;
89 this.el.set_size(this.el.get_stage().width-150,
90 this.el.get_stage().height);
91 this.el.set_position(100,50);
93 public void show(Project.Project pr) {
94 // list all the files, and create new Xcls_fileitem for each one.
96 var fiter = pr.files.map_iterator();
97 while (fiter.next()) {
98 var a = new Xcls_fileitem(this,fiter.get_value());
100 print("add " + fiter.get_value().name + "\n");
101 this.filelayout.el.add_child(a.el);
106 // skip |xns - no return type
107 public class Xcls_filelayout : Object
109 public Clutter.Actor el;
110 private Xcls_ClutterFiles _this;
116 public Xcls_filelayout(Xcls_ClutterFiles _owner )
119 _this.filelayout = this;
120 this.el = new Clutter.Actor();
124 // set gobject values
125 this.el.reactive = true;
126 var child_0 = new Xcls_filelayout_manager( _this );
128 this.el.layout_manager = child_0.el;
131 this.el.add_constraint(
132 new Clutter.BindConstraint(_this.el,Clutter.BindCoordinate.SIZE, 0.0f)
136 // userdefined functions
138 // skip |xns - no return type
140 public class Xcls_filelayout_manager : Object
142 public Clutter.FlowLayout el;
143 private Xcls_ClutterFiles _this;
149 public Xcls_filelayout_manager(Xcls_ClutterFiles _owner )
152 _this.filelayout_manager = this;
153 this.el = new Clutter.FlowLayout( Clutter.FlowOrientation.HORIZONTAL );
157 // set gobject values
158 this.el.column_spacing = 20;
159 this.el.homogeneous = true;
160 this.el.row_spacing = 20;
163 // userdefined functions
165 // skip |xns - no return type
167 public class Xcls_fileitem : Object
169 public Clutter.Actor el;
170 private Xcls_ClutterFiles _this;
174 public Xcls_image image;
175 public Xcls_title title;
178 public Xcls_fileitem(Xcls_ClutterFiles _owner , JsRender.JsRender file)
181 this.el = new Clutter.Actor();
185 // set gobject values
186 var child_0 = new Xcls_BoxLayout5( _this );
188 this.el.layout_manager = child_0.el;
189 var child_1 = new Xcls_image( _this ,file);
191 this.el.add_child ( child_1.el );
192 this.image = child_1;
193 var child_2 = new Xcls_title( _this ,file);
195 this.el.add_child ( child_2.el );
196 this.title = child_2;
199 this.el.set_size(100,100);
202 // userdefined functions
204 // skip |xns - no return type
206 public class Xcls_BoxLayout5 : Object
208 public Clutter.BoxLayout el;
209 private Xcls_ClutterFiles _this;
215 public Xcls_BoxLayout5(Xcls_ClutterFiles _owner )
218 this.el = new Clutter.BoxLayout();
222 // set gobject values
223 this.el.orientation = Clutter.Orientation.VERTICAL;
227 // userdefined functions
229 // skip |xns - no return type
231 public class Xcls_image : Object
233 public Clutter.Texture el;
234 private Xcls_ClutterFiles _this;
240 public Xcls_image(Xcls_ClutterFiles _owner , JsRender.JsRender file)
243 this.el = new Clutter.Texture.from_file(file.getIconFile());
247 // set gobject values
248 this.el.x_align = Clutter.ActorAlign.START;
249 this.el.x_expand = true;
250 this.el.y_align = Clutter.ActorAlign.START;
251 this.el.y_expand = false;
254 // userdefined functions
256 // skip |xns - no return type
258 public class Xcls_title : Object
260 public Clutter.Text el;
261 private Xcls_ClutterFiles _this;
267 public Xcls_title(Xcls_ClutterFiles _owner , JsRender.JsRender file)
270 this.el = new Clutter.Text.full("Sans 10px", file.nickName(),new Clutter.Color.from_string("#fff"));
274 // set gobject values
275 this.el.x_align = Clutter.ActorAlign.START;
276 this.el.x_expand = true;
277 this.el.y_align = Clutter.ActorAlign.START;
278 this.el.y_expand = false;
281 // userdefined functions
283 // skip |xns - no return type