Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TCurlyArcEditor.cxx
Go to the documentation of this file.
1// @(#)root/ged:$Id$
2// Author: Ilka Antcheva, Otto Schaile 15/12/04
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, 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
13/** \class TCurlyArcEditor
14 \ingroup ged
15
16Implements GUI for editing CurlyArc attributes: radius, phi1, phi2.
17
18*/
19
20
21#include "TCurlyArcEditor.h"
22#include "TGLabel.h"
23#include "TGNumberEntry.h"
24#include "TCurlyArc.h"
25#include <iostream>
26
28
36
37////////////////////////////////////////////////////////////////////////////////
38/// Constructor of CurlyArc GUI.
39
41 Int_t height, UInt_t options, Pixel_t back)
42 : TGedFrame(p, width, height, options | kVerticalFrame, back)
43{
44 fCurlyArc = 0;
45
46 MakeTitle("Curly Arc");
47
48 TGCompositeFrame *f3 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
49 AddFrame(f3, new TGLayoutHints(kLHintsTop, 1, 1, 2, 0));
50
51 TGCompositeFrame *f3a = new TGCompositeFrame(f3, 80, 20);
52 f3->AddFrame(f3a, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
53
54 TGLabel *fRadiusLabel = new TGLabel(f3a, "Radius:");
55 f3a->AddFrame(fRadiusLabel, new TGLayoutHints(kLHintsNormal, 8, 0, 5, 5));
56
57 TGLabel *fPhiminLabel = new TGLabel(f3a, "Phimin:");
58 f3a->AddFrame(fPhiminLabel, new TGLayoutHints(kLHintsNormal, 8, 0, 5, 5));
59
60 TGLabel *fPhimaxLabel = new TGLabel(f3a, "Phimax:");
61 f3a->AddFrame(fPhimaxLabel, new TGLayoutHints(kLHintsNormal, 8, 0, 5, 5));
62
63 TGLabel *fCenterXLabel = new TGLabel(f3a, "Center X:");
64 f3a->AddFrame(fCenterXLabel, new TGLayoutHints(kLHintsNormal, 8, 0, 6, 5));
65
66 TGLabel *fCenterYLabel = new TGLabel(f3a, "Y:");
67 f3a->AddFrame(fCenterYLabel, new TGLayoutHints(kLHintsNormal, 49, 0, 6, 0));
68
69 TGCompositeFrame *f3b = new TGCompositeFrame(f3, 80, 20);
70 f3->AddFrame(f3b, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
71
72 fRadiusEntry = new TGNumberEntry(f3b, 0.02, 7, kCRLA_RAD,
76 fRadiusEntry->GetNumberEntry()->SetToolTipText("Set radius of arc.");
77 f3b->AddFrame(fRadiusEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
78
79 fPhiminEntry = new TGNumberEntry(f3b, 0, 7, kCRLA_FMIN,
83 fPhiminEntry->GetNumberEntry()->SetToolTipText("Set Phimin in degrees.");
84 f3b->AddFrame(fPhiminEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
85
86 fPhimaxEntry = new TGNumberEntry(f3b, 0, 7, kCRLA_FMAX,
90 fPhimaxEntry->GetNumberEntry()->SetToolTipText("Set Phimax in degrees.");
91 f3b->AddFrame(fPhimaxEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
92
93 fCenterXEntry = new TGNumberEntry(f3b, 0.0, 7, kCRLA_CX,
97 fCenterXEntry->GetNumberEntry()->SetToolTipText("Set center X coordinate.");
98 f3b->AddFrame(fCenterXEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
99
100 fCenterYEntry = new TGNumberEntry(f3b, 0.0, 7, kCRLA_CY,
104 fCenterYEntry->GetNumberEntry()->SetToolTipText("Set center Y coordinate.");
105 f3b->AddFrame(fCenterYEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
106
107}
108
109////////////////////////////////////////////////////////////////////////////////
110/// Destructor of CurlyArc editor.
111
115
116////////////////////////////////////////////////////////////////////////////////
117/// Connect signals to slots.
118
120{
121 fCenterXEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoCenterXY()");
122 (fCenterXEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoCenterXY()");
123 fCenterYEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoCenterXY()");
124 (fCenterYEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoCenterXY()");
125 fRadiusEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoRadius()");
126 (fRadiusEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoRadius()");
127 fPhiminEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoPhimin()");
128 (fPhiminEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoPhimin()");
129 fPhimaxEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoPhimax()");
130 (fPhimaxEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoPhimax()");
131
132 fInit = kFALSE;
133}
134
135////////////////////////////////////////////////////////////////////////////////
136/// Pick up the used curly arc attributes.
137
139{
140 fCurlyArc = (TCurlyArc *)obj;
142
143 Double_t val = fCurlyArc->GetRadius();
144 fRadiusEntry->SetNumber(val);
145
146 val = fCurlyArc->GetPhimin();
147 fPhiminEntry->SetNumber(val);
148
149 val = fCurlyArc->GetPhimax();
150 fPhimaxEntry->SetNumber(val);
151
152 val = fCurlyArc->GetStartX();
153 fCenterXEntry->SetNumber(val);
154
155 val = fCurlyArc->GetStartY();
156 fCenterYEntry->SetNumber(val);
157
159
161}
162
163////////////////////////////////////////////////////////////////////////////////
164/// Slot connected to set center .
165
167{
168 if (fAvoidSignal) return;
169 fCurlyArc->SetCenter((Double_t)fCenterXEntry->GetNumber(), (Double_t)fCenterYEntry->GetNumber());
170 fCurlyArc->Paint(fCurlyArc->GetDrawOption());
171 Update();
172}
173
174////////////////////////////////////////////////////////////////////////////////
175/// Slot connected to the radius setting.
176
178{
179 if (fAvoidSignal) return;
180 fCurlyArc->SetRadius((Double_t)fRadiusEntry->GetNumber());
181 fCurlyArc->Paint(fCurlyArc->GetDrawOption());
182 Update();
183}
184
185////////////////////////////////////////////////////////////////////////////////
186/// Slot connected to the phimin setting.
187
189{
190 if (fAvoidSignal) return;
191 fCurlyArc->SetPhimin((Double_t)fPhiminEntry->GetNumber());
192 fCurlyArc->Paint(fCurlyArc->GetDrawOption());
193 Update();
194}
195
196////////////////////////////////////////////////////////////////////////////////
197/// Slot connected to the phimax setting.
198
200{
201 if (fAvoidSignal) return;
202 fCurlyArc->SetPhimax((Double_t)fPhimaxEntry->GetNumber());
203 fCurlyArc->Paint(fCurlyArc->GetDrawOption());
204 Update();
205}
@ kVerticalFrame
Definition GuiTypes.h:381
@ kHorizontalFrame
Definition GuiTypes.h:382
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
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassImp(name)
Definition Rtypes.h:377
ECurlyArcWid
@ kCRLA_RAD
@ kCRLA_FMAX
@ kCRLA_CY
@ kCRLA_FMIN
@ kCRLA_CX
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsNormal
Definition TGLayout.h:32
@ kLHintsTop
Definition TGLayout.h:27
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
Implements GUI for editing CurlyArc attributes: radius, phi1, phi2.
~TCurlyArcEditor() override
Destructor of CurlyArc editor.
void SetModel(TObject *obj) override
Pick up the used curly arc attributes.
TCurlyArcEditor(const TGWindow *p=nullptr, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor of CurlyArc GUI.
virtual void DoCenterXY()
Slot connected to set center .
virtual void DoPhimin()
Slot connected to the phimin setting.
TGNumberEntry * fCenterYEntry
center y entry
virtual void ConnectSignals2Slots()
Connect signals to slots.
TCurlyArc * fCurlyArc
CurlyArc object.
TGNumberEntry * fRadiusEntry
radius entry
virtual void DoRadius()
Slot connected to the radius setting.
TGNumberEntry * fPhimaxEntry
Phimax entry.
TGNumberEntry * fCenterXEntry
center x entry
TGNumberEntry * fPhiminEntry
Phimin entry.
virtual void DoPhimax()
Slot connected to the phimax setting.
Implements curly or wavy arcs used to draw Feynman diagrams.
Definition TCurlyArc.h:16
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
TGCompositeFrame(const TGCompositeFrame &)=delete
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
TGNumberEntry is a number entry input widget with up/down buttons.
@ kNEANonNegative
Non-negative number.
@ kNESRealThree
Fixed fraction real, three digit.
@ kNESInteger
Style of number entry field.
@ kNELNoLimits
Limit selection of number entry field.
@ kNELLimitMinMax
Both lower and upper limits.
ROOT GUI Window base class.
Definition TGWindow.h:23
TGedFrame(const TGedFrame &)=delete
Bool_t fInit
init flag for setting signals/slots
Definition TGedFrame.h:47
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
Bool_t fAvoidSignal
flag for executing slots
Definition TGedFrame.h:50
Mother of all ROOT objects.
Definition TObject.h:41