//*CMZ :  2.23/02 03/09/99  10.17.00  by  Rene Brun
//*CMZ :  1.03/09 05/12/97  12.53.43  by  Fons Rademakers
//*-- Author :    Rene Brun   05/03/95

//*KEEP,CopyRight,T=C.
/*************************************************************************
 * Copyright(c) 1995-1999, The ROOT System, All rights reserved.         *
 * Authors: Rene Brun and Fons Rademakers.                               *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/AA_LICENSE.                      *
 * For the list of contributors see $ROOTSYS/AA_CREDITS.                 *
 *************************************************************************/
//*KEND.

#include <stdio.h>

//*KEEP,TVirtualPad.
#include "TVirtualPad.h"
//*KEEP,TClass.
#include "TClass.h"
//*KEEP,TROOT.
#include "TROOT.h"
//*KEEP,TLink.
#include "TLink.h"
//*KEND.

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

*/
//
//

//______________________________________________________________________________
 TLink::TLink() : TText()
{
//*-*-*-*-*-*-*-*-*-*-*Link default constructor*-*-*-*-*-*-*-*-*-*-*-*-*
//*-*                  ============================

   fLink  = 0;
}

//______________________________________________________________________________
 TLink::TLink(Float_t x, Float_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];
   sprintf(line,"->%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;

  TObject *idcur = (TObject*)fLink;
  if (!idcur) return;
  TClass *cl = gROOT->GetClass(GetName());
  if (!cl) return;

//*-*- make a special case for top of Collections
//*-*-    if status word is 0 take first member
//*-*-    otherwise go back to parent of linked list
  if (cl->InheritsFrom(TCollection::Class())) {
     TList *lh = (TList*)idcur;
     if (!TestBit(kObjIsParent))  idcur = lh->First();
     else                         idcur = lh->GetParent();
     if (!idcur) return;
     idcur->Inspect();
     return;
  }

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

   idcur->Inspect();
}


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.