Logo ROOT  
Reference Guide
paramlist.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_eve
3/// Demonstrates usage of simple configuration via TEveParamList class.
4///
5/// \macro_code
6///
7/// \author Matevz Tadel
8
9#include "TEveManager.h"
10#include "TEveParamList.h"
11#include "TQObject.h"
12
13class TParamFollower
14{
15public:
16 TParamFollower()
17 {
18 TQObject::Connect("TEveParamList", "ParamChanged(char*)",
19 "TParamFollower", this, "OnParamChanged(char*)");
20 }
21 virtual ~TParamFollower()
22 {
23 TQObject::Disconnect("TParamFollower", "ParamChanged(char*)",
24 this, "OnParamChanged(char*)");
25 }
26
27 void OnParamChanged(const char* parameter)
28 {
29 auto pl = dynamic_cast<TEveParamList*> (reinterpret_cast<TQObject*>(gTQSender));
30
31 printf("Change in param-list '%s', parameter '%s'.\n", pl->GetElementName(), parameter);
32 }
33
34 ClassDef(TParamFollower, 0);
35};
36
37ClassImp(TParamFollower)
38
39void paramlist()
40{
42
43 TEveParamList* x = 0;
44
45 x = new TEveParamList("Top config");
46 gEve->AddToListTree(x, 0);
47
48 x->AddParameter(TEveParamList::FloatConfig_t("Pepe", 20, 0, 110));
49 x->AddParameter(TEveParamList::IntConfig_t("Dima", 100, 0, 110));
50 x->AddParameter(TEveParamList::BoolConfig_t("Chris", 1));
51
52 x = new TEveParamList("Another config");
53 gEve->AddToListTree(x, 0);
54
55 x->AddParameter(TEveParamList::FloatConfig_t("MagneticField", 4, -4, 4));
56 x->AddParameter(TEveParamList::FloatConfig_t("Temperature", 16, -20, 40));
57
58 new TParamFollower;
59}
#define ClassDef(name, id)
Definition: Rtypes.h:322
#define ClassImp(name)
Definition: Rtypes.h:361
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
R__EXTERN void * gTQSender
Definition: TQObject.h:44
TGListTreeItem * AddToListTree(TEveElement *re, Bool_t open, TGListTree *lt=0)
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
Collection of named parameters.
Definition: TEveParamList.h:27
This is the ROOT implementation of the Qt object communication mechanism (see also http://www....
Definition: TQObject.h:48
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:866
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:1024
Double_t x[n]
Definition: legend1.C:17