Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TLink.cxx
Go to the documentation of this file.
1// @(#)root/graf:$Id$
2// Author: Rene Brun 05/03/95
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#include "TVirtualPad.h"
13#include "TClass.h"
14#include "TLink.h"
15
16#include <cstdio>
17
18/** \class TLink
19\ingroup BasicGraphics
20
21Special TText object used to show hyperlinks.
22
23In the example below created by TObject::Inspect, TLinks are used
24to show pointers to other objects.
25Clicking on one link, inspect the corresponding object.
26*/
27
28////////////////////////////////////////////////////////////////////////////////
29/// Link default constructor.
30
32{
33}
34
35////////////////////////////////////////////////////////////////////////////////
36/// Constructor to define a link object.
37///
38/// pointer points to any kind of object.
39
41 : TText(x, y, "")
42{
43 fLink = pointer;
44 static char line[16];
45 snprintf(line,16,"->%zx ", (size_t)pointer);
47}
48
49////////////////////////////////////////////////////////////////////////////////
50/// Link default destructor.
51
53{
54}
55
56////////////////////////////////////////////////////////////////////////////////
57/// Execute action corresponding to one event.
58///
59/// This member function is called when a link is clicked with the locator
60///
61/// If mouse is clicked on a link text, the object pointed by the link
62/// is Inspected
63
65{
66 if (!gPad) return;
67
68 if (event == kMouseMotion)
69 gPad->SetCursor(kHand);
70
71 if (event != kButton1Up) return;
72
73 if (TestBit(kIsStarStar)) return;
75 if (!idcur) return;
77 if (!cl) return;
78
79 // check if link points to a TObject
80 TClass *c1 = (TClass*)cl->GetBaseClass("TObject");
81 if (!c1) return;
82
83 idcur->Inspect();
84}
@ kMouseMotion
Definition Buttons.h:23
@ kButton1Up
Definition Buttons.h:19
@ kHand
Definition GuiTypes.h:375
cudaEvent_t event
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define gPad
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
TClass * GetBaseClass(const char *classname)
Return pointer to the base class "classname".
Definition TClass.cxx:2667
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition TClass.cxx:2999
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:173
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
Mother of all ROOT objects.
Definition TObject.h:42
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:204
Base class for several text objects.
Definition TText.h:22
TLine * line
Double_t y[n]
Definition legend1.C:17
return c1
Definition legend1.C:41
Double_t x[n]
Definition legend1.C:17