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