Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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:
58  static FontStruct_t GetDefaultFontStruct();
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()(),
69  FontStruct_t font = GetDefaultFontStruct(),
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