Logo ROOT   6.12/07
Reference Guide
TGImageMap.cxx
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Valeriy Onuchin & Fons Rademakers 18/10/2000
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 //////////////////////////////////////////////////////////////////////////
13 // //
14 // TGImageMap (with TGRegion and TGRegionWithId help classes) //
15 // //
16 // A TGImageMap provides the functionality like a clickable image in //
17 // a web browser with sensitive regions (MAP HTML tag). //
18 // //
19 //////////////////////////////////////////////////////////////////////////
20 
21 #include "TGImageMap.h"
22 #include "TRefCnt.h"
23 #include "TGMenu.h"
24 #include "TGToolTip.h"
25 #include "TList.h"
26 #include "TArrayS.h"
27 
28 
32 
33 
34 TGRegionWithId *gCurrentRegion; // current region
35 
36 static TGRegion *gEmptyRegion = 0;
37 static Int_t gPointerX; // current X mouse position
38 static Int_t gPointerY; // current Y mouse position
39 
40 
41 
42 class TGRegionData : public TRefCnt {
43 
44 friend class TGRegion;
45 
46 private:
47  Region_t fRgn; // region handle
48  Bool_t fIsNull; // true if null region
49 
50 public:
51  TGRegionData() { fRgn = 0; fIsNull = kTRUE; AddReference(); }
52  ~TGRegionData() { }
53  TGRegionData &operator=(const TGRegionData &r);
54 };
55 
56 ////////////////////////////////////////////////////////////////////////////////
57 /// Assignemnt of region data object.
58 
59 TGRegionData &TGRegionData::operator=(const TGRegionData &r)
60 {
61  if (this != &r) {
62  fRefs = r.fRefs;
63  fRgn = r.fRgn;
64  fIsNull = r.fIsNull;
65  }
66  return *this;
67 }
68 
69 
70 ////////////////////////////////////////////////////////////////////////////////
71 ////////////////////////////////////////////////////////////////////////////////
72 /// Create a region object.
73 
75 {
76  if (!gEmptyRegion) // avoid too many allocs
78 
80  fData->AddReference();
81 }
82 
83 ////////////////////////////////////////////////////////////////////////////////
84 /// Create empty region.
85 
87 {
88  fData = new TGRegionData;
89  fData->fRgn = gVirtualX->CreateRegion();
90  fData->fIsNull = is_null;
91 }
92 
93 ////////////////////////////////////////////////////////////////////////////////
94 /// Create and initialize a region with a rectangle.
95 
97 {
98  fData = new TGRegionData;
99  fData->fRgn = gVirtualX->CreateRegion();
100  fData->fIsNull = kFALSE;
101 
102  Rectangle_t xr;
103  xr.fX = (Short_t) x;
104  xr.fY = (Short_t) y;
105  xr.fWidth = (UShort_t) w;
106  xr.fHeight = (UShort_t) h;
107  gVirtualX->UnionRectWithRegion(&xr, fData->fRgn, fData->fRgn);
108 }
109 
110 ////////////////////////////////////////////////////////////////////////////////
111 /// Create and intialize a region with a polygon.
112 
114 {
115  fData = new TGRegionData;
116  fData->fIsNull = kFALSE;
117  Point_t *gpoints = new Point_t[n];
118 
119  for (int i = 0; i < n; i++) {
120  gpoints[i].fX = (Short_t) points[i].GetX();
121  gpoints[i].fY = (Short_t) points[i].GetY();
122  }
123 
124  fData->fRgn = gVirtualX->PolygonRegion(gpoints, n, winding);
125 }
126 
127 ////////////////////////////////////////////////////////////////////////////////
128 /// Create and initialize a region with an X and a Y array of points.
129 
130 TGRegion::TGRegion(const TArrayS &x, const TArrayS &y, Bool_t winding)
131 {
132  fData = new TGRegionData;
133  fData->fIsNull = kFALSE;
134 
135  Int_t n = x.GetSize();
136  if (n != y.GetSize()) {
137  Error("TGRegion", "x and y arrays must have same length");
138  return;
139  }
140  Point_t *gpoints = new Point_t[n];
141 
142  for (int i = 0; i < n; i++) {
143  gpoints[i].fX = x.GetArray()[i];
144  gpoints[i].fY = y.GetArray()[i];
145  }
146 
147  fData->fRgn = gVirtualX->PolygonRegion(gpoints, n, winding);
148 }
149 
150 ////////////////////////////////////////////////////////////////////////////////
151 /// Create and initialize a region with an X and Y array of points.
152 
154 {
155  fData = new TGRegionData;
156  fData->fIsNull = kFALSE;
157  Point_t *gpoints = new Point_t[n];
158 
159  for (int i = 0; i < n; i++) {
160  gpoints[i].fX = x[i];
161  gpoints[i].fY = y[i];
162  }
163 
164  fData->fRgn = gVirtualX->PolygonRegion(gpoints, n, winding);
165 }
166 
167 ////////////////////////////////////////////////////////////////////////////////
168 /// Region copy constructor.
169 
171 {
172  fData = r.fData;
173  fData->AddReference();
174 }
175 
176 ////////////////////////////////////////////////////////////////////////////////
177 /// Delete a region.
178 
180 {
181  if (fData->RemoveReference() <= 0) {
182  gVirtualX->DestroyRegion(fData->fRgn);
183  delete fData;
184  }
185 }
186 
187 ////////////////////////////////////////////////////////////////////////////////
188 /// Region assignment operator.
189 
191 {
192  if (this != &r) {
194  r.fData->AddReference();
195 
196  if (fData->RemoveReference() <= 0) {
197  gVirtualX->DestroyRegion(fData->fRgn);
198  delete fData;
199  }
200  fData = r.fData;
201  }
202  return *this;
203 }
204 
205 ////////////////////////////////////////////////////////////////////////////////
206 /// Copy a region.
207 
209 {
210  TGRegion r(fData->fIsNull);
211  gVirtualX->UnionRegion(fData->fRgn, r.fData->fRgn, r.fData->fRgn);
212  return r;
213 }
214 
215 ////////////////////////////////////////////////////////////////////////////////
216 /// Return true if region is not set.
217 
219 {
220  return fData->fIsNull;
221 }
222 
223 ////////////////////////////////////////////////////////////////////////////////
224 /// Return true if region is empty.
225 
227 {
228  return fData->fIsNull || gVirtualX->EmptyRegion(fData->fRgn);
229 }
230 
231 ////////////////////////////////////////////////////////////////////////////////
232 /// Return true if point p is contained in the region.
233 
235 {
236  return gVirtualX->PointInRegion((Int_t)p.GetX(), (Int_t)p.GetY(), fData->fRgn);
237 }
238 
239 ////////////////////////////////////////////////////////////////////////////////
240 /// Return true if point (x,y) is contained in the region.
241 
243 {
244  return gVirtualX->PointInRegion(x, y, fData->fRgn);
245 }
246 
247 ////////////////////////////////////////////////////////////////////////////////
248 /// Return the union of this region with r.
249 
251 {
252  TGRegion result(kFALSE);
253  gVirtualX->UnionRegion(fData->fRgn, r.fData->fRgn, result.fData->fRgn);
254  return result;
255 }
256 
257 ////////////////////////////////////////////////////////////////////////////////
258 /// Returns a region which is the intersection of this region and r.
259 
261 {
262  TGRegion result(kFALSE);
263  gVirtualX->IntersectRegion(fData->fRgn, r.fData->fRgn, result.fData->fRgn);
264  return result;
265 }
266 
267 ////////////////////////////////////////////////////////////////////////////////
268 /// Returns a region which is r subtracted from this region.
269 
271 {
272  TGRegion result(kFALSE);
273  gVirtualX->SubtractRegion(fData->fRgn, r.fData->fRgn, result.fData->fRgn);
274  return result;
275 }
276 
277 ////////////////////////////////////////////////////////////////////////////////
278 /// Returns a region which is the difference between the union and
279 /// intersection this region and r.
280 
282 {
283  TGRegion result(kFALSE);
284  gVirtualX->XorRegion(fData->fRgn, r.fData->fRgn, result.fData->fRgn);
285  return result;
286 }
287 
288 ////////////////////////////////////////////////////////////////////////////////
289 /// Return dimension of region (widht, height).
290 
292 {
293  Rectangle_t r = { 0, 0, 0, 0 };
294  gVirtualX->GetRegionBox(fData->fRgn, &r);
295  return TGDimension(r.fWidth, r.fHeight);
296 }
297 
298 ////////////////////////////////////////////////////////////////////////////////
299 /// Return position of region (x, y).
300 
302 {
303  Rectangle_t r = { 0, 0, 0, 0 };
304  gVirtualX->GetRegionBox(fData->fRgn, &r);
305  return TGPosition(r.fX, r.fY);
306 }
307 
308 ////////////////////////////////////////////////////////////////////////////////
309 /// Region == operator.
310 
312 {
313  return fData == r.fData ?
314  kTRUE : gVirtualX->EqualRegion(fData->fRgn, r.fData->fRgn);
315 }
316 
317 
318 ////////////////////////////////////////////////////////////////////////////////
319 ////////////////////////////////////////////////////////////////////////////////
320 /// Create GUI region (with id and possible tooltip).
321 
323 {
324  fId = 0;
325  fTip = 0;
326  fPopup = 0;
327 }
328 
329 ////////////////////////////////////////////////////////////////////////////////
330 /// Create GUI region (with id and possible tooltip).
331 
334  TGRegion(x, y, w, h, type)
335 {
336  fId = id;
337  fTip = 0;
338  fPopup = 0;
339 }
340 
341 ////////////////////////////////////////////////////////////////////////////////
342 /// Create GUI region (with id and possible tooltip).
343 
345  Bool_t winding) :
346  TGRegion(n, points, winding)
347 {
348  fId = id;
349  fTip = 0;
350  fPopup = 0;
351 }
352 
353 ////////////////////////////////////////////////////////////////////////////////
354 /// Copy constructor.
355 
357 {
358  fId = reg.GetId();
359  fTip = 0;
360  fPopup = 0;
361 }
362 
363 ////////////////////////////////////////////////////////////////////////////////
364 /// Copy ctor which allows setting of new id.
365 
367  TGRegion(reg)
368 {
369  fId = id;
370  fTip = 0;
371  fPopup = 0;
372 }
373 
374 ////////////////////////////////////////////////////////////////////////////////
375 /// Cleanup.
376 
378 {
379  delete fTip;
380 }
381 
382 ////////////////////////////////////////////////////////////////////////////////
383 /// Display popup menu associated with this region.
384 
386 {
388 }
389 
390 ////////////////////////////////////////////////////////////////////////////////
391 /// Set tool tip text associated with this region. The delay is in
392 /// milliseconds (minimum 250). To remove tool tip call method with
393 /// text = 0.
394 
395 void TGRegionWithId::SetToolTipText(const char *text, Long_t delayms,
396  const TGFrame *frame)
397 {
398  if (fTip) {
399  delete fTip;
400  fTip = 0;
401  }
402 
403  if (text && strlen(text))
404  fTip = new TGToolTip(gClient->GetDefaultRoot(), frame, text, delayms);
405 }
406 
407 ////////////////////////////////////////////////////////////////////////////////
408 ////////////////////////////////////////////////////////////////////////////////
409 /// Create an image map widget.
410 
412  TGPictureButton(p, pic)
413 {
416  fListOfRegions = new TList;
417  fTrash = new TList;
418  fMainTip = 0;
419  fLastVisited = 0;
421 
424 
425  gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
428 
431  SetWindowName();
432 }
433 
434 ////////////////////////////////////////////////////////////////////////////////
435 /// Create an image map widget.
436 
437 TGImageMap::TGImageMap(const TGWindow *p, const TString &pic) :
438  TGPictureButton(p, pic.Data())
439 {
442  fListOfRegions = new TList;
443  fTrash = new TList;
444  fMainTip = 0;
445  fLastVisited = 0;
447 
450 
451  gVirtualX->GrabButton(fId, kAnyButton, kAnyModifier,
454 
457  SetWindowName();
458 }
459 
460 ////////////////////////////////////////////////////////////////////////////////
461 /// Cleanup image map widget.
462 
464 {
465  delete fMainTip;
466  fTrash->Delete();
467  delete fTrash;
469  delete fListOfRegions;
470 }
471 
472 ////////////////////////////////////////////////////////////////////////////////
473 /// Add a region to the image map.
474 
475 void TGImageMap::AddRegion(const TGRegion &region, Int_t id)
476 {
477  fListOfRegions->Add(new TGRegionWithId(region, id));
478 }
479 
480 ////////////////////////////////////////////////////////////////////////////////
481 /// Create popoup menu or returns existing for regions with specified id.
482 
484 {
485  TIter next(fListOfRegions);
486  TGRegionWithId *region;
487  TGPopupMenu *popup = 0;
488  TGPopupMenu *newpopup = 0;
489 
490  while ((region = (TGRegionWithId*)next())) {
491  if (id == region->GetId()) {
492  popup = region->GetPopup();
493  if (!popup && !newpopup) {
494  newpopup = new TGPopupMenu(this);
495  fTrash->Add(newpopup);
496  }
497  if (newpopup) region->SetPopup(newpopup);
498  }
499  }
500  return newpopup ? newpopup : popup;
501 }
502 
503 ////////////////////////////////////////////////////////////////////////////////
504 /// Return popup for regions with specified id.
505 
507 {
508  TIter next(fListOfRegions);
509  TGRegionWithId *region;
510 
511  while ((region = (TGRegionWithId*)next())) {
512  if (id == region->GetId()) return region->GetPopup();
513  }
514  return 0;
515 }
516 
517 ////////////////////////////////////////////////////////////////////////////////
518 /// Handle mouse motion events.
519 
521 {
522  TIter next(fListOfRegions);
523  TGRegionWithId *region;
524 
525  if (fNavMode != kNavRegions) return kTRUE;
526  gPointerX = event->fX;
527  gPointerY = event->fY;
528 
529  while ((region = (TGRegionWithId*)next())) {
530  if (region->Contains(gPointerX, gPointerY)) {
531  if (fLastVisited == region->GetId()) return kTRUE;
533  fLastVisited = region->GetId();
534  fTip = region->GetToolTipText();
535  gCurrentRegion = region;
537  return kTRUE;
538  }
539  }
540 
541  if (fLastVisited) {
543  fTip = fMainTip;
544  }
545  fLastVisited = 0; // main
546  return kTRUE;
547 }
548 
549 ////////////////////////////////////////////////////////////////////////////////
550 /// Handle double click events.
551 
553 {
554  TIter next(fListOfRegions);
555  TGRegionWithId *region;
556 
557  if (fTip) fTip->Hide();
558  if (event->fCode != kButton1 ) return kTRUE;
559  if (fNavMode != kNavRegions) return kTRUE;
560 
561  gPointerX = event->fX;
562  gPointerY = event->fY;
563 
564  while ((region = (TGRegionWithId*)next())) {
565  if (region->Contains(gPointerX, gPointerY)) {
566  DoubleClicked(region->GetId());
567  gCurrentRegion = region;
568  return kTRUE;
569  }
570  }
571  DoubleClicked();
572  return kTRUE;
573 }
574 
575 ////////////////////////////////////////////////////////////////////////////////
576 /// Handle button events.
577 
579 {
580  TIter next(fListOfRegions);
581  TGRegionWithId *region;
582  TGPopupMenu *pop;
583 
584  if (fTip) fTip->Hide();
585  if (fNavMode != kNavRegions) return kTRUE;
586 
587  gPointerX = event->fX;
588  gPointerY = event->fY;
589 
590  while ((region = (TGRegionWithId*)next())) {
591  if (region->Contains(gPointerX, gPointerY)) {
592  gCurrentRegion = region;
593  if (event->fType == kButtonPress) {
594  if (event->fCode == kButton1 )
595  RegionClicked(region->GetId());
596  else if (event->fCode == kButton3 ) {
597  pop = region->GetPopup();
598  if (pop) pop->PlaceMenu(gPointerX, gPointerY, kTRUE, kTRUE);
599  }
600  }
601  return kTRUE;
602  }
603  }
604  if (event->fType == kButtonPress)
605  Clicked();
606  return kTRUE;
607 }
608 
609 ////////////////////////////////////////////////////////////////////////////////
610 /// Set tooltip text for main region.
611 
612 void TGImageMap::SetToolTipText(const char *text, Long_t delayms)
613 {
614  if (fMainTip) delete fMainTip;
615  fMainTip = 0;
616 
617  if (text && strlen(text))
618  fMainTip = new TGToolTip(fClient->GetDefaultRoot(), this, text, delayms);
619 }
620 
621 ////////////////////////////////////////////////////////////////////////////////
622 /// Set tooltip text for regions with specified id.
623 
624 void TGImageMap::SetToolTipText(Int_t id, const char *text, Long_t delayms)
625 {
626  TIter next(fListOfRegions);
627  TGRegionWithId *region;
628 
629  while ((region = (TGRegionWithId*)next())) {
630  if (id == region->GetId())
631  region->SetToolTipText(text, delayms, this);
632  }
633 }
634 
635 ////////////////////////////////////////////////////////////////////////////////
636 /// Handle when mouse moves over region id. Emits signal
637 /// OnMouseOver(Int_t).
638 
640 {
641  if (fTip) fTip->Reset();
642  if (fMainTip) fMainTip->Hide();
643  gVirtualX->SetCursor(fId, gVirtualX->CreateCursor(fCursorMouseOver));
644  Emit("OnMouseOver(Int_t)", id);
645 }
646 
647 ////////////////////////////////////////////////////////////////////////////////
648 /// Handle when mouse moves from region id. Emits signal
649 /// OnMouseOut(Int_t).
650 
652 {
653  if(fTip) fTip->Hide();
654  if(fMainTip) fMainTip->Reset();
655  gVirtualX->SetCursor(fId,gVirtualX->CreateCursor(fCursorMouseOut));
656  Emit("OnMouseOut(Int_t)",id);
657 }
658 
659 ////////////////////////////////////////////////////////////////////////////////
660 /// Handle when mouse was clicked on region id. Emits signal
661 /// RegionClicked(Int_t).
662 
664 {
665  Emit("RegionClicked(Int_t)",id);
666 }
667 
668 ////////////////////////////////////////////////////////////////////////////////
669 /// Handle when mouse is double clicked on main map. Emits signal
670 /// DoubleClicked().
671 
673 {
674  Emit("DoubleClicked()");
675 }
676 
677 ////////////////////////////////////////////////////////////////////////////////
678 /// Handle when mouse is double clicked on region id. Emits signal
679 /// DoubleClicked(Int_t).
680 
682 {
683  Emit("DoubleClicked(Int_t)",id);
684 }
TGRegionWithId()
Create GUI region (with id and possible tooltip).
Definition: TGImageMap.cxx:322
const Mask_t kKeyReleaseMask
Definition: GuiTypes.h:159
UShort_t fWidth
Definition: GuiTypes.h:362
TGRegion CopyRegion() const
Copy a region.
Definition: TGImageMap.cxx:208
Short_t fY
Definition: GuiTypes.h:361
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: TList.cxx:467
TGRegion Eor(const TGRegion &r) const
Returns a region which is the difference between the union and intersection this region and r...
Definition: TGImageMap.cxx:281
UShort_t fHeight
Definition: GuiTypes.h:362
TGImageMap(const TGImageMap &)
TGRegion Subtract(const TGRegion &r) const
Returns a region which is r subtracted from this region.
Definition: TGImageMap.cxx:270
void DisplayPopup()
Display popup menu associated with this region.
Definition: TGImageMap.cxx:385
TList * fListOfRegions
Definition: TGImageMap.h:126
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition: TGFrame.cxx:321
virtual void DoubleClicked()
Handle when mouse is double clicked on main map.
Definition: TGImageMap.cxx:672
void Reset()
Reset tool tip popup delay timer.
Definition: TGToolTip.cxx:259
unsigned short UShort_t
Definition: RtypesCore.h:36
TH1 * h
Definition: legend2.C:5
TList * fTrash
Definition: TGImageMap.h:132
Definitions for TRefCnt, base class for reference counted objects.
Definition: TRefCnt.h:27
const Mask_t kLeaveWindowMask
Definition: GuiTypes.h:167
virtual void SetDisabledPicture(const TGPicture *pic)
Changes disabled picture.
Definition: TGButton.cxx:1085
Basic string class.
Definition: TString.h:125
#define gClient
Definition: TGClient.h:166
void SetToolTipText(const char *text, Long_t delayms=300)
Set tooltip text for main region.
Definition: TGImageMap.cxx:612
Short_t fX
Definition: GuiTypes.h:356
int Int_t
Definition: RtypesCore.h:41
static Int_t gPointerX
Definition: TGImageMap.cxx:37
bool Bool_t
Definition: RtypesCore.h:59
TGPopupMenu * GetPopup(Int_t id)
Return popup for regions with specified id.
Definition: TGImageMap.cxx:506
SCoord_t GetY() const
Definition: TPoint.h:48
void Hide()
Hide tool tip window.
Definition: TGToolTip.cxx:246
virtual ~TGRegion()
Delete a region.
Definition: TGImageMap.cxx:179
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion events.
Definition: TGImageMap.cxx:520
SCoord_t GetX() const
Definition: TPoint.h:47
TGToolTip * fTip
Definition: TGImageMap.h:91
virtual Bool_t HandleDoubleClick(Event_t *event)
Handle double click events.
Definition: TGImageMap.cxx:552
ECursor fCursorMouseOver
Definition: TGImageMap.h:128
const Mask_t kPointerMotionMask
Definition: GuiTypes.h:162
Double_t x[n]
Definition: legend1.C:17
void SetPopup(TGPopupMenu *popup)
Definition: TGImageMap.h:108
TGRegionWithId * gCurrentRegion
Definition: TGImageMap.cxx:34
TGRegion()
Create a region object.
Definition: TGImageMap.cxx:74
TGPopupMenu * GetPopup() const
Definition: TGImageMap.h:107
const TGPicture * fPic
Definition: TGButton.h:231
TObject & operator=(const TObject &rhs)
TObject assignment operator.
Definition: TObject.h:271
TGRegion Unite(const TGRegion &r) const
Return the union of this region with r.
Definition: TGImageMap.cxx:250
XFontStruct * id
Definition: TGX11.cxx:108
virtual ~TGRegionWithId()
Cleanup.
Definition: TGImageMap.cxx:377
Short_t fX
Definition: GuiTypes.h:361
Bool_t Contains(const TPoint &p) const
Return true if point p is contained in the region.
Definition: TGImageMap.cxx:234
Definition: TPoint.h:31
A doubly linked list.
Definition: TList.h:44
point * points
Definition: X3DBuffer.c:20
TGRegion & operator=(const TGRegion &r)
Region assignment operator.
Definition: TGImageMap.cxx:190
const Mask_t kButtonPressMask
Definition: GuiTypes.h:160
Int_t fLastVisited
Definition: TGImageMap.h:130
const Mask_t kKeyPressMask
Definition: GuiTypes.h:158
TGPosition GetPosition() const
Return position of region (x, y).
Definition: TGImageMap.cxx:301
ROOT::R::TRInterface & r
Definition: Object.C:4
Array of shorts (16 bits per element).
Definition: TArrayS.h:27
Int_t GetSize() const
Definition: TArray.h:47
EGEventType fType
Definition: GuiTypes.h:174
Bool_t IsNull() const
Return true if region is not set.
Definition: TGImageMap.cxx:218
Int_t GetId() const
Definition: TGImageMap.h:103
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:880
const Handle_t kNone
Definition: GuiTypes.h:87
Bool_t operator==(const TGRegion &r) const
Region == operator.
Definition: TGImageMap.cxx:311
TGToolTip * fTip
Definition: TGButton.h:79
virtual Bool_t HandleButton(Event_t *event)
Handle button events.
Definition: TGImageMap.cxx:578
short Short_t
Definition: RtypesCore.h:35
TGPopupMenu * fPopup
Definition: TGImageMap.h:92
ENavMode fNavMode
Definition: TGImageMap.h:127
#define gVirtualX
Definition: TVirtualX.h:350
const Bool_t kFALSE
Definition: RtypesCore.h:88
ECursor fCursorMouseOut
Definition: TGImageMap.h:129
static Int_t gPointerY
Definition: TGImageMap.cxx:38
TGRegionData * fData
Definition: TGImageMap.h:38
virtual void Clicked()
Definition: TGButton.h:135
long Long_t
Definition: RtypesCore.h:50
#define ClassImp(name)
Definition: Rtypes.h:359
const Mask_t kStructureNotifyMask
Definition: GuiTypes.h:165
TText * text
const Mask_t kButtonReleaseMask
Definition: GuiTypes.h:161
UInt_t fCode
Definition: GuiTypes.h:179
int type
Definition: TGX11.cxx:120
Double_t y[n]
Definition: legend1.C:17
TGToolTip * fMainTip
Definition: TGImageMap.h:131
virtual void OnMouseOver(Int_t id)
Handle when mouse moves over region id.
Definition: TGImageMap.cxx:639
static TGRegion * gEmptyRegion
Definition: TGImageMap.cxx:36
TGDimension GetDimension() const
Return dimension of region (widht, height).
Definition: TGImageMap.cxx:291
virtual ~TGImageMap()
Cleanup image map widget.
Definition: TGImageMap.cxx:463
virtual void OnMouseOut(Int_t id)
Handle when mouse moves from region id.
Definition: TGImageMap.cxx:651
Bool_t IsEmpty() const
Return true if region is empty.
Definition: TGImageMap.cxx:226
Handle_t fId
Definition: TGObject.h:36
Binding & operator=(OUT(*fun)(void))
Mother of all ROOT objects.
Definition: TObject.h:37
TGRegion Intersect(const TGRegion &r) const
Returns a region which is the intersection of this region and r.
Definition: TGImageMap.cxx:260
virtual void RegionClicked(Int_t id)
Handle when mouse was clicked on region id.
Definition: TGImageMap.cxx:663
#define ClassImpQ(name)
Definition: TQObject.h:283
virtual void Add(TObject *obj)
Definition: TList.h:87
void AddRegion(const TGRegion &region, Int_t id)
Add a region to the image map.
Definition: TGImageMap.cxx:475
TGClient * fClient
Definition: TGObject.h:37
const Short_t * GetArray() const
Definition: TArrayS.h:43
Handle_t Region_t
Definition: GuiTypes.h:31
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition: TGClient.cxx:232
TGToolTip * GetToolTipText() const
Definition: TGImageMap.h:104
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:165
TGPopupMenu * CreatePopup(Int_t id)
Create popoup menu or returns existing for regions with specified id.
Definition: TGImageMap.cxx:483
const Mask_t kAnyModifier
Definition: GuiTypes.h:209
const Bool_t kTRUE
Definition: RtypesCore.h:87
const Int_t n
Definition: legend1.C:16
void SetToolTipText(const char *text, Long_t delayms, const TGFrame *frame)
Set tool tip text associated with this region.
Definition: TGImageMap.cxx:395
virtual void PlaceMenu(Int_t x, Int_t y, Bool_t stick_mode, Bool_t grab_pointer)
Popup a popup menu.
Definition: TGMenu.cxx:1238
virtual void SetWindowName(const char *name=0)
Set window name.
Definition: TGWindow.cxx:118
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:185
Short_t fY
Definition: GuiTypes.h:356