Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGIcon.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_TGIcon
13 #define ROOT_TGIcon
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TGIcon //
19 // //
20 // This class handles GUI icons. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #include "TGFrame.h"
25 #include "TGDimension.h"
26 
27 class TGPicture;
28 class TImage;
29 
30 class TGIcon : public TGFrame {
31 
32 protected:
33  const TGPicture *fPic; // icon picture
34  TImage *fImage; // image
35  TString fPath; // directory of image
36 
37  virtual void DoRedraw();
38 
39 private:
40  TGIcon(const TGIcon &); // not implemented
41  TGIcon& operator=(const TGIcon&); // not implemented
42 
43 public:
44  TGIcon(const TGWindow *p, const TGPicture *pic, UInt_t w, UInt_t h,
45  UInt_t options = kChildFrame, Pixel_t back = GetDefaultFrameBackground()) :
46  TGFrame(p, w, h, options, back), fPic(pic), fImage(0), fPath() { SetWindowName(); }
47 
48  TGIcon(const TGWindow *p = 0, const char *image = 0);
49 
50  virtual ~TGIcon();
51 
52  virtual void Reset(); //*MENU*
53  const TGPicture *GetPicture() const { return fPic; }
54  TImage *GetImage() const { return fImage; }
55  virtual void SetPicture(const TGPicture *pic);
56  virtual void SetImage(const char *img);
57  virtual void SetImage(TImage *img);
58  virtual void SetImagePath(const char *path);
59 
60  virtual void Resize(UInt_t w = 0, UInt_t h = 0);
61  virtual void Resize(TGDimension size) { Resize(size.fWidth, size.fHeight); }
62  virtual void MoveResize(Int_t x, Int_t y, UInt_t w = 0, UInt_t h = 0);
63  virtual void ChangeBackgroundColor() { }
64 
65  virtual TGDimension GetDefaultSize() const;
66  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
67 
68  ClassDef(TGIcon,0) // Icon GUI class
69 };
70 
71 #endif