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