Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
28 TVirtualPad *&TVirtualPad::Pad()
29 {
30  static TVirtualPad *currentPad = 0;
31  if (!gThreadTsd)
32  return currentPad;
33  else
34  return *(TVirtualPad**)(*gThreadTsd)(&currentPad,ROOT::kPadThreadSlot);
35 }
36 
37 ClassImp(TVirtualPad);
38 
39 ////////////////////////////////////////////////////////////////////////////////
40 /// VirtualPad default constructor
41 
42 TVirtualPad::TVirtualPad() : TAttPad()
43 {
44  fResizing = kFALSE;
45 }
46 
47 ////////////////////////////////////////////////////////////////////////////////
48 /// VirtualPad constructor
49 
50 TVirtualPad::TVirtualPad(const char *, const char *, Double_t,
51  Double_t, Double_t, Double_t, Color_t color, Short_t , Short_t)
52  : TAttPad()
53 {
54  fResizing = kFALSE;
55 
56  SetFillColor(color);
57  SetFillStyle(1001);
58 }
59 
60 ////////////////////////////////////////////////////////////////////////////////
61 /// VirtualPad destructor
62 
63 TVirtualPad::~TVirtualPad()
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 {
87  R__b.WriteClassBuffer(TVirtualPad::Class(),this);
88  }
89 }
90 
91 ////////////////////////////////////////////////////////////////////////////////
92 /// Should always return false unless you have non-standard picking.
93 
94 Bool_t TVirtualPad::PadInSelectionMode() const
95 {
96  return kFALSE;
97 }
98 
99 ////////////////////////////////////////////////////////////////////////////////
100 /// Should always return false, unless you can highlight selected object in pad.
101 
102 Bool_t TVirtualPad::PadInHighlightMode() const
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 
113 void TVirtualPad::PushTopLevelSelectable(TObject * /*object*/)
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 
122 void TVirtualPad::PushSelectableObject(TObject * /*object*/)
123 {
124 }
125 
126 ////////////////////////////////////////////////////////////////////////////////
127 /// Does nothing, unless you implement your own picking.
128 /// Remove top level selectable and all its' children.
129 
130 void TVirtualPad::PopTopLevelSelectable()
131 {
132 }
133 
134 ////////////////////////////////////////////////////////////////////////////////
135 /// Scope-guards ctor, pushe the object on stack.
136 
137 TPickerStackGuard::TPickerStackGuard(TObject *obj)
138 {
139  gPad->PushTopLevelSelectable(obj);
140 }
141 
142 ////////////////////////////////////////////////////////////////////////////////
143 /// Guard does out of scope, pop object from stack.
144 
145 TPickerStackGuard::~TPickerStackGuard()
146 {
147  gPad->PopTopLevelSelectable();
148 }