GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Level.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_Level
24 #define Gw_Level
25 #define GW_LEVEL_H Gw_Level
26 
27 #ifndef ROOT_TLine
28 #include <TLine.h>
29 #endif
30 
31 #ifndef ROOT_TLatex
32 #include <TLatex.h>
33 #endif
34 
35 #include "GwLogMessage.h"
36 
37 namespace Gw {
38 
53 class Level : public TLine
54 {
55 
56 
57 public:
60 
61  static Style_t GetDefaultStyle(EDefaultStyle d) { return fgDefaultStyle[d]; }
62  static Color_t GetDefaultColor(EDefaultColor d) { return fgDefaultColor[d]; }
63  static Float_t GetDefaultLabelSize() { return fgDefaultLabelSize; }
64  static Color_t GetDefaultLabelColor() { return fgDefaultLabelColor; }
65 
66  static void SetStylePalette(Style_t* pal) { ::memcpy(fgDefaultStyle, pal, fgkMaxStyle*sizeof(Style_t)); }
67  static void SetColorPalette(Color_t* pal) { ::memcpy(fgDefaultColor, pal, fgkMaxColor*sizeof(Color_t)); }
68  static void SetDefaultLabelSize(Float_t size) { fgDefaultLabelSize = size; }
69  static void SetDefaultLabelColor(Color_t color) { fgDefaultLabelColor = color; }
70  static void EnableMove() { fgMovable = true; }
71  static void DisableMove() { fgMovable = false; }
72  static Bool_t IsMovable() { return fgMovable == true; }
73 
74 private:
75  static const Short_t fgkMaxLevelLabel;
76  static const Int_t fgkMaxColor;
77  static const Int_t fgkMaxStyle;
78 
79  static Style_t fgDefaultStyle[]; // 0 for known, 1 for tentative
80  static Color_t fgDefaultColor[]; // 0 for positive parity, 1 for negative and 2 for parity unknown , 3 for selected
81  static Color_t fgDefaultLabelColor; // default text color
82  static Float_t fgDefaultLabelSize; // default text size
83  static Bool_t fgMovable; // graphically movable
84 
85 private:
86  TString fVisLabel; // To know if a label should be drawn ok not
87  TString fPosLabel; // To know the position of label 0:ul; 1:ur; 2:lr; 3:ll
88 
89  TLatex fLabel0; // Some labels associated with this level
90  TLatex fLabel1; // Some labels associated with this level
91  TLatex fLabel2; // Some labels associated with this level
92  TLatex fLabel3; // Some labels associated with this level
93 
94  TLine fExtra; // Extra line for links far away from this level
95  Bool_t fHasExtra; // flag to know whether the level has an extra line
96 
97  EDefaultStyle fDefaultStyle; // line style
98  EDefaultColor fDefaultColor; // line color
99 
100  mutable LogMessage fLog;
101 
102 protected:
103 
104  Bool_t fIsSelected; // graphically selected
105  Bool_t fIsVisible; // flag to know whether the level is visible
106  Bool_t fIsModified; // flag to know whether the link has been modified
107  Float_t fDY; // relative displacement when modified
108 
109 public:
110  Level();
111  virtual ~Level();
112 
114 
117  void SetExtraLine(Double_t, Double_t);
118  void SetExtraLineX1(Double_t);
119  void SetExtraLineX2(Double_t);
120 
122 
128  virtual void SetVisLabel(const char *); //*MENU*
129 
131  virtual void SetLabels(const char *l0, const char *l1, const char *l2, const char *l3) ; // *MENU* *ARGS={l0=>fLabel0,l1=>fLabel1,l2=>fLabel2,l3=>fLabel3}
132 
134  virtual void ExtraLine(Bool_t extra = true); //*TOGGLE* *GETTER=HasExtraLine
135 
137  virtual void SetLabelsSize(Float_t size);
138 
140  virtual void SetLabelsColor(Color_t color);
141 
143  virtual void SetPosLabel(const char *);
144 
146  virtual const char * GetVisLabel() { return fVisLabel.Data(); }
147 
149  virtual const char * GetPosLabel() { return fPosLabel.Data(); }
150 
152  virtual TLatex& GetLabel(Int_t);
153 
155  virtual TLine& GetExtraLine() {return fExtra;}
156 
158  virtual const char* GetLabel0() { return fLabel0.GetTitle(); }
159  virtual const char* GetLabel1() { return fLabel1.GetTitle(); }
160  virtual const char* GetLabel2() { return fLabel2.GetTitle(); }
161  virtual const char* GetLabel3() { return fLabel3.GetTitle(); }
162 
164 
167  virtual void SetLabel(const char *, Int_t);
168 
170  virtual void SetDefaultLabels();
171 
173  virtual void SetX1(Double_t);
175  virtual void SetX2(Double_t);
177  virtual void SetY1(Double_t);
179  virtual void SetY2(Double_t);
180 
182 
188  virtual Int_t Compare(const TObject *) const;
189 
191  virtual Bool_t IsSortable() const { return true; }
192 
194 
197  virtual void Paint(Option_t* option = "");
198  virtual void Draw(Option_t* option = "");
199 
201  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
202 
204  virtual void Selected() {fIsSelected = true;}
205 
207  virtual void DeSelected() {fIsSelected = false;}
208 
210  virtual Bool_t IsSelected() {return fIsSelected;}
211 
213  virtual void SetVisible() {fIsVisible = true;}
214 
216  virtual void SetUnvisible() {fIsVisible = false;}
217 
219  virtual Bool_t IsVisible() {return fIsVisible;}
220 
222  virtual void SetModified() {fIsModified = true;}
223 
225  virtual void SetUnmdified() {fIsModified = false;}
226 
228  virtual Bool_t IsModified() {return fIsModified;}
229 
230  // Set DY
231  virtual void SetDY(Float_t dy) { fDY = dy; }
232 
233  // Get DY
234  virtual Float_t GetDY() { return fDY; }
235 
237  virtual EDefaultStyle GetDefaultStyle() {return fDefaultStyle;}
238 
240  virtual EDefaultColor GetDefaultColor() {return fDefaultColor;}
241 
243  virtual void SetStyle(EDefaultStyle style);
244 
246  virtual void SetColor(EDefaultColor color);
247 
249  virtual Bool_t HasExtraLine() { return fHasExtra; }
250 
252  void Delete(const Option_t* /*opt*/ = "") { return; }
253 
255  ClassDef(Level, 4); // base class for a level
256 };
257 
258 }
259 
260 #endif
virtual const char * GetLabel0()
Get labels title.
Definition: Level.h:158
virtual void DeSelected()
unselected link
Definition: Level.h:207
static Color_t GetDefaultColor(EDefaultColor d)
Definition: Level.h:62
virtual Bool_t IsVisible()
return visible
Definition: Level.h:219
Bool_t fIsVisible
Definition: Level.h:105
virtual void SetDY(Float_t dy)
Definition: Level.h:231
virtual void SetUnmdified()
Set link unvisble.
Definition: Level.h:225
static Style_t GetDefaultStyle(EDefaultStyle d)
Definition: Level.h:61
virtual void SetColor(EDefaultColor color)
Set color.
Definition: Level.cpp:107
ClassDef(Level, 4)
Root dictionary related.
virtual Bool_t IsSelected()
return selection
Definition: Level.h:210
virtual void Paint(Option_t *option="")
used to paint a level
Definition: Level.cpp:333
virtual void SetLabelsColor(Color_t color)
set all labels color
Definition: Level.cpp:125
static void SetStylePalette(Style_t *pal)
Definition: Level.h:66
virtual EDefaultStyle GetDefaultStyle()
return default style
Definition: Level.h:237
virtual void SetLabelsSize(Float_t size)
set all labels size
Definition: Level.cpp:116
static void SetDefaultLabelSize(Float_t size)
Definition: Level.h:68
virtual EDefaultColor GetDefaultColor()
return default color
Definition: Level.h:240
Base class for a Log message.
Definition: GwLogMessage.h:94
void SetExtraLineX2(Double_t)
Definition: Level.cpp:156
virtual void SetModified()
Set link modified.
Definition: Level.h:222
virtual void SetVisible()
Set link visible.
Definition: Level.h:213
header file for GwLogMessage.cpp
virtual void ExtraLine(Bool_t extra=true)
Set extraline drawning.
Definition: Level.cpp:233
virtual void Draw(Option_t *option="")
Definition: Level.cpp:364
virtual const char * GetLabel3()
Definition: Level.h:161
virtual void SetUnvisible()
Set link unvisble.
Definition: Level.h:216
Bool_t fIsModified
Definition: Level.h:106
virtual ~Level()
Definition: Level.cpp:93
virtual const char * GetLabel1()
Definition: Level.h:159
virtual const char * GetLabel2()
Definition: Level.h:160
virtual Bool_t IsSortable() const
Set Sortable true.
Definition: Level.h:191
virtual Bool_t HasExtraLine()
check if extra line
Definition: Level.h:249
static Float_t GetDefaultLabelSize()
Definition: Level.h:63
virtual TLatex & GetLabel(Int_t)
All labels are shifted when moving a level to another position.
Definition: Level.cpp:251
virtual void SetDefaultLabels()
Set default labels.
Definition: Level.cpp:243
virtual void SetPosLabel(const char *)
set position for levels
Definition: Level.cpp:187
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
to execute an event for this level
Definition: Level.cpp:394
virtual void SetX2(Double_t)
All labels are shifted when moving a level to another position.
Definition: Level.cpp:273
virtual void SetY1(Double_t)
All labels are shifted when moving a level to another position.
Definition: Level.cpp:284
virtual void SetLabels(const char *l0, const char *l1, const char *l2, const char *l3)
set label titles
Definition: Level.cpp:224
virtual Int_t Compare(const TObject *) const
used to sort a list of levels
Definition: Level.cpp:322
static Bool_t IsMovable()
Definition: Level.h:72
virtual TLine & GetExtraLine()
Get extra line.
Definition: Level.h:155
virtual void SetVisLabel(const char *)
Used to determine which label should be drawn.
Definition: Level.cpp:172
virtual const char * GetVisLabel()
Used to determine which label should be drawn.
Definition: Level.h:146
EDefaultStyle
Definition: Level.h:58
virtual void SetLabel(const char *, Int_t)
to set labels
Definition: Level.cpp:204
virtual void SetX1(Double_t)
All labels are shifted when moving a level to another position.
Definition: Level.cpp:262
static void SetColorPalette(Color_t *pal)
Definition: Level.h:67
virtual const char * GetPosLabel()
Used to determine the position of labels.
Definition: Level.h:149
static void EnableMove()
Definition: Level.h:70
void Delete(const Option_t *="")
Delete, redifined to avoid appearence in Menu.
Definition: Level.h:252
Level()
Definition: Level.cpp:60
Float_t fDY
Definition: Level.h:107
Bool_t fIsSelected
log message
Definition: Level.h:104
EDefaultColor
Definition: Level.h:59
virtual void SetY2(Double_t)
All labels are shifted when moving a level to another position.
Definition: Level.cpp:303
void SetExtraLine(Double_t, Double_t)
extra line
Definition: Level.cpp:134
const Int_t size
Definition: BenchIO.C:24
virtual void SetStyle(EDefaultStyle style)
Set style.
Definition: Level.cpp:99
virtual Bool_t IsModified()
return modified
Definition: Level.h:228
virtual void Selected()
Selected link.
Definition: Level.h:204
static Color_t GetDefaultLabelColor()
Definition: Level.h:64
void SetExtraLineX1(Double_t)
Definition: Level.cpp:140
virtual Float_t GetDY()
Definition: Level.h:234
static void DisableMove()
Definition: Level.h:71
static void SetDefaultLabelColor(Color_t color)
Definition: Level.h:69
Base class describing a general level.
Definition: Level.h:53