CMS 3D CMS Logo

Public Member Functions | Private Attributes

FWViewCombo Class Reference

List of all members.

Public Member Functions

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

Private Attributes

TEveElement * m_el
FWGeometryTableViewm_tableView

Detailed Description

Definition at line 133 of file FWGeometryTableView.cc.


Constructor & Destructor Documentation

FWViewCombo::FWViewCombo ( const TGWindow *  p,
FWGeometryTableView t 
) [inline]

Definition at line 140 of file FWGeometryTableView.cc.

                                                         : 
      TGTextButton(p, "Select Views", -1, TGButton::GetDefaultGC()(), TGTextButton::GetDefaultFontStruct(), kRaisedFrame | kDoubleBorder  ), m_tableView(t), m_el(0) {}
virtual FWViewCombo::~FWViewCombo ( ) [inline, virtual]

Definition at line 142 of file FWGeometryTableView.cc.

{}

Member Function Documentation

virtual Bool_t FWViewCombo::HandleButton ( Event_t *  event) [inline, virtual]

Definition at line 145 of file FWGeometryTableView.cc.

References fwLog, fwlog::kError, m_el, m_tableView, python::multivaluedict::map(), and v.

   {
      if (event->fType == kButtonPress)
      {
         bool map = false;

         FWPopupMenu* m_viewPopup = new FWPopupMenu(0);

         TEveElementList* views = gEve->GetViewers();
         int idx = 0;

         for (TEveElement::List_i it = views->BeginChildren(); it != views->EndChildren(); ++it)
         { 
            TEveViewer* v = ((TEveViewer*)(*it));
            if (strstr( v->GetElementName(), "3D") )
            {     
               bool added = false;          
               m_viewPopup->AddEntry(v->GetElementName(), idx);
               TEveSceneInfo* si = ( TEveSceneInfo*)v->FindChild(Form("SI - EventScene %s",v->GetElementName() ));
               if (m_el) {
                  for (TEveElement::List_i it = m_el->BeginParents(); it != m_el->EndParents(); ++it ){
                     if (*it == si->GetScene()) {
                        added = true;
                        break;
                     }
                  }
               }
               map = true;
               if (added)
                  m_viewPopup->CheckEntry(idx);
            }
            ++idx;
         }

         if (map) {

            Window_t wdummy;
            Int_t ax,ay;
            gVirtualX->TranslateCoordinates(GetId(),
                                            gClient->GetDefaultRoot()->GetId(),
                                            event->fX, event->fY, //0,0 in local coordinates
                                            ax,ay, //coordinates of screen
                                            wdummy);


            m_viewPopup->PlaceMenu(ax, ay, true,true);
            m_viewPopup->Connect("Activated(Int_t)",
                                 "FWGeometryTableView",
                                 const_cast<FWGeometryTableView*>(m_tableView),
                                 "selectView(Int_t)");
         }
         else
         {
            fwLog(fwlog::kError) << "No 3D View added. \n";
         }
      }
      return true;
   }
void FWViewCombo::setElement ( TEveElement *  x) [inline]

Definition at line 143 of file FWGeometryTableView.cc.

References m_el, and x.

Referenced by FWGeometryTableView::populate3DViewsFromConfig(), and FWGeometryTableView::selectView().

{m_el = x;}

Member Data Documentation

TEveElement* FWViewCombo::m_el [private]

Definition at line 137 of file FWGeometryTableView.cc.

Referenced by HandleButton(), and setElement().

Definition at line 136 of file FWGeometryTableView.cc.

Referenced by HandleButton().