From: Ricardo Markiewicz Date: Thu, 16 Oct 2003 04:31:17 +0000 (+0000) Subject: Agrego callback para salir del programa de 2 formas distinta : desde el menu creando... X-Git-Tag: svn_import~426 X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/commitdiff_plain/c054bed95537d9af309db002e64bfec4bc72051f?ds=sidebyside Agrego callback para salir del programa de 2 formas distinta : desde el menu creando un objeto derivado y desde la barra de herramientas pasando directamente la funcion a ejecutar --- diff --git a/Client/include/mnu_file_exit.h b/Client/include/mnu_file_exit.h new file mode 100644 index 0000000..448950d --- /dev/null +++ b/Client/include/mnu_file_exit.h @@ -0,0 +1,18 @@ + +/* Maneja el Archivo->Salir */ + +#include +#include + +class MnuFileExit:public Gtk::MenuItem { +public: + MnuFileExit(BaseObjectType* cobject, const Glib::RefPtr& refGlade):Gtk::MenuItem(cobject) { + } + virtual ~MnuFileExit() {} + +protected: + virtual void on_activate() { + Gtk::Main::quit(); + } +}; + diff --git a/Client/src/Makefile.am b/Client/src/Makefile.am index d4c08fe..25f41fd 100644 --- a/Client/src/Makefile.am +++ b/Client/src/Makefile.am @@ -1,6 +1,7 @@ ## Process this file with automake to produce Makefile.in INCLUDES = \ + -I../include \ -DPACKAGE_DATA_DIR=\""$(datadir)"\" \ -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \ @PACKAGE_CFLAGS@ diff --git a/Client/src/client.glade b/Client/src/client.glade index 5575c48..41e22a0 100644 --- a/Client/src/client.glade +++ b/Client/src/client.glade @@ -47,60 +47,11 @@ - + True gtk-quit True - - - - - - - - - - - True - _Editar - True - - - - - - - True - gtk-cut - True - - - - - - - True - gtk-copy - True - - - - - - - True - gtk-paste - True - - - - - - - True - gtk-delete - True - + @@ -125,7 +76,7 @@ - + True gtk-properties 1 @@ -212,7 +163,7 @@ - + True gtk-quit True diff --git a/Client/src/main.cpp b/Client/src/main.cpp index c1dfbf5..f7ca2a1 100644 --- a/Client/src/main.cpp +++ b/Client/src/main.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "mnu_file_exit.h" int main (int argc, char **argv) { @@ -18,10 +19,13 @@ int main (int argc, char **argv) } Gtk::Window* pWindow = 0; + MnuFileExit *mnu_file_exit = 0; + Gtk::Button *bar_exit; refXml->get_widget("Principal", pWindow); - if (pWindow) { - client.run(*pWindow); - } + refXml->get_widget_derived("mnu_file_exit", mnu_file_exit); + refXml->get_widget("bar_exit", bar_exit); + bar_exit->signal_clicked().connect( SigC::slot(Gtk::Main::quit) ); + client.run(*pWindow); return 0; }