Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
16
17
20};
21
22
23////////////////////////////////////////////////////////////////////////////////
24/// TPieSliceEditor constructor.
25
27 Int_t width, Int_t height,
28 UInt_t options, Pixel_t back)
29 : TGedFrame(p, width, height, options | kVerticalFrame, back)
30{
31 fPieSlice = 0;
32
33 // start initializing the window components
34 MakeTitle("Title");
35
36 fTitle = new TGTextEntry(this, new TGTextBuffer(50), kPieSlice_Title);
38 fTitle->SetToolTipText("Enter the pie-slice label");
39 // better take kLHintsLeft and Right - Right is not working at the moment
40 AddFrame(fTitle, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
41
43 TGLabel *lbl1 = new TGLabel(f1,"Value");
45 //fValue->SetToolTipText("Set the slice absolute value")
46 fValue->Resize(50, 20);
47 f1->AddFrame(lbl1, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
48 f1->AddFrame(fValue, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
49 AddFrame(f1, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
50
51 TGCompositeFrame *f2 = new TGCompositeFrame(this, 120, 20, kHorizontalFrame);
52 TGLabel *lbl2 = new TGLabel(f2,"Rad Offset");
54 //fOffset->SetToolTipText("Set the slice radial offset")
55 fOffset->Resize(50, 20);
56 f2->AddFrame(lbl2, new TGLayoutHints(kLHintsLeft,1, 1, 1, 1));
57 f2->AddFrame(fOffset, new TGLayoutHints(kLHintsLeft, 7, 1, 1, 1));
58 AddFrame(f2, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1));
59}
60
61
62////////////////////////////////////////////////////////////////////////////////
63/// TPieSliceEditor destructor.
64
66{
67}
68
69
70////////////////////////////////////////////////////////////////////////////////
71/// Set model.
72
74{
75 fPieSlice = (TPieSlice*) (obj);
76
81
84}
85
86
87////////////////////////////////////////////////////////////////////////////////
88/// Connect signals to slots.
89
91{
92 fTitle->Connect("TextChanged(const char *)","TPieSliceEditor",this,"DoTitle(const char *)");
93 fValue->Connect("ValueSet(Long_t)", "TPieSliceEditor", this, "DoValue()");
94 fOffset->Connect("ValueSet(Long_t)", "TPieSliceEditor", this, "DoOffset()");
95
96 fInit = kFALSE; // connect the slots to the signals only once
97}
98
99
100////////////////////////////////////////////////////////////////////////////////
101/// Slot for setting the graph title.
102
104{
105 if (fAvoidSignal) return;
107 Update();
108}
109
110
111////////////////////////////////////////////////////////////////////////////////
112/// Slot for setting the graph title.
113
115{
116 if (fAvoidSignal) return;
117
119 Update();
120}
121
122
123////////////////////////////////////////////////////////////////////////////////
124/// Slot for setting the graph title.
125
127{
128 if (fAvoidSignal) return;
129
131 Update();
132}
133
@ kVerticalFrame
Definition GuiTypes.h:381
@ kHorizontalFrame
Definition GuiTypes.h:382
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
const Bool_t kFALSE
Definition RtypesCore.h:92
const Bool_t kTRUE
Definition RtypesCore.h:91
#define ClassImp(name)
Definition Rtypes.h:364
include TDocParser_001 C image html pict1_TDocParser_001 png width
@ kLHintsLeft
Definition TGLayout.h:31
EPieSliceID
@ kPieSlice_Offset
@ kPieSlice_Title
@ kPieSlice_Value
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1102
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:215
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition TGFrame.cxx:590
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:54
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:57
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.
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:866
TText * text
TF1 * f1
Definition legend1.C:11