/usr/include/root/TGImageMap.h is in libroot-gui-dev 5.34.19+dfsg-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | // @(#)root/gui:$Id$
// Author: Valeriy Onuchin & Fons Rademakers 18/10/2000
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TGImageMap
#define ROOT_TGImageMap
//////////////////////////////////////////////////////////////////////////
// //
// TGImageMap (with TGRegion and TGRegionWithId help classes) //
// //
// A TGImageMap provides the functionality like a clickable image in //
// a web browser with sensitive regions (MAP HTML tag). //
// //
//////////////////////////////////////////////////////////////////////////
#include "TGButton.h"
#include "TPoint.h"
#include "TGDimension.h"
class TGRegionData;
class TGPopupMenu;
class TGToolTip;
class TArrayS;
class TGRegion : public TObject {
protected:
TGRegionData *fData; // data describing region
TGRegion(Bool_t);
TGRegion CopyRegion() const;
public:
enum ERegionType { kRectangle, kEllipse };
TGRegion();
TGRegion(Int_t x, Int_t y, UInt_t w, UInt_t h, ERegionType = kRectangle);
TGRegion(Int_t n, TPoint *points, Bool_t winding = kFALSE);
TGRegion(Int_t n, Int_t *x, Int_t *y, Bool_t winding = kFALSE);
TGRegion(const TArrayS &x, const TArrayS &y, Bool_t winding = kFALSE);
TGRegion(const TGRegion ®);
virtual ~TGRegion();
Bool_t Contains(const TPoint &p) const;
Bool_t Contains(Int_t x, Int_t y) const;
TGRegion Unite(const TGRegion &r) const;
TGRegion Intersect(const TGRegion &r) const;
TGRegion Subtract(const TGRegion &r) const;
TGRegion Eor(const TGRegion &r) const;
TGDimension GetDimension() const;
TGPosition GetPosition() const;
Bool_t IsNull() const;
Bool_t IsEmpty() const;
TGRegion operator|(const TGRegion &r) const { return Unite(r); }
TGRegion operator+(const TGRegion &r) const { return Unite(r); }
TGRegion operator&(const TGRegion &r) const { return Intersect(r); }
TGRegion operator-(const TGRegion &r) const { return Subtract(r); }
TGRegion operator^(const TGRegion &r) const { return Eor(r); }
TGRegion& operator|=(const TGRegion &r) { return *this = *this | r; }
TGRegion& operator+=(const TGRegion &r) { return *this = *this + r; }
TGRegion& operator&=(const TGRegion &r) { return *this = *this & r; }
TGRegion& operator-=(const TGRegion &r) { return *this = *this - r; }
TGRegion& operator^=(const TGRegion &r) { return *this = *this ^ r; }
Bool_t operator==(const TGRegion &r) const;
Bool_t operator!=(const TGRegion &r) const { return !(operator==(r)); }
TGRegion &operator=(const TGRegion &r);
ClassDef(TGRegion,0) // Describes a region
};
class TGRegionWithId : public TGRegion {
private:
TGRegionWithId& operator=(const TGRegionWithId&); // Not implemented
protected:
Int_t fId; // region id
TGToolTip *fTip; // tooltip
TGPopupMenu *fPopup; // popup menu
public:
TGRegionWithId();
TGRegionWithId(Int_t id, Int_t x, Int_t y, UInt_t w, UInt_t h,
ERegionType = kRectangle);
TGRegionWithId(Int_t id, Int_t n, TPoint *points, Bool_t winding = kFALSE);
TGRegionWithId(const TGRegionWithId ®);
TGRegionWithId(const TGRegion ®, Int_t id);
virtual ~TGRegionWithId();
Int_t GetId() const { return fId; }
TGToolTip *GetToolTipText() const { return fTip; }
void SetToolTipText(const char *text, Long_t delayms,
const TGFrame *frame);
TGPopupMenu *GetPopup() const { return fPopup; }
void SetPopup(TGPopupMenu *popup) { fPopup = popup; }
void DisplayPopup();
ClassDef(TGRegionWithId,0) // Region with id, tooltip text and popup menu
};
class TGImageMap : public TGPictureButton {
private:
TGImageMap(const TGImageMap&); // Not implemented
TGImageMap& operator=(const TGImageMap&); // Not implemented
public:
enum ENavMode { kNavRegions, kNavGrid };
protected:
TList *fListOfRegions; // list of regions
ENavMode fNavMode; // navigation mode
ECursor fCursorMouseOver; // cursor shape in regions
ECursor fCursorMouseOut; // cursor shape out of regions
Int_t fLastVisited; // id of the last visited region
TGToolTip *fMainTip; // tooltip text for main region
TList *fTrash; // collect all objects that need to be cleaned up
public:
TGImageMap(const TGWindow *p = 0, const TGPicture *pic = 0);
TGImageMap(const TGWindow *p, const TString &pic);
virtual ~TGImageMap();
virtual Bool_t HandleButton(Event_t *event);
virtual Bool_t HandleDoubleClick(Event_t *event);
virtual Bool_t HandleMotion(Event_t *event);
ENavMode GetNavMode() { return fNavMode; }
void AddRegion(const TGRegion ®ion, Int_t id);
TGPopupMenu *CreatePopup(Int_t id);
TGPopupMenu *GetPopup(Int_t id);
void SetToolTipText(const char *text, Long_t delayms = 300);
void SetToolTipText(Int_t id, const char *text, Long_t delayms = 300);
void SetCursor(ECursor cursor = kHand) { fCursorMouseOver = cursor; }
void SetPicture(const TGPicture * /*new_pic*/) { } // disabled
virtual void RegionClicked(Int_t id); // *SIGNAL*
virtual void DoubleClicked(Int_t id); // *SIGNAL*
virtual void DoubleClicked(); // *SIGNAL*
virtual void OnMouseOver(Int_t id); // *SIGNAL*
virtual void OnMouseOut(Int_t id); // *SIGNAL*
ClassDef(TGImageMap,0) // Clickable image (like MAP in HTML)
};
R__EXTERN TGRegionWithId *gCurrentRegion;
#endif
|