#ifndef ROOT_TGPicture
#define ROOT_TGPicture
#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TRefCnt
#include "TRefCnt.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif
#ifndef ROOT_TGClient
#include "TGClient.h"
#endif
#ifndef ROOT_TGGC
#include "TGGC.h"
#endif
class THashTable;
class TGPicture : public TObject, public TRefCnt {
friend class TGPicturePool;
protected:
TString fName;
Bool_t fScaled;
Pixmap_t fPic;
Pixmap_t fMask;
PictureAttributes_t fAttributes;
TGPicture(const char *name, Bool_t scaled = kFALSE):
fName(name), fScaled(scaled), fPic(kNone), fMask(kNone), fAttributes()
{
fAttributes.fPixels = 0;
SetRefCount(1);
}
TGPicture(const char *name, Pixmap_t pxmap, Pixmap_t mask = 0);
void Draw(Option_t * = "") { MayNotUse("Draw(Option_t*)"); }
public:
virtual ~TGPicture();
const char *GetName() const { return fName; }
UInt_t GetWidth() const { return fAttributes.fWidth; }
UInt_t GetHeight() const { return fAttributes.fHeight; }
Pixmap_t GetPicture() const { return fPic; }
Pixmap_t GetMask() const { return fMask; }
Bool_t IsScaled() const { return fScaled; }
ULong_t Hash() const { return fName.Hash(); }
static const char *HashName(const char *name, Int_t width, Int_t height);
virtual void Draw(Handle_t id, GContext_t gc, Int_t x, Int_t y) const;
void Print(Option_t *option="") const;
ClassDef(TGPicture,0)
};
class TGSelectedPicture : public TGPicture {
protected:
const TGClient *fClient;
static TGGC *fgSelectedGC;
static TGGC &GetSelectedGC();
TGSelectedPicture(const TGSelectedPicture& gp):
TGPicture(gp), fClient(gp.fClient) { }
TGSelectedPicture& operator=(const TGSelectedPicture& gp)
{if(this!=&gp) { TGPicture::operator=(gp); fClient=gp.fClient;}
return *this;}
public:
TGSelectedPicture(const TGClient *client, const TGPicture *p);
virtual ~TGSelectedPicture();
ClassDef(TGSelectedPicture,0)
};
class TGPicturePool : public TObject {
protected:
const TGClient *fClient;
TString fPath;
THashTable *fPicList;
TGPicturePool(const TGPicturePool&);
TGPicturePool& operator=(const TGPicturePool&);
public:
TGPicturePool(const TGClient *client, const char *path):
fClient(client), fPath(path), fPicList(0) { }
virtual ~TGPicturePool();
const char *GetPath() const { return fPath; }
const TGPicture *GetPicture(const char *name);
const TGPicture *GetPicture(const char *name, char **xpm);
const TGPicture *GetPicture(const char *name, UInt_t new_width, UInt_t new_height);
const TGPicture *GetPicture(const char *name, Pixmap_t pxmap, Pixmap_t mask = 0);
void FreePicture(const TGPicture *pic);
void Print(Option_t *option="") const;
ClassDef(TGPicturePool,0)
};
#endif