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
23
24////////////////////////////////////////////////////////////////////////////////
25
27 UInt_t options, Pixel_t back) :
28 TGedFrame(p, width, height, options | kVerticalFrame, back),
29 fM(nullptr),
30
31 fTubeR(nullptr),
32 fConeR(nullptr),
33 fConeL(nullptr),
34
35 fOrigin(nullptr),
36 fVector(nullptr)
37{
38 // Constructor.
39
40 MakeTitle("TEveArrow");
41 Int_t labelW = 51;
42
43 fTubeR = new TEveGValuator(this, "TubeR:", 90, 0);
44 fTubeR->SetLabelWidth(labelW);
45 fTubeR->SetNELength(6);
46 fTubeR->Build();
47 fTubeR->SetLimits(0.001, 1, 101, TGNumberFormat::kNESRealThree);
48 fTubeR->Connect("ValueSet(Double_t)", "TEveArrowEditor", this, "DoTubeR()");
49 AddFrame(fTubeR, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
50
51 fConeR = new TEveGValuator(this, "ConeR:", 90, 0);
52 fConeR->SetLabelWidth(labelW);
53 fConeR->SetNELength(6);
54 fConeR->Build();
55 fConeR->SetLimits(0.001, 1, 101, TGNumberFormat::kNESRealThree);
56 fConeR->Connect("ValueSet(Double_t)", "TEveArrowEditor", this, "DoConeR()");
57 AddFrame(fConeR, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
58
59 fConeL = new TEveGValuator(this, "ConeL:", 90, 0);
60 fConeL->SetLabelWidth(labelW);
61 fConeL->SetNELength(6);
62 fConeL->Build();
63 fConeL->SetLimits(0.001, 1, 101, TGNumberFormat::kNESRealThree);
64 fConeL->Connect("ValueSet(Double_t)", "TEveArrowEditor", this, "DoConeL()");
65 AddFrame(fConeL, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
66
67 TGFont *font = gClient->GetFont("-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
68 {
69 TGHorizontalFrame* hfp = new TGHorizontalFrame(this);
70 TGLabel* labp = new TGLabel(hfp, "Origin");
71 labp->SetTextFont(font);
72 hfp->AddFrame(labp);
73 AddFrame(hfp, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,2,0));
74 fOrigin = new TEveGTriVecValuator(this, "Origin", 160, 20);
75 fOrigin->SetNELength(6);
76 fOrigin->Build(kFALSE, "", "", "");
77 fOrigin->SetLimits(-1e5, 1e5, TGNumberFormat::kNESRealThree);
79 }
80
81 {
82 TGHorizontalFrame* hfp = new TGHorizontalFrame(this);
83 TGLabel* labp = new TGLabel(hfp, "Vector");
84 labp->SetTextFont(font);
85 hfp->AddFrame(labp);
86 AddFrame(hfp, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0,0,2,0));
87 fVector = new TEveGTriVecValuator(this, "Vector", 160, 20);
88 fVector->SetNELength(6);
89 fVector->Build(kFALSE, "", "", "");
90 fVector->SetLimits(-1e5, 1e5, TGNumberFormat::kNESRealThree);
92 }
93
94 fVector->Connect("ValueSet()", "TEveArrowEditor", this, "DoVertex()");
95 fOrigin->Connect("ValueSet()", "TEveArrowEditor", this, "DoVertex()");
96}
97
98////////////////////////////////////////////////////////////////////////////////
99/// Set model object.
100
102{
103 fM = dynamic_cast<TEveArrow*>(obj);
104
105 fTubeR->SetValue(fM->fTubeR);
106 fTubeR->SetValue(fM->fTubeR);
107 fConeL->SetValue(fM->fConeL);
108
109 fOrigin->SetValues(&fM->fOrigin[0]);
110 fVector->SetValues(&fM->fVector[0]);
111}
112
113////////////////////////////////////////////////////////////////////////////////
114/// Slot for TubeR.
115
117{
118 fM->SetTubeR(fTubeR->GetValue());
119 Update();
120}
121
122////////////////////////////////////////////////////////////////////////////////
123/// Slot for ConeR.
124
126{
127 fM->SetConeR(fConeR->GetValue());
128 Update();
129}
130
131////////////////////////////////////////////////////////////////////////////////
132/// Slot for ConeL.
133
135{
136 fM->SetConeL(fConeL->GetValue());
137 Update();
138}
139
140////////////////////////////////////////////////////////////////////////////////
141/// Slot for origin and vector.
142
144{
145 Double_t v[3];
146 fOrigin->GetValues(v);
147 fM->fOrigin.Set(v);
148 fVector->GetValues(v);
149 fM->fVector.Set(v);
150 fM->StampGeom();
151 Update();
152}
@ kVerticalFrame
Definition GuiTypes.h:381
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
int Int_t
Definition RtypesCore.h:45
unsigned int UInt_t
Definition RtypesCore.h:46
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
#define ClassImp(name)
Definition Rtypes.h:377
#define gClient
Definition TGClient.h:156
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
GUI editor for TEveArrow.
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:1117
Encapsulate fonts used in the GUI system.
Definition TGFont.h:140
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:385
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:324
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:95
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition TGedFrame.cxx:72
Mother of all ROOT objects.
Definition TObject.h:41