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
35};
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
113{
114}
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
145
146 val = fCurlyArc->GetPhimin();
148
149 val = fCurlyArc->GetPhimax();
151
152 val = fCurlyArc->GetStartX();
154
155 val = fCurlyArc->GetStartY();
157
159
161}
162
163////////////////////////////////////////////////////////////////////////////////
164/// Slot connected to set center .
165
167{
168 if (fAvoidSignal) return;
171 Update();
172}
173
174////////////////////////////////////////////////////////////////////////////////
175/// Slot connected to the radius setting.
176
178{
179 if (fAvoidSignal) return;
182 Update();
183}
184
185////////////////////////////////////////////////////////////////////////////////
186/// Slot connected to the phimin setting.
187
189{
190 if (fAvoidSignal) return;
193 Update();
194}
195
196////////////////////////////////////////////////////////////////////////////////
197/// Slot connected to the phimax setting.
198
200{
201 if (fAvoidSignal) return;
204 Update();
205}
@ kVerticalFrame
Definition GuiTypes.h:381
@ kHorizontalFrame
Definition GuiTypes.h:382
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
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
winID h TVirtualViewer3D TVirtualGLPainter p
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
Double_t GetPhimax() const
Definition TCurlyArc.h:40
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:38
Double_t GetPhimin() const
Definition TCurlyArc.h:39
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
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
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
Get the number entry field.
virtual Double_t GetNumber() const
virtual void SetNumber(Double_t val, Bool_t emit=kTRUE)
@ 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.
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
Base frame for implementing GUI - a service class.
Definition TGedFrame.h:27
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
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
Definition TObject.cxx:423
void Paint(Option_t *option="") override
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:869