TGString.h

Go to the documentation of this file.
00001 // @(#)root/gui:$Id: TGString.h 23115 2008-04-10 13:35:37Z rdm $
00002 // Author: Fons Rademakers   05/01/98
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TGString
00013 #define ROOT_TGString
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TGString and TGHotString                                             //
00019 //                                                                      //
00020 // TGString wraps a TString and adds some graphics routines like        //
00021 // drawing, size of string on screen depending on font, etc.            //
00022 // TGHotString is a string with a "hot" character unerlined.            //
00023 //                                                                      //
00024 //////////////////////////////////////////////////////////////////////////
00025 
00026 #ifndef ROOT_TString
00027 #include "TString.h"
00028 #endif
00029 #ifndef ROOT_GuiTypes
00030 #include "GuiTypes.h"
00031 #endif
00032 
00033 
00034 class TGString : public TString {
00035 
00036 public:
00037    TGString() : TString() { }
00038    TGString(const char *s) : TString(s) { }
00039    TGString(Int_t number) : TString() { *this += number; }
00040    TGString(const TGString *s);
00041    virtual ~TGString() { }
00042 
00043    Int_t GetLength() const { return Length(); }
00044    const char  *GetString() const { return Data(); }
00045    virtual void SetString(const char *s) { *this = s; }
00046 
00047    virtual void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y);
00048    virtual void DrawWrapped(Drawable_t id, GContext_t gc,
00049                             Int_t x, Int_t y, UInt_t w, FontStruct_t font);
00050    virtual Int_t GetLines(FontStruct_t font, UInt_t w);
00051 
00052    ClassDef(TGString,0)  // Graphics string
00053 };
00054 
00055 
00056 class TGHotString : public TGString {
00057 
00058 protected:
00059    char        fHotChar;      // hot character
00060    Int_t       fHotPos;       // position of hot character
00061 
00062    GContext_t  fLastGC;       // context used during last drawing
00063    Int_t       fOff1;         // variable used during drawing (cache)
00064    Int_t       fOff2;         // variable used during drawing (cache)
00065 
00066    void DrawHotChar(Drawable_t id, GContext_t gc, Int_t x, Int_t y);
00067 
00068 public:
00069    TGHotString(const char *s);
00070 
00071    Int_t GetHotChar() const { return fHotChar; }
00072    Int_t GetHotPos() const { return fHotPos; }
00073    virtual void Draw(Drawable_t id, GContext_t gc, Int_t x, Int_t y);
00074    virtual void DrawWrapped(Drawable_t id, GContext_t gc,
00075                             Int_t x, Int_t y, UInt_t w, FontStruct_t font);
00076 
00077    ClassDef(TGHotString,0)  // Graphics string with hot character
00078 };
00079 
00080 #endif

Generated on Tue Jul 5 14:20:08 2011 for ROOT_528-00b_version by  doxygen 1.5.1