Logo ROOT  
Reference Guide
TGLabel.cxx
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Fons Rademakers 06/01/98
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 /**************************************************************************
12 
13  This source is based on Xclass95, a Win95-looking GUI toolkit.
14  Copyright (C) 1996, 1997 David Barth, Ricky Ralston, Hector Peraza.
15 
16  Xclass95 is free software; you can redistribute it and/or
17  modify it under the terms of the GNU Library General Public
18  License as published by the Free Software Foundation; either
19  version 2 of the License, or (at your option) any later version.
20 
21 **************************************************************************/
22 
23 
24 /** \class TGLabel
25  \ingroup guiwidgets
26 
27 This class handles GUI labels.
28 
29 */
30 
31 
32 #include "TGLabel.h"
33 #include "TGString.h"
34 #include "TGWidget.h"
35 #include "TGResourcePool.h"
36 #include "TColor.h"
37 #include "TClass.h"
38 #include "TVirtualX.h"
39 
40 #include <iostream>
41 
42 
43 const TGFont *TGLabel::fgDefaultFont = nullptr;
44 const TGGC *TGLabel::fgDefaultGC = nullptr;
45 
47 
48 ////////////////////////////////////////////////////////////////////////////////
49 /// Create a label GUI object. TGLabel will become the owner of the
50 /// text and will delete it in its dtor.
51 
53  FontStruct_t font, UInt_t options, ULong_t back) :
54  TGFrame(p, 1, 1, options, back)
55 {
56  fText = text;
60  fDisabled = kFALSE;
61  f3DStyle = 0;
62  fWrapLength = -1;
63  fTFlags = 0;
64  fMLeft = fMRight = fMTop = fMBottom = 0;
65 
66  if (!norm) {
67  norm = GetDefaultGC().GetGC();
68  }
69  fNormGC = norm;
70 
71  if (!font) {
72  font = fgDefaultFont->GetFontStruct();
73  }
74 
75  fFont = fClient->GetFontPool()->GetFont(font);
78  &fTWidth, &fTHeight);
79 
82  wattr.fBitGravity = 5; // center
83  wattr.fWinGravity = 1;
84  gVirtualX->ChangeWindowAttributes(fId, &wattr);
85 
86  Resize();
87  SetWindowName();
88 }
89 
90 ////////////////////////////////////////////////////////////////////////////////
91 /// Create a label GUI object.
92 
93 TGLabel::TGLabel(const TGWindow *p, const char *text, GContext_t norm,
94  FontStruct_t font, UInt_t options, ULong_t back) :
95  TGFrame(p, 1, 1, options, back)
96 {
97  fText = new TGString(!text && !p ? GetName() : text);
101  fDisabled = kFALSE;
102  f3DStyle = 0;
103  fWrapLength = -1;
104  fTFlags = 0;
105  fMLeft = fMRight = fMTop = fMBottom = 0;
106 
107  if (!norm) {
108  norm = GetDefaultGC().GetGC();
109  }
110  fNormGC = norm;
111 
112  if (!font) {
113  font = fgDefaultFont->GetFontStruct();
114  }
115 
116  fFont = fClient->GetFontPool()->GetFont(font);
119  &fTWidth, &fTHeight);
120 
121  SetWindowAttributes_t wattr;
123  wattr.fBitGravity = 5; // center
124  wattr.fWinGravity = 1;
125  gVirtualX->ChangeWindowAttributes(fId, &wattr);
126 
127  Resize();
128  SetWindowName();
129 }
130 
131 ////////////////////////////////////////////////////////////////////////////////
132 /// Delete label.
133 
135 {
136  if (fText) {
137  delete fText;
138  }
139 
140  if (fHasOwnFont) {
141  TGGCPool *pool = fClient->GetGCPool();
142  TGGC *gc = pool->FindGC(fNormGC);
143  if (gc) pool->FreeGC(gc);
144  }
145 
146  if (fFont != fgDefaultFont) {
148  }
149 
150  delete fTLayout;
151 }
152 
153 ////////////////////////////////////////////////////////////////////////////////
154 /// Layout label.
155 
157 {
158  delete fTLayout;
161  &fTWidth, &fTHeight);
162  fClient->NeedRedraw(this);
163 }
164 
165 ////////////////////////////////////////////////////////////////////////////////
166 /// Return default size.
167 
169 {
172  return TGDimension(w, h);
173 }
174 
175 ////////////////////////////////////////////////////////////////////////////////
176 /// Set new text in label. After calling this method one needs to call
177 /// the parents frame's Layout() method to force updating of the label size.
178 /// The new_text is adopted by the TGLabel and will be properly deleted.
179 
180 void TGLabel::SetText(TGString *new_text)
181 {
182  if (fText) delete fText;
183  fText = new_text;
185 
186  Layout();
187 }
188 
189 ////////////////////////////////////////////////////////////////////////////////
190 /// Draw text at position (x, y).
191 
193 {
194  fTLayout->DrawText(fId, gc, x, y, 0, -1);
195  //fTLayout->UnderlineChar(fId, gc, x, y, fText->GetHotPos());
196 }
197 
198 ////////////////////////////////////////////////////////////////////////////////
199 /// Redraw label widget.
200 
202 {
203  int x, y;
204 
207 
208  if (fTMode & kTextLeft) {
209  x = fMLeft;
210  } else if (fTMode & kTextRight) {
211  x = fWidth - fTWidth - fMRight;
212  } else {
213  x = (fWidth - fTWidth + fMLeft - fMRight) >> 1;
214  }
215 
216  if (fTMode & kTextTop) {
217  y = 0;
218  } else if (fTMode & kTextBottom) {
219  y = fHeight - fTHeight;
220  } else {
221  y = (fHeight - fTHeight) >> 1;
222  }
223 
224 
225  if (!fDisabled) {
227  TGGC *gc = pool->FindGC(fNormGC);
228 
229  if (!gc) {
230  fNormGC = GetDefaultGC().GetGC();
231  gc = pool->FindGC(fNormGC);
232  }
233  if (!gc) return;
234 
235  switch (f3DStyle) {
236  case kRaisedFrame:
237  case kSunkenFrame:
238  {
239  Pixel_t forecolor = gc->GetForeground();
241  Pixel_t sh = forecolor;
242 
243  if (f3DStyle == kRaisedFrame) {
244  Pixel_t t = hi;
245  hi = sh;
246  sh = t;
247  }
248 
249  gc->SetForeground(hi);
250  DrawText(gc->GetGC(), x+1, y+1);
251  gc->SetForeground(sh);
252  DrawText(gc->GetGC(), x, y);
253  gc->SetForeground(forecolor);
254  }
255  break;
256 
257  default:
258  DrawText(fNormGC, x, y);
259  break;
260  }
261  } else { // disabled
262  FontH_t fontH;
263 
265  fontH = gVirtualX->GetFontHandle(fFont->GetFontStruct());
266  } else {
267  fontH = gVirtualX->GetFontHandle(GetDefaultFontStruct());
268  }
269  static TGGC *gc1 = 0;
270  static TGGC *gc2 = 0;
271 
272  if (!gc1) {
274  gc1 = new TGGC(*gc1); // copy
275  }
276  gc1->SetFont(fontH);
277  DrawText(gc1->GetGC(), x + 1, y + 1);
278 
279  if (!gc2) {
281  gc2 = new TGGC(*gc2); // copy
282  }
283  gc2->SetFont(fontH);
284  DrawText(gc2->GetGC(), x, y);
285  }
286 }
287 
288 ////////////////////////////////////////////////////////////////////////////////
289 /// Changes text font.
290 /// If global is true font is changed globally - otherwise locally.
291 
292 void TGLabel::SetTextFont(FontStruct_t fontStruct, Bool_t global)
293 {
294  TGFont *font = fClient->GetFontPool()->GetFont(fontStruct);
295 
296  if (!font) {
297  //error
298  return;
299  }
300 
301  SetTextFont(font, global);
302 }
303 
304 ////////////////////////////////////////////////////////////////////////////////
305 /// Changes text font specified by name.
306 /// If global is true font is changed globally - otherwise locally.
307 
308 void TGLabel::SetTextFont(const char *fontName, Bool_t global)
309 {
310  TGFont *font = fClient->GetFont(fontName);
311 
312  if (!font) {
313  // error
314  return;
315  }
316 
317  SetTextFont(font, global);
318 }
319 
320 ////////////////////////////////////////////////////////////////////////////////
321 /// Changes text font specified by pointer to TGFont object.
322 /// If global is true font is changed globally - otherwise locally.
323 
324 void TGLabel::SetTextFont(TGFont *font, Bool_t global)
325 {
326  if (!font) {
327  //error
328  return;
329  }
330 
331  TGFont *oldfont = fFont;
332  fFont = fClient->GetFont(font); // increase usage count
333  if (!fFont) {
334  fFont = oldfont;
335  return;
336  }
337 
339  TGGC *gc = pool->FindGC(fNormGC);
340 
341  if (!global) {
342  if (gc == &GetDefaultGC() ) { // create new GC
343  gc = pool->GetGC((GCValues_t*)gc->GetAttributes(), kTRUE); // copy ctor.
344  }
345  fHasOwnFont = kTRUE;
346  }
347  if (oldfont != fgDefaultFont) {
348  fClient->FreeFont(oldfont);
349  }
350  if (gc) {
351  gc->SetFont(fFont->GetFontHandle());
352  fNormGC = gc->GetGC();
353  }
355  Layout();
356 }
357 
358 ////////////////////////////////////////////////////////////////////////////////
359 /// Changes text color.
360 /// If global is true color is changed globally - otherwise locally.
361 
363 {
365  TGGC *gc = pool->FindGC(fNormGC);
366 
367  if (!global) {
368  if (gc == &GetDefaultGC() ) {
369  gc = pool->GetGC((GCValues_t*)gc->GetAttributes(), kTRUE); // copy
370  }
371  fHasOwnFont = kTRUE;
372  }
373  if (gc) {
374  gc->SetForeground(color);
375  fNormGC = gc->GetGC();
376  }
377  fClient->NeedRedraw(this);
378 }
379 
380 ////////////////////////////////////////////////////////////////////////////////
381 /// Changes text color.
382 /// If global is true color is changed globally - otherwise locally.
383 
384 void TGLabel::SetTextColor(TColor *color, Bool_t global)
385 {
386  if (color) {
387  SetTextColor(color->GetPixel(), global);
388  }
389 }
390 
391 ////////////////////////////////////////////////////////////////////////////////
392 /// Set text justification. Mode is an OR of the bits:
393 /// kTextTop, kTextBottom, kTextLeft, kTextRight, kTextCenterX and
394 /// kTextCenterY.
395 
397 {
399  fTMode = mode;
400 
401  SetWindowAttributes_t wattr;
403  wattr.fWinGravity = 1;
404 
405  switch (mode) {
406  case kTextTop | kTextLeft:
407  wattr.fBitGravity = 1; //NorthWestGravity
408  break;
409  case kTextTop | kTextCenterX:
410  case kTextTop:
411  wattr.fBitGravity = 2; //NorthGravity
412  break;
413  case kTextTop | kTextRight:
414  wattr.fBitGravity = 3; //NorthEastGravity
415  break;
416  case kTextLeft | kTextCenterY:
417  case kTextLeft:
418  wattr.fBitGravity = 4; //WestGravity
419  break;
420  case kTextCenterY | kTextCenterX:
421  wattr.fBitGravity = 5; //CenterGravity
422  break;
423  case kTextRight | kTextCenterY:
424  case kTextRight:
425  wattr.fBitGravity = 6; //EastGravity
426  break;
427  case kTextBottom | kTextLeft:
428  wattr.fBitGravity = 7; //SouthWestGravity
429  break;
430  case kTextBottom | kTextCenterX:
431  case kTextBottom:
432  wattr.fBitGravity = 8; //SouthGravity
433  break;
434  case kTextBottom | kTextRight:
435  wattr.fBitGravity = 9; //SouthEastGravity
436  break;
437  default:
438  wattr.fBitGravity = 5; //CenterGravity
439  break;
440  }
441 
442  gVirtualX->ChangeWindowAttributes(fId, &wattr);
443 
444  Layout();
445 }
446 
447 ////////////////////////////////////////////////////////////////////////////////
448 /// Returns kTRUE if text attributes are unique.
449 /// Returns kFALSE if text attributes are shared (global).
450 
452 {
453  return fHasOwnFont;
454 }
455 
456 ////////////////////////////////////////////////////////////////////////////////
457 /// Save a label widget as a C++ statement(s) on output stream out.
458 
459 void TGLabel::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
460 {
461  char quote = '"';
462 
463  // font + GC
464  option = GetName()+5; // unique digit id of the name
465  TString parGC, parFont;
466  parFont.Form("%s::GetDefaultFontStruct()",IsA()->GetName());
467  parGC.Form("%s::GetDefaultGC()()",IsA()->GetName());
468 
469  if ((GetDefaultFontStruct() != fFont->GetFontStruct()) || (GetDefaultGC()() != fNormGC)) {
471  if (ufont) {
472  ufont->SavePrimitive(out, option);
473  parFont.Form("ufont->GetFontStruct()");
474  }
475 
477  if (userGC) {
478  userGC->SavePrimitive(out, option);
479  parGC.Form("uGC->GetGC()");
480  }
481  }
482 
483  if (fBackground != GetDefaultFrameBackground()) SaveUserColor(out, option);
484 
485  TString label = GetText()->GetString();
486  label.ReplaceAll("\"","\\\"");
487  label.ReplaceAll("\n","\\n");
488 
489  out << " TGLabel *";
490  out << GetName() << " = new TGLabel("<< fParent->GetName()
491  << "," << quote << label << quote;
493  if (!GetOptions()) {
495  if (fNormGC == GetDefaultGC()()) {
496  out <<");" << std::endl;
497  } else {
498  out << "," << parGC.Data() << ");" << std::endl;
499  }
500  } else {
501  out << "," << parGC.Data() << "," << parFont.Data() << ");" << std::endl;
502  }
503  } else {
504  out << "," << parGC.Data() << "," << parFont.Data() << "," << GetOptionString() <<");" << std::endl;
505  }
506  } else {
507  out << "," << parGC.Data() << "," << parFont.Data() << "," << GetOptionString() << ",ucolor);" << std::endl;
508  }
509  if (option && strstr(option, "keep_names"))
510  out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
511 
512  if (fDisabled)
513  out << " " << GetName() << "->Disable();" << std::endl;
514 
515  out << " " << GetName() << "->SetTextJustify(" << GetTextJustify() << ");" << std::endl;
516  out << " " << GetName() << "->SetMargins(" << fMLeft << "," << fMRight << ",";
517  out << fMTop << "," << fMBottom << ");" << std::endl;
518  out << " " << GetName() << "->SetWrapLength(" << fWrapLength << ");" << std::endl;
519 
520 }
521 
522 ////////////////////////////////////////////////////////////////////////////////
523 /// Static returning label default font struct.
524 
526 {
527  if (!fgDefaultFont) {
528  fgDefaultFont = gClient->GetResourcePool()->GetDefaultFont();
529  }
530  return fgDefaultFont->GetFontStruct();
531 }
532 
533 ////////////////////////////////////////////////////////////////////////////////
534 /// Static returning label default graphics context.
535 
537 {
538  if (!fgDefaultGC) {
539  fgDefaultGC = gClient->GetResourcePool()->GetFrameGC();
540  }
541  return *fgDefaultGC;
542 }
TGWindow::SetWindowName
virtual void SetWindowName(const char *name=0)
Set window name.
Definition: TGWindow.cxx:129
TGTextLayout::DrawText
void DrawText(Drawable_t dst, GContext_t gc, Int_t x, Int_t y, Int_t firstChar, Int_t lastChar) const
Use the information in the TGTextLayout object to display a multi-line, justified string of text.
Definition: TGFont.cxx:923
TGClient::FreeFont
void FreeFont(const TGFont *font)
Free a font.
Definition: TGClient.cxx:366
SetWindowAttributes_t::fBitGravity
Int_t fBitGravity
one of bit gravity values
Definition: GuiTypes.h:99
TGFontPool::GetFont
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get the specified font.
Definition: TGFont.cxx:1558
TGWindow
ROOT GUI Window base class.
Definition: TGWindow.h:23
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
kFixedWidth
@ kFixedWidth
Definition: GuiTypes.h:387
kTextTop
@ kTextTop
Definition: TGWidget.h:26
TGGC::GetGC
GContext_t GetGC() const
Definition: TGGC.h:41
TGGC::GetForeground
Pixel_t GetForeground() const
Definition: TGGC.h:73
TGDimension
Definition: TGDimension.h:18
TGGC::GetAttributes
const GCValues_t * GetAttributes() const
Definition: TGGC.h:69
Option_t
const char Option_t
Definition: RtypesCore.h:66
TGResourcePool::GetGCPool
TGGCPool * GetGCPool() const
Definition: TGResourcePool.h:93
TGClient::GetFontPool
TGFontPool * GetFontPool() const
Definition: TGClient.h:136
TGClient::GetGCPool
TGGCPool * GetGCPool() const
Definition: TGClient.h:131
gVirtualX
#define gVirtualX
Definition: TVirtualX.h:338
TString::Data
const char * Data() const
Definition: TString.h:369
TGLabel::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a label widget as a C++ statement(s) on output stream out.
Definition: TGLabel.cxx:459
Pixel_t
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
FontH_t
Handle_t FontH_t
Font handle (as opposed to Font_t which is an index)
Definition: GuiTypes.h:35
TGLabel::fText
TGString * fText
label text
Definition: TGLabel.h:27
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TColor::GetPixel
ULong_t GetPixel() const
Return pixel value corresponding to this color.
Definition: TColor.cxx:1446
TGFrame::fWidth
UInt_t fWidth
frame width
Definition: TGFrame.h:87
TGGC::SavePrimitive
void SavePrimitive(std::ostream &out, Option_t *option="")
Save graphics context info as a C++ statement(s) on output stream out.
Definition: TGGC.cxx:627
TGFontPool::FreeFont
void FreeFont(const TGFont *font)
Free font. If ref count is 0 delete font.
Definition: TGFont.cxx:1718
FontStruct_t
Handle_t FontStruct_t
Pointer to font structure.
Definition: GuiTypes.h:39
TGLabel
This class handles GUI labels.
Definition: TGLabel.h:24
GCValues_t
Graphics context structure.
Definition: GuiTypes.h:224
TGResourcePool::GetFontPool
TGFontPool * GetFontPool() const
Definition: TGResourcePool.h:94
kTextCenterX
@ kTextCenterX
Definition: TGWidget.h:25
x
Double_t x[n]
Definition: legend1.C:17
TClass.h
TColor.h
TGLabel::GetDefaultFontStruct
static FontStruct_t GetDefaultFontStruct()
Static returning label default font struct.
Definition: TGLabel.cxx:525
TGFrame::GetDefaultFrameBackground
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:683
TVirtualX.h
kTextCenterY
@ kTextCenterY
Definition: TGWidget.h:28
TGClient::GetResourcePool
const TGResourcePool * GetResourcePool() const
Definition: TGClient.h:124
TGFont::ComputeTextLayout
TGTextLayout * ComputeTextLayout(const char *string, Int_t numChars, Int_t wrapLength, Int_t justify, Int_t flags, UInt_t *width, UInt_t *height) const
Computes the amount of screen space needed to display a multi-line, justified string of text.
Definition: TGFont.cxx:661
TString
Basic string class.
Definition: TString.h:136
TGFrame
Definition: TGFrame.h:80
TGLabel::fMBottom
Int_t fMBottom
margin bottom
Definition: TGLabel.h:33
SetWindowAttributes_t::fMask
Mask_t fMask
bit mask specifying which fields are valid
Definition: GuiTypes.h:110
text
TText * text
Definition: entrylist_figure1.C:10
TGGCPool::GetGC
TGGC * GetGC(GCValues_t *values, Bool_t rw=kFALSE)
Get the best matching graphics context depending on values.
Definition: TGGC.cxx:987
TGLabel::SetText
virtual void SetText(TGString *newText)
Set new text in label.
Definition: TGLabel.cxx:180
bool
TString::ReplaceAll
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:692
TGGCPool::FreeGC
void FreeGC(const TGGC *gc)
Delete graphics context if it is not used anymore.
Definition: TGGC.cxx:918
TGLabel::fgDefaultFont
static const TGFont * fgDefaultFont
Definition: TGLabel.h:48
TGLabel::DoRedraw
virtual void DoRedraw()
Redraw label widget.
Definition: TGLabel.cxx:201
TGFrame::GetOptionString
TString GetOptionString() const
Returns a frame option string - used in SavePrimitive().
Definition: TGFrame.cxx:2480
kWABitGravity
const Mask_t kWABitGravity
Definition: GuiTypes.h:144
TGFrame::GetOptions
virtual UInt_t GetOptions() const
Definition: TGFrame.h:197
GContext_t
Handle_t GContext_t
Graphics context handle.
Definition: GuiTypes.h:38
TGLabel::fTLayout
TGTextLayout * fTLayout
text layout
Definition: TGLabel.h:41
gClient
#define gClient
Definition: TGClient.h:157
kTextLeft
@ kTextLeft
Definition: TGWidget.h:23
TGFontPool::FindFont
TGFont * FindFont(FontStruct_t font) const
Find font based on its font struct. Returns 0 if font is not found.
Definition: TGFont.cxx:1744
hi
float type_of_call hi(const int &, const int &)
TGString::GetLength
Int_t GetLength() const
Definition: TGString.h:29
TGLabel::fMLeft
Int_t fMLeft
margin left
Definition: TGLabel.h:30
TString::Form
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2311
TGFrame::GetHilightGC
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition: TGFrame.cxx:755
TGLabel::DrawText
virtual void DrawText(GContext_t gc, Int_t x, Int_t y)
Draw text at position (x, y).
Definition: TGLabel.cxx:192
kSunkenFrame
@ kSunkenFrame
Definition: GuiTypes.h:383
TGLabel::TGLabel
TGLabel(const TGLabel &)=delete
kFixedHeight
@ kFixedHeight
Definition: GuiTypes.h:389
TGLabel::GetTextJustify
Int_t GetTextJustify() const
Definition: TGLabel.h:82
TColor
The color creation and management class.
Definition: TColor.h:19
TGLabel::fNormGC
GContext_t fNormGC
graphics context used for drawing label
Definition: TGLabel.h:39
SetWindowAttributes_t::fWinGravity
Int_t fWinGravity
one of the window gravity values
Definition: GuiTypes.h:100
h
#define h(i)
Definition: RSha256.hxx:106
TGWindow::GetName
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGWindow.cxx:336
TGGC
Encapsulate a graphics context used in the low level graphics.
Definition: TGGC.h:22
TGFrame::Resize
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:605
TGObject::fId
Handle_t fId
X11/Win32 Window identifier.
Definition: TGObject.h:26
TGLabel::~TGLabel
virtual ~TGLabel()
Delete label.
Definition: TGLabel.cxx:134
TGLabel::fHasOwnFont
Bool_t fHasOwnFont
kTRUE - font defined locally, kFALSE - globally
Definition: TGLabel.h:42
kWAWinGravity
const Mask_t kWAWinGravity
Definition: GuiTypes.h:145
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
TGFont::GetFontHandle
FontH_t GetFontHandle() const
Definition: TGFont.h:183
TGFrame::SaveUserColor
void SaveUserColor(std::ostream &out, Option_t *)
Save a user color in a C++ macro file - used in SavePrimitive().
Definition: TGFrame.cxx:2453
TGLabel::fTWidth
UInt_t fTWidth
text width
Definition: TGLabel.h:28
y
Double_t y[n]
Definition: legend1.C:17
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
kTextBottom
@ kTextBottom
Definition: TGWidget.h:27
TGWidget.h
kRaisedFrame
@ kRaisedFrame
Definition: GuiTypes.h:384
TGString.h
unsigned int
TGLabel::SetTextFont
virtual void SetTextFont(TGFont *font, Bool_t global=kFALSE)
Changes text font specified by pointer to TGFont object.
Definition: TGLabel.cxx:324
TGLabel::fTMode
Int_t fTMode
text alignment
Definition: TGLabel.h:34
TGLabel.h
TGLabel::fTFlags
Int_t fTFlags
text flags (see TGFont.h ETextLayoutFlags)
Definition: TGLabel.h:37
TGClient::NeedRedraw
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:374
TGLabel::GetDefaultSize
virtual TGDimension GetDefaultSize() const
Return default size.
Definition: TGLabel.cxx:168
TGLabel::SetTextColor
virtual void SetTextColor(Pixel_t color, Bool_t global=kFALSE)
Changes text color.
Definition: TGLabel.cxx:362
TGLabel::GetText
const TGString * GetText() const
Definition: TGLabel.h:74
TGObject::fClient
TGClient * fClient
Connection to display server.
Definition: TGObject.h:27
TGGCPool
Definition: TGGC.h:103
TGGC::SetForeground
void SetForeground(Pixel_t v)
Set foreground color.
Definition: TGGC.cxx:278
TGLabel::GetDefaultGC
static const TGGC & GetDefaultGC()
Static returning label default graphics context.
Definition: TGLabel.cxx:536
TGLabel::fgDefaultGC
static const TGGC * fgDefaultGC
Definition: TGLabel.h:49
TGFrame::GetWhitePixel
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition: TGFrame.cxx:709
TGClient::GetFont
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get a font from the font pool.
Definition: TGClient.cxx:350
TGFrame::GetShadowGC
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition: TGFrame.cxx:765
TGString::GetString
const char * GetString() const
Definition: TGString.h:30
TGLabel::fTextChanged
Bool_t fTextChanged
has text changed
Definition: TGLabel.h:38
TGFont::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save the used font as a C++ statement(s) on output stream out.
Definition: TGFont.cxx:1884
TGLabel::HasOwnFont
Bool_t HasOwnFont() const
Returns kTRUE if text attributes are unique.
Definition: TGLabel.cxx:451
TGResourcePool.h
TGGCPool::FindGC
TGGC * FindGC(const TGGC *gc)
Find graphics context. Returns 0 in case gc is not found.
Definition: TGGC.cxx:951
TGFont::GetFontStruct
FontStruct_t GetFontStruct() const
Definition: TGFont.h:184
TGLabel::f3DStyle
Int_t f3DStyle
3D style (0 - normal, kRaisedFrame - raised, kSunkenFrame - sunken)
Definition: TGLabel.h:35
kTextRight
@ kTextRight
Definition: TGWidget.h:24
TGFrame::fHeight
UInt_t fHeight
frame height
Definition: TGFrame.h:88
TGFrame::fBackground
Pixel_t fBackground
frame background color
Definition: TGFrame.h:95
TGLabel::fMTop
Int_t fMTop
margin top
Definition: TGLabel.h:32
TGFont
Encapsulate fonts used in the GUI system.
Definition: TGFont.h:140
TGLabel::fFont
TGFont * fFont
font to draw label
Definition: TGLabel.h:40
TGLabel::fWrapLength
Int_t fWrapLength
wrap length
Definition: TGLabel.h:36
TGString
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition: TGString.h:20
TGLabel::SetTextJustify
void SetTextJustify(Int_t tmode)
Set text justification.
Definition: TGLabel.cxx:396
TGGC::SetFont
void SetFont(FontH_t v)
Set font.
Definition: TGGC.cxx:411
TGLabel::fDisabled
Bool_t fDisabled
if kTRUE label looks disabled (shaded text)
Definition: TGLabel.h:43
TGWindow::fParent
const TGWindow * fParent
Parent window.
Definition: TGWindow.h:28
TGLabel::Layout
virtual void Layout()
Layout label.
Definition: TGLabel.cxx:156
TGLabel::fTHeight
UInt_t fTHeight
text height
Definition: TGLabel.h:29
int
SetWindowAttributes_t
Attributes that can be used when creating or changing a window.
Definition: GuiTypes.h:93
TGLabel::fMRight
Int_t fMRight
margin right
Definition: TGLabel.h:31
TGFrame::DoRedraw
virtual void DoRedraw()
Redraw the frame.
Definition: TGFrame.cxx:430