Logo ROOT  
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/** \class TCurlyLineEditor
14 \ingroup ged
15
16Implements GUI for editing CurlyLine attributes: shape, size, angle.
17
18*/
19
20
21#include "TCurlyLineEditor.h"
22#include "TGedEditor.h"
23#include "TGLabel.h"
24#include "TGNumberEntry.h"
25#include "TGButton.h"
26#include "TCurlyLine.h"
27#include <iostream>
28
30
39};
40
41////////////////////////////////////////////////////////////////////////////////
42/// Constructor of CurlyLine GUI.
43
45 Int_t height, UInt_t options, Pixel_t back)
46 : TGedFrame(p, width, height, options | kVerticalFrame, back)
47{
48 fCurlyLine = 0;
49
50 MakeTitle("Curly Line");
51
52 TGCompositeFrame *f3 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
53 AddFrame(f3, new TGLayoutHints(kLHintsTop, 1, 1, 3, 0));
54
55 TGCompositeFrame *f3a = new TGCompositeFrame(f3, 80, 20);
56 f3->AddFrame(f3a, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
57
58 TGLabel *fAmplitudeLabel = new TGLabel(f3a, "Amplitude:");
59 f3a->AddFrame(fAmplitudeLabel, new TGLayoutHints(kLHintsNormal, 3, 0, 5, 5));
60
61 TGLabel *fWaveLengthLabel = new TGLabel(f3a, "Wavelgth:");
62 f3a->AddFrame(fWaveLengthLabel, new TGLayoutHints(kLHintsNormal, 3, 0, 5, 5));
63
64 TGCompositeFrame *f3b = new TGCompositeFrame(f3, 80, 20);
65 f3->AddFrame(f3b, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
66
67 fAmplitudeEntry = new TGNumberEntry(f3b, 0.005, 7, kCRLL_AMPL,
71 fAmplitudeEntry->GetNumberEntry()->SetToolTipText("Set amplitude in percent of the pad height.");
72 f3b->AddFrame(fAmplitudeEntry, new TGLayoutHints(kLHintsLeft, 4, 1, 1, 1));
73
74 fWaveLengthEntry = new TGNumberEntry(f3b, 0.005, 7, kCRLL_WAVE,
78 fWaveLengthEntry->GetNumberEntry()->SetToolTipText("Set wavelength in percent of the pad height.");
80 f3b->AddFrame(fWaveLengthEntry, new TGLayoutHints(kLHintsLeft, 4, 1, 3, 1));
81
82 fIsWavy = new TGCheckButton(this, "Gluon (Gamma)", kCRLL_ISW);
83 fIsWavy->SetToolTipText("Toggle between wavy line (Gluon) if selected; curly line (Gamma) otherwise.");
84 AddFrame(fIsWavy, new TGLayoutHints(kLHintsLeft, 5, 1, 5, 8));
85
88
90 fStartXFrame->AddFrame(f4a, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
91
92 TGLabel *fStartXLabel = new TGLabel(f4a, "Start X:");
93 f4a->AddFrame(fStartXLabel, new TGLayoutHints(kLHintsNormal, 21, 0, 5, 5));
94
95 TGLabel *fStartYLabel = new TGLabel(f4a, "Y:");
96 f4a->AddFrame(fStartYLabel, new TGLayoutHints(kLHintsNormal, 50, 0, 5, 5));
97
98 TGLabel *fEndXLabel = new TGLabel(f4a, "End X:");
99 f4a->AddFrame(fEndXLabel, new TGLayoutHints(kLHintsNormal, 24, 0, 5, 5));
100
101 TGLabel *fEndYLabel = new TGLabel(f4a, "Y:");
102 f4a->AddFrame(fEndYLabel, new TGLayoutHints(kLHintsNormal, 51, 0, 5, 1));
103
105 fStartXFrame->AddFrame(f4b, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
106
107 fStartXEntry = new TGNumberEntry(f4b, 0.0, 7, kCRLL_STRX,
111 fStartXEntry->GetNumberEntry()->SetToolTipText("Set start point X ccordinate of curly line.");
112 f4b->AddFrame(fStartXEntry, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
113
114 fStartYEntry = new TGNumberEntry(f4b, 0.0, 7, kCRLL_STRY,
118 fStartYEntry->GetNumberEntry()->SetToolTipText("Set start point Y coordinate of curly line.");
119 f4b->AddFrame(fStartYEntry, new TGLayoutHints(kLHintsLeft, 1, 1, 3, 1));
120
121 fEndXEntry = new TGNumberEntry(f4b, 0.0, 7, kCRLL_ENDX,
125 fEndXEntry->GetNumberEntry()->SetToolTipText("Set end point X coordinate of curly line.");
126 f4b->AddFrame(fEndXEntry, new TGLayoutHints(kLHintsLeft, 1, 1, 3, 1));
127
128 fEndYEntry = new TGNumberEntry(f4b, 0.0, 7, kCRLL_ENDY,
132 fEndYEntry->GetNumberEntry()->SetToolTipText("Set end point Y coordinate of curly line.");
133 f4b->AddFrame(fEndYEntry, new TGLayoutHints(kLHintsLeft, 1, 1, 3, 1));
134
135}
136
137////////////////////////////////////////////////////////////////////////////////
138/// Destructor of CurlyLine editor.
139
141{
142}
143
144////////////////////////////////////////////////////////////////////////////////
145/// Connect signals to slots.
146
148{
149 fStartXEntry->Connect("ValueSet(Long_t)", "TCurlyLineEditor", this, "DoStartXY()");
150 (fStartXEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyLineEditor", this, "DoStartXY()");
151 fStartYEntry->Connect("ValueSet(Long_t)", "TCurlyLineEditor", this, "DoStartXY()");
152 (fStartYEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyLineEditor", this, "DoStartXY()");
153 fEndXEntry->Connect("ValueSet(Long_t)", "TCurlyLineEditor", this, "DoEndXY()");
154 (fEndXEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyLineEditor", this, "DoEndXY()");
155 fEndYEntry->Connect("ValueSet(Long_t)", "TCurlyLineEditor", this, "DoEndXY()");
156 (fEndYEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyLineEditor", this, "DoEndXY()");
157 fAmplitudeEntry->Connect("ValueSet(Long_t)", "TCurlyLineEditor", this, "DoAmplitude()");
158 (fAmplitudeEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyLineEditor", this, "DoAmplitude()");
159 fWaveLengthEntry->Connect("ValueSet(Long_t)", "TCurlyLineEditor", this, "DoWaveLength()");
160 (fWaveLengthEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyLineEditor", this, "DoWaveLength()");
161 fIsWavy->Connect("Clicked()", "TCurlyLineEditor", this, "DoWavy()");
162
163 fInit = kFALSE;
164}
165
166////////////////////////////////////////////////////////////////////////////////
167/// Pick up the used curly line attributes.
168
170{
171 if (obj->InheritsFrom("TCurlyArc")) {
173 fStartXEntry->Disconnect("ValueSet(Long_t)");
174 (fStartXEntry->GetNumberEntry())->Disconnect("ReturnPressed()");
175 fStartYEntry->Disconnect("ValueSet(Long_t)");
176 (fStartYEntry->GetNumberEntry())->Disconnect("ReturnPressed()");
177 fEndXEntry->Disconnect("ValueSet(Long_t)");
178 (fEndXEntry->GetNumberEntry())->Disconnect("ReturnPressed()");
179 fEndYEntry->Disconnect("ValueSet(Long_t)");
180 (fEndYEntry->GetNumberEntry())->Disconnect("ReturnPressed()");
181 }
182
183 fCurlyLine = (TCurlyLine *)obj;
185
188
189 val = fCurlyLine->GetWaveLength();
191
192 val = fCurlyLine->GetStartX();
194
195 val = fCurlyLine->GetEndX();
196 fEndXEntry->SetNumber(val);
197
198 val = fCurlyLine->GetStartY();
200
201 val = fCurlyLine->GetEndY();
202 fEndYEntry->SetNumber(val);
203
204 if (fCurlyLine->GetCurly())
206 else
208
211}
212
213////////////////////////////////////////////////////////////////////////////////
214/// Exclude TAttFillEditor.
215
217{
220}
221
222////////////////////////////////////////////////////////////////////////////////
223/// Slot connected to the CurlyLine StartPoint.
224
226{
227 if (fAvoidSignal) return;
230 Update();
231}
232////////////////////////////////////////////////////////////////////////////////
233/// Slot connected to the CurlyLine End.
234
236{
237 if (fAvoidSignal) return;
240 Update();
241}
242
243////////////////////////////////////////////////////////////////////////////////
244/// Slot connected to the amplitude setting.
245
247{
248 if (fAvoidSignal) return;
251 Update();
252}
253
254////////////////////////////////////////////////////////////////////////////////
255/// Slot connected to the wavelength setting.
256
258{
259 if (fAvoidSignal) return;
263 Update();
264}
265
266////////////////////////////////////////////////////////////////////////////////
267/// Slot connected to the wavy / curly setting.
268
270{
271 if (fAvoidSignal) return;
272 if (fIsWavy->GetState() == kButtonDown)
274 else
277 Update();
278}
void Class()
Definition: Class.C:29
@ 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
const Bool_t kFALSE
Definition: RtypesCore.h:101
double Double_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:100
#define ClassImp(name)
Definition: Rtypes.h:364
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
@ kLHintsLeft
Definition: TGLayout.h:24
@ kLHintsNormal
Definition: TGLayout.h:32
@ kLHintsTop
Definition: TGLayout.h:27
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
Implements GUI for editing CurlyLine attributes: shape, size, angle.
TGCompositeFrame * fStartXFrame
TGNumberEntry * fAmplitudeEntry
ampl entry
virtual void DoWavy()
Slot connected to the wavy / curly setting.
TGNumberEntry * fWaveLengthEntry
wavelength entry
TGNumberEntry * fStartXEntry
start x entry
virtual void DoAmplitude()
Slot connected to the amplitude setting.
virtual void DoWaveLength()
Slot connected to the wavelength setting.
TGNumberEntry * fEndYEntry
end y entry
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
toggle wavy / curly
TGNumberEntry * fEndXEntry
end x entry
virtual void ConnectSignals2Slots()
Connect signals to slots.
TCurlyLine * fCurlyLine
CurlyLineobject.
virtual void SetModel(TObject *obj)
Pick up the used curly line attributes.
virtual void DoEndXY()
Slot connected to the CurlyLine End.
TGNumberEntry * fStartYEntry
start y entry
Implements curly or wavy polylines used to draw Feynman diagrams.
Definition: TCurlyLine.h:19
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:46
Double_t GetEndY() const
Definition: TCurlyLine.h:50
Double_t GetStartY() const
Definition: TCurlyLine.h:49
virtual void SetEndPoint(Double_t x2, Double_t y2)
Set end point.
Definition: TCurlyLine.cxx:406
Bool_t GetCurly() const
Definition: TCurlyLine.h:44
virtual void SetWavy()
Set wavy.
Definition: TCurlyLine.cxx:369
Double_t GetWaveLength() const
Definition: TCurlyLine.h:45
Double_t GetStartX() const
Definition: TCurlyLine.h:47
Double_t GetEndX() const
Definition: TCurlyLine.h:48
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:445
virtual EButtonState GetState() const
Definition: TGButton.h:112
Selects different options.
Definition: TGButton.h:264
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1250
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1117
TGCompositeFrame(const TGCompositeFrame &)=delete
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition: TGFrame.cxx:1190
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.
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 SetNumber(Double_t val, Bool_t emit=kTRUE)
@ kNEANonNegative
Non-negative number.
Definition: TGNumberEntry.h:42
@ kNESRealThree
Fixed fraction real, three digit.
Definition: TGNumberEntry.h:28
@ kNELNoLimits
Limit selection of number entry field.
Definition: TGNumberEntry.h:47
@ kNELLimitMinMax
Both lower and upper limits.
Definition: TGNumberEntry.h:50
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
ROOT GUI Window base class.
Definition: TGWindow.h:23
void ExcludeClassEditor(TClass *cl, Bool_t recurse=kFALSE)
Exclude editor for class cl from current construction.
Definition: TGedEditor.cxx:574
Base frame for implementing GUI - a service class.
Definition: TGedFrame.h:27
virtual Option_t * GetDrawOption() const
Get draw options of the selected object.
Definition: TGedFrame.cxx:80
virtual void ActivateBaseClassEditors(TClass *cl)
Provide list of editors for base-classes.
Definition: TGedFrame.cxx:167
TGedEditor * fGedEditor
manager of this frame
Definition: TGedFrame.h:48
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:37
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
Definition: TObject.cxx:343
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:445
virtual void Paint(Option_t *option="")
Paint this polyline with its current attributes.
Definition: TPolyLine.cxx:527
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:869
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:1027