ROOT
Version v6.32
master
v6.34
v6.32
v6.30
v6.28
v6.26
v6.24
v6.22
v6.20
v6.18
v6.16
v6.14
v6.12
v6.10
v6.08
v6.06
v6.04
Reference Guide
▼
ROOT
ROOT Reference Documentation
Tutorials
►
Functional Parts
►
Namespaces
►
All Classes
▼
Files
▼
File List
►
bindings
►
core
►
documentation
►
geom
▼
graf2d
►
asimage
►
cocoa
►
fitsio
►
gpad
►
gpadv7
▼
graf
►
doc
►
inc
▼
src
TArc.cxx
TArrow.cxx
►
TAttImage.cxx
TBox.cxx
TCandle.cxx
TCrown.cxx
TCurlyArc.cxx
TCurlyLine.cxx
TCutG.cxx
TDiamond.cxx
►
TEllipse.cxx
TFrame.cxx
►
TGaxis.cxx
TGraphPolar.cxx
TGraphPolargram.cxx
TGraphQQ.cxx
►
TImage.cxx
►
TLatex.cxx
TLegend.cxx
TLegendEntry.cxx
TLine.cxx
TLink.cxx
TMarker.cxx
►
TMathText.cxx
TPave.cxx
TPaveLabel.cxx
►
TPaveStats.cxx
TPavesText.cxx
TPaveText.cxx
►
TPie.cxx
TPieSlice.cxx
TPoints.cxx
TPolyLine.cxx
TText.cxx
►
TTF.cxx
TWbox.cxx
►
gviz
►
postscript
►
quartz
►
win32gdk
►
x11
►
x11ttf
►
graf3d
►
gui
►
hist
►
html
►
io
►
main
►
math
►
montecarlo
►
net
►
proof
►
roofit
►
sql
►
tmva
►
tree
►
tutorials
►
v6-32-00-patches
►
File Members
Release Notes
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
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 <cstdio>
13
14
#include "
TVirtualPad.h
"
15
#include "
TClass.h
"
16
#include "
TLink.h
"
17
#include "snprintf.h"
18
19
ClassImp
(
TLink
);
20
21
/** \class TLink
22
\ingroup BasicGraphics
23
24
Special TText object used to show hyperlinks.
25
26
In the example below created by TObject::Inspect, TLinks are used
27
to show pointers to other objects.
28
Clicking on one link, inspect the corresponding object.
29
*/
30
31
////////////////////////////////////////////////////////////////////////////////
32
/// Link default constructor.
33
34
TLink::TLink
() :
TText
()
35
{
36
}
37
38
////////////////////////////////////////////////////////////////////////////////
39
/// Constructor to define a link object.
40
///
41
/// pointer points to any kind of object.
42
43
TLink::TLink
(
Double_t
x
,
Double_t
y
,
void
*pointer)
44
:
TText
(
x
,
y
,
""
)
45
{
46
fLink
= pointer;
47
static
char
line
[16];
48
snprintf
(
line
,16,
"->%zx "
, (
size_t
)pointer);
49
SetTitle
(
line
);
50
}
51
52
////////////////////////////////////////////////////////////////////////////////
53
/// Link default destructor.
54
55
TLink::~TLink
()
56
{
57
}
58
59
////////////////////////////////////////////////////////////////////////////////
60
/// Execute action corresponding to one event.
61
///
62
/// This member function is called when a link is clicked with the locator
63
///
64
/// If mouse is clicked on a link text, the object pointed by the link
65
/// is Inspected
66
67
void
TLink::ExecuteEvent
(
Int_t
event,
Int_t
,
Int_t
)
68
{
69
if
(!
gPad
)
return
;
70
71
if
(event ==
kMouseMotion
)
72
gPad
->SetCursor(
kHand
);
73
74
if
(event !=
kButton1Up
)
return
;
75
76
if
(
TestBit
(
kIsStarStar
))
return
;
77
TObject
*
idcur
= (
TObject
*)
fLink
;
78
if
(!
idcur
)
return
;
79
TClass
*cl =
TClass::GetClass
(
GetName
());
80
if
(!cl)
return
;
81
82
// check if link points to a TObject
83
TClass
*
c1
= (
TClass
*)cl->
GetBaseClass
(
"TObject"
);
84
if
(!
c1
)
return
;
85
86
idcur
->Inspect();
87
}
kMouseMotion
@ kMouseMotion
Definition
Buttons.h:23
kButton1Up
@ kButton1Up
Definition
Buttons.h:19
kHand
@ kHand
Definition
GuiTypes.h:374
ClassImp
#define ClassImp(name)
Definition
Rtypes.h:377
TClass.h
TLink.h
TVirtualPad.h
gPad
#define gPad
Definition
TVirtualPad.h:305
snprintf
#define snprintf
Definition
civetweb.c:1540
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
TClass
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition
TClass.h:81
TClass::GetBaseClass
TClass * GetBaseClass(const char *classname)
Return pointer to the base class "classname".
Definition
TClass.cxx:2655
TClass::GetClass
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:2968
TLink
Special TText object used to show hyperlinks.
Definition
TLink.h:17
TLink::ExecuteEvent
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Definition
TLink.cxx:67
TLink::~TLink
~TLink() override
Link default destructor.
Definition
TLink.cxx:55
TLink::fLink
void * fLink
pointer to object
Definition
TLink.h:21
TLink::TLink
TLink()
Link default constructor.
Definition
TLink.cxx:34
TLink::kIsStarStar
@ kIsStarStar
Definition
TLink.h:24
TNamed::SetTitle
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition
TNamed.cxx:164
TNamed::GetName
const char * GetName() const override
Returns name of object.
Definition
TNamed.h:47
TObject
Mother of all ROOT objects.
Definition
TObject.h:41
TObject::TestBit
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition
TObject.h:199
TText
Base class for several text objects.
Definition
TText.h:22
double
int
line
TLine * line
Definition
entrylistblock_figure1.C:235
y
Double_t y[n]
Definition
legend1.C:17
c1
return c1
Definition
legend1.C:41
x
Double_t x[n]
Definition
legend1.C:17
graf2d
graf
src
TLink.cxx
ROOT v6-32 - Reference Guide Generated on Mon Mar 10 2025 03:58:16 (GVA Time) using Doxygen 1.10.0