X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/c325d243c1992d904c05cdf8efec8d9385ad99bd..b0a202776ab7634c206b495b42e20cfe6492e035:/Constructor/cisternptywnd.cpp?ds=inline diff --git a/Constructor/cisternptywnd.cpp b/Constructor/cisternptywnd.cpp index c19de00..12617e2 100644 --- a/Constructor/cisternptywnd.cpp +++ b/Constructor/cisternptywnd.cpp @@ -1,11 +1,22 @@ #include "cisternptywnd.h" +#include "cistern.h" CisternPtyWnd::CisternPtyWnd(BaseObjectType* cobject, const Glib::RefPtr& refGlade):PropertyWnd(cobject, refGlade) { - refGlade = Gnome::Glade::Xml::create("constructor.glade", "cistern_pty_wnd"); 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() @@ -14,9 +25,7 @@ CisternPtyWnd::~CisternPtyWnd() void CisternPtyWnd::on_btn_accept_clicked() { - cistern->set_capacidad( spin_capacidad->get_value() ); - cistern->set_contenido_inicial( spin_inicial->get_value() ); - cistern->set_name( txt_cistern_name->get_text() ); + CisternPtyWnd::on_btn_apply_clicked(); hide(); } @@ -25,4 +34,23 @@ 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(); }