Logo ROOT  
Reference Guide
TGString.h
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Fons Rademakers 05/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 #ifndef ROOT_TGString
13 #define ROOT_TGString
14 
15 
16 #include "TString.h"
17 #include "GuiTypes.h"
18 
19 
20 class TGString : public TString {
21 
22 public:
23  TGString() : TString() { }
24  TGString(const char *s) : TString(s) { }
25  TGString(Int_t number) : TString() { *this += number; }
26  TGString(const TGString *s);
27  virtual ~TGString() { }
28 
29  Int_t GetLength() const { return Length(); }
30  const char *GetString() const { return Data(); }
31  virtual void SetString(const char *s) { *this = s; }
32 
33  virtual void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y);
34  virtual void DrawWrapped(Drawable_t id, GContext_t gc,
35  Int_t x, Int_t y, UInt_t w, FontStruct_t font);
36  virtual Int_t GetLines(FontStruct_t font, UInt_t w);
37 
38  ClassDef(TGString,0) // Graphics string
39 };
40 
41 
42 class TGHotString : public TGString {
43 
44 protected:
45  char fHotChar; ///< hot character
46  Int_t fHotPos; ///< position of hot character
47 
48  GContext_t fLastGC; ///< context used during last drawing
49  Int_t fOff1; ///< variable used during drawing (cache)
50  Int_t fOff2; ///< variable used during drawing (cache)
51 
53 
54 public:
55  TGHotString(const char *s);
56 
57  Int_t GetHotChar() const { return fHotChar; }
58  Int_t GetHotPos() const { return fHotPos; }
59  virtual void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y);
60  virtual void DrawWrapped(Drawable_t id, GContext_t gc,
61  Int_t x, Int_t y, UInt_t w, FontStruct_t font);
62 
63  ClassDef(TGHotString,0) // Graphics string with hot character
64 };
65 
66 #endif
TGString::~TGString
virtual ~TGString()
Definition: TGString.h:27
TGHotString::DrawHotChar
void DrawHotChar(Drawable_t id, GContext_t gc, Int_t x, Int_t y)
Draw the underline under the hot character.
Definition: TGString.cxx:237
TGString::DrawWrapped
virtual void DrawWrapped(Drawable_t id, GContext_t gc, Int_t x, Int_t y, UInt_t w, FontStruct_t font)
Draw a string in a column with width w.
Definition: TGString.cxx:65
TGHotString::fHotChar
char fHotChar
hot character
Definition: TGString.h:45
TString::Data
const char * Data() const
Definition: TString.h:369
FontStruct_t
Handle_t FontStruct_t
Pointer to font structure.
Definition: GuiTypes.h:39
TGHotString
TGHotString is a string with a "hot" character underlined.
Definition: TGString.h:42
TGHotString::GetHotChar
Int_t GetHotChar() const
Definition: TGString.h:57
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:162
Int_t
int Int_t
Definition: RtypesCore.h:45
x
Double_t x[n]
Definition: legend1.C:17
TString::Length
Ssiz_t Length() const
Definition: TString.h:410
TGHotString::TGHotString
TGHotString(const char *s)
Create a hot string.
Definition: TGString.cxx:140
TGString::GetLines
virtual Int_t GetLines(FontStruct_t font, UInt_t w)
Get number of lines of width w the string would take using a certain font.
Definition: TGString.cxx:107
TString
Basic string class.
Definition: TString.h:136
TString.h
Drawable_t
Handle_t Drawable_t
Drawable handle.
Definition: GuiTypes.h:31
GContext_t
Handle_t GContext_t
Graphics context handle.
Definition: GuiTypes.h:38
TGHotString::fHotPos
Int_t fHotPos
position of hot character
Definition: TGString.h:46
TGString::GetLength
Int_t GetLength() const
Definition: TGString.h:29
TGHotString::fOff2
Int_t fOff2
variable used during drawing (cache)
Definition: TGString.h:50
TGHotString::Draw
virtual void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y)
Draw a hot string and underline the hot character.
Definition: TGString.cxx:175
GuiTypes.h
TGString::SetString
virtual void SetString(const char *s)
Definition: TGString.h:31
TGHotString::GetHotPos
Int_t GetHotPos() const
Definition: TGString.h:58
TGString::TGString
TGString(const char *s)
Definition: TGString.h:24
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
TGString::TGString
TGString(Int_t number)
Definition: TGString.h:25
y
Double_t y[n]
Definition: legend1.C:17
TGHotString::fOff1
Int_t fOff1
variable used during drawing (cache)
Definition: TGString.h:49
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGString::Draw
virtual void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y)
Draw string.
Definition: TGString.cxx:56
TGString::GetString
const char * GetString() const
Definition: TGString.h:30
TGHotString::fLastGC
GContext_t fLastGC
context used during last drawing
Definition: TGString.h:48
TGString
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition: TGString.h:20
TGString::TGString
TGString()
Definition: TGString.h:23
TGHotString::DrawWrapped
virtual void DrawWrapped(Drawable_t id, GContext_t gc, Int_t x, Int_t y, UInt_t w, FontStruct_t font)
Draw a hot string in a column with width w.
Definition: TGString.cxx:186
int