// @(#)root/gui:$Id$
// Author: Fons Rademakers   05/01/98

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGString
#define ROOT_TGString


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGString and TGHotString                                             //
//                                                                      //
// TGString wraps a TString and adds some graphics routines like        //
// drawing, size of string on screen depending on font, etc.            //
// TGHotString is a string with a "hot" character unerlined.            //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TString
#include "TString.h"
#endif
#ifndef ROOT_GuiTypes
#include "GuiTypes.h"
#endif


class TGString : public TString {

public:
   TGString() : TString() { }
   TGString(const char *s) : TString(s) { }
   TGString(Int_t number) : TString() { *this += number; }
   TGString(const TGString *s);
   virtual ~TGString() { }

   Int_t GetLength() const { return Length(); }
   const char  *GetString() const { return Data(); }
   virtual void SetString(const char *s) { *this = s; }

   virtual void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y);
   virtual void DrawWrapped(Drawable_t id, GContext_t gc,
                            Int_t x, Int_t y, UInt_t w, FontStruct_t font);
   virtual Int_t GetLines(FontStruct_t font, UInt_t w);

   ClassDef(TGString,0)  // Graphics string
};


class TGHotString : public TGString {

protected:
   char        fHotChar;      // hot character
   Int_t       fHotPos;       // position of hot character

   GContext_t  fLastGC;       // context used during last drawing
   Int_t       fOff1;         // variable used during drawing (cache)
   Int_t       fOff2;         // variable used during drawing (cache)

   void DrawHotChar(Drawable_t id, GContext_t gc, Int_t x, Int_t y);

public:
   TGHotString(const char *s);

   Int_t GetHotChar() const { return fHotChar; }
   Int_t GetHotPos() const { return fHotPos; }
   virtual void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y);
   virtual void DrawWrapped(Drawable_t id, GContext_t gc,
                            Int_t x, Int_t y, UInt_t w, FontStruct_t font);

   ClassDef(TGHotString,0)  // Graphics string with hot character
};

#endif
 TGString.h:1
 TGString.h:2
 TGString.h:3
 TGString.h:4
 TGString.h:5
 TGString.h:6
 TGString.h:7
 TGString.h:8
 TGString.h:9
 TGString.h:10
 TGString.h:11
 TGString.h:12
 TGString.h:13
 TGString.h:14
 TGString.h:15
 TGString.h:16
 TGString.h:17
 TGString.h:18
 TGString.h:19
 TGString.h:20
 TGString.h:21
 TGString.h:22
 TGString.h:23
 TGString.h:24
 TGString.h:25
 TGString.h:26
 TGString.h:27
 TGString.h:28
 TGString.h:29
 TGString.h:30
 TGString.h:31
 TGString.h:32
 TGString.h:33
 TGString.h:34
 TGString.h:35
 TGString.h:36
 TGString.h:37
 TGString.h:38
 TGString.h:39
 TGString.h:40
 TGString.h:41
 TGString.h:42
 TGString.h:43
 TGString.h:44
 TGString.h:45
 TGString.h:46
 TGString.h:47
 TGString.h:48
 TGString.h:49
 TGString.h:50
 TGString.h:51
 TGString.h:52
 TGString.h:53
 TGString.h:54
 TGString.h:55
 TGString.h:56
 TGString.h:57
 TGString.h:58
 TGString.h:59
 TGString.h:60
 TGString.h:61
 TGString.h:62
 TGString.h:63
 TGString.h:64
 TGString.h:65
 TGString.h:66
 TGString.h:67
 TGString.h:68
 TGString.h:69
 TGString.h:70
 TGString.h:71
 TGString.h:72
 TGString.h:73
 TGString.h:74
 TGString.h:75
 TGString.h:76
 TGString.h:77
 TGString.h:78
 TGString.h:79
 TGString.h:80