Logo ROOT   6.18/05
Reference Guide
TCurlyLineEditor.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// TCurlyLineEditor //
15// //
16// Implements GUI for editing CurlyLine attributes: shape, size, angle.// //
17// //
18//////////////////////////////////////////////////////////////////////////
19//Begin_Html
20/*
21<img src="gif/TCurlyLineEditor.gif">
22*/
23//End_Html
24
25
26#include "TCurlyLineEditor.h"
27#include "TGedEditor.h"
28#include "TGLabel.h"
29#include "TGNumberEntry.h"
30#include "TGButton.h"
31#include "TCurlyLine.h"
32#include <iostream>
33
35
44};
45
46////////////////////////////////////////////////////////////////////////////////
47/// Constructor of CurlyLine GUI.
48
50 Int_t height, UInt_t options, Pixel_t back)
51 : TGedFrame(p, width, height, options | kVerticalFrame, back)
52{
53 fCurlyLine = 0;
54
55 MakeTitle("Curly Line");
56
57 TGCompositeFrame *f3 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
58 AddFrame(f3, new TGLayoutHints(kLHintsTop, 1, 1, 3, 0));
59
60 TGCompositeFrame *f3a = new TGCompositeFrame(f3, 80, 20);
61 f3->AddFrame(f3a, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
62
63 TGLabel *fAmplitudeLabel = new TGLabel(f3a, "Amplitude:");
64 f3a->AddFrame(fAmplitudeLabel, new TGLayoutHints(kLHintsNormal, 3, 0, 5, 5));
65
66 TGLabel *fWaveLengthLabel = new TGLabel(f3a, "Wavelgth:");
67 f3a->AddFrame(fWaveLengthLabel, new TGLayoutHints(kLHintsNormal, 3, 0, 5, 5));
68
69 TGCompositeFrame *f3b = new TGCompositeFrame(f3, 80, 20);
70 f3->AddFrame(f3b, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
71
72 fAmplitudeEntry = new TGNumberEntry(f3b, 0.005, 7, kCRLL_AMPL,
76 fAmplitudeEntry->GetNumberEntry()->SetToolTipText("Set amplitude in percent of the pad height.");
77 f3b->AddFrame(fAmplitudeEntry, new TGLayoutHints(kLHintsLeft, 4, 1, 1, 1));
78
79 fWaveLengthEntry = new TGNumberEntry(f3b, 0.005, 7, kCRLL_WAVE,
83 fWaveLengthEntry->GetNumberEntry()->SetToolTipText("Set wavelength in percent of the pad height.");
85 f3b->AddFrame(fWaveLengthEntry, new TGLayoutHints(kLHintsLeft, 4, 1, 3, 1));
86
87 fIsWavy = new TGCheckButton(this, "Gluon (Gamma)", kCRLL_ISW);
88 fIsWavy->SetToolTipText("Toggle between wavy line (Gluon) if selected; curly line (Gamma) otherwise.");
89 AddFrame(fIsWavy, new TGLayoutHints(kLHintsLeft, 5, 1, 5, 8));
90
93
95 fStartXFrame->AddFrame(f4a, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
96
97 TGLabel *fStartXLabel = new TGLabel(f4a, "Start X:");
98 f4a->AddFrame(fStartXLabel, new TGLayoutHints(kLHintsNormal, 21, 0, 5, 5));
99
100 TGLabel *fStartYLabel = new TGLabel(f4a, "Y:");
101 f4a->AddFrame(fStartYLabel, new TGLayoutHints(kLHintsNormal, 50, 0, 5, 5));
102
103 TGLabel *fEndXLabel = new TGLabel(f4a, "End X:");
104 f4a->AddFrame(fEndXLabel, new TGLayoutHints(kLHintsNormal, 24, 0, 5, 5));
105
106 TGLabel *fEndYLabel = new TGLabel(f4a, "Y:");
107 f4a->AddFrame(fEndYLabel, new TGLayoutHints(kLHintsNormal, 51, 0, 5, 1));
108
110 fStartXFrame->AddFrame(f4b, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
111
112 fStartXEntry = new TGNumberEntry(f4b, 0.0, 7, kCRLL_STRX,
116 fStartXEntry->GetNumberEntry()->SetToolTipText("Set start point X ccordinate of curly line.");
117 f4b->AddFrame(fStartXEntry, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
118
119 fStartYEntry = new TGNumberEntry(f4b, 0.0, 7, kCRLL_STRY,
123 fStartYEntry->GetNumberEntry()->SetToolTipText("Set start point Y coordinate of curly line.");
124 f4b->AddFrame(fStartYEntry, new TGLayoutHints(kLHintsLeft, 1, 1, 3, 1));
125
126 fEndXEntry = new TGNumberEntry(f4b, 0.0, 7, kCRLL_ENDX,
130 fEndXEntry->GetNumberEntry()->SetToolTipText("Set end point X coordinate of curly line.");
131 f4b->AddFrame(fEndXEntry, new TGLayoutHints(kLHintsLeft, 1, 1, 3, 1));
132
133 fEndYEntry = new TGNumberEntry(f4b, 0.0, 7, kCRLL_ENDY,
137 fEndYEntry->GetNumberEntry()->SetToolTipText("Set end point Y coordinate of curly line.");
138 f4b->AddFrame(fEndYEntry, new TGLayoutHints(kLHintsLeft, 1, 1, 3, 1));
139
140}
141
142////////////////////////////////////////////////////////////////////////////////
143/// Destructor of CurlyLine editor.
144
146{
147}
148
149////////////////////////////////////////////////////////////////////////////////
150/// Connect signals to slots.
151
153{
154 fStartXEntry->Connect("ValueSet(Long_t)", "TCurlyLineEditor", this, "DoStartXY()");
155 (fStartXEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyLineEditor", this, "DoStartXY()");
156 fStartYEntry->Connect("ValueSet(Long_t)", "TCurlyLineEditor", this, "DoStartXY()");
157 (fStartYEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyLineEditor", this, "DoStartXY()");
158 fEndXEntry->Connect("ValueSet(Long_t)", "TCurlyLineEditor", this, "DoEndXY()");
159 (fEndXEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyLineEditor", this, "DoEndXY()");
160 fEndYEntry->Connect("ValueSet(Long_t)", "TCurlyLineEditor", this, "DoEndXY()");
161 (fEndYEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyLineEditor", this, "DoEndXY()");
162 fAmplitudeEntry->Connect("ValueSet(Long_t)", "TCurlyLineEditor", this, "DoAmplitude()");
163 (fAmplitudeEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyLineEditor", this, "DoAmplitude()");
164 fWaveLengthEntry->Connect("ValueSet(Long_t)", "TCurlyLineEditor", this, "DoWaveLength()");
165 (fWaveLengthEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyLineEditor", this, "DoWaveLength()");
166 fIsWavy->Connect("Clicked()", "TCurlyLineEditor", this, "DoWavy()");
167
168 fInit = kFALSE;
169}
170
171////////////////////////////////////////////////////////////////////////////////
172/// Pick up the used curly line attributes.
173
175{
176 if (obj->InheritsFrom("TCurlyArc")) {
178 fStartXEntry->Disconnect("ValueSet(Long_t)");
179 (fStartXEntry->GetNumberEntry())->Disconnect("ReturnPressed()");
180 fStartYEntry->Disconnect("ValueSet(Long_t)");
181 (fStartYEntry->GetNumberEntry())->Disconnect("ReturnPressed()");
182 fEndXEntry->Disconnect("ValueSet(Long_t)");
183 (fEndXEntry->GetNumberEntry())->Disconnect("ReturnPressed()");
184 fEndYEntry->Disconnect("ValueSet(Long_t)");
185 (fEndYEntry->GetNumberEntry())->Disconnect("ReturnPressed()");
186 }
187
188 fCurlyLine = (TCurlyLine *)obj;
190
193
194 val = fCurlyLine->GetWaveLength();
196
197 val = fCurlyLine->GetStartX();
199
200 val = fCurlyLine->GetEndX();
201 fEndXEntry->SetNumber(val);
202
203 val = fCurlyLine->GetStartY();
205
206 val = fCurlyLine->GetEndY();
207 fEndYEntry->SetNumber(val);
208
209 if (fCurlyLine->GetCurly())
211 else
213
216}
217
218////////////////////////////////////////////////////////////////////////////////
219/// Exclude TAttFillEditor.
220
222{
225}
226
227////////////////////////////////////////////////////////////////////////////////
228/// Slot connected to the CurlyLine StartPoint.
229
231{
232 if (fAvoidSignal) return;
235 Update();
236}
237////////////////////////////////////////////////////////////////////////////////
238/// Slot connected to the CurlyLine End.
239
241{
242 if (fAvoidSignal) return;
245 Update();
246}
247
248////////////////////////////////////////////////////////////////////////////////
249/// Slot connected to the amplitude setting.
250
252{
253 if (fAvoidSignal) return;
256 Update();
257}
258
259////////////////////////////////////////////////////////////////////////////////
260/// Slot connected to the wavelength setting.
261
263{
264 if (fAvoidSignal) return;
268 Update();
269}
270
271////////////////////////////////////////////////////////////////////////////////
272/// Slot connected to the wavy / curly setting.
273
275{
276 if (fAvoidSignal) return;
277 if (fIsWavy->GetState() == kButtonDown)
279 else
282 Update();
283}
void Class()
Definition: Class.C:29
ULong_t Pixel_t
Definition: GuiTypes.h:39
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
double Double_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassImp(name)
Definition: Rtypes.h:365
ECurlyLineWid
@ kCRLL_STRY
@ kCRLL_WAVE
@ kCRLL_ENDY
@ kCRLL_ISW
@ kCRLL_AMPL
@ kCRLL_ENDX
@ kCRLL_STRX
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
@ kButtonDown
Definition: TGButton.h:54
@ kButtonUp
Definition: TGButton.h:53
@ kVerticalFrame
Definition: TGFrame.h:59
@ kHorizontalFrame
Definition: TGFrame.h:60
@ kLHintsLeft
Definition: TGLayout.h:31
@ kLHintsNormal
Definition: TGLayout.h:39
@ kLHintsTop
Definition: TGLayout.h:34
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:75
TGCompositeFrame * fStartXFrame
TGNumberEntry * fAmplitudeEntry
virtual void DoWavy()
Slot connected to the wavy / curly setting.
TGNumberEntry * fWaveLengthEntry
TGNumberEntry * fStartXEntry
virtual void DoAmplitude()
Slot connected to the amplitude setting.
virtual void DoWaveLength()
Slot connected to the wavelength setting.
TGNumberEntry * fEndYEntry
virtual void ActivateBaseClassEditors(TClass *cl)
Exclude TAttFillEditor.
virtual void DoStartXY()
Slot connected to the CurlyLine StartPoint.
virtual ~TCurlyLineEditor()
Destructor of CurlyLine editor.
TCurlyLineEditor(const TGWindow *p=0, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor of CurlyLine GUI.
TGCheckButton * fIsWavy
TGNumberEntry * fEndXEntry
virtual void ConnectSignals2Slots()
Connect signals to slots.
TCurlyLine * fCurlyLine
virtual void SetModel(TObject *obj)
Pick up the used curly line attributes.
virtual void DoEndXY()
Slot connected to the CurlyLine End.
TGNumberEntry * fStartYEntry
Implements curly or wavy polylines used to draw Feynman diagrams.
Definition: TCurlyLine.h:21
virtual void SetWaveLength(Double_t WaveLength)
Set wave length.
Definition: TCurlyLine.cxx:378
virtual void SetCurly()
Set curly.
Definition: TCurlyLine.cxx:360
virtual void SetAmplitude(Double_t x)
Set amplitude.
Definition: TCurlyLine.cxx:387
virtual void SetStartPoint(Double_t x1, Double_t y1)
Set start point.
Definition: TCurlyLine.cxx:396
Double_t GetAmplitude() const
Definition: TCurlyLine.h:48
Double_t GetEndY() const
Definition: TCurlyLine.h:52
Double_t GetStartY() const
Definition: TCurlyLine.h:51
virtual void SetEndPoint(Double_t x2, Double_t y2)
Set end point.
Definition: TCurlyLine.cxx:406
Bool_t GetCurly() const
Definition: TCurlyLine.h:46
virtual void SetWavy()
Set wavy.
Definition: TCurlyLine.cxx:369
Double_t GetWaveLength() const
Definition: TCurlyLine.h:47
Double_t GetStartX() const
Definition: TCurlyLine.h:49
Double_t GetEndX() const
Definition: TCurlyLine.h:50
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:395
virtual EButtonState GetState() const
Definition: TGButton.h:112
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1200
TGCompositeFrame(const TGCompositeFrame &)
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition: TGFrame.cxx:1172
virtual void SetNumber(Double_t val)
TGNumberEntryField * GetNumberEntry() const
virtual void Associate(const TGWindow *w)
Make w the window that will receive the generated messages.
virtual Double_t GetNumber() const
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
void ExcludeClassEditor(TClass *cl, Bool_t recurse=kFALSE)
Exclude editor for class cl from current construction.
Definition: TGedEditor.cxx:578
virtual Option_t * GetDrawOption() const
Get draw options of the selected object.
Definition: TGedFrame.cxx:81
virtual void ActivateBaseClassEditors(TClass *cl)
Provide list of editors for base-classes.
Definition: TGedFrame.cxx:168
TGedEditor * fGedEditor
Definition: TGedFrame.h:54
Bool_t fInit
Definition: TGedFrame.h:53
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:56
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:341
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:443
virtual void Paint(Option_t *option="")
Paint this polyline with its current attributes.
Definition: TPolyLine.cxx:531
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:867
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
Definition: TQObject.cxx:1025