]> git.llucax.com Git - z.facultad/75.42/plaqui.git/commitdiff
intento dibujar lineas en la ventana (para probar) pero yo quiero dibujar sobre el...
authorNicolás Dimov <ndimov@gmail.com>
Fri, 17 Oct 2003 05:35:14 +0000 (05:35 +0000)
committerNicolás Dimov <ndimov@gmail.com>
Fri, 17 Oct 2003 05:35:14 +0000 (05:35 +0000)
Constructor/constructor.glade
Constructor/main.cpp
Constructor/ventana
Constructor/ventana.cpp
Constructor/ventana.h

index 5afaf80cc601a4bcfd9d49746e2d623a8ab83132..909386b0967214f8067987791e3221ee2580c5a5 100644 (file)
@@ -4,10 +4,12 @@
 <glade-interface>
 
 <widget class="GtkWindow" id="window1">
 <glade-interface>
 
 <widget class="GtkWindow" id="window1">
+  <property name="width_request">640</property>
+  <property name="height_request">480</property>
   <property name="visible">True</property>
   <property name="title" translatable="yes">window1</property>
   <property name="type">GTK_WINDOW_TOPLEVEL</property>
   <property name="visible">True</property>
   <property name="title" translatable="yes">window1</property>
   <property name="type">GTK_WINDOW_TOPLEVEL</property>
-  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="window_position">GTK_WIN_POS_CENTER</property>
   <property name="modal">False</property>
   <property name="resizable">True</property>
   <property name="destroy_with_parent">False</property>
   <property name="modal">False</property>
   <property name="resizable">True</property>
   <property name="destroy_with_parent">False</property>
                              <property name="relief">GTK_RELIEF_NORMAL</property>
                            </widget>
                            <packing>
                              <property name="relief">GTK_RELIEF_NORMAL</property>
                            </widget>
                            <packing>
-                             <property name="x">64</property>
-                             <property name="y">80</property>
+                             <property name="x">464</property>
+                             <property name="y">8</property>
                            </packing>
                          </child>
                        </widget>
                            </packing>
                          </child>
                        </widget>
index 2768d48879a9d90c8571a7a70efa1cec8e5033fd..67c3ffce2f18dcd88251e880ce12d091fd7c79f8 100644 (file)
@@ -23,8 +23,6 @@ int main (int argc, char **argv)
   Ventana* pWindow = 0;
   refXml->get_widget_derived("window1", pWindow);
   pWindow->set_title("Una ventana posta");
   Ventana* pWindow = 0;
   refXml->get_widget_derived("window1", pWindow);
   pWindow->set_title("Una ventana posta");
- // refXml->get_widget_derived("button9",btn_salir);
-//  btn_salir->signal_released().connect(SigC::slot(*this,&BtnSalir::on_pressed));
-  kit.run(*pWindow);
+   kit.run(*pWindow);
   return 0;
 }
   return 0;
 }
index 26e093506c22c57d8040f60e55156d9685babb18..e92b66a465f9e197a36cfb728f986784707cc9e7 100755 (executable)
Binary files a/Constructor/ventana and b/Constructor/ventana differ
index 24dfe61f92578c6d56c65aa15baddcb3367a9134..bebf3a83960aaa2a01f8c8fa7f51716f0e5ff190 100644 (file)
@@ -4,7 +4,11 @@ Ventana::Ventana(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>&
 Gtk::Window(cobject) 
 {
        refGlade->get_widget("button9", btn_salir);
 Gtk::Window(cobject) 
 {
        refGlade->get_widget("button9", btn_salir);
+       refGlade->get_widget("fixed1", fixed);
+       refGlade->get_widget("button6",btn_dibujar);
        btn_salir->signal_released().connect(SigC::slot(*this,&Ventana::on_btn_salir_pressed ));
        btn_salir->signal_released().connect(SigC::slot(*this,&Ventana::on_btn_salir_pressed ));
+       btn_dibujar->signal_released().connect(SigC::slot(*this,&Ventana::on_btn_dibujar_released ));
+       //btn_dibujar->set_title("una N");
 }
 
 Ventana::~Ventana()
 }
 
 Ventana::~Ventana()
@@ -15,3 +19,25 @@ void Ventana::on_btn_salir_pressed()
 {
        Gtk::Main::quit();
 }
 {
        Gtk::Main::quit();
 }
+
+void Ventana::on_btn_dibujar_released()
+{
+       //quiero dibujar en el fixed 
+       // como lo obtengo??
+       Glib::RefPtr<Gdk::Window> win = get_window();
+       Glib::RefPtr<Gdk::GC> gc = get_style()->get_black_gc();
+       win->draw_line(gc,50,50, 50,100);
+       win->draw_line(gc,50,50, 80, 100);
+       win->draw_line (gc,80,100, 80,50);
+       
+       win->draw_line (gc,90,50, 90,100);
+       
+       win->draw_line (gc,100,50, 100,100);
+       win->draw_line (gc,100,50, 150,50);
+       win->draw_line (gc,100,100,150,100);
+       
+       win->draw_line (gc,160,50, 160,100);
+       win->draw_line (gc,160,50, 210,50);
+       win->draw_line (gc,160,100, 210,100);
+       win->draw_line (gc,210,50, 210,100);
+}
index 8151ce195dac4990863b6c38803b52ce45569d01..df6407880a21582d83f97acd7e0f356c9e6c382d 100644 (file)
@@ -5,6 +5,7 @@
 #include <libglademm.h>
 #include <gtkmm/window.h>
 #include <gtkmm/button.h>
 #include <libglademm.h>
 #include <gtkmm/window.h>
 #include <gtkmm/button.h>
+#include <gtkmm/fixed.h>
 class Ventana: public Gtk::Window
 {
        public: 
 class Ventana: public Gtk::Window
 {
        public: 
@@ -12,7 +13,10 @@ class Ventana: public Gtk::Window
                        virtual ~Ventana();
        protected:
                        Gtk::Button* btn_salir;
                        virtual ~Ventana();
        protected:
                        Gtk::Button* btn_salir;
+                       Gtk::Button* btn_dibujar;
+                       Gtk::Fixed* fixed;
                        virtual void on_btn_salir_pressed();
                        virtual void on_btn_salir_pressed();
+                       virtual void on_btn_dibujar_released();
        
 };
 
        
 };