Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
16class TGTable;
17class TGString;
18class TGTooltip;
19class TGPicture;
20class TObjArray;
21class TGWindow;
22class TGToolTip;
23
24class TGTableCell : public TGFrame {
25
26friend class TGTable;
27
28protected:
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 height
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 void DoRedraw() override;
48 void DrawBorder() override;
49 virtual void DrawBorder(Handle_t id, Int_t x, Int_t y);
50 virtual void MoveDraw(Int_t x, Int_t y);
51 void Resize(UInt_t width, UInt_t height) override;
52 void Resize(TGDimension newsize) override;
53
54 virtual void Highlight();
55 void Init(Bool_t resize);
56
57public:
59 static const TGGC &GetDefaultGC();
60
61 TGTableCell(const TGWindow *p = nullptr, TGTable *table = nullptr, TGString *label = nullptr,
62 UInt_t row = 0, UInt_t column = 0, UInt_t width = 80,
63 UInt_t height = 25, GContext_t norm = GetDefaultGC()(),
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
72 ~TGTableCell() override;
73
74 void DrawCopy(Handle_t id, Int_t x, Int_t y) override;
75
76 virtual void SetLabel(const char *label);
77
78 virtual void SetImage(TGPicture *image);
79 // virtual void SetBckgndGC(TGGC *gc);
80
81 virtual void SetTextJustify(Int_t tmode);
82 virtual void SetFont(FontStruct_t font);
83 virtual void SetFont(const char *fontName);
84
85 virtual void Select();
86 virtual void SelectRow();
87 virtual void SelectColumn();
88
89 virtual UInt_t GetColumn() const { return fColumn; }
90 virtual UInt_t GetRow() const { return fRow; };
91 virtual TGString* GetLabel() const { return fLabel; }
92 virtual TGPicture* GetImage() const { return fImage; }
93 virtual UInt_t GetWidth() const { return fWidth; }
94 virtual UInt_t GetHeight() const {return fHeight; }
95 virtual TGDimension GetSize() const { return TGDimension(fWidth, fHeight); }
96 virtual Int_t GetTextJustify() const { return fTMode; }
97
98 ClassDefOverride(TGTableCell, 0) // A single cell in a TGTable.
99};
100
101#endif
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:38
ULongptr_t Handle_t
Generic resource handle.
Definition GuiTypes.h:26
Handle_t FontStruct_t
Pointer to font structure.
Definition GuiTypes.h:39
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Encapsulate fonts used in the GUI system.
Definition TGFont.h:140
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
UInt_t fHeight
frame height
Definition TGFrame.h:88
UInt_t fWidth
frame width
Definition TGFrame.h:87
Encapsulate a graphics context used in the low level graphics.
Definition TGGC.h:22
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition TGPicture.h:25
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition TGString.h:20
TGTableCell is the class that represents a single cell in a TGTable.
Definition TGTableCell.h:24
virtual void SelectColumn()
Select the column that this TGTableCell belongs to.
virtual void SetTextJustify(Int_t tmode)
Set the text justify mode of the cell to mode.
static const TGFont * fgDefaultFont
Default font.
Definition TGTableCell.h:45
virtual void SetLabel(const char *label)
Set the label of this cell to label.
TGToolTip * fTip
Possible Tooltip.
Definition TGTableCell.h:30
static const TGGC * fgDefaultGC
Default graphics context.
Definition TGTableCell.h:44
virtual UInt_t GetWidth() const
Definition TGTableCell.h:93
Int_t fTMode
Text justify mode.
Definition TGTableCell.h:33
UInt_t fTWidth
Label width.
Definition TGTableCell.h:35
void DoRedraw() override
Redraw the TGTableCell.
virtual Int_t GetTextJustify() const
Definition TGTableCell.h:96
TGPicture * fImage
Image or icon.
Definition TGTableCell.h:34
FontStruct_t fFontStruct
Font of the label.
Definition TGTableCell.h:37
virtual UInt_t GetRow() const
Definition TGTableCell.h:90
Bool_t fReadOnly
Cell readonly state.
Definition TGTableCell.h:31
TGTable * fTable
TGTable that a cell belongs to.
Definition TGTableCell.h:42
UInt_t fTHeight
Label height.
Definition TGTableCell.h:36
virtual void SetFont(FontStruct_t font)
Changes text font.
virtual void SelectRow()
Select the row that this TGTableCell belongs to.
void DrawBorder() override
Draw the cell border.
virtual void Highlight()
Highlight the this TGTableCell.
virtual void SetImage(TGPicture *image)
Set the image that this cell contains to image.
virtual void MoveDraw(Int_t x, Int_t y)
Move the TGTableCell and redraw it.
TGString * fLabel
Text as shown in the cell.
Definition TGTableCell.h:29
Bool_t fEnabled
Cell enabled state.
Definition TGTableCell.h:32
virtual TGDimension GetSize() const
Definition TGTableCell.h:95
static FontStruct_t GetDefaultFontStruct()
Return default font structure.
UInt_t fRow
Row this cell belongs to.
Definition TGTableCell.h:41
virtual TGString * GetLabel() const
Definition TGTableCell.h:91
void Resize(UInt_t width, UInt_t height) override
Resize the TGTableCell.
virtual TGPicture * GetImage() const
Definition TGTableCell.h:92
UInt_t fColumn
Column this cell belongs to.
Definition TGTableCell.h:40
Bool_t fHasOwnFont
Does the cell have it's own font.
Definition TGTableCell.h:38
void DrawCopy(Handle_t id, Int_t x, Int_t y) override
Draw list view item in other window.
void Init(Bool_t resize)
Initialise the TGTableCell.
virtual void Select()
Select this TGTableCell.
static const TGGC & GetDefaultGC()
Return default graphics context.
GContext_t fNormGC
graphics context used to draw the cell
Definition TGTableCell.h:39
~TGTableCell() override
TGTableCell destructor.
virtual UInt_t GetHeight() const
Definition TGTableCell.h:94
virtual UInt_t GetColumn() const
Definition TGTableCell.h:89
Create an array to hold a bunch of numbers.
Definition TGTable.h:34
A tooltip can be a one or multiple lines help text that is displayed in a window when the mouse curso...
Definition TGToolTip.h:24
ROOT GUI Window base class.
Definition TGWindow.h:23
An array of TObjects.
Definition TObjArray.h:31
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17