Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:42

0001 // @(#)root/eve:$Id$
0002 // Author: Dmytro Kovalskyi, 28.2.2008
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TEveParamList
0013 #define ROOT_TEveParamList
0014 
0015 #include "TEveElement.h"
0016 #include "TQObject.h"
0017 #include <vector>
0018 
0019 //==============================================================================
0020 //==============================================================================
0021 // TEveParamList
0022 //==============================================================================
0023 
0024 class TEveParamList : public TEveElement,
0025                       public TNamed,
0026                       public TQObject
0027 {
0028    friend class TEveParamListEditor;
0029 
0030 public:
0031    struct FloatConfig_t
0032    {
0033       Float_t   fValue, fMin, fMax;
0034       TString   fName;
0035       Bool_t    fSelector;
0036 
0037       FloatConfig_t(TString name, Double_t value, Double_t min, Double_t max, Bool_t selector = kFALSE):
0038          fValue(value), fMin(min), fMax(max), fName(name), fSelector(selector) {}
0039       FloatConfig_t(): fValue(0), fMin(0), fMax(0), fName(""), fSelector(kFALSE) {}
0040    };
0041    typedef std::vector<FloatConfig_t>       FloatConfigVec_t;
0042    typedef FloatConfigVec_t::iterator       FloatConfigVec_i;
0043    typedef FloatConfigVec_t::const_iterator FloatConfigVec_ci;
0044 
0045    struct IntConfig_t
0046    {
0047       Int_t     fValue, fMin, fMax;
0048       TString   fName;
0049       Bool_t    fSelector;
0050 
0051       IntConfig_t(TString name, Int_t value, Int_t min, Int_t max, Bool_t selector=kFALSE) :
0052          fValue(value), fMin(min), fMax(max), fName(name), fSelector(selector) {}
0053       IntConfig_t() : fValue(0), fMin(0), fMax(0), fName(""), fSelector(kFALSE) {}
0054    };
0055    typedef std::vector<IntConfig_t>       IntConfigVec_t;
0056    typedef IntConfigVec_t::iterator       IntConfigVec_i;
0057    typedef IntConfigVec_t::const_iterator IntConfigVec_ci;
0058 
0059    struct BoolConfig_t
0060    {
0061       Bool_t    fValue;
0062       TString   fName;
0063 
0064       BoolConfig_t(TString name, Bool_t value): fValue(value), fName(name) {}
0065       BoolConfig_t() : fValue(kFALSE), fName("") {}
0066    };
0067    typedef std::vector<BoolConfig_t>       BoolConfigVec_t;
0068    typedef BoolConfigVec_t::iterator       BoolConfigVec_i;
0069    typedef BoolConfigVec_t::const_iterator BoolConfigVec_ci;
0070 
0071 private:
0072    TEveParamList(const TEveParamList&);            // Not implemented
0073    TEveParamList& operator=(const TEveParamList&); // Not implemented
0074 
0075 protected:
0076    Color_t              fColor;
0077    FloatConfigVec_t     fFloatParameters;
0078    IntConfigVec_t       fIntParameters;
0079    BoolConfigVec_t      fBoolParameters;
0080 
0081 public:
0082    TEveParamList(const char* n="TEveParamList", const char* t="", Bool_t doColor=kFALSE);
0083    ~TEveParamList() override {}
0084 
0085    void AddParameter(const FloatConfig_t& parameter) { fFloatParameters.push_back(parameter); }
0086    void AddParameter(const IntConfig_t& parameter)   { fIntParameters.push_back(parameter); }
0087    void AddParameter(const BoolConfig_t& parameter)  { fBoolParameters.push_back(parameter); }
0088 
0089    const FloatConfigVec_t&  GetFloatParameters() { return fFloatParameters; }
0090    const IntConfigVec_t&    GetIntParameters()   { return fIntParameters; }
0091    const BoolConfigVec_t&   GetBoolParameters()  { return fBoolParameters; }
0092 
0093    FloatConfig_t    GetFloatParameter(const TString& name);
0094    IntConfig_t      GetIntParameter  (const TString& name);
0095    Bool_t           GetBoolParameter (const TString& name);
0096 
0097    void ParamChanged(const char* name); // *SIGNAL*
0098 
0099    ClassDefOverride(TEveParamList, 0); // Eve element to store generic configuration information.
0100 };
0101 
0102 
0103 //==============================================================================
0104 //==============================================================================
0105 // TEveParamListEditor
0106 //==============================================================================
0107 
0108 #include "TGedFrame.h"
0109 
0110 class TGButton;
0111 class TGCheckButton;
0112 class TGNumberEntry;
0113 class TGColorSelect;
0114 
0115 class TEveGValuator;
0116 class TEveGDoubleValuator;
0117 
0118 class TEveParamList;
0119 
0120 class TGNumberEntry;
0121 
0122 class TEveParamListEditor : public TGedFrame
0123 {
0124 private:
0125    TEveParamListEditor(const TEveParamListEditor&);            // Not implemented
0126    TEveParamListEditor& operator=(const TEveParamListEditor&); // Not implemented
0127 
0128 protected:
0129    TEveParamList                 *fM; // Model object.
0130    TGVerticalFrame               *fParamFrame;
0131    std::vector<TGNumberEntry*>    fIntParameters;
0132    std::vector<TGNumberEntry*>    fFloatParameters;
0133    std::vector<TGCheckButton*>    fBoolParameters;
0134 
0135    virtual void InitModel(TObject* obj);
0136 
0137 public:
0138    TEveParamListEditor(const TGWindow *p = nullptr, Int_t width=170, Int_t height=30,
0139          UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground());
0140    ~TEveParamListEditor() override {}
0141 
0142    void SetModel(TObject* obj) override;
0143 
0144    // Declare callback/slot methods
0145    void DoIntUpdate();
0146    void DoFloatUpdate();
0147    void DoBoolUpdate();
0148 
0149    ClassDefOverride(TEveParamListEditor, 0); // GUI editor for TEveParamList.
0150 };
0151 #endif