00001 #include "SmootherGUI.h" 00002 00003 SmootherGUI::SmootherGUI(Smoother *module) : 00004 AbstractGtkmmModuleGUI(module, "Smoother"), 00005 m_graph(300, 7), 00006 m_spinnerBox(false, 5), 00007 m_box(false, 0), 00008 m_lblWindowSize("History Size: "), 00009 m_adjWindowSize(0.0, 1.0, 70.0, 1.0, 5.0, 0.0), 00010 m_spbWindowSize(m_adjWindowSize) 00011 { 00012 m_spbWindowSize.signal_value_changed().connect(sigc::mem_fun(*this, &SmootherGUI::setWindowSize)); 00013 00014 m_spinnerBox.pack_start(m_lblWindowSize, Gtk::PACK_SHRINK, 0); 00015 m_spinnerBox.pack_start(m_spbWindowSize, Gtk::PACK_SHRINK, 0); 00016 00017 m_box.pack_start(m_spinnerBox, Gtk::PACK_SHRINK, 0); 00018 m_box.pack_start(m_graph, Gtk::PACK_SHRINK, 0); 00019 00020 add(m_box); 00021 } 00022 00023 void SmootherGUI::init() 00024 { 00025 m_spbWindowSize.set_value(static_cast<Smoother*>(getModule())->getWindowSize()); 00026 show_all(); 00027 } 00028 00029 void SmootherGUI::destroy() 00030 { 00031 hide_all(); 00032 } 00033 00034 void SmootherGUI::addData(const Vector3d &v) 00035 { 00036 m_graph.addData(v); 00037 } 00038 00039 void SmootherGUI::setWindowSize() 00040 { 00041 static_cast<Smoother*>(getModule())->setWindowSize(static_cast<size_t>(m_spbWindowSize.get_value())); 00042 }