Logo ROOT  
Reference Guide
selection_sigs.C File Reference

Detailed Description

Test signals from TEveSelection class.

#include "TEveSelection.h" // To enforce auto-loading of libEve.
class SigTestSpitter
{
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(), (ULong_t)el, el ? el->GetElementName() : "");
}
void Removed(TEveElement* el)
{
printf("%s Removed 0x%lx '%s'\n", fPrefix.Data(), (ULong_t)el, el ? el->GetElementName() : "");
}
void Cleared()
{
printf("%s Cleared'\n", fPrefix.Data());
}
};
void selection_sigs()
{
new SigTestSpitter(gEve->GetSelection(), "Selection");
new SigTestSpitter(gEve->GetHighlight(), "Highlight");
}
unsigned long ULong_t
Definition: RtypesCore.h:51
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition: TEveElement.h:34
TEveSelection * GetSelection() const
Definition: TEveManager.h:129
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
TEveSelection * GetHighlight() const
Definition: TEveManager.h:130
Make sure there is a SINGLE running TEveSelection for each selection type (select/highlight).
Definition: TEveSelection.h:23
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:867
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
Definition: TQObject.cxx:1025
Basic string class.
Definition: TString.h:131
const char * Data() const
Definition: TString.h:364
Author
Matevz Tadel

Definition in file selection_sigs.C.