GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Cascade.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004 by Olivier Stezowski *
3  * stezow(AT)ipnl.in2p3.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
23 #ifndef Gw_Cascade
24 #define Gw_Cascade
25 #define GW_CASCADE_H Gw_Cascade
26 
27 #ifndef ROOT_TList
28 #include <TList.h>
29 #endif
30 
31 #ifndef ROOT_TLatex
32 #include <TLatex.h>
33 #endif
34 
35 #include "GwLogMessage.h"
36 
37 class TGraphErrors;
38 
39 namespace Gw {
40 
41 
51 class Cascade : public TList
52 {
53 
54 public:
55 
58 
59  static Style_t GetDefaultStyle(EDefaultStyle d) { return fgDefaultStyle[d]; }
60  static Color_t GetDefaultColor(EDefaultColor d) { return fgDefaultColor[d]; }
61  static Float_t GetDefaultLabelSize() { return fgDefaultLabelSize; }
62 
63  static void SetStylePalette(Style_t* pal) { ::memcpy(fgDefaultStyle, pal, fgkMaxStyle*sizeof(Style_t)); }
64  static void SetColorPalette(Color_t* pal) { ::memcpy(fgDefaultColor, pal, fgkMaxColor*sizeof(Color_t)); }
65  static void SetDefaultLabelSize(Float_t size) { fgDefaultLabelSize = size; }
66 
67 protected:
68  TLatex fName; // cascade's name
69  TLatex fType; // cascade's type
70 
73 
74  Bool_t fIsSelected; // graphically selected
75  Bool_t fIsVisible; // flag to know whether the level is visible
76 
77  mutable LogMessage fLog;
78 
79 private:
80 
81  static const Int_t fgkMaxColor;
82  static const Int_t fgkMaxStyle;
83 
84  static Float_t fgDefaultLabelSize; // default text size
85  static Style_t fgDefaultStyle[]; // 0 for known, 1 for tentative
86  static Color_t fgDefaultColor[]; // 0 for default, 1 for selected
87 
88 private:
89 
90  Double_t fXName; // position in X for name
91  Double_t fYName; // position in Y for name
92 
93 public:
94  Cascade();
95  virtual ~Cascade();
96 
98  virtual TLatex& GetLatex(Option_t *opt = "name");
99 
101 
105  virtual const Char_t* GetName() const ;
107 
110  virtual void SetName(const Char_t* name);
111 
112  // interface for using SetText from TLatex in graphical context
114  virtual void SetLabels(const Char_t* name, const Char_t* type = "ND", Double_t x = 0, Double_t y = 0); //*MENU* *ARGS={name=>fName,type=>fType,x=>fXName,y=>fYName}
115 
117  virtual Double_t GetXName() const { return fName.GetX(); }
118 
120  virtual Double_t GetYName() const { return fName.GetY(); }
121 
123 
126  virtual const Char_t* GetType() const ;
127 
129 
132  virtual void SetType(const Char_t *);
133 
135  virtual void Paint(Option_t* opt ="");
136  virtual void Draw(Option_t* opt ="");
137 
139  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
140 
142  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
143 
145  void ls(Option_t* opt = "") const; //*MENU*
146 
148  virtual void Selected() {fIsSelected = true;}
149 
151  virtual void DeSelected() {fIsSelected = false;}
152 
154  virtual Bool_t IsSelected() {return fIsSelected;}
155 
157  virtual void SetVisible(Bool_t visu); //*TOGGLE* *ARGS={visu=>fIsVisible} *GETTER=IsVisible
158 
160  virtual Bool_t IsVisible() {return fIsVisible;}
161 
164 
167 
169  virtual void SetLabelColor(EDefaultColor color)
170  { fName.SetTextColor(GetDefaultColor(color) );
171  fType.SetTextColor(GetDefaultColor(color) ); }
172 
174  TGraphErrors* DoJ2() const;
175 
177  TGraphErrors* DoJ1() const;
178 
180  ClassDef(Cascade,3); // a cascade is a list of links
181 };
182 // inline members
183 inline void Cascade::SetName(const Char_t *name) { fName.SetTitle(name); }
184 inline void Cascade::SetType(const Char_t *type) { fType.SetTitle(type); }
185 inline const Char_t *Cascade::GetName() const { return fName.GetTitle(); }
186 inline const Char_t *Cascade::GetType() const { return fType.GetTitle(); }
187 
188 }
189 #endif
virtual Double_t GetXName() const
Get X for name.
Definition: Cascade.h:117
TLatex fType
Definition: Cascade.h:69
static void SetDefaultLabelSize(Float_t size)
Definition: Cascade.h:65
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance to object.
Definition: Cascade.cpp:145
static void SetStylePalette(Style_t *pal)
Definition: Cascade.h:63
TGraphErrors * DoJ2() const
Compute J2.
Definition: Cascade.cpp:234
A cascade is a list of links.
Definition: Cascade.h:51
virtual const Char_t * GetName() const
to get only the cascade's name
Definition: Cascade.h:185
static void SetColorPalette(Color_t *pal)
Definition: Cascade.h:64
virtual ~Cascade()
Definition: Cascade.cpp:85
Bool_t fIsSelected
Definition: Cascade.h:74
EDefaultColor fDefaultColor
Definition: Cascade.h:72
EDefaultStyle fDefaultStyle
Definition: Cascade.h:71
virtual void DeSelected()
unselected link
Definition: Cascade.h:151
virtual Double_t GetYName() const
Get Y for name.
Definition: Cascade.h:120
Base class for a Log message.
Definition: GwLogMessage.h:94
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
to execute an event for this cascade
Definition: Cascade.cpp:153
virtual void Selected()
Selected link.
Definition: Cascade.h:148
header file for GwLogMessage.cpp
virtual const Char_t * GetType() const
to get only the cascade's type
Definition: Cascade.h:186
virtual EDefaultStyle GetDefaultStyle()
return default style
Definition: Cascade.h:163
void ls(Option_t *opt="") const
Print out.
Definition: Cascade.cpp:160
Bool_t fIsVisible
Definition: Cascade.h:75
static Color_t GetDefaultColor(EDefaultColor d)
Definition: Cascade.h:60
virtual Bool_t IsSelected()
return selection
Definition: Cascade.h:154
static Style_t GetDefaultStyle(EDefaultStyle d)
Definition: Cascade.h:59
ClassDef(Cascade, 3)
rootcint dictionary
virtual EDefaultColor GetDefaultColor()
return default color
Definition: Cascade.h:166
virtual void SetLabelColor(EDefaultColor color)
Set color label.
Definition: Cascade.h:169
virtual void Draw(Option_t *opt="")
Definition: Cascade.cpp:116
virtual void SetLabels(const Char_t *name, const Char_t *type="ND", Double_t x=0, Double_t y=0)
set cascade label
Definition: Cascade.cpp:99
LogMessage fLog
Definition: Cascade.h:77
virtual void SetName(const Char_t *name)
to set only the cascade's name
Definition: Cascade.h:183
virtual void SetVisible(Bool_t visu)
Set cascade (un)visible, do not delete the objects, still present, just not drawn ! ...
Definition: Cascade.cpp:124
virtual TLatex & GetLatex(Option_t *opt="name")
to get and modify the displayed properties of name and type
Definition: Cascade.cpp:91
virtual void Paint(Option_t *opt="")
Draw/Paint methods.
Definition: Cascade.cpp:109
const Int_t size
Definition: BenchIO.C:24
TLatex fName
Definition: Cascade.h:68
TGraphErrors * DoJ1() const
Compute J1.
Definition: Cascade.cpp:170
virtual void SetType(const Char_t *)
to set only the cascade's type
Definition: Cascade.h:184
virtual Bool_t IsVisible()
return visible
Definition: Cascade.h:160
static Float_t GetDefaultLabelSize()
Definition: Cascade.h:61