CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/Fireworks/Core/src/FWGLEventHandler.cc

Go to the documentation of this file.
00001 #include "Fireworks/Core/interface/FWGLEventHandler.h"
00002 #include "Fireworks/Core/interface/FWGUIManager.h"
00003 
00004 #include "KeySymbols.h"
00005 #include "TGLViewer.h"
00006 #include "TGLWidget.h"
00007 #include "TGLPhysicalShape.h"
00008 
00009 
00010 FWGLEventHandler::FWGLEventHandler(TGWindow *w, TObject *obj, TEveCaloLego* l):
00011    TEveLegoEventHandler(w, obj, l)
00012 {
00013 }
00014 
00015 void
00016 FWGLEventHandler::PopupContextMenu(TGLPhysicalShape* pshp,  Event_t *event, Int_t gx, Int_t gy)
00017 {
00018    // Popup context menu.
00019 
00020   
00021    if (event->fState & kKeyShiftMask && event->fState & kKeyControlMask)
00022    {
00023       TGLEventHandler::PopupContextMenu(pshp, event, gx, gy);
00024       return;
00025    }
00026 
00027    if (pshp)
00028    {
00029       SelectForClicked(event);
00030       openSelectedModelContextMenu_(gx,gy);
00031    }
00032 }
00033 
00034 Bool_t FWGLEventHandler::HandleKey(Event_t *event)
00035 {
00036    UInt_t keysym;
00037    char tmp[2];
00038    gVirtualX->LookupString(event, tmp, sizeof(tmp), keysym);
00039 
00040    if (keysym == kKey_Enter || keysym == kKey_Return || keysym == kKey_Space)
00041    {
00042       if (event->fType == kGKeyPress)
00043       {
00044          Int_t    x, y;
00045          Window_t childdum;
00046          gVirtualX->TranslateCoordinates(fGLViewer->GetGLWidget()->GetId(), gClient->GetDefaultRoot()->GetId(),
00047                                          event->fX, event->fY, x, y, childdum);
00048 
00049          fGLViewer->RequestSelect(event->fX, event->fY);
00050          PopupContextMenu(fGLViewer->GetSelRec().GetPhysShape(), event, x, y);
00051       }
00052       return kTRUE;
00053    }
00054    else
00055    {
00056       return TEveLegoEventHandler::HandleKey(event);
00057    }
00058 }