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 ( (-1 * (y+200)) > ( last_child_bottom - this.el.height)) {
77 // print("\nlast child - this height = %f ==== new y %f\n ".printf(
78 // last_child_bottom - this.el.height,
80 // y = float.min(0, y); //??
81 // print("scroll event of %f - new y = %f ".printf(event.y, y));
82 this.filelayout.el.y = y;
88 // userdefined functions
89 public void set_size(float w, float h) {
90 _this.filelayout_manager.el.max_column_width = w - 150;
91 this.el.set_size(this.el.get_stage().width-150,
92 this.el.get_stage().height);
93 this.el.set_position(100,50);
95 public void show(Project.Project pr) {
96 // list all the files, and create new Xcls_fileitem for each one.
98 var fiter = pr.files.map_iterator();
99 while (fiter.next()) {
100 var a = new Xcls_fileitem(this,fiter.get_value());
102 print("add " + fiter.get_value().name + "\n");
103 this.filelayout.el.add_child(a.el);
108 // skip |xns - no return type
109 public class Xcls_filelayout : Object
111 public Clutter.Actor el;
112 private Xcls_ClutterFiles _this;
118 public Xcls_filelayout(Xcls_ClutterFiles _owner )
121 _this.filelayout = this;
122 this.el = new Clutter.Actor();
126 // set gobject values
127 this.el.reactive = true;
128 var child_0 = new Xcls_filelayout_manager( _this );
130 this.el.layout_manager = child_0.el;
133 this.el.add_constraint(
134 new Clutter.BindConstraint(_this.el,Clutter.BindCoordinate.SIZE, 0.0f)
138 // userdefined functions
140 // skip |xns - no return type
142 public class Xcls_filelayout_manager : Object
144 public Clutter.FlowLayout el;
145 private Xcls_ClutterFiles _this;
151 public Xcls_filelayout_manager(Xcls_ClutterFiles _owner )
154 _this.filelayout_manager = this;
155 this.el = new Clutter.FlowLayout( Clutter.FlowOrientation.HORIZONTAL );
159 // set gobject values
160 this.el.column_spacing = 20;
161 this.el.homogeneous = true;
162 this.el.row_spacing = 20;
165 // userdefined functions
167 // skip |xns - no return type
169 public class Xcls_fileitem : Object
171 public Clutter.Actor el;
172 private Xcls_ClutterFiles _this;
176 public Xcls_image image;
177 public Xcls_title title;
180 public Xcls_fileitem(Xcls_ClutterFiles _owner , JsRender.JsRender file)
183 this.el = new Clutter.Actor();
187 // set gobject values
188 this.el.reactive = true;
189 var child_0 = new Xcls_BoxLayout5( _this );
191 this.el.layout_manager = child_0.el;
192 var child_1 = new Xcls_image( _this ,file);
194 this.el.add_child ( child_1.el );
195 this.image = child_1;
196 var child_2 = new Xcls_title( _this ,file);
198 this.el.add_child ( child_2.el );
199 this.title = child_2;
202 this.el.set_size(100,100);
205 this.el.enter_event.connect( ( event) => {
206 this.el.background_color = new Clutter.Color.from_string("#eee");
209 this.el.leave_event.connect( ( event) => {
210 this.el.background_color = new Clutter.Color.from_string("#000");
215 // userdefined functions
217 // skip |xns - no return type
219 public class Xcls_BoxLayout5 : Object
221 public Clutter.BoxLayout el;
222 private Xcls_ClutterFiles _this;
228 public Xcls_BoxLayout5(Xcls_ClutterFiles _owner )
231 this.el = new Clutter.BoxLayout();
235 // set gobject values
236 this.el.orientation = Clutter.Orientation.VERTICAL;
240 // userdefined functions
242 // skip |xns - no return type
244 public class Xcls_image : Object
246 public Clutter.Texture el;
247 private Xcls_ClutterFiles _this;
253 public Xcls_image(Xcls_ClutterFiles _owner , JsRender.JsRender file)
256 this.el = new Clutter.Texture.from_file(file.getIconFile());
260 // set gobject values
261 this.el.margin_left = "";
262 this.el.x_align = Clutter.ActorAlign.START;
263 this.el.x_expand = true;
264 this.el.y_align = Clutter.ActorAlign.START;
265 this.el.y_expand = false;
270 // userdefined functions
272 // skip |xns - no return type
274 public class Xcls_title : Object
276 public Clutter.Text el;
277 private Xcls_ClutterFiles _this;
283 public Xcls_title(Xcls_ClutterFiles _owner , JsRender.JsRender file)
286 this.el = new Clutter.Text.full("Sans 10px", file.nickName(),new Clutter.Color.from_string("#fff"));
290 // set gobject values
291 this.el.x_align = Clutter.ActorAlign.START;
292 this.el.x_expand = true;
293 this.el.y_align = Clutter.ActorAlign.START;
294 this.el.y_expand = false;
297 // userdefined functions
299 // skip |xns - no return type