CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
FWGeometryTableViewBase::FWViewCombo Class Reference

#include <FWGeometryTableViewBase.h>

Inheritance diagram for FWGeometryTableViewBase::FWViewCombo:

Public Member Functions

 FWViewCombo (const TGWindow *p, FWGeometryTableViewBase *t)
 
Bool_t HandleButton (Event_t *event) override
 
void setElement (TEveElement *x)
 
 ~FWViewCombo () override
 

Private Attributes

TEveElement * m_el
 
FWGeometryTableViewBasem_tableView
 

Detailed Description

Definition at line 48 of file FWGeometryTableViewBase.h.

Constructor & Destructor Documentation

◆ FWViewCombo()

FWGeometryTableViewBase::FWViewCombo::FWViewCombo ( const TGWindow *  p,
FWGeometryTableViewBase t 
)
inline

Definition at line 54 of file FWGeometryTableViewBase.h.

55  : TGTextButton(p,
56  "Select Views",
57  -1,
58  TGButton::GetDefaultGC()(),
59  TGTextButton::GetDefaultFontStruct(),
60  kRaisedFrame | kDoubleBorder),
61  m_tableView(t),
62  m_el(nullptr) {}

◆ ~FWViewCombo()

FWGeometryTableViewBase::FWViewCombo::~FWViewCombo ( )
inlineoverride

Definition at line 63 of file FWGeometryTableViewBase.h.

63 {}

Member Function Documentation

◆ HandleButton()

Bool_t FWGeometryTableViewBase::FWViewCombo::HandleButton ( Event_t *  event)
override

Definition at line 51 of file FWGeometryTableViewBase.cc.

References fwLog, heavyIonCSV_trainingSettings::idx, fwlog::kInfo, m_el, m_tableView, genParticles_cff::map, alignCSCRings::s, and findQualityFiles::v.

51  {
52  if (event->fType == kButtonPress) {
53  bool map = false;
54 
55  FWPopupMenu* m_viewPopup = new FWPopupMenu(nullptr);
56 
57  TEveElementList* views = gEve->GetViewers();
58  int idx = 0;
59 
60  for (TEveElement::List_i it = views->BeginChildren(); it != views->EndChildren(); ++it) {
61  TEveViewer* v = ((TEveViewer*)(*it));
62  if (strstr(v->GetElementName(), "3D")) {
63  bool added = false;
64  m_viewPopup->AddEntry(v->GetElementName(), idx);
65 
66  for (TEveElement::List_i eit = v->BeginChildren(); eit != v->EndChildren(); ++eit) {
67  TEveScene* s = ((TEveSceneInfo*)*eit)->GetScene();
68  if (m_el && s->HasChildren() && s->FirstChild() == m_el) {
69  added = true;
70  break;
71  }
72  }
73  map = true;
74  if (added)
75  m_viewPopup->CheckEntry(idx);
76  }
77  ++idx;
78  }
79 
80  if (map) {
81  Window_t wdummy;
82  Int_t ax, ay;
83  gVirtualX->TranslateCoordinates(GetId(),
84  gClient->GetDefaultRoot()->GetId(),
85  event->fX,
86  event->fY, //0,0 in local coordinates
87  ax,
88  ay, //coordinates of screen
89  wdummy);
90 
91  m_viewPopup->PlaceMenu(ax, ay, true, true);
92  m_viewPopup->Connect("Activated(Int_t)",
93  "FWGeometryTableViewBase",
94  const_cast<FWGeometryTableViewBase*>(m_tableView),
95  "selectView(Int_t)");
96  } else {
97  fwLog(fwlog::kInfo) << "No 3D View added. \n";
98  }
99  }
100  return true;
101 }
#define fwLog(_level_)
Definition: fwLog.h:45
Definition: event.py:1

◆ setElement()

void FWGeometryTableViewBase::FWViewCombo::setElement ( TEveElement *  x)
inline

Member Data Documentation

◆ m_el

TEveElement* FWGeometryTableViewBase::FWViewCombo::m_el
private

Definition at line 51 of file FWGeometryTableViewBase.h.

Referenced by HandleButton(), and setElement().

◆ m_tableView

FWGeometryTableViewBase* FWGeometryTableViewBase::FWViewCombo::m_tableView
private

Definition at line 50 of file FWGeometryTableViewBase.h.

Referenced by HandleButton().