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
27
35
36////////////////////////////////////////////////////////////////////////////////
37/// Constructor of CurlyArc GUI.
38
40 Int_t height, UInt_t options, Pixel_t back)
41 : TGedFrame(p, width, height, options | kVerticalFrame, back)
42{
43 fCurlyArc = 0;
44
45 MakeTitle("Curly Arc");
46
47 TGCompositeFrame *f3 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame);
48 AddFrame(f3, new TGLayoutHints(kLHintsTop, 1, 1, 2, 0));
49
50 TGCompositeFrame *f3a = new TGCompositeFrame(f3, 80, 20);
51 f3->AddFrame(f3a, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0));
52
53 TGLabel *fRadiusLabel = new TGLabel(f3a, "Radius:");
54 f3a->AddFrame(fRadiusLabel, new TGLayoutHints(kLHintsNormal, 8, 0, 5, 5));
55
56 TGLabel *fPhiminLabel = new TGLabel(f3a, "Phimin:");
57 f3a->AddFrame(fPhiminLabel, new TGLayoutHints(kLHintsNormal, 8, 0, 5, 5));
58
59 TGLabel *fPhimaxLabel = new TGLabel(f3a, "Phimax:");
60 f3a->AddFrame(fPhimaxLabel, new TGLayoutHints(kLHintsNormal, 8, 0, 5, 5));
61
62 TGLabel *fCenterXLabel = new TGLabel(f3a, "Center X:");
63 f3a->AddFrame(fCenterXLabel, new TGLayoutHints(kLHintsNormal, 8, 0, 6, 5));
64
65 TGLabel *fCenterYLabel = new TGLabel(f3a, "Y:");
66 f3a->AddFrame(fCenterYLabel, new TGLayoutHints(kLHintsNormal, 49, 0, 6, 0));
67
68 TGCompositeFrame *f3b = new TGCompositeFrame(f3, 80, 20);
69 f3->AddFrame(f3b, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
70
71 fRadiusEntry = new TGNumberEntry(f3b, 0.02, 7, kCRLA_RAD,
75 fRadiusEntry->GetNumberEntry()->SetToolTipText("Set radius of arc.");
76 f3b->AddFrame(fRadiusEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
77
78 fPhiminEntry = new TGNumberEntry(f3b, 0, 7, kCRLA_FMIN,
82 fPhiminEntry->GetNumberEntry()->SetToolTipText("Set Phimin in degrees.");
83 f3b->AddFrame(fPhiminEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
84
85 fPhimaxEntry = new TGNumberEntry(f3b, 0, 7, kCRLA_FMAX,
89 fPhimaxEntry->GetNumberEntry()->SetToolTipText("Set Phimax in degrees.");
90 f3b->AddFrame(fPhimaxEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
91
92 fCenterXEntry = new TGNumberEntry(f3b, 0.0, 7, kCRLA_CX,
96 fCenterXEntry->GetNumberEntry()->SetToolTipText("Set center X coordinate.");
97 f3b->AddFrame(fCenterXEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
98
99 fCenterYEntry = new TGNumberEntry(f3b, 0.0, 7, kCRLA_CY,
103 fCenterYEntry->GetNumberEntry()->SetToolTipText("Set center Y coordinate.");
104 f3b->AddFrame(fCenterYEntry, new TGLayoutHints(kLHintsLeft, 6, 1, 3, 1));
105
106}
107
108////////////////////////////////////////////////////////////////////////////////
109/// Destructor of CurlyArc editor.
110
114
115////////////////////////////////////////////////////////////////////////////////
116/// Connect signals to slots.
117
119{
120 fCenterXEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoCenterXY()");
121 (fCenterXEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoCenterXY()");
122 fCenterYEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoCenterXY()");
123 (fCenterYEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoCenterXY()");
124 fRadiusEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoRadius()");
125 (fRadiusEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoRadius()");
126 fPhiminEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoPhimin()");
127 (fPhiminEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoPhimin()");
128 fPhimaxEntry->Connect("ValueSet(Long_t)", "TCurlyArcEditor", this, "DoPhimax()");
129 (fPhimaxEntry->GetNumberEntry())->Connect("ReturnPressed()", "TCurlyArcEditor", this, "DoPhimax()");
130
131 fInit = kFALSE;
132}
133
134////////////////////////////////////////////////////////////////////////////////
135/// Pick up the used curly arc attributes.
136
138{
139 fCurlyArc = (TCurlyArc *)obj;
141
142 Double_t val = fCurlyArc->GetRadius();
143 fRadiusEntry->SetNumber(val);
144
145 val = fCurlyArc->GetPhimin();
146 fPhiminEntry->SetNumber(val);
147
148 val = fCurlyArc->GetPhimax();
149 fPhimaxEntry->SetNumber(val);
150
151 val = fCurlyArc->GetStartX();
152 fCenterXEntry->SetNumber(val);
153
154 val = fCurlyArc->GetStartY();
155 fCenterYEntry->SetNumber(val);
156
158
160}
161
162////////////////////////////////////////////////////////////////////////////////
163/// Slot connected to set center .
164
166{
167 if (fAvoidSignal) return;
168 fCurlyArc->SetCenter((Double_t)fCenterXEntry->GetNumber(), (Double_t)fCenterYEntry->GetNumber());
169 fCurlyArc->Paint(fCurlyArc->GetDrawOption());
170 Update();
171}
172
173////////////////////////////////////////////////////////////////////////////////
174/// Slot connected to the radius setting.
175
177{
178 if (fAvoidSignal) return;
179 fCurlyArc->SetRadius((Double_t)fRadiusEntry->GetNumber());
180 fCurlyArc->Paint(fCurlyArc->GetDrawOption());
181 Update();
182}
183
184////////////////////////////////////////////////////////////////////////////////
185/// Slot connected to the phimin setting.
186
188{
189 if (fAvoidSignal) return;
190 fCurlyArc->SetPhimin((Double_t)fPhiminEntry->GetNumber());
191 fCurlyArc->Paint(fCurlyArc->GetDrawOption());
192 Update();
193}
194
195////////////////////////////////////////////////////////////////////////////////
196/// Slot connected to the phimax setting.
197
199{
200 if (fAvoidSignal) return;
201 fCurlyArc->SetPhimax((Double_t)fPhimaxEntry->GetNumber());
202 fCurlyArc->Paint(fCurlyArc->GetDrawOption());
203 Update();
204}
@ kVerticalFrame
Definition GuiTypes.h:382
@ kHorizontalFrame
Definition GuiTypes.h:383
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:41
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
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
~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.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1109
TGCompositeFrame(const TGCompositeFrame &)=delete
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.
@ 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.
ROOT GUI Window base class.
Definition TGWindow.h:23
TGedFrame(const TGedFrame &)=delete
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:94
virtual void Update()
Update the current pad when an attribute is changed via GUI.
Definition TGedFrame.cxx:71
Bool_t fAvoidSignal
flag for executing slots
Definition TGedFrame.h:50
Mother of all ROOT objects.
Definition TObject.h:42