Logo ROOT   6.10/09
Reference Guide
TGTableCell.h
Go to the documentation of this file.
1 // Author: Roel Aaij 14/08/2007
2 
3 /*************************************************************************
4  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #ifndef ROOT_TGTableCell
12 #define ROOT_TGTableCell
13 
14 #include "TGFrame.h"
15 
16 class TGTable;
17 class TGString;
18 class TGTooltip;
19 class TGPicture;
20 class TObjArray;
21 class TGWindow;
22 class TGToolTip;
23 
24 class TGTableCell : public TGFrame {
25 
26 friend class TGTable;
27 
28 protected:
29  TGString *fLabel; // Text as shown in the cell
30  TGToolTip *fTip; // Possible Tooltip
31  Bool_t fReadOnly; // Cell readonly state
32  Bool_t fEnabled; // Cell enabled state
33  Int_t fTMode; // Text justify mode
34  TGPicture *fImage; // Image or icon
35  UInt_t fTWidth; // Label width
36  UInt_t fTHeight; // Label heigth
37  FontStruct_t fFontStruct; // Font of the label
38  Bool_t fHasOwnFont; // Does the cell have it's own font
39  GContext_t fNormGC; // graphics context used to draw the cell
40  UInt_t fColumn; // Column this cell belongs to
41  UInt_t fRow; // Row this cell belongs to
42  TGTable *fTable; // TGTable that a cell belongs to
43 
44  static const TGGC *fgDefaultGC; // Default graphics context
45  static const TGFont *fgDefaultFont; // Default font
46 
47  virtual void DoRedraw();
48  virtual void DrawBorder();
49  virtual void DrawBorder(Handle_t id, Int_t x, Int_t y);
50  virtual void MoveDraw(Int_t x, Int_t y);
51  virtual void Resize(UInt_t width, UInt_t height);
52  virtual void Resize(TGDimension newsize);
53 
54  virtual void Highlight();
55  void Init(Bool_t resize);
56 
57 public:
59  static const TGGC &GetDefaultGC();
60 
61  TGTableCell(const TGWindow *p = 0, TGTable *table = 0, TGString *label = 0,
62  UInt_t row = 0, UInt_t column = 0, UInt_t width = 80,
63  UInt_t height = 25, GContext_t norm = GetDefaultGC()(),
64  FontStruct_t font = GetDefaultFontStruct(), UInt_t option = 0,
65  Bool_t resize = kTRUE);
66  TGTableCell(const TGWindow *p, TGTable *table, const char *label,
67  UInt_t row = 0, UInt_t column = 0, UInt_t width = 80,
68  UInt_t height = 25, GContext_t norm = GetDefaultGC()(),
70  UInt_t option = 0, Bool_t resize = kTRUE);
71 // TGTableCell(const TGWindow *p, TGTable *table, TGPicture *image,
72 // TGString *label, UInt_t row, UInt_t column,
73 // UInt_t width, UInt_t height, GContext_t norm = GetDefaultGC()(),
74 // FontStruct_t font = GetDefaultFontStruct(),
75 // UInt_t option = 0, Bool_t resize = kTRUE);
76 // TGTableCell(const TGWindow *p, TGTable *table, TGPicture *image,
77 // const char *label, UInt_t row, UInt_t column, UInt_t width,
78 // UInt_t height, GContext_t norm = GetDefaultGC()(),
79 // FontStruct_t font = GetDefaultFontStruct(),
80 // UInt_t option = 0, Bool_t resize = kTRUE);
81  virtual ~TGTableCell();
82 
83  virtual void DrawCopy(Handle_t id, Int_t x, Int_t y);
84 
85  virtual void SetLabel(const char *label);
86 
87  virtual void SetImage(TGPicture *image);
88  // virtual void SetBckgndGC(TGGC *gc);
89 
90  virtual void SetTextJustify(Int_t tmode);
91  virtual void SetFont(FontStruct_t font);
92  virtual void SetFont(const char *fontName);
93 
94  virtual void Select();
95  virtual void SelectRow();
96  virtual void SelectColumn();
97 
98  virtual UInt_t GetColumn() const { return fColumn; }
99  virtual UInt_t GetRow() const { return fRow; };
100  virtual TGString* GetLabel() const { return fLabel; }
101  virtual TGPicture* GetImage() const { return fImage; }
102  virtual UInt_t GetWidth() const { return fWidth; }
103  virtual UInt_t GetHeight() const {return fHeight; }
104  virtual TGDimension GetSize() const { return TGDimension(fWidth, fHeight); }
105  virtual Int_t GetTextJustify() const { return fTMode; }
106 
107  ClassDef(TGTableCell, 0) // A single cell in a TGTable.
108 } ;
109 
110 #endif
Handle_t FontStruct_t
Definition: GuiTypes.h:38
static const TGGC * fgDefaultGC
Definition: TGTableCell.h:44
virtual void SetLabel(const char *label)
Set the label of this cell to label.
An array of TObjects.
Definition: TObjArray.h:37
virtual ~TGTableCell()
TGTableCell destructor.
UInt_t fColumn
Definition: TGTableCell.h:40
Int_t fTMode
Definition: TGTableCell.h:33
void Init(Bool_t resize)
Initialise the TGTableCell.
Handle_t GContext_t
Definition: GuiTypes.h:37
virtual void SetFont(FontStruct_t font)
Changes text font.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual UInt_t GetWidth() const
Definition: TGTableCell.h:102
FontStruct_t fFontStruct
Definition: TGTableCell.h:37
UInt_t fTHeight
Definition: TGTableCell.h:36
static FontStruct_t GetDefaultFontStruct()
Return default font structure.
static const TGFont * fgDefaultFont
Definition: TGTableCell.h:45
virtual TGDimension GetSize() const
Definition: TGTableCell.h:104
TGToolTip * fTip
Definition: TGTableCell.h:30
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:297
UInt_t fTWidth
Definition: TGTableCell.h:35
virtual void DrawCopy(Handle_t id, Int_t x, Int_t y)
Draw list view item in other window.
virtual void Highlight()
Highlight the this TGTableCell.
GContext_t fNormGC
Definition: TGTableCell.h:39
virtual UInt_t GetRow() const
Definition: TGTableCell.h:99
UInt_t fRow
Definition: TGTableCell.h:41
TGTableCell(const TGWindow *p=0, TGTable *table=0, TGString *label=0, UInt_t row=0, UInt_t column=0, UInt_t width=80, UInt_t height=25, GContext_t norm=GetDefaultGC()(), FontStruct_t font=GetDefaultFontStruct(), UInt_t option=0, Bool_t resize=kTRUE)
TGTableCell constructor.
Definition: TGTableCell.cxx:44
Bool_t fEnabled
Definition: TGTableCell.h:32
TGTable * fTable
Definition: TGTableCell.h:42
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual void SetImage(TGPicture *image)
Set the image that this cell contains to image.
virtual Int_t GetTextJustify() const
Definition: TGTableCell.h:105
TGString * fLabel
Definition: TGTableCell.h:29
virtual UInt_t GetColumn() const
Definition: TGTableCell.h:98
UInt_t fWidth
Definition: TGFrame.h:134
virtual void SelectColumn()
Select the column that this TGTableCell belongs to.
static const TGGC & GetDefaultGC()
Return default graphics context.
virtual void SelectRow()
Select the row that this TGTableCell belongs to.
virtual UInt_t GetHeight() const
Definition: TGTableCell.h:103
virtual TGString * GetLabel() const
Definition: TGTableCell.h:100
Definition: TGFont.h:149
Double_t y[n]
Definition: legend1.C:17
UInt_t fHeight
Definition: TGFrame.h:135
virtual void DoRedraw()
Redraw the TGTableCell.
Bool_t fHasOwnFont
Definition: TGTableCell.h:38
virtual void Resize(UInt_t width, UInt_t height)
Resize the TGTableCell.
TGPicture * fImage
Definition: TGTableCell.h:34
virtual void SetTextJustify(Int_t tmode)
Set the text justify mode of the cell to mode.
virtual void Select()
Select this TGTableCell.
Bool_t fReadOnly
Definition: TGTableCell.h:31
virtual void MoveDraw(Int_t x, Int_t y)
Move the TGTableCell and redraw it.
virtual void DrawBorder()
Draw the cell border.
const Bool_t kTRUE
Definition: RtypesCore.h:91
double norm(double *x, double *p)
Definition: unuranDistr.cxx:40
Definition: TGGC.h:31
virtual TGPicture * GetImage() const
Definition: TGTableCell.h:101
ULong_t Handle_t
Definition: GuiTypes.h:25