ROOT  6.06/09
Reference Guide
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 // //
14 // TCurlyArcEditor //
15 // //
16 // Implements GUI for editing CurlyArc attributes: radius, phi1, phi2. // //
17 // //
18 //////////////////////////////////////////////////////////////////////////
19 //Begin_Html
20 /*
21 <img src="gif/TCurlyArcEditor.gif">
22 */
23 //End_Html
24 
25 
26 #include "TCurlyArcEditor.h"
27 #include "TGLabel.h"
28 #include "TGNumberEntry.h"
29 #include "TCurlyArc.h"
30 #include <iostream>
31 
33 
34 enum ECurlyArcWid {
35  kCRLA_RAD,
36  kCRLA_FMIN,
37  kCRLA_FMAX,
38  kCRLA_CX,
39  kCRLA_CY
40 };
41 
42 ////////////////////////////////////////////////////////////////////////////////
43 /// Constructor of CurlyArc GUI.
44 
46  Int_t height, UInt_t options, Pixel_t back)
47  : TGedFrame(p, width, height, options | kVerticalFrame, back)
48 {
49  fCurlyArc = 0;
50 
51  MakeTitle("Curly Arc");
52 
53  TGCompositeFrame *f3 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
54  AddFrame(f3, new TGLayoutHints(kLHintsTop, 1, 1, 2, 0));
55 
56  TGCompositeFrame *f3a = new TGCompositeFrame(f3, 80, 20);
57  f3->AddFrame(f3a, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
58 
59  TGLabel *fRadiusLabel = new TGLabel(f3a, "Radius:");
60  f3a->AddFrame(fRadiusLabel, new TGLayoutHints(kLHintsNormal, 8, 0, 5, 5));
61 
62  TGLabel *fPhiminLabel = new TGLabel(f3a, "Phimin:");
63  f3a->AddFrame(fPhiminLabel, new TGLayoutHints(kLHintsNormal, 8, 0, 5, 5));
64 
65  TGLabel *fPhimaxLabel = new TGLabel(f3a, "Phimax:");
66  f3a->AddFrame(fPhimaxLabel, new TGLayoutHints(kLHintsNormal, 8, 0, 5, 5));
67 
68  TGLabel *fCenterXLabel = new TGLabel(f3a, "Center X:");
69  f3a->AddFrame(fCenterXLabel, new TGLayoutHints(kLHintsNormal, 8, 0, 6, 5));
70 
71  TGLabel *fCenterYLabel = new TGLabel(f3a, "Y:");
72  f3a->AddFrame(fCenterYLabel, new TGLayoutHints(kLHintsNormal, 49, 0, 6, 0));
73 
74  TGCompositeFrame *f3b = new TGCompositeFrame(f3, 80, 20);
75  f3->AddFrame(f3b, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
76 
77  fRadiusEntry = new TGNumberEntry(f3b, 0.02, 7, kCRLA_RAD,
81  fRadiusEntry->GetNumberEntry()->SetToolTipText("Set radius of arc.");
82  f3b->AddFrame(fRadiusEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
83 
84  fPhiminEntry = new TGNumberEntry(f3b, 0, 7, kCRLA_FMIN,
88  fPhiminEntry->GetNumberEntry()->SetToolTipText("Set Phimin in degrees.");
89  f3b->AddFrame(fPhiminEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
90 
91  fPhimaxEntry = new TGNumberEntry(f3b, 0, 7, kCRLA_FMAX,
95  fPhimaxEntry->GetNumberEntry()->SetToolTipText("Set Phimax in degrees.");
96  f3b->AddFrame(fPhimaxEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
97 
98  fCenterXEntry = new TGNumberEntry(f3b, 0.0, 7, kCRLA_CX,
102  fCenterXEntry->GetNumberEntry()->SetToolTipText("Set center X coordinate.");
103  f3b->AddFrame(fCenterXEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
104 
105  fCenterYEntry = new TGNumberEntry(f3b, 0.0, 7, kCRLA_CY,
109  fCenterYEntry->GetNumberEntry()->SetToolTipText("Set center Y coordinate.");
110  f3b->AddFrame(fCenterYEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
111 
112 }
113 
114 ////////////////////////////////////////////////////////////////////////////////
115 /// Destructor of CurlyArc editor.
116 
118 {
119 }
120 
121 ////////////////////////////////////////////////////////////////////////////////
122 /// Connect signals to slots.
123 
125 {
126  fCenterXEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoCenterXY()");
127  (fCenterXEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoCenterXY()");
128  fCenterYEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoCenterXY()");
129  (fCenterYEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoCenterXY()");
130  fRadiusEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoRadius()");
131  (fRadiusEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoRadius()");
132  fPhiminEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoPhimin()");
133  (fPhiminEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoPhimin()");
134  fPhimaxEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoPhimax()");
135  (fPhimaxEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoPhimax()");
136 
137  fInit = kFALSE;
138 }
139 
140 ////////////////////////////////////////////////////////////////////////////////
141 /// Pick up the used curly arc attributes.
142 
144 {
145  fCurlyArc = (TCurlyArc *)obj;
147 
148  Double_t val = fCurlyArc->GetRadius();
149  fRadiusEntry->SetNumber(val);
150 
151  val = fCurlyArc->GetPhimin();
152  fPhiminEntry->SetNumber(val);
153 
154  val = fCurlyArc->GetPhimax();
155  fPhimaxEntry->SetNumber(val);
156 
157  val = fCurlyArc->GetStartX();
158  fCenterXEntry->SetNumber(val);
159 
160  val = fCurlyArc->GetStartY();
161  fCenterYEntry->SetNumber(val);
162 
164 
166 }
167 
168 ////////////////////////////////////////////////////////////////////////////////
169 /// Slot connected to set center .
170 
172 {
173  if (fAvoidSignal) return;
176  Update();
177 }
178 
179 ////////////////////////////////////////////////////////////////////////////////
180 /// Slot connected to the radius setting.
181 
183 {
184  if (fAvoidSignal) return;
187  Update();
188 }
189 
190 ////////////////////////////////////////////////////////////////////////////////
191 /// Slot connected to the phimin setting.
192 
194 {
195  if (fAvoidSignal) return;
198  Update();
199 }
200 
201 ////////////////////////////////////////////////////////////////////////////////
202 /// Slot connected to the phimax setting.
203 
205 {
206  if (fAvoidSignal) return;
209  Update();
210 }
virtual void SetPhimax(Double_t phimax)
Set Curly Arc maximum Phi.
Definition: TCurlyArc.cxx:461
virtual void SetCenter(Double_t x1, Double_t y1)
Set Curly Arc center.
Definition: TCurlyArc.cxx:433
Double_t GetPhimin() const
Definition: TCurlyArc.h:47
TGNumberEntry * fPhimaxEntry
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
ClassImp(TCurlyArcEditor) enum ECurlyArcWid
virtual void SetNumber(Double_t val)
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: Rtypes.h:92
TGNumberEntry * fRadiusEntry
TGNumberEntry * fCenterYEntry
Bool_t fAvoidSignal
Definition: TGedFrame.h:58
TGNumberEntryField * GetNumberEntry() const
virtual void DoPhimin()
Slot connected to the phimin setting.
virtual void SetModel(TObject *obj)
Pick up the used curly arc attributes.
ULong_t Pixel_t
Definition: GuiTypes.h:41
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
Definition: TObject.cxx:399
TGNumberEntry * fPhiminEntry
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition: TGedFrame.cxx:73
TGCompositeFrame(const TGCompositeFrame &)
virtual ~TCurlyArcEditor()
Destructor of CurlyArc editor.
virtual void DoPhimax()
Slot connected to the phimax setting.
Double_t GetPhimax() const
Definition: TCurlyArc.h:48
virtual void SetRadius(Double_t radius)
Set Curly Arc radius.
Definition: TCurlyArc.cxx:443
virtual void DoRadius()
Slot connected to the radius setting.
virtual void ConnectSignals2Slots()
Connect signals to slots.
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
virtual void SetPhimin(Double_t phimin)
Set Curly Arc minimum Phi.
Definition: TCurlyArc.cxx:452
unsigned int UInt_t
Definition: RtypesCore.h:42
Double_t GetRadius() const
Definition: TCurlyArc.h:46
Double_t GetStartX() const
Definition: TCurlyLine.h:60
double Double_t
Definition: RtypesCore.h:55
TCurlyArcEditor(const TGWindow *p=0, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor of CurlyArc GUI.
TGNumberEntry * fCenterXEntry
TCurlyArc * fCurlyArc
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
Mother of all ROOT objects.
Definition: TObject.h:58
Bool_t fInit
Definition: TGedFrame.h:55
Double_t GetStartY() const
Definition: TCurlyLine.h:62
virtual void Paint(Option_t *option="")
Paint this polyline with its current attributes.
Definition: TPolyLine.cxx:531
virtual Double_t GetNumber() const
const Bool_t kTRUE
Definition: Rtypes.h:91
TObject * obj
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition: TGedFrame.cxx:96
Implements curly or wavy arcs used to draw Feynman diagrams.
Definition: TCurlyArc.h:25
virtual void DoCenterXY()
Slot connected to set center .