1 /* === S Y N F I G ========================================================= */
2 /*! \file widget_time.cpp
3 ** \brief Template File
5 ** $Id: widget_distance.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_distance.h"
38 /* === U S I N G =========================================================== */
41 //using namespace etl;
42 using namespace synfig;
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_Distance::Widget_Distance():
58 Gtk::SpinButton(0.05,5),
59 adjustment(0,-100000000,100000000,1,1,1)
60 // adjustment(0,-100000000,100000000,1,2,0)
62 set_adjustment(adjustment);
66 Widget_Distance::~Widget_Distance()
71 Widget_Distance::on_input(double* new_value)
73 distance_=synfig::String(get_text());
74 *new_value=distance_.get();
79 Widget_Distance::on_output()
82 distance_=get_adjustment()->get_value();
83 set_text(distance_.get_string(get_digits()));
84 } catch (...) { /* synfig::error("Widget_Distance::on_output(): Caught something..."); */ }
89 Widget_Distance::set_value(const synfig::Distance &data)
92 get_adjustment()->set_value(distance_.get());
96 Widget_Distance::get_value() const
98 distance_=get_adjustment()->get_value();