]> git.llucax.com Git - z.facultad/75.42/plaqui.git/commitdiff
Agregue un intento de dibujar la grilla sobre el fondo, creando una clase
authorRicardo Markiewicz <gazer.arg@gmail.com>
Sun, 12 Oct 2003 23:08:23 +0000 (23:08 +0000)
committerRicardo Markiewicz <gazer.arg@gmail.com>
Sun, 12 Oct 2003 23:08:23 +0000 (23:08 +0000)
heredada de Gtk::Fixed. sin saber por que las lineas comienzan desde el
borde izquierdo de la ventana en lugar desde el borde derecho del widget.
No documentacion no es clara y no encuentro el error.

tests/GUI/Makefile.am
tests/GUI/dndwindow.cc
tests/GUI/dndwindow.h
tests/GUI/workplace.cc [new file with mode: 0644]
tests/GUI/workplace.h [new file with mode: 0644]

index 63657953780404d7902993c84f8b7d5bbbd76176..f996496bac5da0ad300f89eaa1a3aac30fcae450 100644 (file)
@@ -11,7 +11,9 @@ drag_and_drop_SOURCES = main.cc \
        dndwindow.cc \
        dndwindow.h \
        item.cc \
-       item.h
+       item.h \
+       workplace.h \
+       workplace.cc
 
 drag_and_drop_LDADD = @PACKAGE_LIBS@
 
index daa593958027875326b53ee2d7a1b9129dc5774d..019591bff4bc2b162fc469cb4824aeebbe0831f2 100644 (file)
@@ -35,8 +35,13 @@ DnDWindow::DnDWindow()
   add(m_HBox);
 
        m_HBox.pack_start(m_VBox);
+       
+       m_VBox.pack_start(m_Button_Canio);
+       m_VBox.pack_start(m_Button_Y);
+       m_VBox.pack_start(m_Button_Codo);
+
        m_HBox.pack_start(m_WorkPlace);
-       m_WorkPlace.set_size_request(300, 300);
+       m_WorkPlace.set_size_request(600, 600);
 
   //Targets:
   std::list<Gtk::TargetEntry> listTargets;
@@ -59,20 +64,12 @@ DnDWindow::DnDWindow()
   m_Button_Y.signal_drag_begin().connect( SigC::slot(*this, &DnDWindow::on_y_drag_begin));
   m_Button_Codo.signal_drag_begin().connect( SigC::slot(*this, &DnDWindow::on_codo_drag_begin));
 
-  m_VBox.pack_start(m_Button_Canio);
-       m_VBox.pack_start(m_Button_Y);
-       m_VBox.pack_start(m_Button_Codo);
-
-
   //Drop site:
-
-  //Make m_Label_Drop a DnD drop destination:
   m_WorkPlace.drag_dest_set(listTargets);
-
-  //Connect signals:
+  
+       //Connect signals:
   m_WorkPlace.signal_drag_data_received().connect( SigC::slot(*this, &DnDWindow::on_label_drop_drag_data_received) );
 
-
   show_all();
 }
 
@@ -152,3 +149,4 @@ void DnDWindow::on_label_drop_drag_data_received(const Glib::RefPtr<Gdk::DragCon
   context->drag_finish(false, false, time);
 }
 
+
index 8c590288aec498ef7925cc05ff7829e803221b8c..eeda3e3fecca44d8ee743774e2c73b59e90fb729 100644 (file)
@@ -25,6 +25,7 @@
 #include <gtkmm/button.h>
 #include <gtkmm/fixed.h>
 #include "item.h"
+#include "workplace.h"
 
 class DnDWindow : public Gtk::Window
 {
@@ -44,7 +45,6 @@ protected:
   virtual void on_y_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
   virtual void on_codo_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
 
-
        void  on_item_button_down();
        //Member widgets:
   Gtk::HBox m_HBox;
@@ -52,7 +52,7 @@ protected:
   Gtk::Button m_Button_Canio;
        Gtk::Button m_Button_Y;
        Gtk::Button m_Button_Codo;
-  Gtk::Fixed m_WorkPlace;
+  WorkPlace m_WorkPlace;
        std::list<CItem *> listaItems;
 };
 
diff --git a/tests/GUI/workplace.cc b/tests/GUI/workplace.cc
new file mode 100644 (file)
index 0000000..4c11f6c
--- /dev/null
@@ -0,0 +1,18 @@
+
+
+#include "workplace.h"
+
+WorkPlace::WorkPlace():Gtk::Fixed()
+{
+}
+
+bool WorkPlace::on_expose_event(GdkEventExpose *e)
+{
+       int i;
+       for(i=0; i<get_width(); i+=32) {
+               get_window()->draw_line(get_style()->get_black_gc(), i, 0, i, get_height());
+       }
+
+       return true;
+}
+
diff --git a/tests/GUI/workplace.h b/tests/GUI/workplace.h
new file mode 100644 (file)
index 0000000..421c000
--- /dev/null
@@ -0,0 +1,15 @@
+
+#ifndef _H_WORKPLACE_
+#define _H_WORKPLACE_
+
+#include <gtkmm/fixed.h>
+#include <gdkmm/gc.h>
+
+class WorkPlace:public Gtk::Fixed {
+public:
+       WorkPlace();
+       virtual ~WorkPlace() {}
+       virtual bool on_expose_event(GdkEventExpose *);
+};
+
+#endif