ROOT
master
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
21
Special TText object used to show hyperlinks.
22
23
In the example below created by TObject::Inspect, TLinks are used
24
to show pointers to other objects.
25
Clicking on one link, inspect the corresponding object.
26
*/
27
28
////////////////////////////////////////////////////////////////////////////////
29
/// Link default constructor.
30
31
TLink::TLink
() :
TText
()
32
{
33
}
34
35
////////////////////////////////////////////////////////////////////////////////
36
/// Constructor to define a link object.
37
///
38
/// pointer points to any kind of object.
39
40
TLink::TLink
(
Double_t
x
,
Double_t
y
,
void
*pointer)
41
:
TText
(
x
,
y
,
""
)
42
{
43
fLink
= pointer;
44
static
char
line
[16];
45
snprintf
(
line
,16,
"->%zx "
, (
size_t
)pointer);
46
SetTitle
(
line
);
47
}
48
49
////////////////////////////////////////////////////////////////////////////////
50
/// Link default destructor.
51
52
TLink::~TLink
()
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
64
void
TLink::ExecuteEvent
(
Int_t
event
,
Int_t
,
Int_t
)
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
;
74
TObject
*
idcur
= (
TObject
*)
fLink
;
75
if
(!
idcur
)
return
;
76
TClass
*cl =
TClass::GetClass
(
GetName
());
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
@ kMouseMotion
Definition
Buttons.h:23
kButton1Up
@ kButton1Up
Definition
Buttons.h:19
kHand
@ kHand
Definition
GuiTypes.h:375
event
cudaEvent_t event
Definition
RooBatchCompute.cu:106
TClass.h
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:359
TLink.h
TVirtualPad.h
gPad
#define gPad
Definition
TVirtualPad.h:337
ROOT::Detail::TRangeCast
Definition
TCollection.h:312
TClass
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition
TClass.h:84
TClass::GetBaseClass
TClass * GetBaseClass(const char *classname)
Return pointer to the base class "classname".
Definition
TClass.cxx:2667
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:2999
TLink::ExecuteEvent
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute action corresponding to one event.
Definition
TLink.cxx:64
TLink::~TLink
~TLink() override
Link default destructor.
Definition
TLink.cxx:52
TLink::fLink
void * fLink
pointer to object
Definition
TLink.h:21
TLink::TLink
TLink()
Link default constructor.
Definition
TLink.cxx:31
TLink::kIsStarStar
@ kIsStarStar
Definition
TLink.h:24
TNamed::SetTitle
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition
TNamed.cxx:173
TNamed::GetName
const char * GetName() const override
Returns name of object.
Definition
TNamed.h:49
TObject
Mother of all ROOT objects.
Definition
TObject.h:42
TObject::TestBit
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition
TObject.h:204
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
ROOTmaster - Reference Guide Generated on Sat Sep 26 2026 04:34:12 (GVA Time) using Doxygen 1.10.0