From: Nicolás Dimov Date: Fri, 17 Oct 2003 05:35:14 +0000 (+0000) Subject: intento dibujar lineas en la ventana (para probar) pero yo quiero dibujar sobre el... X-Git-Tag: svn_import~418 X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/commitdiff_plain/d7d153e01ab4d697635e6b165f8c509d6d21a3fc?ds=sidebyside intento dibujar lineas en la ventana (para probar) pero yo quiero dibujar sobre el fixed, hago para agarrarlo? --- diff --git a/Constructor/constructor.glade b/Constructor/constructor.glade index 5afaf80..909386b 100644 --- a/Constructor/constructor.glade +++ b/Constructor/constructor.glade @@ -4,10 +4,12 @@ + 640 + 480 True window1 GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE + GTK_WIN_POS_CENTER False True False @@ -281,8 +283,8 @@ GTK_RELIEF_NORMAL - 64 - 80 + 464 + 8 diff --git a/Constructor/main.cpp b/Constructor/main.cpp index 2768d48..67c3ffc 100644 --- a/Constructor/main.cpp +++ b/Constructor/main.cpp @@ -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"); - // 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; } diff --git a/Constructor/ventana b/Constructor/ventana index 26e0935..e92b66a 100755 Binary files a/Constructor/ventana and b/Constructor/ventana differ diff --git a/Constructor/ventana.cpp b/Constructor/ventana.cpp index 24dfe61..bebf3a8 100644 --- a/Constructor/ventana.cpp +++ b/Constructor/ventana.cpp @@ -4,7 +4,11 @@ Ventana::Ventana(BaseObjectType* cobject, const Glib::RefPtr& 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_dibujar->signal_released().connect(SigC::slot(*this,&Ventana::on_btn_dibujar_released )); + //btn_dibujar->set_title("una N"); } Ventana::~Ventana() @@ -15,3 +19,25 @@ void Ventana::on_btn_salir_pressed() { Gtk::Main::quit(); } + +void Ventana::on_btn_dibujar_released() +{ + //quiero dibujar en el fixed + // como lo obtengo?? + Glib::RefPtr win = get_window(); + Glib::RefPtr 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); +} diff --git a/Constructor/ventana.h b/Constructor/ventana.h index 8151ce1..df64078 100644 --- a/Constructor/ventana.h +++ b/Constructor/ventana.h @@ -5,6 +5,7 @@ #include #include #include +#include class Ventana: public Gtk::Window { public: @@ -12,7 +13,10 @@ class Ventana: public Gtk::Window virtual ~Ventana(); protected: Gtk::Button* btn_salir; + Gtk::Button* btn_dibujar; + Gtk::Fixed* fixed; virtual void on_btn_salir_pressed(); + virtual void on_btn_dibujar_released(); };