1 #include "cisternptywnd.h"
4 CisternPtyWnd::CisternPtyWnd(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade):PropertyWnd(cobject, refGlade)
6 refGlade->get_widget("spin_capacidad", spin_capacidad);
7 refGlade->get_widget("spin_inicial", spin_inicial);
8 refGlade->get_widget("txt_cistern_name", txt_cistern_name);
9 refGlade->get_widget("btn_select_color", btn_select_color);
10 refGlade->get_widget("color_preview",color_preview);
11 refGlade->get_widget("spin_flot_inf", spin_flot_inf);
12 refGlade->get_widget("spin_flot_sup", spin_flot_sup);
14 Glib::RefPtr<Gnome::Glade::Xml> ref = Gnome::Glade::Xml::create(PACKAGE_DATA_DIR"/plaqui-constructor/dialogs/constructor.glade", "color_select_dlg");
15 ref->get_widget("color_select_dlg",color_select_dlg);
16 ref->get_widget("dlg_select_color_cancel",dlg_select_color_cancel);
17 ref->get_widget("dlg_select_color_ok",dlg_select_color_ok);
19 btn_select_color->signal_clicked().connect(SigC::slot(*this,&CisternPtyWnd::on_btn_select_color_clicked));
20 dlg_select_color_cancel->signal_clicked().connect(SigC::slot(*this,&CisternPtyWnd::on_dlg_select_color_cancel_clicked));
21 dlg_select_color_ok->signal_clicked().connect(SigC::slot(*this,&CisternPtyWnd::on_dlg_select_color_ok_clicked));
25 void CisternPtyWnd::show()
27 if (cistern != NULL) {
28 color_preview->modify_bg( Gtk::STATE_NORMAL , cistern->get_liquid_color() );
33 CisternPtyWnd::~CisternPtyWnd()
37 void CisternPtyWnd::on_btn_accept_clicked()
39 CisternPtyWnd::on_btn_apply_clicked();
40 if ( !cistern->workplace->chek_name(txt_cistern_name->get_text(), cistern->get_id()) )
44 void CisternPtyWnd::on_btn_apply_clicked()
46 cistern->set_capacidad( spin_capacidad->get_value() );
47 cistern->set_contenido_inicial( spin_inicial->get_value() );
48 cistern->set_name( txt_cistern_name->get_text() );
49 cistern->set_flotante_inf(spin_flot_inf->get_value() );
50 cistern->set_flotante_sup(spin_flot_sup->get_value() );
51 color_select_dlg->get_colorsel()->set_current_color(cistern->get_liquid_color());
52 if ( cistern->workplace->chek_name(txt_cistern_name->get_text(), cistern->get_id()) )
55 cistern->set_name( txt_cistern_name->get_text() );
58 void CisternPtyWnd::on_btn_select_color_clicked()
60 color_select_dlg->get_colorsel()->set_current_color(cistern->get_liquid_color());
61 color_select_dlg->show();
64 void CisternPtyWnd::on_dlg_select_color_cancel_clicked()
66 color_select_dlg->hide();
69 void CisternPtyWnd::on_dlg_select_color_ok_clicked()
71 cistern->set_liquid_color( color_select_dlg->get_colorsel()->get_current_color() );
72 color_preview->modify_bg( Gtk::STATE_NORMAL , cistern->get_liquid_color() );
73 color_select_dlg->hide();