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 Glib::RefPtr<Gnome::Glade::Xml> ref2 = Gnome::Glade::Xml::create(PACKAGE_DATA_DIR"/plaqui-constructor/dialogs/constructor.glade", "dlg_flot");
20 ref2->get_widget("dlg_flot",dlg_flot);
21 ref2->get_widget("btn_dlg_flot_ok",btn_dlg_flot_ok);
23 btn_dlg_flot_ok->signal_clicked().connect(SigC::slot(*this,&CisternPtyWnd::on_btn_dlg_flot_ok_clicked));
25 btn_select_color->signal_clicked().connect(SigC::slot(*this,&CisternPtyWnd::on_btn_select_color_clicked));
26 dlg_select_color_cancel->signal_clicked().connect(SigC::slot(*this,&CisternPtyWnd::on_dlg_select_color_cancel_clicked));
27 dlg_select_color_ok->signal_clicked().connect(SigC::slot(*this,&CisternPtyWnd::on_dlg_select_color_ok_clicked));
31 void CisternPtyWnd::show()
33 if (cistern != NULL) {
34 color_preview->modify_bg( Gtk::STATE_NORMAL , cistern->get_liquid_color() );
39 CisternPtyWnd::~CisternPtyWnd()
43 void CisternPtyWnd::on_btn_accept_clicked()
45 CisternPtyWnd::on_btn_apply_clicked();
46 if ( !cistern->workplace->chek_name(txt_cistern_name->get_text(), cistern->get_id()) && ( spin_flot_inf->get_value() < spin_flot_sup->get_value() ) )
50 void CisternPtyWnd::on_btn_apply_clicked()
52 cistern->set_capacidad( spin_capacidad->get_value() );
53 cistern->set_contenido_inicial( spin_inicial->get_value() );
54 cistern->set_name( txt_cistern_name->get_text() );
55 color_select_dlg->get_colorsel()->set_current_color(cistern->get_liquid_color());
56 if ( cistern->workplace->chek_name(txt_cistern_name->get_text(), cistern->get_id()) )
59 cistern->set_name( txt_cistern_name->get_text() );
60 if ( spin_flot_inf->get_value() >= spin_flot_sup->get_value() )
63 cistern->set_flotante_inf(spin_flot_inf->get_value() );
64 cistern->set_flotante_sup(spin_flot_sup->get_value() );
68 void CisternPtyWnd::on_btn_select_color_clicked()
70 color_select_dlg->get_colorsel()->set_current_color(cistern->get_liquid_color());
71 color_select_dlg->show();
74 void CisternPtyWnd::on_dlg_select_color_cancel_clicked()
76 color_select_dlg->hide();
79 void CisternPtyWnd::on_dlg_select_color_ok_clicked()
81 cistern->set_liquid_color( color_select_dlg->get_colorsel()->get_current_color() );
82 color_preview->modify_bg( Gtk::STATE_NORMAL , cistern->get_liquid_color() );
83 color_select_dlg->hide();
86 void CisternPtyWnd::on_btn_dlg_flot_ok_clicked()