Logo ROOT   6.10/09
Reference Guide
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,
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
const char Option_t
Definition: RtypesCore.h:62
virtual void Resize(TGDimension size)
Resize the frame.
Definition: TGIcon.h:61
TH1 * h
Definition: legend2.C:5
virtual void SetImage(const char *img)
Set icon image.
Definition: TGIcon.cxx:90
Basic string class.
Definition: TString.h:129
int Int_t
Definition: RtypesCore.h:41
An abstract interface to image processing library.
Definition: TImage.h:29
TGIcon(const TGWindow *p, const TGPicture *pic, UInt_t w, UInt_t h, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Definition: TGIcon.h:44
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize.
Definition: TGIcon.cxx:140
TImage * GetImage() const
Definition: TGIcon.h:54
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:297
ULong_t Pixel_t
Definition: GuiTypes.h:39
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:665
Definition: TGIcon.h:30
virtual ~TGIcon()
Delete icon and free picture.
Definition: TGIcon.cxx:72
virtual void ChangeBackgroundColor()
Definition: TGIcon.h:63
const TGPicture * GetPicture() const
Definition: TGIcon.h:53
TGIcon & operator=(const TGIcon &)
UInt_t fHeight
Definition: TGDimension.h:30
virtual TGDimension GetDefaultSize() const
Return size of icon.
Definition: TGIcon.cxx:118
UInt_t fWidth
Definition: TGDimension.h:29
virtual void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0)
Move icon to (x,y) and resize it to (w,h).
Definition: TGIcon.cxx:167
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save an icon widget as a C++ statement(s) on output stream out.
Definition: TGIcon.cxx:202
TGIcon(const TGIcon &)
unsigned int UInt_t
Definition: RtypesCore.h:42
TImage * fImage
Definition: TGIcon.h:34
const TGPicture * fPic
Definition: TGIcon.h:33
virtual void SetImagePath(const char *path)
Set directory where image is located.
Definition: TGIcon.cxx:191
Double_t y[n]
Definition: legend1.C:17
virtual void DoRedraw()
Redraw picture.
Definition: TGIcon.cxx:127
TString fPath
Definition: TGIcon.h:35
virtual void SetPicture(const TGPicture *pic)
Set icon picture.
Definition: TGIcon.cxx:80
virtual void SetWindowName(const char *name=0)
Set window name.
Definition: TGWindow.cxx:118
virtual void Reset()
Reset icon to original image. It can be used only via context menu.
Definition: TGIcon.cxx:176