X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/235ee3a1e830ab839163ad2585c11d760bcd841c..796708eefb056b936274da15c7af2c7d709c9249:/Constructor/cisternptywnd.cpp?ds=sidebyside diff --git a/Constructor/cisternptywnd.cpp b/Constructor/cisternptywnd.cpp index 5ef0ec1..12617e2 100644 --- a/Constructor/cisternptywnd.cpp +++ b/Constructor/cisternptywnd.cpp @@ -1,16 +1,56 @@ #include "cisternptywnd.h" +#include "cistern.h" -CisternPtyWnd::CisternPtyWnd(BaseObjectType* cobject, const Glib::RefPtr& refGlade):PropertyWnd(cobject,refGlade) +CisternPtyWnd::CisternPtyWnd(BaseObjectType* cobject, const Glib::RefPtr& refGlade):PropertyWnd(cobject, refGlade) { - refGlade->get_widget("spin_caudal", spin_caudal); - refGlade->get_widget("spin_fluido_max", spin_fluido_max); + refGlade->get_widget("spin_capacidad", spin_capacidad); + refGlade->get_widget("spin_inicial", spin_inicial); + refGlade->get_widget("txt_cistern_name", txt_cistern_name); + refGlade->get_widget("btn_select_color", btn_select_color); + refGlade->get_widget("color_preview",color_preview); + + Glib::RefPtr ref = Gnome::Glade::Xml::create("constructor.glade", "color_select_dlg"); + ref->get_widget("color_select_dlg",color_select_dlg); + ref->get_widget("dlg_select_color_cancel",dlg_select_color_cancel); + ref->get_widget("dlg_select_color_ok",dlg_select_color_ok); + + btn_select_color->signal_clicked().connect(SigC::slot(*this,&CisternPtyWnd::on_btn_select_color_clicked)); + dlg_select_color_cancel->signal_clicked().connect(SigC::slot(*this,&CisternPtyWnd::on_dlg_select_color_cancel_clicked)); + dlg_select_color_ok->signal_clicked().connect(SigC::slot(*this,&CisternPtyWnd::on_dlg_select_color_ok_clicked)); } CisternPtyWnd::~CisternPtyWnd() { } - + void CisternPtyWnd::on_btn_accept_clicked() { + CisternPtyWnd::on_btn_apply_clicked(); hide(); } + +void CisternPtyWnd::on_btn_apply_clicked() +{ + cistern->set_capacidad( spin_capacidad->get_value() ); + cistern->set_contenido_inicial( spin_inicial->get_value() ); + cistern->set_name( txt_cistern_name->get_text() ); + color_select_dlg->get_colorsel()->set_current_color(cistern->get_liquid_color()); +} + +void CisternPtyWnd::on_btn_select_color_clicked() +{ + color_select_dlg->get_colorsel()->set_current_color(cistern->get_liquid_color()); + color_select_dlg->show(); +} + +void CisternPtyWnd::on_dlg_select_color_cancel_clicked() +{ + color_select_dlg->hide(); +} + +void CisternPtyWnd::on_dlg_select_color_ok_clicked() +{ + cistern->set_liquid_color( color_select_dlg->get_colorsel()->get_current_color() ); + color_preview->modify_bg( Gtk::STATE_NORMAL , cistern->get_liquid_color() ); + color_select_dlg->hide(); +}