Logo ROOT   6.14/05
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 
13 class TParamFollower
14 {
15 public:
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  TEveParamList* pl = dynamic_cast<TEveParamList*>
30  (reinterpret_cast<TQObject*>(gTQSender));
31 
32  printf("Change in param-list '%s', parameter '%s'.\n",
33  pl->GetElementName(), parameter);
34  }
35 
36  ClassDef(TParamFollower, 0);
37 };
38 
39 ClassImp(TParamFollower)
40 
41 void paramlist()
42 {
44 
45  TEveParamList* x = 0;
46 
47  x = new TEveParamList("Top config");
48  gEve->AddToListTree(x, 0);
49 
50  x->AddParameter(TEveParamList::FloatConfig_t("Pepe", 20, 0, 110));
51  x->AddParameter(TEveParamList::IntConfig_t("Dima", 100, 0, 110));
53 
54  x = new TEveParamList("Another config");
55  gEve->AddToListTree(x, 0);
56 
57  x->AddParameter(TEveParamList::FloatConfig_t("MagneticField", 4, -4, 4));
58  x->AddParameter(TEveParamList::FloatConfig_t("Temperature", 16, -20, 40));
59 
60  new TParamFollower;
61 }
void AddParameter(const FloatConfig_t &parameter)
Definition: TEveParamList.h:85
R__EXTERN void * gTQSender
Definition: TQObject.h:45
This is the ROOT implementation of the Qt object communication mechanism (see also http://www...
Definition: TQObject.h:49
TGListTreeItem * AddToListTree(TEveElement *re, Bool_t open, TGListTree *lt=0)
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:320
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:867
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
virtual const char * GetElementName() const
Virtual function for retrieving name of the element.
#define ClassImp(name)
Definition: Rtypes.h:359
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
Collection of named parameters.
Definition: TEveParamList.h:24