00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TGPicture
00013 #define ROOT_TGPicture
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef ROOT_TObject
00028 #include "TObject.h"
00029 #endif
00030 #ifndef ROOT_TRefCnt
00031 #include "TRefCnt.h"
00032 #endif
00033 #ifndef ROOT_TString
00034 #include "TString.h"
00035 #endif
00036 #ifndef ROOT_TGClient
00037 #include "TGClient.h"
00038 #endif
00039 #ifndef ROOT_TGGC
00040 #include "TGGC.h"
00041 #endif
00042
00043 class THashTable;
00044
00045
00046 class TGPicture : public TObject, public TRefCnt {
00047
00048 friend class TGPicturePool;
00049
00050 protected:
00051 TString fName;
00052 Bool_t fScaled;
00053 Pixmap_t fPic;
00054 Pixmap_t fMask;
00055 PictureAttributes_t fAttributes;
00056
00057 TGPicture(const char *name, Bool_t scaled = kFALSE):
00058 fName(name), fScaled(scaled), fPic(kNone), fMask(kNone), fAttributes()
00059 {
00060 fAttributes.fPixels = 0;
00061 SetRefCount(1);
00062 }
00063
00064 TGPicture(const char *name, Pixmap_t pxmap, Pixmap_t mask = 0);
00065
00066
00067 void Draw(Option_t * = "") { MayNotUse("Draw(Option_t*)"); }
00068
00069 public:
00070 virtual ~TGPicture();
00071
00072 const char *GetName() const { return fName; }
00073 UInt_t GetWidth() const { return fAttributes.fWidth; }
00074 UInt_t GetHeight() const { return fAttributes.fHeight; }
00075 Pixmap_t GetPicture() const { return fPic; }
00076 Pixmap_t GetMask() const { return fMask; }
00077 Bool_t IsScaled() const { return fScaled; }
00078 ULong_t Hash() const { return fName.Hash(); }
00079 static const char *HashName(const char *name, Int_t width, Int_t height);
00080
00081 virtual void Draw(Handle_t id, GContext_t gc, Int_t x, Int_t y) const;
00082 void Print(Option_t *option="") const;
00083
00084 ClassDef(TGPicture,0)
00085 };
00086
00087
00088 class TGSelectedPicture : public TGPicture {
00089
00090 protected:
00091 const TGClient *fClient;
00092
00093 static TGGC *fgSelectedGC;
00094 static TGGC &GetSelectedGC();
00095
00096 TGSelectedPicture(const TGSelectedPicture& gp):
00097 TGPicture(gp), fClient(gp.fClient) { }
00098 TGSelectedPicture& operator=(const TGSelectedPicture& gp)
00099 {if(this!=&gp) { TGPicture::operator=(gp); fClient=gp.fClient;}
00100 return *this;}
00101
00102 public:
00103 TGSelectedPicture(const TGClient *client, const TGPicture *p);
00104 virtual ~TGSelectedPicture();
00105
00106 ClassDef(TGSelectedPicture,0)
00107 };
00108
00109
00110 class TGPicturePool : public TObject {
00111
00112 protected:
00113 const TGClient *fClient;
00114 TString fPath;
00115 THashTable *fPicList;
00116
00117 TGPicturePool(const TGPicturePool&);
00118 TGPicturePool& operator=(const TGPicturePool&);
00119
00120 public:
00121 TGPicturePool(const TGClient *client, const char *path):
00122 fClient(client), fPath(path), fPicList(0) { }
00123 virtual ~TGPicturePool();
00124
00125 const char *GetPath() const { return fPath; }
00126 const TGPicture *GetPicture(const char *name);
00127 const TGPicture *GetPicture(const char *name, char **xpm);
00128 const TGPicture *GetPicture(const char *name, UInt_t new_width, UInt_t new_height);
00129 const TGPicture *GetPicture(const char *name, Pixmap_t pxmap, Pixmap_t mask = 0);
00130 void FreePicture(const TGPicture *pic);
00131
00132 void Print(Option_t *option="") const;
00133
00134 ClassDef(TGPicturePool,0)
00135 };
00136
00137 #endif