paramlist.C

Go to the documentation of this file.
00001 // @(#)root/eve:$Id: text_test.C 26717 2008-12-07 22:07:55Z matevz $
00002 // Author: Matevz Tadel
00003 
00004 // Demonstrates usage of simple configuration via TEveParamList class.
00005 
00006 // Must run in compiled mode for dynamic_cast to work properly.
00007 
00008 #if defined(__CINT__) && !defined(__MAKECINT__)
00009 {
00010    gSystem->CompileMacro("paramlist.C");
00011    paramlist();
00012 }
00013 #else
00014 
00015 #include "TEveManager.h"
00016 #include "TEveParamList.h"
00017 #include "TQObject.h"
00018 
00019 class TParamFollower
00020 {
00021 public:
00022    TParamFollower()
00023    {
00024       TQObject::Connect("TEveParamList", "ParamChanged(char*)",
00025                         "TParamFollower", this, "OnParamChanged(char*)");
00026    }
00027    virtual ~TParamFollower()
00028    {
00029       TQObject::Disconnect("TParamFollower", "ParamChanged(char*)",
00030                            this, "OnParamChanged(char*)");
00031    }
00032 
00033    void OnParamChanged(const char* parameter)
00034    {
00035       TEveParamList* pl = dynamic_cast<TEveParamList*>
00036          (reinterpret_cast<TQObject*>(gTQSender));
00037 
00038       printf("Change in param-list '%s', parameter '%s'.\n",
00039              pl->GetElementName(), parameter);
00040    }
00041 
00042    ClassDef(TParamFollower, 0);
00043 };
00044 
00045 void paramlist()
00046 {
00047    TEveManager::Create();
00048 
00049    TEveParamList* x = 0;
00050 
00051    x = new TEveParamList("Top config");
00052    gEve->AddToListTree(x, 0);
00053 
00054    x->AddParameter(TEveParamList::FloatConfig_t("Pepe", 20, 0, 110));
00055    x->AddParameter(TEveParamList::IntConfig_t("Dima", 100, 0, 110));
00056    x->AddParameter(TEveParamList::BoolConfig_t("Chris", 1));
00057 
00058    x = new TEveParamList("Another config");
00059    gEve->AddToListTree(x, 0);
00060 
00061    x->AddParameter(TEveParamList::FloatConfig_t("MagneticField", 4, -4, 4));
00062    x->AddParameter(TEveParamList::FloatConfig_t("Temperature", 16, -20, 40));
00063 
00064    new TParamFollower;
00065 }
00066 
00067 #endif

Generated on Tue Jul 5 15:43:51 2011 for ROOT_528-00b_version by  doxygen 1.5.1