]> git.llucax.com Git - z.facultad/75.42/plaqui.git/commitdiff
- Agrego el dialogo de conectar
authorRicardo Markiewicz <gazer.arg@gmail.com>
Sat, 18 Oct 2003 18:11:08 +0000 (18:11 +0000)
committerRicardo Markiewicz <gazer.arg@gmail.com>
Sat, 18 Oct 2003 18:11:08 +0000 (18:11 +0000)
- Agrego una clase Menu para encapsular todos los items
del menu en lugar de hacer una clase por item.
- Actualizo la interfaz

Client/ChangeLog
Client/include/dlg_conectar.h [new file with mode: 0644]
Client/include/menu_bar.h [new file with mode: 0644]
Client/include/mnu_file_exit.h [deleted file]
Client/include/mnu_help_about.h [deleted file]
Client/src/Makefile.am
Client/src/client.glade
Client/src/dlg_conectar.cpp [new file with mode: 0644]
Client/src/main.cpp
Client/src/menu_bar.cpp [new file with mode: 0644]

index 8bf1e0e3d2df58405e9e84b47b83b8c714a05c0f..4d125daea54877bc4b28c10ac6a4fab7cffc76fd 100644 (file)
@@ -1,3 +1,7 @@
+18-10-2003 Ricardo Markiewicz <rmarkie@fi.uba.ar>
+       * Encapsulo los handlers de los items del menu en una sola clase
+               menu.
+
 17-10-2003 Ricardo Markiewicz <rmarkie@fi.uba.ar>
        * Agrego la carga del archivo ChangeLog en el dialogo "Acerca de ..."
 
diff --git a/Client/include/dlg_conectar.h b/Client/include/dlg_conectar.h
new file mode 100644 (file)
index 0000000..3c75234
--- /dev/null
@@ -0,0 +1,32 @@
+
+
+#ifndef _DLG_CONECTAR_H_
+#define _DLG_CONECTAR_H_
+
+#include <gtkmm.h>
+#include <libglademm.h>
+
+/** Dialogo de Inicio de conexión
+ *
+ *  Este diálogo deja al usuario ingresar el nombre del servidor y
+ *  el puerto para inicializar una simulación.
+ */
+class DlgConectar:public Gtk::Window {
+public:
+       /// Constructor
+       DlgConectar(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &rg);
+       /// Destructor
+       virtual ~DlgConectar();
+
+protected:
+       /// Referencia al XML desde donde fue creada la ventana
+       Glib::RefPtr<Gnome::Glade::Xml> refXml;
+
+       /// Handler del boton OK
+       virtual void on_btn_ok_clicked();
+       /// Handler del boton CANCEL
+       virtual void on_btn_cancel_clicked();
+};
+
+#endif
+
diff --git a/Client/include/menu_bar.h b/Client/include/menu_bar.h
new file mode 100644 (file)
index 0000000..23ef6e6
--- /dev/null
@@ -0,0 +1,23 @@
+
+#ifndef _MENU_BAR_H_
+#define _MENU_BAR_H_
+
+#include <gtkmm.h>
+#include <libglademm.h>
+
+class MiMenuBar:public Gtk::MenuBar {
+public:
+       MiMenuBar(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &rg);
+       virtual ~MiMenuBar();
+
+protected:
+       // Archivo XML del Padre
+       Glib::RefPtr<Gnome::Glade::Xml> refXml;
+       // Callbacks de los items del menu
+       virtual void on_mnu_file_exit();
+       virtual void on_mnu_file_connect();
+       virtual void on_mnu_help_about();
+};
+
+#endif
+
diff --git a/Client/include/mnu_file_exit.h b/Client/include/mnu_file_exit.h
deleted file mode 100644 (file)
index 448950d..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-
-/* Maneja el Archivo->Salir */
-
-#include <gtkmm.h>
-#include <iostream>
-
-class MnuFileExit:public Gtk::MenuItem {
-public:
-       MnuFileExit(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade):Gtk::MenuItem(cobject) {
-       }
-       virtual ~MnuFileExit() {}
-
-protected:
-       virtual void on_activate() {
-               Gtk::Main::quit();
-       }
-};
-
diff --git a/Client/include/mnu_help_about.h b/Client/include/mnu_help_about.h
deleted file mode 100644 (file)
index 168bd3d..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-
-/* Maneja el Ayuda->Acerca de */
-
-#include <gtkmm.h>
-#include <glibmm/iochannel.h>
-#include <iostream>
-
-class MnuHelpAbout:public Gtk::MenuItem {
-public:
-       MnuHelpAbout(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade):Gtk::MenuItem(cobject) {
-       }
-       virtual ~MnuHelpAbout() {}
-
-protected:
-       Glib::RefPtr<Gnome::Glade::Xml> refXml;
-
-       virtual void on_activate() {
-               // preparo para leer el archivo ChangeLog
-               Glib::ustring line;
-               Glib::RefPtr<Gtk::TextBuffer> log_buffer;
-               Glib::RefPtr<Glib::IOChannel> log_io;
-
-               log_buffer = Gtk::TextBuffer::create();
-               log_io = Glib::IOChannel::create_from_file("../ChangeLog", "r");
-               while (log_io->read_line(line) != Glib::IO_STATUS_EOF) {
-                       log_buffer->insert_at_cursor(line);
-               }
-
-               try {
-                       refXml = Gnome::Glade::Xml::create("client.glade", "dlgAbout");
-               }
-               catch(const Gnome::Glade::XmlError &ex) {
-                       std::cerr << ex.what() << std::endl;
-                       return;
-               }
-               Gtk::Window *dlg = 0;
-               Gtk::Button *btn_cerrar = 0;
-               Gtk::TextView *txt_changelog = 0;
-               refXml->get_widget("dlgAbout", dlg);
-               refXml->get_widget("btn_close", btn_cerrar);
-               refXml->get_widget("txt_changelog", txt_changelog);
-               btn_cerrar->signal_clicked().connect(SigC::slot(*dlg, &Gtk::Dialog::hide));
-               txt_changelog->set_buffer(log_buffer);
-               dlg->show();
-       }
-};
-
index 25f41fd54917d1048422c34c271cc97e50292943..5d24ed904c2b9671769631e0a11ec52de3db7497 100644 (file)
@@ -8,7 +8,9 @@ INCLUDES = \
 
 bin_PROGRAMS = plaqui-client 
 
-plaqui_client_SOURCES = main.cpp
+plaqui_client_SOURCES = main.cpp \
+                                                                                               menu_bar.cpp \
+                                                                                               dlg_conectar.cpp
 
 plaqui_client_LDADD = @PACKAGE_LIBS@
 
index 6d9e49c8aa36426498850d5eff2a2e73d5a7b83a..8314b2871c4641bad26815bbdf1ec2e03a528a0f 100644 (file)
@@ -21,7 +21,7 @@
       <property name="spacing">0</property>
 
       <child>
-       <widget class="GtkMenuBar" id="menubar1">
+       <widget class="GtkMenuBar" id="menu_bar">
          <property name="visible">True</property>
 
          <child>
@@ -34,7 +34,7 @@
                <widget class="GtkMenu" id="menuitem1_menu">
 
                  <child>
-                   <widget class="GtkImageMenuItem" id="mnu_conectar">
+                   <widget class="GtkImageMenuItem" id="mnu_file_connect">
                      <property name="visible">True</property>
                      <property name="label" translatable="yes">_Conectar</property>
                      <property name="use_underline">True</property>
                      <child>
                        <widget class="GtkFixed" id="work_place">
                          <property name="visible">True</property>
-
-                         <child>
-                           <widget class="GtkButton" id="button9">
-                             <property name="width_request">368</property>
-                             <property name="height_request">96</property>
-                             <property name="visible">True</property>
-                             <property name="can_focus">True</property>
-                             <property name="label" translatable="yes">Este boton es para ver si se mueve el scroll!!</property>
-                             <property name="use_underline">True</property>
-                             <property name="relief">GTK_RELIEF_NORMAL</property>
-                           </widget>
-                           <packing>
-                             <property name="x">224</property>
-                             <property name="y">120</property>
-                           </packing>
-                         </child>
                        </widget>
                      </child>
                    </widget>
          <property name="update_policy">GTK_UPDATE_ALWAYS</property>
          <property name="snap_to_ticks">False</property>
          <property name="wrap">False</property>
-         <property name="adjustment">1234 0 100 1 10 10</property>
+         <property name="adjustment">1234 0 65365 1 10 10</property>
        </widget>
        <packing>
          <property name="left_attach">1</property>
          <property name="spacing">23</property>
 
          <child>
-           <widget class="GtkButton" id="button7">
+           <widget class="GtkButton" id="btn_cancel">
              <property name="visible">True</property>
              <property name="can_default">True</property>
              <property name="can_focus">True</property>
          </child>
 
          <child>
-           <widget class="GtkButton" id="button8">
+           <widget class="GtkButton" id="btn_ok">
              <property name="visible">True</property>
              <property name="can_default">True</property>
              <property name="can_focus">True</property>
diff --git a/Client/src/dlg_conectar.cpp b/Client/src/dlg_conectar.cpp
new file mode 100644 (file)
index 0000000..8af1482
--- /dev/null
@@ -0,0 +1,32 @@
+
+#include "dlg_conectar.h"
+
+DlgConectar::DlgConectar(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &rg):Gtk::Window(co),refXml(rg)
+{
+       Gtk::Button *btn_ok=0, *btn_cancel=0;
+       refXml->get_widget("btn_ok", btn_ok);
+       refXml->get_widget("btn_cancel", btn_cancel);
+
+       btn_ok->signal_clicked().connect( SigC::slot(*this, &DlgConectar::on_btn_ok_clicked) );
+       btn_cancel->signal_clicked().connect( SigC::slot(*this, &DlgConectar::on_btn_cancel_clicked) );
+}
+
+DlgConectar::~DlgConectar()
+{
+}
+
+void DlgConectar::on_btn_ok_clicked()
+{
+       /* Aca tengo que iniciarl el thread que se trata de conectar
+        * al servidor, que descarga el modelo e inicia la
+        * actualizacion.
+        *
+        * Tendre que ver como se hara toda la comunicacion
+        */
+}
+
+void DlgConectar::on_btn_cancel_clicked()
+{
+       hide();
+}
+
index b9fe6301d3d05534149c7db9b4ef796a92918ec3..e1cb3364ab9fdbc10d0f94c2cfb415dced58310b 100644 (file)
@@ -2,8 +2,7 @@
 #include <gtkmm.h>
 #include <libglademm.h>
 #include <iostream>
-#include "mnu_file_exit.h"
-#include "mnu_help_about.h"
+#include "menu_bar.h"
 
 int main (int argc, char **argv)
 {
@@ -21,14 +20,12 @@ int main (int argc, char **argv)
        }
 
        Gtk::Window* pWindow = 0;
-       MnuFileExit *mnu_file_exit = 0;
-       MnuHelpAbout *mnu_help_about = 0;
        Gtk::Button *bar_exit;
        Gtk::Fixed *work_place;
+       MiMenuBar *menu_bar;
 
        refXml->get_widget("Principal", pWindow);
-       refXml->get_widget_derived("mnu_file_exit", mnu_file_exit);
-       refXml->get_widget_derived("mnu_help_about", mnu_help_about);
+       refXml->get_widget_derived("menu_bar", menu_bar);
        refXml->get_widget("bar_exit", bar_exit);
        refXml->get_widget("work_place", work_place);
        work_place->set_size_request(10000, 10000);
diff --git a/Client/src/menu_bar.cpp b/Client/src/menu_bar.cpp
new file mode 100644 (file)
index 0000000..0ca75bc
--- /dev/null
@@ -0,0 +1,74 @@
+
+#include "menu_bar.h"
+#include <iostream>
+#include "dlg_conectar.h"
+
+MiMenuBar::MiMenuBar(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &rg):Gtk::MenuBar(co),refXml(rg)
+{
+       Gtk::MenuItem *conect=0, *exit=0, *about=0;
+       rg->get_widget("mnu_file_connect", conect);
+       rg->get_widget("mnu_file_exit", exit);
+       rg->get_widget("mnu_help_about", about);
+       conect->signal_activate().connect( SigC::slot(*this, &MiMenuBar::on_mnu_file_connect));
+       exit->signal_activate().connect( SigC::slot(*this, &MiMenuBar::on_mnu_file_exit));
+       about->signal_activate().connect( SigC::slot(*this, &MiMenuBar::on_mnu_help_about));
+}
+
+MiMenuBar::~MiMenuBar()
+{
+}
+
+void MiMenuBar::on_mnu_file_exit()
+{
+       Gtk::Main::quit();
+}
+
+void MiMenuBar::on_mnu_file_connect()
+{
+       // preparo para leer el archivo ChangeLog
+       Glib::RefPtr<Gnome::Glade::Xml> xml;
+
+       try {
+               xml = Gnome::Glade::Xml::create("client.glade", "dlgConectar");
+       }
+       catch(const Gnome::Glade::XmlError &ex) {
+               std::cerr << ex.what() << std::endl;
+               return;
+       }
+       DlgConectar *dlg = 0;
+       xml->get_widget_derived("dlgConectar", dlg);
+       dlg->show();
+}
+
+void MiMenuBar::on_mnu_help_about()
+{
+       // preparo para leer el archivo ChangeLog
+       Glib::RefPtr<Gnome::Glade::Xml> xml;
+       Glib::ustring line;
+       Glib::RefPtr<Gtk::TextBuffer> log_buffer;
+       Glib::RefPtr<Glib::IOChannel> log_io;
+
+       log_buffer = Gtk::TextBuffer::create();
+       log_io = Glib::IOChannel::create_from_file("../ChangeLog", "r");
+       while (log_io->read_line(line) != Glib::IO_STATUS_EOF) {
+               log_buffer->insert_at_cursor(line);
+       }
+
+       try {
+               xml = Gnome::Glade::Xml::create("client.glade", "dlgAbout");
+       }
+       catch(const Gnome::Glade::XmlError &ex) {
+               std::cerr << ex.what() << std::endl;
+               return;
+       }
+       Gtk::Window *dlg = 0;
+       Gtk::Button *btn_cerrar = 0;
+       Gtk::TextView *txt_changelog = 0;
+       xml->get_widget("dlgAbout", dlg);
+       xml->get_widget("btn_close", btn_cerrar);
+       xml->get_widget("txt_changelog", txt_changelog);
+       btn_cerrar->signal_clicked().connect(SigC::slot(*dlg, &Gtk::Dialog::hide));
+       txt_changelog->set_buffer(log_buffer);
+       dlg->show();
+}
+