Logo ROOT  
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#include "TGFrame.h"
17#include "TGDimension.h"
18
19class TGPicture;
20class TImage;
21
22class TGIcon : public TGFrame {
23
24protected:
25 const TGPicture *fPic; ///< icon picture
26 TImage *fImage; ///< image
27 TString fPath; ///< directory of image
28
29 virtual void DoRedraw();
30
31private:
32 TGIcon(const TGIcon &) = delete;
33 TGIcon& operator=(const TGIcon&) = delete;
34
35public:
36 TGIcon(const TGWindow *p, const TGPicture *pic, UInt_t w, UInt_t h,
38 TGFrame(p, w, h, options, back), fPic(pic), fImage(nullptr), fPath() { SetWindowName(); }
39
40 TGIcon(const TGWindow *p = nullptr, const char *image = nullptr);
41
42 virtual ~TGIcon();
43
44 virtual void Reset(); //*MENU*
45 const TGPicture *GetPicture() const { return fPic; }
46 TImage *GetImage() const { return fImage; }
47 virtual void SetPicture(const TGPicture *pic);
48 virtual void SetImage(const char *img);
49 virtual void SetImage(TImage *img);
50 virtual void SetImagePath(const char *path);
51
52 virtual void Resize(UInt_t w = 0, UInt_t h = 0);
53 virtual void Resize(TGDimension size) { Resize(size.fWidth, size.fHeight); }
54 virtual void MoveResize(Int_t x, Int_t y, UInt_t w = 0, UInt_t h = 0);
55 virtual void ChangeBackgroundColor() { }
56
57 virtual TGDimension GetDefaultSize() const;
58 virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
59
60 ClassDef(TGIcon,0) // Icon GUI class
61};
62
63#endif
int Int_t
Definition: CPyCppyy.h:43
unsigned int UInt_t
Definition: CPyCppyy.h:44
@ kChildFrame
Definition: GuiTypes.h:379
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
#define h(i)
Definition: RSha256.hxx:106
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
const char Option_t
Definition: RtypesCore.h:66
#define ClassDef(name, id)
Definition: Rtypes.h:325
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition: TGFrame.h:80
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:683
This class handles GUI icons.
Definition: TGIcon.h:22
TGIcon(const TGWindow *p, const TGPicture *pic, UInt_t w, UInt_t h, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Definition: TGIcon.h:36
virtual void Resize(TGDimension size)
Resize the frame.
Definition: TGIcon.h:53
TImage * GetImage() const
Definition: TGIcon.h:46
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:166
virtual void DoRedraw()
Redraw picture.
Definition: TGIcon.cxx:126
virtual ~TGIcon()
Delete icon and free picture.
Definition: TGIcon.cxx:71
TGIcon & operator=(const TGIcon &)=delete
virtual void SetPicture(const TGPicture *pic)
Set icon picture.
Definition: TGIcon.cxx:79
virtual void SetImage(const char *img)
Set icon image.
Definition: TGIcon.cxx:89
const TGPicture * GetPicture() const
Definition: TGIcon.h:45
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:203
virtual void ChangeBackgroundColor()
Definition: TGIcon.h:55
const TGPicture * fPic
icon picture
Definition: TGIcon.h:25
TImage * fImage
image
Definition: TGIcon.h:26
virtual TGDimension GetDefaultSize() const
Return size of icon.
Definition: TGIcon.cxx:117
TString fPath
directory of image
Definition: TGIcon.h:27
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize.
Definition: TGIcon.cxx:139
TGIcon(const TGIcon &)=delete
virtual void Reset()
Reset icon to original image. It can be used only via context menu.
Definition: TGIcon.cxx:175
virtual void SetImagePath(const char *path)
Set directory where image is located.
Definition: TGIcon.cxx:190
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition: TGPicture.h:25
ROOT GUI Window base class.
Definition: TGWindow.h:23
virtual void SetWindowName(const char *name=0)
Set window name.
Definition: TGWindow.cxx:129
An abstract interface to image processing library.
Definition: TImage.h:29
Basic string class.
Definition: TString.h:136
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17