</child>
</widget>
+<widget class="GtkDialog" id="dlg_quit">
+ <property name="width_request">230</property>
+ <property name="height_request">98</property>
+ <property name="title" translatable="yes">dialog1</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_CENTER</property>
+ <property name="modal">True</property>
+ <property name="resizable">False</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">True</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox6">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area5">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
+
+ <child>
+ <widget class="GtkButton" id="btn_dlg_quit_cancel">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-6</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="btn_dlg_quit_ok">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-ok</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-5</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label34">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">El archivo no fue guardado
+¿Desea guardarlo antes de salir?</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
</glade-interface>
int id;
/// Defino los elementos de la ventana.
Gtk::Button *btn_canio, *btn_codo, *btn_y, *btn_tanque, *btn_bomba, *btn_exclusa, *btn_drain, *btn_file_ok, *btn_file_cancel, *btn_check, *btn_dlg_close,
- *btn_and, *btn_or, *btn_not, *btn_open_ok, *btn_open_cancel, *quick_btn_clear, *quick_btn_save, *quick_btn_open, *quick_btn_new, *btn_find;
+ *btn_and, *btn_or, *btn_not, *btn_open_ok, *btn_open_cancel, *quick_btn_clear, *quick_btn_save, *quick_btn_open, *quick_btn_new, *btn_find,
+ *btn_dlg_quit_ok, *btn_dlg_quit_cancel;
Gtk::ImageMenuItem *main_menu_quit,*main_menu_new, *edit_menu_del, *edit_menu_delete_all, *main_menu_save, *main_menu_open;
Gtk::CheckButton *chk_btn_logica;
Gtk::FileSelection *file_selection, *file_open_selection;
Gtk::Combo *combo_entry;
- Gtk::Dialog *dlg_connect, *dlg_about;
+ Gtk::Dialog *dlg_connect, *dlg_about, *dlg_quit;
Gtk::Label *dlg_label;
Gtk::Statusbar *status_bar;
Glib::RefPtr<Gdk::Pixbuf> ico_canio, ico_y, ico_codo, ico_tanque, ico_bomba, ico_exclusa, ico_drain, ico_and, ico_or, ico_not;
virtual void on_quick_btn_save_clicked();
virtual void on_quick_btn_new_clicked();
virtual void on_btn_find_clicked();
+ virtual void on_btn_dlg_quit_ok_clicked();
+ virtual void on_btn_dlg_quit_cancel_clicked();
///Verifica la conexion de todos los items iterando en la listaItems.
bool check_connection(Glib::ustring& name);
rev = rev.substr(6, rev.length() - 8);
std::string s = "PlaQui Constructor versión " VERSION " (revisión ";
s += rev + ")";
- lbl_plaqui_version->set_text(Glib::locale_to_utf8(s));
+// lbl_plaqui_version->set_text(Glib::locale_to_utf8(s));
refGlade->get_widget("dlgAbout", dlg_about);
refGlade->get_widget("close_about", close_about);
refGlade->get_widget("edit_menu_delete_all", edit_menu_delete_all);
refGlade->get_widget("btn_find", btn_find);
refGlade->get_widget("status_bar", status_bar);
+ refGlade->get_widget("dlg_quit", dlg_quit);
+ refGlade->get_widget("btn_dlg_quit_ok", btn_dlg_quit_ok);
+ refGlade->get_widget("btn_dlg_quit_cancel", btn_dlg_quit_cancel);
//Obtengo el area de trabajo, la cual tiene definida su propia clase.
refGlade->get_widget_derived("workplace", workplace); //fixed
quick_btn_new->signal_clicked().connect(SigC::slot(*this, &Constructor::on_quick_btn_new_clicked));
quick_btn_save->signal_clicked().connect(SigC::slot(*this, &Constructor::on_quick_btn_save_clicked));
quick_btn_open->signal_clicked().connect(SigC::slot(*this, &Constructor::on_main_menu_open));
+ btn_dlg_quit_ok->signal_clicked().connect(SigC::slot(*this, &Constructor::on_btn_dlg_quit_ok_clicked));
+ btn_dlg_quit_cancel->signal_clicked().connect(SigC::slot(*this, &Constructor::on_btn_dlg_quit_cancel_clicked));
main_menu_quit->signal_activate().connect(SigC::slot(*this, &Constructor::on_main_menu_quit));
main_menu_new->signal_activate().connect(SigC::slot(*this, &Constructor::on_quick_btn_new_clicked));
gtk_selection_data_set(selection_data, selection_data->target, 8,(const guchar*)"not_e.png",9);
}
-//Sale del programa.
+//Sale del programa. Pregunta si desea salvar antes de salir.
void Constructor::on_main_menu_quit()
{
- delete this;
+ if ( !saved )
+ dlg_quit->show();
+ else
+ Gtk::Main::quit();
+}
+
+//Sale del programa guardando el archivo.
+void Constructor::on_btn_dlg_quit_ok_clicked()
+{
+ dlg_quit->hide();
+ on_quick_btn_save_clicked();
+}
+
+//Sale del programa sin guardar el archivo.
+void Constructor::on_btn_dlg_quit_cancel_clicked()
+{
+ dlg_quit->hide();
Gtk::Main::quit();
- //hide();
}
+
// Carga de un archivo XML
void Constructor::on_main_menu_open()
{