ROOT logo

From $ROOTSYS/tutorials/eve/selection_sigs.C

// @(#)root/eve:$Id: text_test.C 26717 2008-12-07 22:07:55Z matevz $
// Author: Matevz Tadel

// Test signals from TEveSelection class.

#include "TEveSelection.h" // To enforce auto-loading of libEve.

class SigTestSpitter
{
   TEveSelection *fSel;
   TString        fPrefix;

public:
   SigTestSpitter(TEveSelection* sel, const TString& prefix) :
      fSel(sel), fPrefix(prefix)
   {
      fSel->Connect("SelectionAdded(TEveElement*)", "SigTestSpitter", this, "Added(TEveElement*)");
      fSel->Connect("SelectionRemoved(TEveElement*)", "SigTestSpitter", this, "Removed(TEveElement*)");
      fSel->Connect("SelectionCleared()", "SigTestSpitter", this, "Cleared()");
   }
   ~SigTestSpitter()
   {
      fSel->Disconnect("SelectionAdded(TEveElement*)", this, "Added(TEveElement*)");
      fSel->Disconnect("SelectionRemoved(TEveElement*)", this, "Removed(TEveElement*)");
      fSel->Disconnect("SelectionCleared()", this, "Cleared()");
   }
   // ----------------------------------------------------------------
   void Added(TEveElement* el)
   {
      printf("%s Added 0x%lx '%s'\n", fPrefix.Data(), el, el ? el->GetElementName() : "");
   }
   void Removed(TEveElement* el)
   {
      printf("%s Removed 0x%lx '%s'\n", fPrefix.Data(), el, el ? el->GetElementName() : "");
   }
   void Cleared()
   {
      printf("%s Cleared'\n", fPrefix.Data());
   }
};

void selection_sigs()
{
   TEveManager::Create();

   new SigTestSpitter(gEve->GetSelection(), "Selection");
   new SigTestSpitter(gEve->GetHighlight(), "Highlight");
}
 selection_sigs.C:1
 selection_sigs.C:2
 selection_sigs.C:3
 selection_sigs.C:4
 selection_sigs.C:5
 selection_sigs.C:6
 selection_sigs.C:7
 selection_sigs.C:8
 selection_sigs.C:9
 selection_sigs.C:10
 selection_sigs.C:11
 selection_sigs.C:12
 selection_sigs.C:13
 selection_sigs.C:14
 selection_sigs.C:15
 selection_sigs.C:16
 selection_sigs.C:17
 selection_sigs.C:18
 selection_sigs.C:19
 selection_sigs.C:20
 selection_sigs.C:21
 selection_sigs.C:22
 selection_sigs.C:23
 selection_sigs.C:24
 selection_sigs.C:25
 selection_sigs.C:26
 selection_sigs.C:27
 selection_sigs.C:28
 selection_sigs.C:29
 selection_sigs.C:30
 selection_sigs.C:31
 selection_sigs.C:32
 selection_sigs.C:33
 selection_sigs.C:34
 selection_sigs.C:35
 selection_sigs.C:36
 selection_sigs.C:37
 selection_sigs.C:38
 selection_sigs.C:39
 selection_sigs.C:40
 selection_sigs.C:41
 selection_sigs.C:42
 selection_sigs.C:43
 selection_sigs.C:44
 selection_sigs.C:45
 selection_sigs.C:46
 selection_sigs.C:47
 selection_sigs.C:48
 selection_sigs.C:49
thumb