Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
selection_sigs.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_eve
3/// Test signals from TEveSelection class.
4///
5/// \macro_code
6///
7/// \author Matevz Tadel
8
9#include "TEveSelection.h" // To enforce auto-loading of libEve.
10
11class SigTestSpitter {
12 TEveSelection *fSel;
13 TString fPrefix;
14
15public:
16 SigTestSpitter(TEveSelection *sel, const TString &prefix) : fSel(sel), fPrefix(prefix)
17 {
18 fSel->Connect("SelectionAdded(TEveElement*)", "SigTestSpitter", this, "Added(TEveElement*)");
19 fSel->Connect("SelectionRemoved(TEveElement*)", "SigTestSpitter", this, "Removed(TEveElement*)");
20 fSel->Connect("SelectionCleared()", "SigTestSpitter", this, "Cleared()");
21 }
22 ~SigTestSpitter()
23 {
24 fSel->Disconnect("SelectionAdded(TEveElement*)", this, "Added(TEveElement*)");
25 fSel->Disconnect("SelectionRemoved(TEveElement*)", this, "Removed(TEveElement*)");
26 fSel->Disconnect("SelectionCleared()", this, "Cleared()");
27 }
28 // ----------------------------------------------------------------
29 void Added(TEveElement *el)
30 {
31 printf("%s Added 0x%lx '%s'\n", fPrefix.Data(), (ULong_t)el, el ? el->GetElementName() : "");
32 }
33 void Removed(TEveElement *el)
34 {
35 printf("%s Removed 0x%lx '%s'\n", fPrefix.Data(), (ULong_t)el, el ? el->GetElementName() : "");
36 }
37 void Cleared() { printf("%s Cleared'\n", fPrefix.Data()); }
38};
39
40void selection_sigs()
41{
43
44 new SigTestSpitter(gEve->GetSelection(), "Selection");
45 new SigTestSpitter(gEve->GetHighlight(), "Highlight");
46}
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
Definition RtypesCore.h:69
externTEveManager * gEve
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition TQObject.cxx:865
Bool_t Disconnect(const char *signal=nullptr, void *receiver=nullptr, const char *slot=nullptr)
Disconnects signal of this object from slot of receiver.
const char * Data() const
Definition TString.h:384