Logo ROOT  
Reference Guide
TPieSliceEditor.cxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
3 * All rights reserved. *
4 * *
5 * For the licensing terms see $ROOTSYS/LICENSE. *
6 * For the list of contributors see $ROOTSYS/README/CREDITS. *
7 *************************************************************************/
8
9#include "TPieSliceEditor.h"
10#include "TPieSlice.h"
11#include "TGTextEntry.h"
12#include "TGNumberEntry.h"
13#include "TGLabel.h"
14
15
16/** \class TPieSliceEditor
17\ingroup ged
18
19Editor for changing pie-chart's slice attributes.
20
21*/
22
23
25
26
29};
30
31
32////////////////////////////////////////////////////////////////////////////////
33/// TPieSliceEditor constructor.
34
36 Int_t width, Int_t height,
37 UInt_t options, Pixel_t back)
38 : TGedFrame(p, width, height, options | kVerticalFrame, back)
39{
40 fPieSlice = 0;
41
42 // start initializing the window components
43 MakeTitle("Title");
44
45 fTitle = new TGTextEntry(this, new TGTextBuffer(50), kPieSlice_Title);
47 fTitle->SetToolTipText("Enter the pie-slice label");
48 // better take kLHintsLeft and Right - Right is not working at the moment
49 AddFrame(fTitle, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
50
52 TGLabel *lbl1 = new TGLabel(f1,"Value");
54 //fValue->SetToolTipText("Set the slice absolute value")
55 fValue->Resize(50, 20);
56 f1->AddFrame(lbl1, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
57 f1->AddFrame(fValue, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
58 AddFrame(f1, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
59
60 TGCompositeFrame *f2 = new TGCompositeFrame(this, 120, 20, kHorizontalFrame);
61 TGLabel *lbl2 = new TGLabel(f2,"Rad Offset");
63 //fOffset->SetToolTipText("Set the slice radial offset")
64 fOffset->Resize(50, 20);
65 f2->AddFrame(lbl2, new TGLayoutHints(kLHintsLeft,1, 1, 1, 1));
66 f2->AddFrame(fOffset, new TGLayoutHints(kLHintsLeft, 7, 1, 1, 1));
67 AddFrame(f2, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
68}
69
70
71////////////////////////////////////////////////////////////////////////////////
72/// TPieSliceEditor destructor.
73
75{
76}
77
78
79////////////////////////////////////////////////////////////////////////////////
80/// Set model.
81
83{
84 fPieSlice = (TPieSlice*) (obj);
85
90
93}
94
95
96////////////////////////////////////////////////////////////////////////////////
97/// Connect signals to slots.
98
100{
101 fTitle->Connect("TextChanged(const char *)","TPieSliceEditor",this,"DoTitle(const char *)");
102 fValue->Connect("ValueSet(Long_t)", "TPieSliceEditor", this, "DoValue()");
103 fOffset->Connect("ValueSet(Long_t)", "TPieSliceEditor", this, "DoOffset()");
104
105 fInit = kFALSE; // connect the slots to the signals only once
106}
107
108
109////////////////////////////////////////////////////////////////////////////////
110/// Slot for setting the graph title.
111
113{
114 if (fAvoidSignal) return;
116 Update();
117}
118
119
120////////////////////////////////////////////////////////////////////////////////
121/// Slot for setting the graph title.
122
124{
125 if (fAvoidSignal) return;
126
128 Update();
129}
130
131
132////////////////////////////////////////////////////////////////////////////////
133/// Slot for setting the graph title.
134
136{
137 if (fAvoidSignal) return;
138
140 Update();
141}
142
@ 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
const Bool_t kTRUE
Definition: RtypesCore.h:100
#define ClassImp(name)
Definition: Rtypes.h:364
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
@ kLHintsLeft
Definition: TGLayout.h:24
EPieSliceID
@ kPieSlice_Offset
@ kPieSlice_Title
@ kPieSlice_Value
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 UInt_t GetDefaultHeight() const
Definition: TGFrame.h:191
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:605
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.
virtual Double_t GetNumber() const
virtual void SetNumber(Double_t val, Bool_t emit=kTRUE)
@ kNEANonNegative
Non-negative number.
Definition: TGNumberEntry.h:42
@ kNESReal
Real number.
Definition: TGNumberEntry.h:30
@ kNESRealTwo
Fixed fraction real, two digit.
Definition: TGNumberEntry.h:27
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
Definition: TGTextBuffer.h:19
A TGTextEntry is a one line text input widget.
Definition: TGTextEntry.h:24
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
virtual void SetText(const char *text, Bool_t emit=kTRUE)
Sets text entry to text, clears the selection and moves the cursor to the end of the line.
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
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
Mother of all ROOT objects.
Definition: TObject.h:37
Editor for changing pie-chart's slice attributes.
void ConnectSignals2Slots()
Connect signals to slots.
void SetModel(TObject *)
Set model.
void DoTitle(const char *)
Slot for setting the graph title.
TGNumberEntry * fOffset
Grafical offset in the radial direction.
~TPieSliceEditor()
TPieSliceEditor destructor.
TGNumberEntry * fValue
Value of the slice.
void DoValue()
Slot for setting the graph title.
TPieSlice * fPieSlice
TGTextEntry * fTitle
Slice label.
void DoOffset()
Slot for setting the graph title.
TPieSliceEditor(const TGWindow *p=0, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
TPieSliceEditor constructor.
A slice of a piechart, see the TPie class.
Definition: TPieSlice.h:18
void SetValue(Double_t)
Set the value for this slice.
Definition: TPieSlice.cxx:101
void SetRadiusOffset(Double_t)
Set the radial offset of this slice.
Definition: TPieSlice.cxx:91
Double_t GetRadiusOffset()
return the value of the offset in radial direction for this slice.
Definition: TPieSlice.cxx:68
Double_t GetValue()
Return the value of this slice.
Definition: TPieSlice.cxx:76
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
TText * text
TF1 * f1
Definition: legend1.C:11