selection_sigs.C

Go to the documentation of this file.
00001 // @(#)root/eve:$Id: text_test.C 26717 2008-12-07 22:07:55Z matevz $
00002 // Author: Matevz Tadel
00003 
00004 // Test signals from TEveSelection class.
00005 
00006 #include "TEveSelection.h" // To enforce auto-loading of libEve.
00007 
00008 class SigTestSpitter
00009 {
00010    TEveSelection *fSel;
00011    TString        fPrefix;
00012 
00013 public:
00014    SigTestSpitter(TEveSelection* sel, const TString& prefix) :
00015       fSel(sel), fPrefix(prefix)
00016    {
00017       fSel->Connect("SelectionAdded(TEveElement*)", "SigTestSpitter", this, "Added(TEveElement*)");
00018       fSel->Connect("SelectionRemoved(TEveElement*)", "SigTestSpitter", this, "Removed(TEveElement*)");
00019       fSel->Connect("SelectionCleared()", "SigTestSpitter", this, "Cleared()");
00020    }
00021    ~SigTestSpitter()
00022    {
00023       fSel->Disconnect("SelectionAdded(TEveElement*)", this, "Added(TEveElement*)");
00024       fSel->Disconnect("SelectionRemoved(TEveElement*)", this, "Removed(TEveElement*)");
00025       fSel->Disconnect("SelectionCleared()", this, "Cleared()");
00026    }
00027    // ----------------------------------------------------------------
00028    void Added(TEveElement* el)
00029    {
00030       printf("%s Added 0x%lx '%s'\n", fPrefix.Data(), el, el ? el->GetElementName() : "");
00031    }
00032    void Removed(TEveElement* el)
00033    {
00034       printf("%s Removed 0x%lx '%s'\n", fPrefix.Data(), el, el ? el->GetElementName() : "");
00035    }
00036    void Cleared()
00037    {
00038       printf("%s Cleared'\n", fPrefix.Data());
00039    }
00040 };
00041 
00042 void selection_sigs()
00043 {
00044    TEveManager::Create();
00045 
00046    new SigTestSpitter(gEve->GetSelection(), "Selection");
00047    new SigTestSpitter(gEve->GetHighlight(), "Highlight");
00048 }

Generated on Tue Jul 5 15:43:52 2011 for ROOT_528-00b_version by  doxygen 1.5.1