CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

FWGLEventHandler Class Reference

#include <FWGLEventHandler.h>

List of all members.

Public Member Functions

 FWGLEventHandler (TGWindow *w, TObject *obj, TEveCaloLego *l=0)
virtual Bool_t HandleButton (Event_t *event)
virtual Bool_t HandleCrossing (Event_t *event)
virtual Bool_t HandleFocusChange (Event_t *event)
virtual Bool_t HandleKey (Event_t *event)
virtual void PopupContextMenu (TGLPhysicalShape *pshp, Event_t *event, Int_t gx, Int_t gy)
void setViewer (FWEveView *ev)
virtual ~FWGLEventHandler ()

Public Attributes

sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_

Private Member Functions

 FWGLEventHandler (const FWGLEventHandler &)
const FWGLEventHandleroperator= (const FWGLEventHandler &)

Private Attributes

FWEveViewm_viewer

Detailed Description

Definition at line 11 of file FWGLEventHandler.h.


Constructor & Destructor Documentation

FWGLEventHandler::FWGLEventHandler ( TGWindow *  w,
TObject *  obj,
TEveCaloLego *  l = 0 
)

Definition at line 16 of file FWGLEventHandler.cc.

                                                                            :
   TEveLegoEventHandler(w, obj, l),
   m_viewer(0)
{}
virtual FWGLEventHandler::~FWGLEventHandler ( ) [inline, virtual]

Definition at line 15 of file FWGLEventHandler.h.

{}
FWGLEventHandler::FWGLEventHandler ( const FWGLEventHandler ) [private]

Member Function Documentation

Bool_t FWGLEventHandler::HandleButton ( Event_t *  event) [virtual]

Definition at line 49 of file FWGLEventHandler.cc.

References m_viewer, FWEveView::requestGLHandlerPick(), FW3DViewBase::setCurrentDMTVertex(), findQualityFiles::v, x, and detailsBasic3DVector::y.

{
   Bool_t res = TEveLegoEventHandler::HandleButton(event);
   if (m_viewer->requestGLHandlerPick() && event->fType == kButtonPress )
   {
       Int_t    x, y;
       Window_t childdum;
       gVirtualX->TranslateCoordinates(gClient->GetDefaultRoot()->GetId(), fGLViewer->GetGLWidget()->GetId(),event->fX, event->fY, x, y, childdum);                fGLViewer->RequestSelect(event->fX, event->fY);
       if (fGLViewer->GetSelRec().GetN() > 0 ) 
         {
           TGLVector3 v(event->fX, event->fY, 0.5*fGLViewer->GetSelRec().GetMinZ());
           fGLViewer->CurrentCamera().WindowToViewport(v);
           v = fGLViewer->CurrentCamera().ViewportToWorld(v);
           FW3DViewBase* v3d = dynamic_cast<FW3DViewBase*>(m_viewer);
           v3d->setCurrentDMTVertex(v.X(), v.Y(), v.Z());
         }
   }

   return res;
}
Bool_t FWGLEventHandler::HandleCrossing ( Event_t *  event) [virtual]

Definition at line 108 of file FWGLEventHandler.cc.

References m_viewer, and FWEveView::viewer().

{
   // Handle generic Event_t type 'event' - provided to catch focus changes
   // and terminate any interaction in viewer.

   if (m_viewer->viewer() && event->fType == kLeaveNotify)
      TEveGedEditor::ElementChanged(m_viewer->viewer());

   return TGLEventHandler::HandleCrossing(event);
}
Bool_t FWGLEventHandler::HandleFocusChange ( Event_t *  event) [virtual]

Definition at line 96 of file FWGLEventHandler.cc.

References m_viewer, and FWEveView::viewer().

{
   // Handle generic Event_t type 'event' - provided to catch focus changes
   // and terminate any interaction in viewer.

   if (m_viewer->viewer() && event->fType == kFocusOut)
      TEveGedEditor::ElementChanged(m_viewer->viewer());

   return TGLEventHandler::HandleFocusChange(event);
}
Bool_t FWGLEventHandler::HandleKey ( Event_t *  event) [virtual]

Definition at line 70 of file FWGLEventHandler.cc.

References event(), PopupContextMenu(), tmp, x, and detailsBasic3DVector::y.

{
   UInt_t keysym;
   char tmp[2];
   gVirtualX->LookupString(event, tmp, sizeof(tmp), keysym);

   if (keysym == kKey_Enter || keysym == kKey_Return || keysym == kKey_Space)
   {
      if (event->fType == kGKeyPress)
      {
         Int_t    x, y;
         Window_t childdum;
         gVirtualX->TranslateCoordinates(fGLViewer->GetGLWidget()->GetId(), gClient->GetDefaultRoot()->GetId(),
                                         event->fX, event->fY, x, y, childdum);

         fGLViewer->RequestSelect(event->fX, event->fY);
         PopupContextMenu(fGLViewer->GetSelRec().GetPhysShape(), event, x, y);
      }
      return kTRUE;
   }
   else {
      return TEveLegoEventHandler::HandleKey(event);

   }
}
const FWGLEventHandler& FWGLEventHandler::operator= ( const FWGLEventHandler ) [private]
void FWGLEventHandler::PopupContextMenu ( TGLPhysicalShape *  pshp,
Event_t *  event,
Int_t  gx,
Int_t  gy 
) [virtual]

Definition at line 22 of file FWGLEventHandler.cc.

References FWGeoTopNodeGLScene::GeoPopupMenu(), m_viewer, openSelectedModelContextMenu_, and FWEveView::viewerGL().

Referenced by HandleKey().

{
   // Popup context menu.
  
   if (event->fState & kKeyShiftMask && event->fState & kKeyControlMask)
   {
      TGLEventHandler::PopupContextMenu(pshp, event, gx, gy);
      return;
   }
  
   if (pshp)
   {
      SelectForClicked(event);
    
      if (pshp->GetLogical()) 
      {
         FWGeoTopNodeGLScene* js = dynamic_cast<FWGeoTopNodeGLScene*>(pshp->GetLogical()->GetScene());
         if (js) {
            js->GeoPopupMenu(gx, gy, m_viewer->viewerGL());
            return;
         }
      }
    
      openSelectedModelContextMenu_(gx,gy);
   }
}
void FWGLEventHandler::setViewer ( FWEveView ev) [inline]

Definition at line 28 of file FWGLEventHandler.h.

References m_viewer.

Referenced by FWEveView::FWEveView().

{ m_viewer = ev; }

Member Data Documentation

sigc::signal<void,Int_t,Int_t> FWGLEventHandler::openSelectedModelContextMenu_

Definition at line 26 of file FWGLEventHandler.h.

Referenced by FWEveView::FWEveView(), and PopupContextMenu().