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// //
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
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
150
151 val = fCurlyArc->GetPhimin();
153
154 val = fCurlyArc->GetPhimax();
156
157 val = fCurlyArc->GetStartX();
159
160 val = fCurlyArc->GetStartY();
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}
@ kVerticalFrame
Definition GuiTypes.h:381
@ kHorizontalFrame
Definition GuiTypes.h:382
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
const Bool_t kFALSE
Definition RtypesCore.h:92
double Double_t
Definition RtypesCore.h:59
const Bool_t kTRUE
Definition RtypesCore.h:91
#define ClassImp(name)
Definition Rtypes.h:364
ECurlyArcWid
@ kCRLA_RAD
@ kCRLA_FMAX
@ kCRLA_CY
@ kCRLA_FMIN
@ kCRLA_CX
include TDocParser_001 C image html pict1_TDocParser_001 png width
@ kLHintsLeft
Definition TGLayout.h:31
@ kLHintsNormal
Definition TGLayout.h:39
@ kLHintsTop
Definition TGLayout.h:34
virtual void DoCenterXY()
Slot connected to set center .
virtual void DoPhimin()
Slot connected to the phimin setting.
TGNumberEntry * fCenterYEntry
virtual void ConnectSignals2Slots()
Connect signals to slots.
TCurlyArc * fCurlyArc
TGNumberEntry * fRadiusEntry
virtual void SetModel(TObject *obj)
Pick up the used curly arc attributes.
virtual void DoRadius()
Slot connected to the radius setting.
TGNumberEntry * fPhimaxEntry
TGNumberEntry * fCenterXEntry
virtual ~TCurlyArcEditor()
Destructor of CurlyArc editor.
TGNumberEntry * fPhiminEntry
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.
virtual void DoPhimax()
Slot connected to the phimax setting.
Implements curly or wavy arcs used to draw Feynman diagrams.
Definition TCurlyArc.h:18
Double_t GetPhimax() const
Definition TCurlyArc.h:41
virtual void SetRadius(Double_t radius)
Set Curly Arc radius.
virtual void SetPhimin(Double_t phimin)
Set Curly Arc minimum Phi.
virtual void SetCenter(Double_t x1, Double_t y1)
Set Curly Arc center.
Double_t GetRadius() const
Definition TCurlyArc.h:39
Double_t GetPhimin() const
Definition TCurlyArc.h:40
virtual void SetPhimax(Double_t phimax)
Set Curly Arc maximum Phi.
Double_t GetStartY() const
Definition TCurlyLine.h:49
Double_t GetStartX() const
Definition TCurlyLine.h:47
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1102
virtual void SetNumber(Double_t val)
TGNumberEntryField * GetNumberEntry() const
virtual Double_t GetNumber() const
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
Bool_t fInit
Definition TGedFrame.h:54
virtual void MakeTitle(const char *title)
Create attribute frame title.
Definition TGedFrame.cxx:96
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition TGedFrame.cxx:73
Bool_t fAvoidSignal
Definition TGedFrame.h:57
Mother of all ROOT objects.
Definition TObject.h:37
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
Definition TObject.cxx:343
virtual void Paint(Option_t *option="")
Paint this polyline with its current attributes.
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:866