CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWGLEventHandler.cc
Go to the documentation of this file.
3 
4 #include "KeySymbols.h"
5 #include "TGLViewer.h"
6 #include "TGLWidget.h"
7 #include "TGLPhysicalShape.h"
8 #include "TGLLogicalShape.h"
9 #include "TEveGedEditor.h"
10 #include "TEveViewer.h"
11 #include "FWGeoTopNodeScene.h"
12 
13 FWGLEventHandler::FWGLEventHandler(TGWindow *w, TObject *obj, TEveCaloLego* l):
14  TEveLegoEventHandler(w, obj, l),
15  m_viewer(0)
16 {}
17 
18 void
19 FWGLEventHandler::PopupContextMenu(TGLPhysicalShape* pshp, Event_t *event, Int_t gx, Int_t gy)
20 {
21  // Popup context menu.
22 
23  if (event->fState & kKeyShiftMask && event->fState & kKeyControlMask)
24  {
25  TGLEventHandler::PopupContextMenu(pshp, event, gx, gy);
26  return;
27  }
28 
29  if (pshp)
30  {
31  SelectForClicked(event);
32 
33  if (pshp->GetLogical())
34  {
35  FWGeoTopNodeGLScene* js = dynamic_cast<FWGeoTopNodeGLScene*>(pshp->GetLogical()->GetScene());
36  if (js) {
37  js->GeoPopupMenu(gx, gy, m_viewer->GetGLViewer());
38  return;
39  }
40  }
41 
43  }
44 }
45 
47 {
48  UInt_t keysym;
49  char tmp[2];
50  gVirtualX->LookupString(event, tmp, sizeof(tmp), keysym);
51 
52  if (keysym == kKey_Enter || keysym == kKey_Return || keysym == kKey_Space)
53  {
54  if (event->fType == kGKeyPress)
55  {
56  Int_t x, y;
57  Window_t childdum;
58  gVirtualX->TranslateCoordinates(fGLViewer->GetGLWidget()->GetId(), gClient->GetDefaultRoot()->GetId(),
59  event->fX, event->fY, x, y, childdum);
60 
61  fGLViewer->RequestSelect(event->fX, event->fY);
62  PopupContextMenu(fGLViewer->GetSelRec().GetPhysShape(), event, x, y);
63  }
64  return kTRUE;
65  }
66  else
67  {
68  return TEveLegoEventHandler::HandleKey(event);
69  }
70 }
71 
73 {
74  // Handle generic Event_t type 'event' - provided to catch focus changes
75  // and terminate any interaction in viewer.
76 
77  if (m_viewer && event->fType == kFocusOut)
78  TEveGedEditor::ElementChanged(m_viewer);
79 
80  return TGLEventHandler::HandleFocusChange(event);
81 }
82 
83 //______________________________________________________________________________
85 {
86  // Handle generic Event_t type 'event' - provided to catch focus changes
87  // and terminate any interaction in viewer.
88 
89  if (m_viewer && event->fType == kLeaveNotify)
90  TEveGedEditor::ElementChanged(m_viewer);
91 
92  return TGLEventHandler::HandleCrossing(event);
93 }
void GeoPopupMenu(Int_t gx, Int_t gy, TGLViewer *)
virtual Bool_t HandleCrossing(Event_t *event)
virtual Bool_t HandleKey(Event_t *event)
TEveViewer * m_viewer
FWGLEventHandler(TGWindow *w, TObject *obj, TEveCaloLego *l=0)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
unsigned int UInt_t
Definition: FUTypes.h:12
virtual void PopupContextMenu(TGLPhysicalShape *pshp, Event_t *event, Int_t gx, Int_t gy)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
virtual Bool_t HandleFocusChange(Event_t *event)
Definition: DDAxes.h:10
T w() const