Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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//////////////////////////////////////////////////////////////////////////
17// //
18// TGString and TGHotString //
19// //
20// TGString wraps a TString and adds some graphics routines like //
21// drawing, size of string on screen depending on font, etc. //
22// TGHotString is a string with a "hot" character unerlined. //
23// //
24//////////////////////////////////////////////////////////////////////////
25
26#include "TString.h"
27#include "GuiTypes.h"
28
29
30class TGString : public TString {
31
32public:
33 TGString() : TString() { }
34 TGString(const char *s) : TString(s) { }
35 TGString(Int_t number) : TString() { *this += number; }
36 TGString(const TGString *s);
37 virtual ~TGString() { }
38
39 Int_t GetLength() const { return Length(); }
40 const char *GetString() const { return Data(); }
41 virtual void SetString(const char *s) { *this = s; }
42
43 virtual void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y);
44 virtual void DrawWrapped(Drawable_t id, GContext_t gc,
45 Int_t x, Int_t y, UInt_t w, FontStruct_t font);
46 virtual Int_t GetLines(FontStruct_t font, UInt_t w);
47
48 ClassDef(TGString,0) // Graphics string
49};
50
51
52class TGHotString : public TGString {
53
54protected:
55 char fHotChar; // hot character
56 Int_t fHotPos; // position of hot character
57
58 GContext_t fLastGC; // context used during last drawing
59 Int_t fOff1; // variable used during drawing (cache)
60 Int_t fOff2; // variable used during drawing (cache)
61
63
64public:
65 TGHotString(const char *s);
66
67 Int_t GetHotChar() const { return fHotChar; }
68 Int_t GetHotPos() const { return fHotPos; }
69 virtual void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y);
70 virtual void DrawWrapped(Drawable_t id, GContext_t gc,
71 Int_t x, Int_t y, UInt_t w, FontStruct_t font);
72
73 ClassDef(TGHotString,0) // Graphics string with hot character
74};
75
76#endif
Handle_t Drawable_t
Drawable handle.
Definition GuiTypes.h:31
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:38
Handle_t FontStruct_t
Pointer to font structure.
Definition GuiTypes.h:39
int Int_t
Definition RtypesCore.h:45
unsigned int UInt_t
Definition RtypesCore.h:46
#define ClassDef(name, id)
Definition Rtypes.h:325
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:181
Int_t fOff1
Definition TGString.h:59
char fHotChar
Definition TGString.h:55
void DrawHotChar(Drawable_t id, GContext_t gc, Int_t x, Int_t y)
Draw the underline under the hot character.
Definition TGString.cxx:232
Int_t GetHotPos() const
Definition TGString.h:68
Int_t GetHotChar() const
Definition TGString.h:67
GContext_t fLastGC
Definition TGString.h:58
Int_t fHotPos
Definition TGString.h:56
Int_t fOff2
Definition TGString.h:60
Int_t GetLength() const
Definition TGString.h:39
virtual void SetString(const char *s)
Definition TGString.h:41
const char * GetString() const
Definition TGString.h:40
TGString(Int_t number)
Definition TGString.h:35
TGString(const char *s)
Definition TGString.h:34
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:102
TGString()
Definition TGString.h:33
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:60
virtual ~TGString()
Definition TGString.h:37
Basic string class.
Definition TString.h:136
Ssiz_t Length() const
Definition TString.h:410
const char * Data() const
Definition TString.h:369
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
th1 Draw()