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 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 (TEveViewer *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

TEveViewer * m_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 13 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::HandleCrossing ( Event_t *  event) [virtual]

Definition at line 84 of file FWGLEventHandler.cc.

References m_viewer.

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

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

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

Definition at line 72 of file FWGLEventHandler.cc.

References m_viewer.

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

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

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

Definition at line 46 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 19 of file FWGLEventHandler.cc.

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

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->GetGLViewer());
            return;
         }
      }
    
      openSelectedModelContextMenu_(gx,gy);
   }
}
void FWGLEventHandler::setViewer ( TEveViewer *  ev) [inline]

Definition at line 26 of file FWGLEventHandler.h.

References m_viewer.

Referenced by FWEveView::FWEveView().

{ m_viewer = ev; }

Member Data Documentation

TEveViewer* FWGLEventHandler::m_viewer [private]

Definition at line 32 of file FWGLEventHandler.h.

Referenced by HandleCrossing(), HandleFocusChange(), PopupContextMenu(), and setViewer().

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

Definition at line 24 of file FWGLEventHandler.h.

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