1 /* === S I N F G =========================================================== */
2 /*! \file widget_time.cpp
3 ** \brief Template File
5 ** $Id: widget_time.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
8 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
14 ** You may not copy, print, publish, or in any
15 ** other way distribute this software without
16 ** a prior written agreement with
17 ** the copyright holder.
20 /* ========================================================================= */
22 /* === H E A D E R S ======================================================= */
31 #include <gtkmm/entry.h>
32 #include <gtkmm/button.h>
33 #include "widget_time.h"
38 /* === U S I N G =========================================================== */
41 //using namespace etl;
42 using namespace sinfg;
43 using namespace studio;
45 /* === M A C R O S ========================================================= */
51 /* === G L O B A L S ======================================================= */
53 /* === P R O C E D U R E S ================================================= */
55 /* === M E T H O D S ======================================================= */
57 Widget_Time::Widget_Time():
61 signal_activate().connect(sigc::mem_fun(*this,&studio::Widget_Time::refresh_value));
62 signal_activate().connect(sigc::mem_fun(*this,&studio::Widget_Time::refresh_text));
65 Widget_Time::~Widget_Time()
70 Widget_Time::refresh_text()
72 set_text(time_.get_string(fps_,App::get_time_format()));
77 Widget_Time::set_value(const sinfg::Time &data)
84 Widget_Time::get_value() const
90 Widget_Time::set_fps(float x)
97 Widget_Time::refresh_value()
101 Time newtime(get_text(),fps_);
102 if(abs(newtime-time_)>=0.001)
106 signal_value_changed()();
111 throw string("Caught unknown exception");
116 Widget_Time::on_event(GdkEvent* event)
118 const Time scroll_amount(0.25);
123 if(event->scroll.direction==GDK_SCROLL_DOWN)
125 time_-=scroll_amount;
127 signal_value_changed()();
129 else if(event->scroll.direction==GDK_SCROLL_UP)
131 time_+=scroll_amount;
133 signal_value_changed()();
141 return Gtk::Entry::on_event(event);
145 Widget_Time::on_focus_out_event(GdkEventFocus* event)
149 return Gtk::Entry::on_focus_out_event(event);
153 Widget_Time::on_focus_in_event(GdkEventFocus* event)
155 set_text(time_.get_string(fps_,App::get_time_format()|Time::FORMAT_FULL));
156 return Gtk::Entry::on_focus_in_event(event);