Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TEveParamList.h
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Author: Dmytro Kovalskyi, 28.2.2008
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TEveParamList
13 #define ROOT_TEveParamList
14 
15 #include "TEveElement.h"
16 #include "TQObject.h"
17 #include <vector>
18 
19 //==============================================================================
20 //==============================================================================
21 // TEveParamList
22 //==============================================================================
23 
24 class TEveParamList : public TEveElement,
25  public TNamed,
26  public TQObject
27 {
28  friend class TEveParamListEditor;
29 
30 public:
31  struct FloatConfig_t
32  {
33  Float_t fValue, fMin, fMax;
34  TString fName;
35  Bool_t fSelector;
36 
37  FloatConfig_t(TString name, Double_t value, Double_t min, Double_t max, Bool_t selector = kFALSE):
38  fValue(value), fMin(min), fMax(max), fName(name), fSelector(selector) {}
39  FloatConfig_t(): fValue(0), fMin(0), fMax(0), fName(""), fSelector(kFALSE) {}
40  };
41  typedef std::vector<FloatConfig_t> FloatConfigVec_t;
42  typedef FloatConfigVec_t::iterator FloatConfigVec_i;
43  typedef FloatConfigVec_t::const_iterator FloatConfigVec_ci;
44 
45  struct IntConfig_t
46  {
47  Int_t fValue, fMin, fMax;
48  TString fName;
49  Bool_t fSelector;
50 
51  IntConfig_t(TString name, Int_t value, Int_t min, Int_t max, Bool_t selector=kFALSE) :
52  fValue(value), fMin(min), fMax(max), fName(name), fSelector(selector) {}
53  IntConfig_t() : fValue(0), fMin(0), fMax(0), fName(""), fSelector(kFALSE) {}
54  };
55  typedef std::vector<IntConfig_t> IntConfigVec_t;
56  typedef IntConfigVec_t::iterator IntConfigVec_i;
57  typedef IntConfigVec_t::const_iterator IntConfigVec_ci;
58 
59  struct BoolConfig_t
60  {
61  Bool_t fValue;
62  TString fName;
63 
64  BoolConfig_t(TString name, Bool_t value): fValue(value), fName(name) {}
65  BoolConfig_t() : fValue(kFALSE), fName("") {}
66  };
67  typedef std::vector<BoolConfig_t> BoolConfigVec_t;
68  typedef BoolConfigVec_t::iterator BoolConfigVec_i;
69  typedef BoolConfigVec_t::const_iterator BoolConfigVec_ci;
70 
71 private:
72  TEveParamList(const TEveParamList&); // Not implemented
73  TEveParamList& operator=(const TEveParamList&); // Not implemented
74 
75 protected:
76  Color_t fColor;
77  FloatConfigVec_t fFloatParameters;
78  IntConfigVec_t fIntParameters;
79  BoolConfigVec_t fBoolParameters;
80 
81 public:
82  TEveParamList(const char* n="TEveParamList", const char* t="", Bool_t doColor=kFALSE);
83  virtual ~TEveParamList() {}
84 
85  void AddParameter(const FloatConfig_t& parameter) { fFloatParameters.push_back(parameter); }
86  void AddParameter(const IntConfig_t& parameter) { fIntParameters.push_back(parameter); }
87  void AddParameter(const BoolConfig_t& parameter) { fBoolParameters.push_back(parameter); }
88 
89  const FloatConfigVec_t& GetFloatParameters() { return fFloatParameters; }
90  const IntConfigVec_t& GetIntParameters() { return fIntParameters; }
91  const BoolConfigVec_t& GetBoolParameters() { return fBoolParameters; }
92 
93  FloatConfig_t GetFloatParameter(const TString& name);
94  IntConfig_t GetIntParameter (const TString& name);
95  Bool_t GetBoolParameter (const TString& name);
96 
97  void ParamChanged(const char* name); // *SIGNAL*
98 
99  ClassDef(TEveParamList, 0); // Eve element to store generic configuration information.
100 };
101 
102 
103 //==============================================================================
104 //==============================================================================
105 // TEveParamListEditor
106 //==============================================================================
107 
108 #include "TGedFrame.h"
109 
110 class TGButton;
111 class TGCheckButton;
112 class TGNumberEntry;
113 class TGColorSelect;
114 
115 class TEveGValuator;
116 class TEveGDoubleValuator;
117 
118 class TEveParamList;
119 
120 class TGNumberEntry;
121 
122 class TEveParamListEditor : public TGedFrame
123 {
124 private:
125  TEveParamListEditor(const TEveParamListEditor&); // Not implemented
126  TEveParamListEditor& operator=(const TEveParamListEditor&); // Not implemented
127 
128 protected:
129  TEveParamList *fM; // Model object.
130  TGVerticalFrame *fParamFrame;
131  std::vector<TGNumberEntry*> fIntParameters;
132  std::vector<TGNumberEntry*> fFloatParameters;
133  std::vector<TGCheckButton*> fBoolParameters;
134 
135  virtual void InitModel(TObject* obj);
136 
137 public:
138  TEveParamListEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30,
139  UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground());
140  virtual ~TEveParamListEditor() {}
141 
142  virtual void SetModel(TObject* obj);
143 
144  // Declare callback/slot methods
145  void DoIntUpdate();
146  void DoFloatUpdate();
147  void DoBoolUpdate();
148 
149  ClassDef(TEveParamListEditor, 0); // GUI editor for TEveParamList.
150 };
151 #endif