Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
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 "TGLabel.h"
15#include "TEveGValuators.h"
16
17/** \class TEveArrowEditor
18\ingroup TEve
19GUI editor for TEveArrow.
20*/
21
22
23////////////////////////////////////////////////////////////////////////////////
24
26 UInt_t options, Pixel_t back) :
27 TGedFrame(p, width, height, options | kVerticalFrame, back),
28 fM(nullptr),
29
30 fTubeR(nullptr),
31 fConeR(nullptr),
32 fConeL(nullptr),
33
34 fOrigin(nullptr),
35 fVector(nullptr)
36{
37 // Constructor.
38
39 MakeTitle("TEveArrow");
40 Int_t labelW = 51;
41
42 fTubeR = new TEveGValuator(this, "TubeR:", 90, 0);
43 fTubeR->SetLabelWidth(labelW);
44 fTubeR->SetNELength(6);
45 fTubeR->Build();
46 fTubeR->SetLimits(0.001, 1, 101, TGNumberFormat::kNESRealThree);
47 fTubeR->Connect("ValueSet(Double_t)", "TEveArrowEditor", this, "DoTubeR()");
48 AddFrame(fTubeR, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
49
50 fConeR = new TEveGValuator(this, "ConeR:", 90, 0);
51 fConeR->SetLabelWidth(labelW);
52 fConeR->SetNELength(6);
53 fConeR->Build();
54 fConeR->SetLimits(0.001, 1, 101, TGNumberFormat::kNESRealThree);
55 fConeR->Connect("ValueSet(Double_t)", "TEveArrowEditor", this, "DoConeR()");
56 AddFrame(fConeR, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
57
58 fConeL = new TEveGValuator(this, "ConeL:", 90, 0);
59 fConeL->SetLabelWidth(labelW);
60 fConeL->SetNELength(6);
61 fConeL->Build();
62 fConeL->SetLimits(0.001, 1, 101, TGNumberFormat::kNESRealThree);
63 fConeL->Connect("ValueSet(Double_t)", "TEveArrowEditor", this, "DoConeL()");
64 AddFrame(fConeL, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
65
66 TGFont *font = gClient->GetFont("-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
67 {
68 TGHorizontalFrame* hfp = new TGHorizontalFrame(this);
69 TGLabel* labp = new TGLabel(hfp, "Origin");
70 labp->SetTextFont(font);
71 hfp->AddFrame(labp);
72 AddFrame(hfp, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,2,0));
73 fOrigin = new TEveGTriVecValuator(this, "Origin", 160, 20);
74 fOrigin->SetNELength(6);
75 fOrigin->Build(kFALSE, "", "", "");
76 fOrigin->SetLimits(-1e5, 1e5, TGNumberFormat::kNESRealThree);
78 }
79
80 {
81 TGHorizontalFrame* hfp = new TGHorizontalFrame(this);
82 TGLabel* labp = new TGLabel(hfp, "Vector");
83 labp->SetTextFont(font);
84 hfp->AddFrame(labp);
85 AddFrame(hfp, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,2,0));
86 fVector = new TEveGTriVecValuator(this, "Vector", 160, 20);
87 fVector->SetNELength(6);
88 fVector->Build(kFALSE, "", "", "");
89 fVector->SetLimits(-1e5, 1e5, TGNumberFormat::kNESRealThree);
91 }
92
93 fVector->Connect("ValueSet()", "TEveArrowEditor", this, "DoVertex()");
94 fOrigin->Connect("ValueSet()", "TEveArrowEditor", this, "DoVertex()");
95}
96
97////////////////////////////////////////////////////////////////////////////////
98/// Set model object.
99
101{
102 fM = dynamic_cast<TEveArrow*>(obj);
103
104 fTubeR->SetValue(fM->fTubeR);
105 fTubeR->SetValue(fM->fTubeR);
106 fConeL->SetValue(fM->fConeL);
107
108 fOrigin->SetValues(&fM->fOrigin[0]);
109 fVector->SetValues(&fM->fVector[0]);
110}
111
112////////////////////////////////////////////////////////////////////////////////
113/// Slot for TubeR.
114
116{
117 fM->SetTubeR(fTubeR->GetValue());
118 Update();
119}
120
121////////////////////////////////////////////////////////////////////////////////
122/// Slot for ConeR.
123
125{
126 fM->SetConeR(fConeR->GetValue());
127 Update();
128}
129
130////////////////////////////////////////////////////////////////////////////////
131/// Slot for ConeL.
132
134{
135 fM->SetConeL(fConeL->GetValue());
136 Update();
137}
138
139////////////////////////////////////////////////////////////////////////////////
140/// Slot for origin and vector.
141
143{
144 Double_t v[3];
145 fOrigin->GetValues(v);
146 fM->fOrigin.Set(v);
147 fVector->GetValues(v);
148 fM->fVector.Set(v);
149 fM->StampGeom();
150 Update();
151}
@ kVerticalFrame
Definition GuiTypes.h:382
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:41
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
#define gClient
Definition TGClient.h:157
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
TEveGValuator * fConeR
void DoConeL()
Slot for ConeL.
TEveArrowEditor(const TEveArrowEditor &)
void DoVertex()
Slot for origin and vector.
void DoConeR()
Slot for ConeR.
TEveGTriVecValuator * fOrigin
TEveGValuator * fConeL
TEveGTriVecValuator * fVector
void DoTubeR()
Slot for TubeR.
TEveGValuator * fTubeR
void SetModel(TObject *obj) override
Set model object.
Class used for display of a thick arrow.
Definition TEveArrow.h:25
Composite GUI element for setting three numerical values (label, three number-entries).
Composite GUI element for single value selection (supports label, number-entry and slider).
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
Encapsulate fonts used in the GUI system.
Definition TGFont.h:140
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:387
This class handles GUI labels.
Definition TGLabel.h:24
virtual void SetTextFont(TGFont *font, Bool_t global=kFALSE)
Changes text font specified by pointer to TGFont object.
Definition TGLabel.cxx:323
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
@ kNESRealThree
Fixed fraction real, three digit.
ROOT GUI Window base class.
Definition TGWindow.h:23
TGedFrame(const TGedFrame &)=delete
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition TGedFrame.cxx:94
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition TGedFrame.cxx:71
Mother of all ROOT objects.
Definition TObject.h:42