]> git.llucax.com Git - z.facultad/75.42/plaqui.git/commitdiff
Me vuelvo loco cd Constructor/cd Constructor/ pero hubo una regresion, para rotar...
authorNicolás Dimov <ndimov@gmail.com>
Fri, 24 Oct 2003 04:56:44 +0000 (04:56 +0000)
committerNicolás Dimov <ndimov@gmail.com>
Fri, 24 Oct 2003 04:56:44 +0000 (04:56 +0000)
Constructor/canio.cpp
Constructor/codo.cpp
Constructor/item.cpp
Constructor/item.h
Constructor/y.cpp

index 73dd6f1252a8ba114f7f0688ae652b3c6a5d1ed7..0afb2bc51f004b62d3f18386c04522a09a211f4e 100644 (file)
@@ -17,7 +17,7 @@ Canio::~Canio()
 bool Canio::on_button_press_event(GdkEventButton *event)
 {
        int w, h;
 bool Canio::on_button_press_event(GdkEventButton *event)
 {
        int w, h;
-       if ((event->type == GDK_BUTTON_PRESS) && ( event->button ==3)){
+       if ((event->type == GDK_BUTTON_PRESS) && ( event->button ==2)){
                image = null; 
                image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0);
                imgActual++;
                image = null; 
                image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0);
                imgActual++;
@@ -33,5 +33,9 @@ bool Canio::on_button_press_event(GdkEventButton *event)
                set_size_request(h, w);         
                image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0);
        }
                set_size_request(h, w);         
                image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0);
        }
+       if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 3)){
+               menu_popup.popup(event->button, event->time);
+                return true; //It has been handled.
+       }
        return true;
 }
        return true;
 }
index 6870e2d2c3ef6bf7c296debbf6fff5b935012329..75c9d26b5da2885419d9b851eb227ad063ff7cf9 100644 (file)
@@ -18,7 +18,7 @@ Codo::~Codo()
 
 bool Codo::on_button_press_event(GdkEventButton *event)
 {
 
 bool Codo::on_button_press_event(GdkEventButton *event)
 {
-       if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 3)){
+       if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 2)){
                image = null;   
                image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0);
                imgActual++;
                image = null;   
                image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0);
                imgActual++;
@@ -39,5 +39,9 @@ bool Codo::on_button_press_event(GdkEventButton *event)
                set_size_request(image->get_width(),image->get_height());
                image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0);
        }
                set_size_request(image->get_width(),image->get_height());
                image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0);
        }
+       if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 3)){
+               menu_popup.popup(event->button, event->time);
+                return true; //It has been handled.
+       }
        return true;
 }
        return true;
 }
index 72106e2b0e32315c7deee6965f6311017947b190..15c3930a2f4789f7dc5fa5eac6f3d91aa284d6f5 100644 (file)
@@ -1,17 +1,20 @@
-
-
 #include "item.h"
 #include <iostream>
 
 CItem::CItem(const char *filename):Gtk::DrawingArea()
 {
        image = Gdk::Pixbuf::create_from_file(filename);
 #include "item.h"
 #include <iostream>
 
 CItem::CItem(const char *filename):Gtk::DrawingArea()
 {
        image = Gdk::Pixbuf::create_from_file(filename);
-
        set_size_request(image->get_width(), image->get_height());
 }
 
 CItem::CItem()
 {
        set_size_request(image->get_width(), image->get_height());
 }
 
 CItem::CItem()
 {
+       menu_image.set(Gtk::Stock::CANCEL, Gtk::ICON_SIZE_MENU);
+       Gtk::Menu::MenuList& menulist = menu_popup.items();
+    menulist.push_back( Gtk::Menu_Helpers::MenuElem("Opcion", SigC::slot(*this, &CItem::on_menu_file_popup_generic) ) );
+    menulist.push_back( Gtk::Menu_Helpers::MenuElem("Rotar", Gtk::Menu::AccelKey("<control>r"),SigC::slot(*this, &CItem::on_menu_file_popup_generic) ) );
+    menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Eliminar", menu_image,SigC::slot(*this, &CItem::on_menu_file_popup_generic) ) ) ;
+       menu_popup.accelerate(*this);
 }
 
 CItem::~CItem()
 }
 
 CItem::~CItem()
@@ -28,3 +31,8 @@ bool CItem::on_expose_event(GdkEventExpose* event)
        //Gtk::DrawingArea::on_expose_event(event);
        return true;
 }
        //Gtk::DrawingArea::on_expose_event(event);
        return true;
 }
+
+void CItem::on_menu_file_popup_generic()
+{
+   std::cout << "A popup menu item was selected." << std::endl;
+}
index 01b8f87eb6f1808ab13174a704eb3f52a44cf972..7a2f35b4fc3ac27b9de47274d3eb246f4c3decfc 100644 (file)
@@ -4,18 +4,23 @@
 #define GTKMM_EXAMPLE_DRAWINGAREALINES_H
 
 #include <gtkmm/drawingarea.h>
 #define GTKMM_EXAMPLE_DRAWINGAREALINES_H
 
 #include <gtkmm/drawingarea.h>
+#include <gtkmm/stock.h>
+#include <gtkmm.h>
 #include <gdkmm.h>
 
 #include <gdkmm.h>
 
-//Custom drawing area with modified expose_event.
+
 class CItem:public Gtk::DrawingArea {
 public:
        CItem();
        CItem(const char *filename);
        ~CItem();
        virtual bool on_expose_event(GdkEventExpose* event);
 class CItem:public Gtk::DrawingArea {
 public:
        CItem();
        CItem(const char *filename);
        ~CItem();
        virtual bool on_expose_event(GdkEventExpose* event);
+       virtual void on_menu_file_popup_generic();
        Glib::RefPtr<Gdk::Pixbuf> get_image() { return image; }
 protected:
        Glib::RefPtr<Gdk::Pixbuf> get_image() { return image; }
 protected:
+       Gtk::Menu menu_popup;
+       Gtk::Image menu_image;
        Glib::RefPtr<Gdk::Pixbuf> image;
 };
 
        Glib::RefPtr<Gdk::Pixbuf> image;
 };
 
-#endif //GTKMM_EXAMPLE_DRAWINGAREALINES_H
+#endif
index 414bee6058e2c4ce1cae6f91a3760d7460789aad..9c4e19728eb83a8cbd094afdbb335b7d109f2c38 100644 (file)
@@ -19,7 +19,7 @@ Y::~Y()
 bool Y::on_button_press_event(GdkEventButton *event)
 {
        int w,h;
 bool Y::on_button_press_event(GdkEventButton *event)
 {
        int w,h;
-       if ((event->type == GDK_BUTTON_PRESS) && (event->button == 3 )){
+       if ((event->type == GDK_BUTTON_PRESS) && (event->button == 2 )){
                image = null;   
                image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0);
                imgActual++;
                image = null;   
                image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0);
                imgActual++;
@@ -41,5 +41,9 @@ bool Y::on_button_press_event(GdkEventButton *event)
                set_size_request(h, w);         
                image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0);
        }
                set_size_request(h, w);         
                image->render_to_drawable(get_window(),get_style()->get_black_gc(),0,0,0,0,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0);
        }
+       if ((event->type == GDK_BUTTON_PRESS) && ( event->button == 3)){
+               menu_popup.popup(event->button, event->time);
+                return true; //It has been handled.
+       }
        return true;
 }
        return true;
 }