1 /* Copyright 2009 Yorba Foundation
3 * This software is licensed under the GNU Lesser General Public License
4 * (version 2.1 or later). See the COPYING file in this distribution.
10 public class StatusBar : Gtk.DrawingArea {
11 Model.TimeSystem provider;
12 int64 current_position = 0;
14 public StatusBar(Model.Project p, Model.TimeSystem provider, int height) {
15 set_flags(Gtk.WidgetFlags.NO_WINDOW);
16 modify_bg(Gtk.StateType.NORMAL, parse_color("#666"));
17 set_size_request(0, height);
19 p.media_engine.position_changed.connect(on_position_changed);
20 this.provider = provider;
23 public void on_position_changed(int64 new_position) {
24 emit(this, Facility.SIGNAL_HANDLERS, Level.INFO, "on_position_changed");
25 current_position = new_position;
29 public override bool expose_event(Gdk.EventExpose e) {
30 window.draw_rectangle(style.bg_gc[(int) Gtk.StateType.NORMAL], true,
31 allocation.x, allocation.y, allocation.width, allocation.height);
33 string time = provider.get_time_string(current_position);
35 Pango.Layout layout = create_pango_layout(time);
36 Gdk.draw_layout(window, style.white_gc, allocation.x + 4, allocation.y + 2, layout);