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 print("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..
70 print("\nnew y %f sroll actor height %f = last child bottom %f\n ".printf(
73 this.filelayout.el.last_child.y + this.filelayout.el.last_child.height));
74 // y = float.min(0, y); //??
75 print("scroll event of %f - new y = %f ".printf(event.y, y));
76 this.filelayout.el.y = y;
82 // userdefined functions
83 public void set_size(float w, float h) {
84 _this.filelayout_manager.el.max_column_width = w - 150;
85 this.el.set_size(this.el.get_stage().width-150,
86 this.el.get_stage().height);
87 this.el.set_position(100,50);
89 public void show(Project.Project pr) {
90 // list all the files, and create new Xcls_fileitem for each one.
92 var fiter = pr.files.map_iterator();
93 while (fiter.next()) {
94 var a = new Xcls_fileitem(this,fiter.get_value());
96 print("add " + fiter.get_value().name + "\n");
97 this.filelayout.el.add_child(a.el);
102 // skip |xns - no return type
103 public class Xcls_filelayout : Object
105 public Clutter.Actor el;
106 private Xcls_ClutterFiles _this;
112 public Xcls_filelayout(Xcls_ClutterFiles _owner )
115 _this.filelayout = this;
116 this.el = new Clutter.Actor();
120 // set gobject values
121 this.el.reactive = true;
122 var child_0 = new Xcls_filelayout_manager( _this );
124 this.el.layout_manager = child_0.el;
127 this.el.add_constraint(
128 new Clutter.BindConstraint(_this.el,Clutter.BindCoordinate.SIZE, 0.0f)
132 // userdefined functions
134 // skip |xns - no return type
136 public class Xcls_filelayout_manager : Object
138 public Clutter.FlowLayout el;
139 private Xcls_ClutterFiles _this;
145 public Xcls_filelayout_manager(Xcls_ClutterFiles _owner )
148 _this.filelayout_manager = this;
149 this.el = new Clutter.FlowLayout( Clutter.FlowOrientation.HORIZONTAL );
153 // set gobject values
154 this.el.column_spacing = 20;
155 this.el.homogeneous = true;
156 this.el.row_spacing = 20;
159 // userdefined functions
161 // skip |xns - no return type
163 public class Xcls_fileitem : Object
165 public Clutter.Actor el;
166 private Xcls_ClutterFiles _this;
170 public Xcls_image image;
171 public Xcls_title title;
174 public Xcls_fileitem(Xcls_ClutterFiles _owner , JsRender.JsRender file)
177 this.el = new Clutter.Actor();
181 // set gobject values
182 var child_0 = new Xcls_BoxLayout5( _this );
184 this.el.layout_manager = child_0.el;
185 var child_1 = new Xcls_image( _this ,file);
187 this.el.add_child ( child_1.el );
188 this.image = child_1;
189 var child_2 = new Xcls_title( _this ,file);
191 this.el.add_child ( child_2.el );
192 this.title = child_2;
195 this.el.set_size(100,100);
198 // userdefined functions
200 // skip |xns - no return type
202 public class Xcls_BoxLayout5 : Object
204 public Clutter.BoxLayout el;
205 private Xcls_ClutterFiles _this;
211 public Xcls_BoxLayout5(Xcls_ClutterFiles _owner )
214 this.el = new Clutter.BoxLayout();
218 // set gobject values
219 this.el.orientation = Clutter.Orientation.VERTICAL;
223 // userdefined functions
225 // skip |xns - no return type
227 public class Xcls_image : Object
229 public Clutter.Texture el;
230 private Xcls_ClutterFiles _this;
236 public Xcls_image(Xcls_ClutterFiles _owner , JsRender.JsRender file)
239 this.el = new Clutter.Texture.from_file(file.getIconFile());
243 // set gobject values
244 this.el.x_align = Clutter.ActorAlign.START;
245 this.el.x_expand = true;
246 this.el.y_align = Clutter.ActorAlign.START;
247 this.el.y_expand = false;
250 // userdefined functions
252 // skip |xns - no return type
254 public class Xcls_title : Object
256 public Clutter.Text el;
257 private Xcls_ClutterFiles _this;
263 public Xcls_title(Xcls_ClutterFiles _owner , JsRender.JsRender file)
266 this.el = new Clutter.Text.full("Sans 10px", file.nickName(),new Clutter.Color.from_string("#fff"));
270 // set gobject values
271 this.el.x_align = Clutter.ActorAlign.START;
272 this.el.x_expand = true;
273 this.el.y_align = Clutter.ActorAlign.START;
274 this.el.y_expand = false;
277 // userdefined functions
279 // skip |xns - no return type