// @(#)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 test_selection_sigs()
{
   TEveManager::Create();

   new SigTestSpitter(gEve->GetSelection(), "Selection");
   new SigTestSpitter(gEve->GetHighlight(), "Highlight");
}
thumb

Last change: Wed Dec 17 10:56:29 2008
Last generated: 2008-12-17 10:56

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.