ROOT logo
// @(#)root/graf:$Id$
// Author: Rene Brun   05/03/95

/*************************************************************************
 * 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.             *
 *************************************************************************/

#include <stdio.h>

#include "TVirtualPad.h"
#include "TClass.h"
#include "TLink.h"

ClassImp(TLink)


//______________________________________________________________________________
//
// Special TText object used to show hyperlinks.
// In the example below created by TObject::Inspect, TLinks are used
// to show pointers to other objects.
// Clicking on one link, inspect the corresponding object.
//Begin_Html
/*
<img src="gif/link.gif">
*/
//End_Html
//


//______________________________________________________________________________
TLink::TLink() : TText()
{
   // Link default constructor.

   fLink  = 0;
}


//______________________________________________________________________________
TLink::TLink(Double_t x, Double_t y, void *pointer)
           : TText(x, y, "")
{
   // Constructor to define a link object.
   //
   // pointer points to any kind of object.

   fLink  = pointer;
   static char line[16];
   snprintf(line,16,"->%lx ", (Long_t)pointer);
   SetTitle(line);
}


//______________________________________________________________________________
TLink::~TLink()
{
   // Link default destructor.
}


//______________________________________________________________________________
void TLink::ExecuteEvent(Int_t event, Int_t, Int_t)
{
   // Execute action corresponding to one event.
   //
   //  This member function is called when a link is clicked with the locator
   //
   //  If mouse is clicked on a link text, the object pointed by the link
   //  is Inspected

   if (event == kMouseMotion)
      gPad->SetCursor(kHand);

   if (event != kButton1Up) return;

   if (TestBit(kIsStarStar)) return;
   TObject *idcur = (TObject*)fLink;
   if (!idcur) return;
   TClass *cl = TClass::GetClass(GetName());
   if (!cl) return;

   // check if link points to a TObject
   TClass *c1 = (TClass*)cl->GetBaseClass("TObject");
   if (!c1) return;

   idcur->Inspect();
}
 TLink.cxx:1
 TLink.cxx:2
 TLink.cxx:3
 TLink.cxx:4
 TLink.cxx:5
 TLink.cxx:6
 TLink.cxx:7
 TLink.cxx:8
 TLink.cxx:9
 TLink.cxx:10
 TLink.cxx:11
 TLink.cxx:12
 TLink.cxx:13
 TLink.cxx:14
 TLink.cxx:15
 TLink.cxx:16
 TLink.cxx:17
 TLink.cxx:18
 TLink.cxx:19
 TLink.cxx:20
 TLink.cxx:21
 TLink.cxx:22
 TLink.cxx:23
 TLink.cxx:24
 TLink.cxx:25
 TLink.cxx:26
 TLink.cxx:27
 TLink.cxx:28
 TLink.cxx:29
 TLink.cxx:30
 TLink.cxx:31
 TLink.cxx:32
 TLink.cxx:33
 TLink.cxx:34
 TLink.cxx:35
 TLink.cxx:36
 TLink.cxx:37
 TLink.cxx:38
 TLink.cxx:39
 TLink.cxx:40
 TLink.cxx:41
 TLink.cxx:42
 TLink.cxx:43
 TLink.cxx:44
 TLink.cxx:45
 TLink.cxx:46
 TLink.cxx:47
 TLink.cxx:48
 TLink.cxx:49
 TLink.cxx:50
 TLink.cxx:51
 TLink.cxx:52
 TLink.cxx:53
 TLink.cxx:54
 TLink.cxx:55
 TLink.cxx:56
 TLink.cxx:57
 TLink.cxx:58
 TLink.cxx:59
 TLink.cxx:60
 TLink.cxx:61
 TLink.cxx:62
 TLink.cxx:63
 TLink.cxx:64
 TLink.cxx:65
 TLink.cxx:66
 TLink.cxx:67
 TLink.cxx:68
 TLink.cxx:69
 TLink.cxx:70
 TLink.cxx:71
 TLink.cxx:72
 TLink.cxx:73
 TLink.cxx:74
 TLink.cxx:75
 TLink.cxx:76
 TLink.cxx:77
 TLink.cxx:78
 TLink.cxx:79
 TLink.cxx:80
 TLink.cxx:81
 TLink.cxx:82
 TLink.cxx:83
 TLink.cxx:84
 TLink.cxx:85
 TLink.cxx:86
 TLink.cxx:87
 TLink.cxx:88
 TLink.cxx:89
 TLink.cxx:90
 TLink.cxx:91
 TLink.cxx:92