Logo ROOT   6.18/05
Reference Guide
TPieSliceEditor.cxx
Go to the documentation of this file.
1#include "TPieSliceEditor.h"
2#include "TPieSlice.h"
3#include "TGTextEntry.h"
4#include "TGNumberEntry.h"
5#include "TGLabel.h"
6
8
9
12};
13
14
15////////////////////////////////////////////////////////////////////////////////
16/// TPieSliceEditor constructor.
17
19 Int_t width, Int_t height,
20 UInt_t options, Pixel_t back)
21 : TGedFrame(p, width, height, options | kVerticalFrame, back)
22{
23 fPieSlice = 0;
24
25 // start initializing the window components
26 MakeTitle("Title");
27
28 fTitle = new TGTextEntry(this, new TGTextBuffer(50), kPieSlice_Title);
30 fTitle->SetToolTipText("Enter the pie-slice label");
31 // better take kLHintsLeft and Right - Right is not working at the moment
32 AddFrame(fTitle, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
33
35 TGLabel *lbl1 = new TGLabel(f1,"Value");
37 //fValue->SetToolTipText("Set the slice absolute value")
38 fValue->Resize(50, 20);
39 f1->AddFrame(lbl1, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
40 f1->AddFrame(fValue, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
41 AddFrame(f1, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
42
43 TGCompositeFrame *f2 = new TGCompositeFrame(this, 120, 20, kHorizontalFrame);
44 TGLabel *lbl2 = new TGLabel(f2,"Rad Offset");
46 //fOffset->SetToolTipText("Set the slice radial offset")
47 fOffset->Resize(50, 20);
48 f2->AddFrame(lbl2, new TGLayoutHints(kLHintsLeft,1, 1, 1, 1));
49 f2->AddFrame(fOffset, new TGLayoutHints(kLHintsLeft, 7, 1, 1, 1));
50 AddFrame(f2, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
51}
52
53
54////////////////////////////////////////////////////////////////////////////////
55/// TPieSliceEditor destructor.
56
58{
59}
60
61
62////////////////////////////////////////////////////////////////////////////////
63/// Set model.
64
66{
67 fPieSlice = (TPieSlice*) (obj);
68
73
76}
77
78
79////////////////////////////////////////////////////////////////////////////////
80/// Connect signals to slots.
81
83{
84 fTitle->Connect("TextChanged(const char *)","TPieSliceEditor",this,"DoTitle(const char *)");
85 fValue->Connect("ValueSet(Long_t)", "TPieSliceEditor", this, "DoValue()");
86 fOffset->Connect("ValueSet(Long_t)", "TPieSliceEditor", this, "DoOffset()");
87
88 fInit = kFALSE; // connect the slots to the signals only once
89}
90
91
92////////////////////////////////////////////////////////////////////////////////
93/// Slot for setting the graph title.
94
96{
97 if (fAvoidSignal) return;
99 Update();
100}
101
102
103////////////////////////////////////////////////////////////////////////////////
104/// Slot for setting the graph title.
105
107{
108 if (fAvoidSignal) return;
109
111 Update();
112}
113
114
115////////////////////////////////////////////////////////////////////////////////
116/// Slot for setting the graph title.
117
119{
120 if (fAvoidSignal) return;
121
123 Update();
124}
125
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
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassImp(name)
Definition: Rtypes.h:365
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
@ kVerticalFrame
Definition: TGFrame.h:59
@ kHorizontalFrame
Definition: TGFrame.h:60
@ kLHintsLeft
Definition: TGLayout.h:31
EPieSliceID
@ kPieSlice_Offset
@ kPieSlice_Title
@ kPieSlice_Value
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 UInt_t GetDefaultHeight() const
Definition: TGFrame.h:238
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
virtual void SetNumber(Double_t val)
virtual Double_t GetNumber() const
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.
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
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
void ConnectSignals2Slots()
Connect signals to slots.
void SetModel(TObject *)
Set model.
void DoTitle(const char *)
Slot for setting the graph title.
TGNumberEntry * fOffset
~TPieSliceEditor()
TPieSliceEditor destructor.
TGNumberEntry * fValue
void DoValue()
Slot for setting the graph title.
TPieSlice * fPieSlice
TGTextEntry * fTitle
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:108
void SetRadiusOffset(Double_t)
Set the radial offset of this slice.
Definition: TPieSlice.cxx:98
Double_t GetRadiusOffset()
return the value of the offset in radial direction for this slice.
Definition: TPieSlice.cxx:75
Double_t GetValue()
Return the value of this slice.
Definition: TPieSlice.cxx:83
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
TText * text
TF1 * f1
Definition: legend1.C:11