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 - layout height = %f , sroll actor height %f\n ".printf(
71 y, this.filelayout.el.height, this.el.height));
72 // y = float.min(0, y); //??
73 print("scroll event of %f - new y = %f ".printf(event.y, y));
74 this.filelayout.el.y = y;
80 // userdefined functions
81 public void set_size(float w, float h) {
82 _this.filelayout_manager.el.max_column_width = w - 150;
83 this.el.set_size(this.el.get_stage().width-150,
84 this.el.get_stage().height);
85 this.el.set_position(100,50);
87 public void show(Project.Project pr) {
88 // list all the files, and create new Xcls_fileitem for each one.
90 var fiter = pr.files.map_iterator();
91 while (fiter.next()) {
92 var a = new Xcls_fileitem(this,fiter.get_value());
94 print("add " + fiter.get_value().name + "\n");
95 this.filelayout.el.add_child(a.el);
100 // skip |xns - no return type
101 public class Xcls_filelayout : Object
103 public Clutter.Actor el;
104 private Xcls_ClutterFiles _this;
110 public Xcls_filelayout(Xcls_ClutterFiles _owner )
113 _this.filelayout = this;
114 this.el = new Clutter.Actor();
118 // set gobject values
119 this.el.reactive = true;
120 var child_0 = new Xcls_filelayout_manager( _this );
122 this.el.layout_manager = child_0.el;
125 this.el.add_constraint(
126 new Clutter.BindConstraint(_this.el,Clutter.BindCoordinate.SIZE, 0.0f)
130 // userdefined functions
132 // skip |xns - no return type
134 public class Xcls_filelayout_manager : Object
136 public Clutter.FlowLayout el;
137 private Xcls_ClutterFiles _this;
143 public Xcls_filelayout_manager(Xcls_ClutterFiles _owner )
146 _this.filelayout_manager = this;
147 this.el = new Clutter.FlowLayout( Clutter.FlowOrientation.HORIZONTAL );
151 // set gobject values
152 this.el.column_spacing = 20;
153 this.el.homogeneous = true;
154 this.el.row_spacing = 20;
157 // userdefined functions
159 // skip |xns - no return type
161 public class Xcls_fileitem : Object
163 public Clutter.Actor el;
164 private Xcls_ClutterFiles _this;
168 public Xcls_image image;
169 public Xcls_title title;
172 public Xcls_fileitem(Xcls_ClutterFiles _owner , JsRender.JsRender file)
175 this.el = new Clutter.Actor();
179 // set gobject values
180 var child_0 = new Xcls_BoxLayout5( _this );
182 this.el.layout_manager = child_0.el;
183 var child_1 = new Xcls_image( _this ,file);
185 this.el.add_child ( child_1.el );
186 this.image = child_1;
187 var child_2 = new Xcls_title( _this ,file);
189 this.el.add_child ( child_2.el );
190 this.title = child_2;
193 this.el.set_size(100,100);
196 // userdefined functions
198 // skip |xns - no return type
200 public class Xcls_BoxLayout5 : Object
202 public Clutter.BoxLayout el;
203 private Xcls_ClutterFiles _this;
209 public Xcls_BoxLayout5(Xcls_ClutterFiles _owner )
212 this.el = new Clutter.BoxLayout();
216 // set gobject values
217 this.el.orientation = Clutter.Orientation.VERTICAL;
221 // userdefined functions
223 // skip |xns - no return type
225 public class Xcls_image : Object
227 public Clutter.Texture el;
228 private Xcls_ClutterFiles _this;
234 public Xcls_image(Xcls_ClutterFiles _owner , JsRender.JsRender file)
237 this.el = new Clutter.Texture.from_file(file.getIconFile());
241 // set gobject values
242 this.el.x_align = Clutter.ActorAlign.START;
243 this.el.x_expand = true;
244 this.el.y_align = Clutter.ActorAlign.START;
245 this.el.y_expand = false;
248 // userdefined functions
250 // skip |xns - no return type
252 public class Xcls_title : Object
254 public Clutter.Text el;
255 private Xcls_ClutterFiles _this;
261 public Xcls_title(Xcls_ClutterFiles _owner , JsRender.JsRender file)
264 this.el = new Clutter.Text.full("Sans 10px", file.nickName(),new Clutter.Color.from_string("#fff"));
268 // set gobject values
269 this.el.x_align = Clutter.ActorAlign.START;
270 this.el.x_expand = true;
271 this.el.y_align = Clutter.ActorAlign.START;
272 this.el.y_expand = false;
275 // userdefined functions
277 // skip |xns - no return type