Logo ROOT  
Reference Guide
TVirtualPad.cxx
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Rene Brun 05/12/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, 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 #include "TVirtualPad.h"
13 #include "TBuffer.h"
14 #include "TThreadSlots.h"
15 
16 /** \class TVirtualPad
17 \ingroup Base
18 
19 TVirtualPad is an abstract base class for the Pad and Canvas classes.
20 */
21 
22 Int_t (*gThreadXAR)(const char *xact, Int_t nb, void **ar, Int_t *iret) = 0;
23 
24 ////////////////////////////////////////////////////////////////////////////////
25 /// Return the current pad for the current thread.
26 
28 {
29  static TVirtualPad *currentPad = 0;
30  if (!gThreadTsd)
31  return currentPad;
32  else
33  return *(TVirtualPad**)(*gThreadTsd)(&currentPad,ROOT::kPadThreadSlot);
34 }
35 
37 
38 ////////////////////////////////////////////////////////////////////////////////
39 /// VirtualPad default constructor
40 
42 {
43  fResizing = kFALSE;
44 }
45 
46 ////////////////////////////////////////////////////////////////////////////////
47 /// VirtualPad constructor
48 
49 TVirtualPad::TVirtualPad(const char *, const char *, Double_t,
51  : TAttPad()
52 {
53  fResizing = kFALSE;
54 
55  SetFillColor(color);
56  SetFillStyle(1001);
57 }
58 
59 ////////////////////////////////////////////////////////////////////////////////
60 /// VirtualPad destructor
61 
63 {
64 }
65 
66 ////////////////////////////////////////////////////////////////////////////////
67 /// Stream an object of class TVirtualPad.
68 
69 void TVirtualPad::Streamer(TBuffer &R__b)
70 {
71  if (R__b.IsReading()) {
72  UInt_t R__s, R__c;
73  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
74  if (R__v > 1) {
75  R__b.ReadClassBuffer(TVirtualPad::Class(), this, R__v, R__s, R__c);
76  return;
77  }
78  //====process old versions before automatic schema evolution
79  TObject::Streamer(R__b);
80  TAttLine::Streamer(R__b);
81  TAttFill::Streamer(R__b);
82  TAttPad::Streamer(R__b);
83  //====end of old versions
84 
85  } else {
87  }
88 }
89 
90 ////////////////////////////////////////////////////////////////////////////////
91 /// Should always return false unless you have non-standard picking.
92 
94 {
95  return kFALSE;
96 }
97 
98 ////////////////////////////////////////////////////////////////////////////////
99 /// Should always return false, unless you can highlight selected object in pad.
100 
102 {
103  return kFALSE;
104 }
105 
106 ////////////////////////////////////////////////////////////////////////////////
107 /// Does nothing, unless you implement your own picking.
108 /// When complex object containing sub-objects (which can be picked)
109 /// is painted in a pad, this "top-level" object is pushed into
110 /// the selectables stack.
111 
113 {
114 }
115 
116 ////////////////////////////////////////////////////////////////////////////////
117 /// Does nothing, unless you implement your own picking.
118 /// "Complete" object, or part of complex object, which
119 /// can be picked.
120 
122 {
123 }
124 
125 ////////////////////////////////////////////////////////////////////////////////
126 /// Does nothing, unless you implement your own picking.
127 /// Remove top level selectable and all its' children.
128 
130 {
131 }
132 
133 ////////////////////////////////////////////////////////////////////////////////
134 /// Scope-guards ctor, pushe the object on stack.
135 
137 {
138  gPad->PushTopLevelSelectable(obj);
139 }
140 
141 ////////////////////////////////////////////////////////////////////////////////
142 /// Guard does out of scope, pop object from stack.
143 
145 {
146  gPad->PopTopLevelSelectable();
147 }
TAttPad
Manages default Pad attributes.
Definition: TAttPad.h:19
Version_t
short Version_t
Definition: RtypesCore.h:65
TAttFill::SetFillStyle
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition: TAttFill.h:39
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TBuffer::ReadClassBuffer
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
Int_t
int Int_t
Definition: RtypesCore.h:45
TBuffer
Buffer base class used for serializing objects.
Definition: TBuffer.h:43
ROOT::kPadThreadSlot
@ kPadThreadSlot
Definition: TThreadSlots.h:29
Color_t
short Color_t
Definition: RtypesCore.h:83
bool
TThreadSlots.h
TBuffer.h
TVirtualPad::Pad
static TVirtualPad *& Pad()
Return the current pad for the current thread.
Definition: TVirtualPad.cxx:27
TBuffer::WriteClassBuffer
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TVirtualPad.h
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
TPickerStackGuard::TPickerStackGuard
TPickerStackGuard(TObject *obj)
Scope-guards ctor, pushe the object on stack.
Definition: TVirtualPad.cxx:136
Short_t
short Short_t
Definition: RtypesCore.h:39
TBuffer::ReadVersion
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
TVirtualPad::TVirtualPad
TVirtualPad()
VirtualPad default constructor.
Definition: TVirtualPad.cxx:41
TVirtualPad::PadInHighlightMode
virtual Bool_t PadInHighlightMode() const
Should always return false, unless you can highlight selected object in pad.
Definition: TVirtualPad.cxx:101
TPickerStackGuard::~TPickerStackGuard
~TPickerStackGuard()
Guard does out of scope, pop object from stack.
Definition: TVirtualPad.cxx:144
TBuffer::IsReading
Bool_t IsReading() const
Definition: TBuffer.h:86
Double_t
double Double_t
Definition: RtypesCore.h:59
TVirtualPad
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:51
TVirtualPad::PopTopLevelSelectable
virtual void PopTopLevelSelectable()
Does nothing, unless you implement your own picking.
Definition: TVirtualPad.cxx:129
TVirtualPad::~TVirtualPad
virtual ~TVirtualPad()
VirtualPad destructor.
Definition: TVirtualPad.cxx:62
TVirtualPad::PadInSelectionMode
virtual Bool_t PadInSelectionMode() const
Should always return false unless you have non-standard picking.
Definition: TVirtualPad.cxx:93
gThreadXAR
Int_t(* gThreadXAR)(const char *xact, Int_t nb, void **ar, Int_t *iret)=0
Definition: TVirtualPad.cxx:22
TAttFill::SetFillColor
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition: TAttFill.h:37
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
gThreadTsd
R__EXTERN void **(* gThreadTsd)(void *, Int_t)
Definition: TThreadSlots.h:40
gPad
#define gPad
Definition: TVirtualPad.h:287
TVirtualPad::PushTopLevelSelectable
virtual void PushTopLevelSelectable(TObject *top)
Does nothing, unless you implement your own picking.
Definition: TVirtualPad.cxx:112
TVirtualPad::fResizing
Bool_t fResizing
Definition: TVirtualPad.h:54
Class
void Class()
Definition: Class.C:29
TVirtualPad::PushSelectableObject
virtual void PushSelectableObject(TObject *obj)
Does nothing, unless you implement your own picking.
Definition: TVirtualPad.cxx:121