// @(#)root/eve:$Id$
// Author: Dmytro Kovalskyi, 28.2.2008

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TEveParamList
#define ROOT_TEveParamList

#include "TEveElement.h"
#include "TQObject.h"
#include <vector>

//==============================================================================
//==============================================================================
// TEveParamList
//==============================================================================

class TEveParamList : public TEveElement,
                      public TNamed,
                      public TQObject
{
   friend class TEveParamListEditor;

public:
   struct FloatConfig_t
   {
      Float_t   fValue, fMin, fMax;
      TString   fName;
      Bool_t    fSelector;

      FloatConfig_t(TString name, Double_t value, Double_t min, Double_t max, Bool_t selector = kFALSE):
         fValue(value), fMin(min), fMax(max), fName(name), fSelector(selector) {}
      FloatConfig_t(): fValue(0), fMin(0), fMax(0), fName(""), fSelector(kFALSE) {}
   };
   typedef std::vector<FloatConfig_t>       FloatConfigVec_t;
   typedef FloatConfigVec_t::iterator       FloatConfigVec_i;
   typedef FloatConfigVec_t::const_iterator FloatConfigVec_ci;

   struct IntConfig_t
   {
      Int_t     fValue, fMin, fMax;
      TString   fName;
      Bool_t    fSelector;

      IntConfig_t(TString name, Int_t value, Int_t min, Int_t max, Bool_t selector=kFALSE) :
         fValue(value), fMin(min), fMax(max), fName(name), fSelector(selector) {}
      IntConfig_t() : fValue(0), fMin(0), fMax(0), fName(""), fSelector(kFALSE) {}
   };
   typedef std::vector<IntConfig_t>       IntConfigVec_t;
   typedef IntConfigVec_t::iterator       IntConfigVec_i;
   typedef IntConfigVec_t::const_iterator IntConfigVec_ci;

   struct BoolConfig_t
   {
      Bool_t    fValue;
      TString   fName;

      BoolConfig_t(TString name, Bool_t value): fValue(value), fName(name) {}
      BoolConfig_t() : fValue(kFALSE), fName("") {}
   };
   typedef std::vector<BoolConfig_t>       BoolConfigVec_t;
   typedef BoolConfigVec_t::iterator       BoolConfigVec_i;
   typedef BoolConfigVec_t::const_iterator BoolConfigVec_ci;

private:
   TEveParamList(const TEveParamList&);            // Not implemented
   TEveParamList& operator=(const TEveParamList&); // Not implemented

protected:
   Color_t              fColor;
   FloatConfigVec_t     fFloatParameters;
   IntConfigVec_t       fIntParameters;
   BoolConfigVec_t      fBoolParameters;

public:
   TEveParamList(const char* n="TEveParamList", const char* t="", Bool_t doColor=kFALSE);
   virtual ~TEveParamList() {}

   void AddParameter(const FloatConfig_t& parameter) { fFloatParameters.push_back(parameter); }
   void AddParameter(const IntConfig_t& parameter)   { fIntParameters.push_back(parameter); }
   void AddParameter(const BoolConfig_t& parameter)  { fBoolParameters.push_back(parameter); }

   const FloatConfigVec_t&  GetFloatParameters() { return fFloatParameters; }
   const IntConfigVec_t&    GetIntParameters()   { return fIntParameters; }
   const BoolConfigVec_t&   GetBoolParameters()  { return fBoolParameters; }

   FloatConfig_t    GetFloatParameter(const TString& name);
   IntConfig_t      GetIntParameter  (const TString& name);
   Bool_t           GetBoolParameter (const TString& name);

   void ParamChanged(const char* name); // *SIGNAL*

   ClassDef(TEveParamList, 0); // Eve element to store generic configuration information.
};


//==============================================================================
//==============================================================================
// TEveParamListEditor
//==============================================================================

#include "TGedFrame.h"

class TGButton;
class TGCheckButton;
class TGNumberEntry;
class TGColorSelect;

class TEveGValuator;
class TEveGDoubleValuator;

class TEveParamList;

class TGNumberEntry;

class TEveParamListEditor : public TGedFrame
{
private:
   TEveParamListEditor(const TEveParamListEditor&);            // Not implemented
   TEveParamListEditor& operator=(const TEveParamListEditor&); // Not implemented

protected:
   TEveParamList                 *fM; // Model object.
   TGVerticalFrame               *fParamFrame;
   std::vector<TGNumberEntry*>    fIntParameters;
   std::vector<TGNumberEntry*>    fFloatParameters;
   std::vector<TGCheckButton*>    fBoolParameters;

   virtual void InitModel(TObject* obj);

public:
   TEveParamListEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30,
         UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground());
   virtual ~TEveParamListEditor() {}

   virtual void SetModel(TObject* obj);

   // Declare callback/slot methods
   void DoIntUpdate();
   void DoFloatUpdate();
   void DoBoolUpdate();

   ClassDef(TEveParamListEditor, 0); // GUI editor for TEveParamList.
};
#endif
 TEveParamList.h:1
 TEveParamList.h:2
 TEveParamList.h:3
 TEveParamList.h:4
 TEveParamList.h:5
 TEveParamList.h:6
 TEveParamList.h:7
 TEveParamList.h:8
 TEveParamList.h:9
 TEveParamList.h:10
 TEveParamList.h:11
 TEveParamList.h:12
 TEveParamList.h:13
 TEveParamList.h:14
 TEveParamList.h:15
 TEveParamList.h:16
 TEveParamList.h:17
 TEveParamList.h:18
 TEveParamList.h:19
 TEveParamList.h:20
 TEveParamList.h:21
 TEveParamList.h:22
 TEveParamList.h:23
 TEveParamList.h:24
 TEveParamList.h:25
 TEveParamList.h:26
 TEveParamList.h:27
 TEveParamList.h:28
 TEveParamList.h:29
 TEveParamList.h:30
 TEveParamList.h:31
 TEveParamList.h:32
 TEveParamList.h:33
 TEveParamList.h:34
 TEveParamList.h:35
 TEveParamList.h:36
 TEveParamList.h:37
 TEveParamList.h:38
 TEveParamList.h:39
 TEveParamList.h:40
 TEveParamList.h:41
 TEveParamList.h:42
 TEveParamList.h:43
 TEveParamList.h:44
 TEveParamList.h:45
 TEveParamList.h:46
 TEveParamList.h:47
 TEveParamList.h:48
 TEveParamList.h:49
 TEveParamList.h:50
 TEveParamList.h:51
 TEveParamList.h:52
 TEveParamList.h:53
 TEveParamList.h:54
 TEveParamList.h:55
 TEveParamList.h:56
 TEveParamList.h:57
 TEveParamList.h:58
 TEveParamList.h:59
 TEveParamList.h:60
 TEveParamList.h:61
 TEveParamList.h:62
 TEveParamList.h:63
 TEveParamList.h:64
 TEveParamList.h:65
 TEveParamList.h:66
 TEveParamList.h:67
 TEveParamList.h:68
 TEveParamList.h:69
 TEveParamList.h:70
 TEveParamList.h:71
 TEveParamList.h:72
 TEveParamList.h:73
 TEveParamList.h:74
 TEveParamList.h:75
 TEveParamList.h:76
 TEveParamList.h:77
 TEveParamList.h:78
 TEveParamList.h:79
 TEveParamList.h:80
 TEveParamList.h:81
 TEveParamList.h:82
 TEveParamList.h:83
 TEveParamList.h:84
 TEveParamList.h:85
 TEveParamList.h:86
 TEveParamList.h:87
 TEveParamList.h:88
 TEveParamList.h:89
 TEveParamList.h:90
 TEveParamList.h:91
 TEveParamList.h:92
 TEveParamList.h:93
 TEveParamList.h:94
 TEveParamList.h:95
 TEveParamList.h:96
 TEveParamList.h:97
 TEveParamList.h:98
 TEveParamList.h:99
 TEveParamList.h:100
 TEveParamList.h:101
 TEveParamList.h:102
 TEveParamList.h:103
 TEveParamList.h:104
 TEveParamList.h:105
 TEveParamList.h:106
 TEveParamList.h:107
 TEveParamList.h:108
 TEveParamList.h:109
 TEveParamList.h:110
 TEveParamList.h:111
 TEveParamList.h:112
 TEveParamList.h:113
 TEveParamList.h:114
 TEveParamList.h:115
 TEveParamList.h:116
 TEveParamList.h:117
 TEveParamList.h:118
 TEveParamList.h:119
 TEveParamList.h:120
 TEveParamList.h:121
 TEveParamList.h:122
 TEveParamList.h:123
 TEveParamList.h:124
 TEveParamList.h:125
 TEveParamList.h:126
 TEveParamList.h:127
 TEveParamList.h:128
 TEveParamList.h:129
 TEveParamList.h:130
 TEveParamList.h:131
 TEveParamList.h:132
 TEveParamList.h:133
 TEveParamList.h:134
 TEveParamList.h:135
 TEveParamList.h:136
 TEveParamList.h:137
 TEveParamList.h:138
 TEveParamList.h:139
 TEveParamList.h:140
 TEveParamList.h:141
 TEveParamList.h:142
 TEveParamList.h:143
 TEveParamList.h:144
 TEveParamList.h:145
 TEveParamList.h:146
 TEveParamList.h:147
 TEveParamList.h:148
 TEveParamList.h:149
 TEveParamList.h:150
 TEveParamList.h:151