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