Logo ROOT   6.08/07
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 #ifndef ROOT_TGFrame
15 #include "TGFrame.h"
16 #endif
17 
18 class TGTable;
19 class TGString;
20 class TGTooltip;
21 class TGPicture;
22 class TObjArray;
23 class TGWindow;
24 class TGToolTip;
25 
26 class TGTableCell : public TGFrame {
27 
28 friend class TGTable;
29 
30 protected:
31  TGString *fLabel; // Text as shown in the cell
32  TGToolTip *fTip; // Possible Tooltip
33  Bool_t fReadOnly; // Cell readonly state
34  Bool_t fEnabled; // Cell enabled state
35  Int_t fTMode; // Text justify mode
36  TGPicture *fImage; // Image or icon
37  UInt_t fTWidth; // Label width
38  UInt_t fTHeight; // Label heigth
39  FontStruct_t fFontStruct; // Font of the label
40  Bool_t fHasOwnFont; // Does the cell have it's own font
41  GContext_t fNormGC; // graphics context used to draw the cell
42  UInt_t fColumn; // Column this cell belongs to
43  UInt_t fRow; // Row this cell belongs to
44  TGTable *fTable; // TGTable that a cell belongs to
45 
46  static const TGGC *fgDefaultGC; // Default graphics context
47  static const TGFont *fgDefaultFont; // Default font
48 
49  virtual void DoRedraw();
50  virtual void DrawBorder();
51  virtual void DrawBorder(Handle_t id, Int_t x, Int_t y);
52  virtual void MoveDraw(Int_t x, Int_t y);
53  virtual void Resize(UInt_t width, UInt_t height);
54  virtual void Resize(TGDimension newsize);
55 
56  virtual void Highlight();
57  void Init(Bool_t resize);
58 
59 public:
61  static const TGGC &GetDefaultGC();
62 
63  TGTableCell(const TGWindow *p = 0, TGTable *table = 0, TGString *label = 0,
64  UInt_t row = 0, UInt_t column = 0, UInt_t width = 80,
65  UInt_t height = 25, GContext_t norm = GetDefaultGC()(),
66  FontStruct_t font = GetDefaultFontStruct(), UInt_t option = 0,
67  Bool_t resize = kTRUE);
68  TGTableCell(const TGWindow *p, TGTable *table, const char *label,
69  UInt_t row = 0, UInt_t column = 0, UInt_t width = 80,
70  UInt_t height = 25, GContext_t norm = GetDefaultGC()(),
72  UInt_t option = 0, Bool_t resize = kTRUE);
73 // TGTableCell(const TGWindow *p, TGTable *table, TGPicture *image,
74 // TGString *label, UInt_t row, UInt_t column,
75 // UInt_t width, UInt_t height, GContext_t norm = GetDefaultGC()(),
76 // FontStruct_t font = GetDefaultFontStruct(),
77 // UInt_t option = 0, Bool_t resize = kTRUE);
78 // TGTableCell(const TGWindow *p, TGTable *table, TGPicture *image,
79 // const char *label, UInt_t row, UInt_t column, UInt_t width,
80 // UInt_t height, GContext_t norm = GetDefaultGC()(),
81 // FontStruct_t font = GetDefaultFontStruct(),
82 // UInt_t option = 0, Bool_t resize = kTRUE);
83  virtual ~TGTableCell();
84 
85  virtual void DrawCopy(Handle_t id, Int_t x, Int_t y);
86 
87  virtual void SetLabel(const char *label);
88 
89  virtual void SetImage(TGPicture *image);
90  // virtual void SetBckgndGC(TGGC *gc);
91 
92  virtual void SetTextJustify(Int_t tmode);
93  virtual void SetFont(FontStruct_t font);
94  virtual void SetFont(const char *fontName);
95 
96  virtual void Select();
97  virtual void SelectRow();
98  virtual void SelectColumn();
99 
100  virtual UInt_t GetColumn() const { return fColumn; }
101  virtual UInt_t GetRow() const { return fRow; };
102  virtual TGString* GetLabel() const { return fLabel; }
103  virtual TGPicture* GetImage() const { return fImage; }
104  virtual UInt_t GetWidth() const { return fWidth; }
105  virtual UInt_t GetHeight() const {return fHeight; }
106  virtual TGDimension GetSize() const { return TGDimension(fWidth, fHeight); }
107  virtual Int_t GetTextJustify() const { return fTMode; }
108 
109  ClassDef(TGTableCell, 0) // A single cell in a TGTable.
110 } ;
111 
112 #endif
Handle_t FontStruct_t
Definition: GuiTypes.h:40
static const TGGC * fgDefaultGC
Definition: TGTableCell.h:46
virtual void SetLabel(const char *label)
Set the label of this cell to label.
An array of TObjects.
Definition: TObjArray.h:39
virtual ~TGTableCell()
TGTableCell destructor.
UInt_t fColumn
Definition: TGTableCell.h:42
Int_t fTMode
Definition: TGTableCell.h:35
void Init(Bool_t resize)
Initialise the TGTableCell.
Handle_t GContext_t
Definition: GuiTypes.h:39
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:104
FontStruct_t fFontStruct
Definition: TGTableCell.h:39
UInt_t fTHeight
Definition: TGTableCell.h:38
static FontStruct_t GetDefaultFontStruct()
Return default font structure.
static const TGFont * fgDefaultFont
Definition: TGTableCell.h:47
virtual TGDimension GetSize() const
Definition: TGTableCell.h:106
TGToolTip * fTip
Definition: TGTableCell.h:32
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
UInt_t fTWidth
Definition: TGTableCell.h:37
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:41
virtual UInt_t GetRow() const
Definition: TGTableCell.h:101
UInt_t fRow
Definition: TGTableCell.h:43
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:34
TGTable * fTable
Definition: TGTableCell.h:44
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:107
TGString * fLabel
Definition: TGTableCell.h:31
virtual UInt_t GetColumn() const
Definition: TGTableCell.h:100
UInt_t fWidth
Definition: TGFrame.h:150
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:105
virtual TGString * GetLabel() const
Definition: TGTableCell.h:102
Definition: TGFont.h:155
Double_t y[n]
Definition: legend1.C:17
UInt_t fHeight
Definition: TGFrame.h:151
virtual void DoRedraw()
Redraw the TGTableCell.
Bool_t fHasOwnFont
Definition: TGTableCell.h:40
virtual void Resize(UInt_t width, UInt_t height)
Resize the TGTableCell.
TGPicture * fImage
Definition: TGTableCell.h:36
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:33
virtual void MoveDraw(Int_t x, Int_t y)
Move the TGTableCell and redraw it.
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void DrawBorder()
Draw the cell border.
double norm(double *x, double *p)
Definition: unuranDistr.cxx:40
Definition: TGGC.h:35
virtual TGPicture * GetImage() const
Definition: TGTableCell.h:103
ULong_t Handle_t
Definition: GuiTypes.h:27