ROOT logo
// Author: Roel Aaij   14/08/2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGTableCell
#define ROOT_TGTableCell

#ifndef ROOT_TGFrame
#include "TGFrame.h"
#endif

class TGTable;
class TGString;
class TGTooltip;
class TGPicture;
class TObjArray;
class TGWindow;
class TGToolTip;

class TGTableCell : public TGFrame {

friend class TGTable;

protected:
   TGString      *fLabel;      // Text as shown in the cell
   TGToolTip     *fTip;        // Possible Tooltip
   Bool_t         fReadOnly;   // Cell readonly state
   Bool_t         fEnabled;    // Cell enabled state
   Int_t          fTMode;      // Text justify mode
   TGPicture     *fImage;      // Image or icon
   UInt_t         fTWidth;     // Label width
   UInt_t         fTHeight;    // Label heigth
   FontStruct_t   fFontStruct; // Font of the label
   Bool_t         fHasOwnFont; // Does the cell have it's own font
   GContext_t     fNormGC;     // graphics context used to draw the cell
   UInt_t         fColumn;     // Column this cell belongs to
   UInt_t         fRow;        // Row this cell belongs to
   TGTable       *fTable;      // TGTable that a cell belongs to

   static const TGGC   *fgDefaultGC;   // Default graphics context
   static const TGFont *fgDefaultFont; // Default font

   virtual void DoRedraw();
   virtual void DrawBorder();
   virtual void DrawBorder(Handle_t id, Int_t x, Int_t y);
   virtual void MoveDraw(Int_t x, Int_t y); 
   virtual void Resize(UInt_t width, UInt_t height);
   virtual void Resize(TGDimension newsize);

   virtual void Highlight();
   void         Init(Bool_t resize);

public:
   static FontStruct_t GetDefaultFontStruct();
   static const TGGC   &GetDefaultGC();

   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(const TGWindow *p, TGTable *table, const char *label, 
               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(const TGWindow *p, TGTable *table, TGPicture *image, 
//                TGString *label,  UInt_t row, UInt_t column,
//                UInt_t width, UInt_t height, GContext_t norm = GetDefaultGC()(),
//                FontStruct_t font = GetDefaultFontStruct(),
//                UInt_t option = 0, Bool_t resize = kTRUE);
//    TGTableCell(const TGWindow *p, TGTable *table, TGPicture *image, 
//                const char *label, UInt_t row, UInt_t column, UInt_t width, 
//                UInt_t height, GContext_t norm = GetDefaultGC()(),
//                FontStruct_t font = GetDefaultFontStruct(),
//                UInt_t option = 0, Bool_t resize = kTRUE);
   virtual ~TGTableCell();

   virtual void DrawCopy(Handle_t id, Int_t x, Int_t y);
    
   virtual void SetLabel(const char *label);
   
   virtual void SetImage(TGPicture *image);
   //   virtual void SetBckgndGC(TGGC *gc);

   virtual void SetTextJustify(Int_t tmode); 
   virtual void SetFont(FontStruct_t font);
   virtual void SetFont(const char *fontName);

   virtual void Select();
   virtual void SelectRow();
   virtual void SelectColumn();

   virtual UInt_t      GetColumn() const { return fColumn; }
   virtual UInt_t      GetRow() const { return fRow; };
   virtual TGString*   GetLabel() const { return fLabel; }
   virtual TGPicture*  GetImage() const { return fImage; }
   virtual UInt_t      GetWidth() const { return fWidth; }
   virtual UInt_t      GetHeight() const {return fHeight; }
   virtual TGDimension GetSize() const { return TGDimension(fWidth, fHeight); }
   virtual Int_t       GetTextJustify() const { return fTMode; }

   ClassDef(TGTableCell, 0) // A single cell in a TGTable.
} ;

#endif
 TGTableCell.h:1
 TGTableCell.h:2
 TGTableCell.h:3
 TGTableCell.h:4
 TGTableCell.h:5
 TGTableCell.h:6
 TGTableCell.h:7
 TGTableCell.h:8
 TGTableCell.h:9
 TGTableCell.h:10
 TGTableCell.h:11
 TGTableCell.h:12
 TGTableCell.h:13
 TGTableCell.h:14
 TGTableCell.h:15
 TGTableCell.h:16
 TGTableCell.h:17
 TGTableCell.h:18
 TGTableCell.h:19
 TGTableCell.h:20
 TGTableCell.h:21
 TGTableCell.h:22
 TGTableCell.h:23
 TGTableCell.h:24
 TGTableCell.h:25
 TGTableCell.h:26
 TGTableCell.h:27
 TGTableCell.h:28
 TGTableCell.h:29
 TGTableCell.h:30
 TGTableCell.h:31
 TGTableCell.h:32
 TGTableCell.h:33
 TGTableCell.h:34
 TGTableCell.h:35
 TGTableCell.h:36
 TGTableCell.h:37
 TGTableCell.h:38
 TGTableCell.h:39
 TGTableCell.h:40
 TGTableCell.h:41
 TGTableCell.h:42
 TGTableCell.h:43
 TGTableCell.h:44
 TGTableCell.h:45
 TGTableCell.h:46
 TGTableCell.h:47
 TGTableCell.h:48
 TGTableCell.h:49
 TGTableCell.h:50
 TGTableCell.h:51
 TGTableCell.h:52
 TGTableCell.h:53
 TGTableCell.h:54
 TGTableCell.h:55
 TGTableCell.h:56
 TGTableCell.h:57
 TGTableCell.h:58
 TGTableCell.h:59
 TGTableCell.h:60
 TGTableCell.h:61
 TGTableCell.h:62
 TGTableCell.h:63
 TGTableCell.h:64
 TGTableCell.h:65
 TGTableCell.h:66
 TGTableCell.h:67
 TGTableCell.h:68
 TGTableCell.h:69
 TGTableCell.h:70
 TGTableCell.h:71
 TGTableCell.h:72
 TGTableCell.h:73
 TGTableCell.h:74
 TGTableCell.h:75
 TGTableCell.h:76
 TGTableCell.h:77
 TGTableCell.h:78
 TGTableCell.h:79
 TGTableCell.h:80
 TGTableCell.h:81
 TGTableCell.h:82
 TGTableCell.h:83
 TGTableCell.h:84
 TGTableCell.h:85
 TGTableCell.h:86
 TGTableCell.h:87
 TGTableCell.h:88
 TGTableCell.h:89
 TGTableCell.h:90
 TGTableCell.h:91
 TGTableCell.h:92
 TGTableCell.h:93
 TGTableCell.h:94
 TGTableCell.h:95
 TGTableCell.h:96
 TGTableCell.h:97
 TGTableCell.h:98
 TGTableCell.h:99
 TGTableCell.h:100
 TGTableCell.h:101
 TGTableCell.h:102
 TGTableCell.h:103
 TGTableCell.h:104
 TGTableCell.h:105
 TGTableCell.h:106
 TGTableCell.h:107
 TGTableCell.h:108
 TGTableCell.h:109
 TGTableCell.h:110
 TGTableCell.h:111
 TGTableCell.h:112