Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 void DoRedraw() override;
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 ~TGIcon() override;
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 void Resize(UInt_t w = 0, UInt_t h = 0) override;
53 void Resize(TGDimension size) override { Resize(size.fWidth, size.fHeight); }
54 void MoveResize(Int_t x, Int_t y, UInt_t w = 0, UInt_t h = 0) override;
55 virtual void ChangeBackgroundColor() {}
56
57 TGDimension GetDefaultSize() const override;
58 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
59
60 ClassDefOverride(TGIcon,0) // Icon GUI class
61};
62
63#endif
@ 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
int Int_t
Definition RtypesCore.h:45
unsigned int UInt_t
Definition RtypesCore.h:46
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
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
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
Move icon to (x,y) and resize it to (w,h).
Definition TGIcon.cxx:166
~TGIcon() override
Delete icon and free picture.
Definition TGIcon.cxx:71
const TGPicture * GetPicture() const
Definition TGIcon.h:45
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save an icon widget as a C++ statement(s) on output stream out.
Definition TGIcon.cxx:203
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
void Resize(TGDimension size) override
Resize the frame.
Definition TGIcon.h:53
virtual void ChangeBackgroundColor()
Definition TGIcon.h:55
const TGPicture * fPic
icon picture
Definition TGIcon.h:25
TImage * fImage
image
Definition TGIcon.h:26
void DoRedraw() override
Redraw picture.
Definition TGIcon.cxx:126
TString fPath
directory of image
Definition TGIcon.h:27
void Resize(UInt_t w=0, UInt_t h=0) override
Resize.
Definition TGIcon.cxx:139
TGIcon(const TGIcon &)=delete
TGDimension GetDefaultSize() const override
Return size of icon.
Definition TGIcon.cxx:117
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
TImage * GetImage() const
Definition TGIcon.h:46
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=nullptr)
Set window name.
Definition TGWindow.cxx:129
An abstract interface to image processing library.
Definition TImage.h:29
Basic string class.
Definition TString.h:139
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17