Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:57

0001 // @(#)root/gui:$Id$
0002 // Author: Fons Rademakers   05/01/98
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGIcon
0013 #define ROOT_TGIcon
0014 
0015 
0016 #include "TGFrame.h"
0017 #include "TGDimension.h"
0018 
0019 class TGPicture;
0020 class TImage;
0021 
0022 class TGIcon : public TGFrame {
0023 
0024 protected:
0025    const TGPicture  *fPic;     ///< icon picture
0026    TImage           *fImage;   ///< image
0027    TString           fPath;    ///< directory of image
0028 
0029    void DoRedraw() override;
0030 
0031 private:
0032    TGIcon(const TGIcon &) = delete;
0033    TGIcon& operator=(const TGIcon&) = delete;
0034 
0035 public:
0036    TGIcon(const TGWindow *p, const TGPicture *pic, UInt_t w, UInt_t h,
0037       UInt_t options = kChildFrame, Pixel_t back = GetDefaultFrameBackground()) :
0038          TGFrame(p, w, h, options, back), fPic(pic), fImage(nullptr), fPath() { SetWindowName(); }
0039 
0040    TGIcon(const TGWindow *p = nullptr, const char *image = nullptr);
0041 
0042    ~TGIcon() override;
0043 
0044    virtual void Reset();         //*MENU*
0045    const TGPicture *GetPicture() const { return fPic; }
0046    TImage *GetImage() const { return fImage; }
0047    virtual void SetPicture(const TGPicture *pic);
0048    virtual void SetImage(const char *img);
0049    virtual void SetImage(TImage *img);
0050    virtual void SetImagePath(const char *path);
0051 
0052    void Resize(UInt_t w = 0, UInt_t h = 0) override;
0053    void Resize(TGDimension size) override { Resize(size.fWidth, size.fHeight); }
0054    void MoveResize(Int_t x, Int_t y, UInt_t w = 0, UInt_t h = 0) override;
0055    virtual void ChangeBackgroundColor() {}
0056 
0057    TGDimension GetDefaultSize() const override;
0058    void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0059 
0060    ClassDefOverride(TGIcon,0)  // Icon GUI class
0061 };
0062 
0063 #endif