ROOT  6.06/09
Reference Guide
TEveArrowEditor.cxx
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Author: Matevz Tadel 2007
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 #include "TEveArrowEditor.h"
13 #include "TEveArrow.h"
14 #include "TVirtualPad.h"
15 #include "TGLabel.h"
16 #include "TEveGValuators.h"
17 
18 /** \class TEveArrowEditor
19 \ingroup TEve
20 GUI editor for TEveArrow.
21 */
22 
24 
25 ////////////////////////////////////////////////////////////////////////////////
26 
28  UInt_t options, Pixel_t back) :
29  TGedFrame(p, width, height, options | kVerticalFrame, back),
30  fM(0),
31 
32  fTubeR(0),
33  fConeR(0),
34  fConeL(0),
35 
36  fOrigin(0),
37  fVector(0)
38 {
39  // Constructor.
40 
41  MakeTitle("TEveArrow");
42  Int_t labelW = 51;
43 
44  fTubeR = new TEveGValuator(this, "TubeR:", 90, 0);
45  fTubeR->SetLabelWidth(labelW);
46  fTubeR->SetNELength(6);
47  fTubeR->Build();
49  fTubeR->Connect("ValueSet(Double_t)", "TEveArrowEditor", this, "DoTubeR()");
50  AddFrame(fTubeR, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
51 
52  fConeR = new TEveGValuator(this, "ConeR:", 90, 0);
53  fConeR->SetLabelWidth(labelW);
54  fConeR->SetNELength(6);
55  fConeR->Build();
57  fConeR->Connect("ValueSet(Double_t)", "TEveArrowEditor", this, "DoConeR()");
58  AddFrame(fConeR, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
59 
60  fConeL = new TEveGValuator(this, "ConeL:", 90, 0);
61  fConeL->SetLabelWidth(labelW);
62  fConeL->SetNELength(6);
63  fConeL->Build();
65  fConeL->Connect("ValueSet(Double_t)", "TEveArrowEditor", this, "DoConeL()");
66  AddFrame(fConeL, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
67 
68  TGFont *font = gClient->GetFont("-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
69  {
70  TGHorizontalFrame* hfp = new TGHorizontalFrame(this);
71  TGLabel* labp = new TGLabel(hfp, "Origin");
72  labp->SetTextFont(font);
73  hfp->AddFrame(labp);
74  AddFrame(hfp, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,2,0));
75  fOrigin = new TEveGTriVecValuator(this, "Origin", 160, 20);
76  fOrigin->SetNELength(6);
77  fOrigin->Build(kFALSE, "", "", "");
79  AddFrame(fOrigin, new TGLayoutHints(kLHintsTop , 0,0,0,0));
80  }
81 
82  {
83  TGHorizontalFrame* hfp = new TGHorizontalFrame(this);
84  TGLabel* labp = new TGLabel(hfp, "Vector");
85  labp->SetTextFont(font);
86  hfp->AddFrame(labp);
87  AddFrame(hfp, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,2,0));
88  fVector = new TEveGTriVecValuator(this, "Vector", 160, 20);
89  fVector->SetNELength(6);
90  fVector->Build(kFALSE, "", "", "");
92  AddFrame(fVector, new TGLayoutHints(kLHintsTop , 0,0,0,0));
93  }
94 
95  fVector->Connect("ValueSet()", "TEveArrowEditor", this, "DoVertex()");
96  fOrigin->Connect("ValueSet()", "TEveArrowEditor", this, "DoVertex()");
97 }
98 
99 ////////////////////////////////////////////////////////////////////////////////
100 /// Set model object.
101 
103 {
104  fM = dynamic_cast<TEveArrow*>(obj);
105 
109 
110  fOrigin->SetValues(&fM->fOrigin[0]);
111  fVector->SetValues(&fM->fVector[0]);
112 }
113 
114 ////////////////////////////////////////////////////////////////////////////////
115 /// Slot for TubeR.
116 
118 {
119  fM->SetTubeR(fTubeR->GetValue());
120  Update();
121 }
122 
123 ////////////////////////////////////////////////////////////////////////////////
124 /// Slot for ConeR.
125 
127 {
128  fM->SetConeR(fConeR->GetValue());
129  Update();
130 }
131 
132 ////////////////////////////////////////////////////////////////////////////////
133 /// Slot for ConeL.
134 
136 {
137  fM->SetConeL(fConeL->GetValue());
138  Update();
139 }
140 
141 ////////////////////////////////////////////////////////////////////////////////
142 /// Slot for origin and vector.
143 
145 {
146  Double_t v[3];
147  fOrigin->GetValues(v);
148  fM->fOrigin.Set(v);
149  fVector->GetValues(v);
150  fM->fVector.Set(v);
151  Update();
152 }
153 
154 
Composite GUI element for setting three numerical values (label, three number-entries).
void SetTubeR(Float_t x)
Definition: TEveArrow.h:53
void SetLimits(Int_t min, Int_t max)
Set limits for all three number-entries, integer values.
void SetNELength(Int_t l)
void Set(const Float_t *v)
Definition: TEveVector.h:52
virtual void SetValue(Float_t v, Bool_t emit=kFALSE)
Set value, optionally emit signal.
virtual void SetModel(TObject *obj)
Set model object.
Float_t fConeL
Definition: TEveArrow.h:38
void DoVertex()
Slot for origin and vector.
TEveGValuator * fTubeR
Class used for display of a thick arrow.
Definition: TEveArrow.h:21
#define gClient
Definition: TGClient.h:174
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void SetTextFont(TGFont *font, Bool_t global=kFALSE)
Changes text font specified by pointer to TGFont object.
Definition: TGLabel.cxx:321
void GetValues(Float_t &v0, Float_t &v1, Float_t &v2) const
TEveGValuator * fConeR
Composite GUI element for single value selection (supports label, number-entry and slider)...
ClassImp(TEveArrowEditor)
Float_t GetValue() const
ULong_t Pixel_t
Definition: GuiTypes.h:41
TEveGTriVecValuator * fOrigin
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition: TGedFrame.cxx:73
void SetValues(Float_t v0, Float_t v1, Float_t v2)
TEveGTriVecValuator * fVector
void SetConeL(Float_t x)
Definition: TEveArrow.h:55
void Build(Bool_t vertical, const char *lab0, const char *lab1, const char *lab2)
Create sub-components (label, number entries).
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:1135
void DoConeL()
Slot for ConeL.
SVector< double, 2 > v
Definition: Dict.h:5
TEveGValuator * fConeL
void SetNELength(Int_t l)
void SetConeR(Float_t x)
Definition: TEveArrow.h:54
unsigned int UInt_t
Definition: RtypesCore.h:42
GUI editor for TEveArrow.
virtual void Build(Bool_t connect=kTRUE)
Create sub-components (label, number entry, slider).
double Double_t
Definition: RtypesCore.h:55
TEveArrow * fM
Definition: TGFont.h:155
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
TEveVector fVector
Definition: TEveArrow.h:41
Mother of all ROOT objects.
Definition: TObject.h:58
Float_t fTubeR
Definition: TEveArrow.h:36
TEveVector fOrigin
Definition: TEveArrow.h:40
void SetLabelWidth(Int_t w)
TEveArrowEditor(const TEveArrowEditor &)
void SetLimits(Int_t min, Int_t max)
Set limits of the represented value for integer values.
TObject * obj
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
void DoConeR()
Slot for ConeR.
void DoTubeR()
Slot for TubeR.