COIN-OR::LEMON - Graph Library

Changeset 32:1f45545f124c in glemon-0.x for graph_displayer_canvas-event.cc


Ignore:
Timestamp:
07/12/05 20:21:49 (16 years ago)
Author:
Hegyi Péter
Branch:
gui
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk/gui@2046
Message:

Editors are based.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • graph_displayer_canvas-event.cc

    r31 r32  
    4242    case ERASER:
    4343      actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::eraserEventHandler), false);
     44      break;
     45
     46    case EDGE_MAP_EDIT:
     47      actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::edgeMapEditEventHandler), false);
     48      break;
     49
     50    case NODE_MAP_EDIT:
     51      actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::nodeMapEditEventHandler), false);
    4452      break;
    4553
     
    211219    case GDK_MOTION_NOTIFY:
    212220      {
    213         double world_motion_x, world_motion_y;
    214221        GdkEvent * generated=new GdkEvent();
    215222        generated->motion.x=e->motion.x;
     
    477484}
    478485
     486bool GraphDisplayerCanvas::edgeMapEditEventHandler(GdkEvent* e)
     487{
     488  switch(e->type)
     489    {
     490    case GDK_BUTTON_PRESS:
     491      window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
     492      active_item=(get_item_at(clicked_x, clicked_y));
     493      active_edge=INVALID;
     494      for (EdgeIt i(g); i!=INVALID; ++i)
     495        {
     496          if(edgesmap[i]==active_item)
     497            {
     498              active_edge=i;
     499            }
     500        }
     501      if(active_edge!=INVALID)
     502        {
     503          if(canvasentrywidget)
     504            {
     505              delete(canvasentrywidget);
     506            }
     507          entrywidget.show();
     508          entrywidget.set_text("Hello!");
     509          //      canvasentrywidget=new Gnome::Canvas::Widget(displayed_graph, clicked_x, clicked_y,entrywidget);
     510          canvasentrywidget=new Gnome::Canvas::Widget(displayed_graph, e->button.x, e->button.y, entrywidget);
     511          canvasentrywidget->property_width().set_value(70);
     512          canvasentrywidget->property_height().set_value(50);
     513          canvasentrywidget->show();
     514          *(edgesmap[active_edge]) << Gnome::Canvas::Properties::fill_color("red");
     515        }
     516      active_item=NULL;         // !!!!!!!!!!!!!!!!!!!!!!!!!!!
     517      active_edge=INVALID;      // !!!!!!!!!!!!!!!!!!!!!!!!!!!
     518      break;
     519    default:
     520      break;
     521    }
     522  return false; 
     523}
     524
     525bool GraphDisplayerCanvas::nodeMapEditEventHandler(GdkEvent* e)
     526{
     527  e=e;
     528  return false;
     529}
     530
    479531void GraphDisplayerCanvas::deleteItem(NodeIt node_to_delete)
    480532{
     
    537589
    538590}
     591
Note: See TracChangeset for help on using the changeset viewer.