X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/4ac79a1d1914c71cd3d15853f4b15f5646885412..796708eefb056b936274da15c7af2c7d709c9249:/Constructor/cisternptywnd.cpp diff --git a/Constructor/cisternptywnd.cpp b/Constructor/cisternptywnd.cpp index 98acbd6..12617e2 100644 --- a/Constructor/cisternptywnd.cpp +++ b/Constructor/cisternptywnd.cpp @@ -1,11 +1,56 @@ -//cisternptywnd.cpp - #include "cisternptywnd.h" +#include "cistern.h" -CisternPtyWnd::CisternPtyWnd():PropertyWnd() +CisternPtyWnd::CisternPtyWnd(BaseObjectType* cobject, const Glib::RefPtr& refGlade):PropertyWnd(cobject, refGlade) { + 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(); +}