X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/7353f36b6d2eca998f2cb2ca561219b3979ff167..e860608dbbbbaa43d0f241ab7a43da7c4608e192:/Client/src/item_codo.cpp diff --git a/Client/src/item_codo.cpp b/Client/src/item_codo.cpp index 76aefe1..ce0f2b5 100644 --- a/Client/src/item_codo.cpp +++ b/Client/src/item_codo.cpp @@ -1,25 +1,67 @@ #include "item_codo.h" -Codo::Codo(Glib::ustring _name, int orientacion):Item(_name) +ViewCodo::ViewCodo(Glib::ustring _name, int orientacion):ViewItem(_name) { switch (orientacion) { case 0: - image = Gdk::Pixbuf::create_from_file("codo_o.png"); + image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/codo_o.png"); break; case 1: - image = Gdk::Pixbuf::create_from_file("codo_n.png"); + image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/codo_n.png"); break; case 2: - image = Gdk::Pixbuf::create_from_file("codo_e.png"); + image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/codo_e.png"); break; case 3: - image = Gdk::Pixbuf::create_from_file("codo_s.png"); + image.set(PACKAGE_DATA_DIR"/plaqui-client/pixmaps/codo_s.png"); } - set_size_request(image->get_width(), image->get_height()); + m_or = orientacion; + image.show(); + set_size_request(); } -Codo::~Codo() +ViewCodo::~ViewCodo() { } +bool ViewCodo::on_image_expose_event(GdkEventExpose *e) +{ + Glib::RefPtr colormap = image.get_colormap(); + Gdk::Color blanco = Gdk::Color("white"); + colormap->alloc_color(blanco); + colormap->alloc_color(color); + gc->set_foreground(blanco); + gc->set_background(blanco); + gc->set_line_attributes(6, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER); + int w,h; + w = image.get_width(); + h = image.get_height(); + // TODO : hacer que dibuje arcos en el sentido del codo! + switch (m_or) { + case 0: + image.get_window()->draw_arc(gc, 0, -16, 16, w, h, 0, 90*64); + gc->set_line_attributes(4, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER); + gc->set_foreground(color); + image.get_window()->draw_arc(gc, 0, -16, 16, w, h, 0, 90*64); + break; + case 1: + image.get_window()->draw_arc(gc, 0, -16, -16, w, h, 0*64, -90*64); + gc->set_line_attributes(4, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER); + gc->set_foreground(color); + image.get_window()->draw_arc(gc, 0, -16, -16, w, h, 0*64, -90*64); + break; + case 2: + image.get_window()->draw_arc(gc, 0, 16, -16, w, h, -90*64, -90*64); + gc->set_line_attributes(4, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER); + gc->set_foreground(color); + image.get_window()->draw_arc(gc, 0, 16, -16, w, h, -90*64, -90*64); + break; + case 3: + image.get_window()->draw_arc(gc, 0, 16, 16, w, h, 90*64, 90*64); + gc->set_line_attributes(4, Gdk::LINE_SOLID, Gdk::CAP_NOT_LAST, Gdk::JOIN_MITER); + gc->set_foreground(color); + image.get_window()->draw_arc(gc, 0, 16, 16, w, h, 90*64, 90*64); + } +} +