TGTableCell.h

Go to the documentation of this file.
00001 // Author: Roel Aaij   14/08/2007
00002 
00003 /*************************************************************************
00004  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
00005  * All rights reserved.                                                  *
00006  *                                                                       *
00007  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00008  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00009  *************************************************************************/
00010 
00011 #ifndef ROOT_TGTableCell
00012 #define ROOT_TGTableCell
00013 
00014 #ifndef ROOT_TGFrame
00015 #include "TGFrame.h"
00016 #endif
00017 
00018 class TGTable;
00019 class TGString;
00020 class TGTooltip;
00021 class TGPicture;
00022 class TObjArray;
00023 class TGWindow;
00024 class TGToolTip;
00025 
00026 class TGTableCell : public TGFrame {
00027 
00028 friend class TGTable;
00029 
00030 protected:
00031    TGString      *fLabel;      // Text as shown in the cell
00032    TGToolTip     *fTip;        // Possible Tooltip
00033    Bool_t         fReadOnly;   // Cell readonly state
00034    Bool_t         fEnabled;    // Cell enabled state
00035    Int_t          fTMode;      // Text justify mode
00036    TGPicture     *fImage;      // Image or icon
00037    UInt_t         fTWidth;     // Label width
00038    UInt_t         fTHeight;    // Label heigth
00039    FontStruct_t   fFontStruct; // Font of the label
00040    Bool_t         fHasOwnFont; // Does the cell have it's own font
00041    GContext_t     fNormGC;     // graphics context used to draw the cell
00042    UInt_t         fColumn;     // Column this cell belongs to
00043    UInt_t         fRow;        // Row this cell belongs to
00044    TGTable       *fTable;      // TGTable that a cell belongs to
00045 
00046    static const TGGC   *fgDefaultGC;   // Default graphics context
00047    static const TGFont *fgDefaultFont; // Default font
00048 
00049    virtual void DoRedraw();
00050    virtual void DrawBorder();
00051    virtual void DrawBorder(Handle_t id, Int_t x, Int_t y);
00052    virtual void MoveDraw(Int_t x, Int_t y); 
00053    virtual void Resize(UInt_t width, UInt_t height);
00054    virtual void Resize(TGDimension newsize);
00055 
00056    virtual void Highlight();
00057    void         Init(Bool_t resize);
00058 
00059 public:
00060    static FontStruct_t GetDefaultFontStruct();
00061    static const TGGC   &GetDefaultGC();
00062 
00063    TGTableCell(const TGWindow *p = 0, TGTable *table = 0, TGString *label = 0, 
00064                UInt_t row = 0, UInt_t column = 0, UInt_t width = 80, 
00065                UInt_t height = 25, GContext_t norm = GetDefaultGC()(), 
00066                FontStruct_t font = GetDefaultFontStruct(), UInt_t option = 0,
00067                Bool_t resize = kTRUE);
00068    TGTableCell(const TGWindow *p, TGTable *table, const char *label, 
00069                UInt_t row = 0, UInt_t column = 0, UInt_t width = 80, 
00070                UInt_t height = 25, GContext_t norm = GetDefaultGC()(),
00071                FontStruct_t font = GetDefaultFontStruct(),
00072                UInt_t option = 0, Bool_t resize =  kTRUE);
00073 //    TGTableCell(const TGWindow *p, TGTable *table, TGPicture *image, 
00074 //                TGString *label,  UInt_t row, UInt_t column,
00075 //                UInt_t width, UInt_t height, GContext_t norm = GetDefaultGC()(),
00076 //                FontStruct_t font = GetDefaultFontStruct(),
00077 //                UInt_t option = 0, Bool_t resize = kTRUE);
00078 //    TGTableCell(const TGWindow *p, TGTable *table, TGPicture *image, 
00079 //                const char *label, UInt_t row, UInt_t column, UInt_t width, 
00080 //                UInt_t height, GContext_t norm = GetDefaultGC()(),
00081 //                FontStruct_t font = GetDefaultFontStruct(),
00082 //                UInt_t option = 0, Bool_t resize = kTRUE);
00083    virtual ~TGTableCell();
00084 
00085    virtual void DrawCopy(Handle_t id, Int_t x, Int_t y);
00086     
00087    virtual void SetLabel(const char *label);
00088    
00089    virtual void SetImage(TGPicture *image);
00090    //   virtual void SetBckgndGC(TGGC *gc);
00091 
00092    virtual void SetTextJustify(Int_t tmode); 
00093    virtual void SetFont(FontStruct_t font);
00094    virtual void SetFont(const char *fontName);
00095 
00096    virtual void Select();
00097    virtual void SelectRow();
00098    virtual void SelectColumn();
00099 
00100    virtual UInt_t      GetColumn() const { return fColumn; }
00101    virtual UInt_t      GetRow() const { return fRow; };
00102    virtual TGString*   GetLabel() const { return fLabel; }
00103    virtual TGPicture*  GetImage() const { return fImage; }
00104    virtual UInt_t      GetWidth() const { return fWidth; }
00105    virtual UInt_t      GetHeight() const {return fHeight; }
00106    virtual TGDimension GetSize() const { return TGDimension(fWidth, fHeight); }
00107    virtual Int_t       GetTextJustify() const { return fTMode; }
00108 
00109    ClassDef(TGTableCell, 0) // A single cell in a TGTable.
00110 } ;
00111 
00112 #endif

Generated on Tue Jul 5 14:20:08 2011 for ROOT_528-00b_version by  doxygen 1.5.1