ROOT logo
// @(#)root/gl:$Id: TGLAnnotation.h 27560 2009-02-20 21:41:28Z matevz $
// Author:  Matevz and Alja Tadel  20/02/2009

/*************************************************************************
 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGLAnnotation
#define ROOT_TGLAnnotation

#include "TGLOverlay.h"
#include "TGLUtil.h"
#include "TGLFontManager.h"

class TGLViewer;
class TGLViewerBase;
class TGLFont;
class TGTextEdit;
class TGMainFrame;

class TGLAnnotation : public TGLOverlayElement
{
private:
   TGLAnnotation(const TGLAnnotation&);            // Not implemented
   TGLAnnotation& operator=(const TGLAnnotation&); // Not implemented

   void MakeEditor();

protected:
   TGMainFrame      *fMainFrame;
   TGTextEdit       *fTextEdit;

   TGLViewer        *fParent;

   TString           fText;           // annotation text
   Float_t           fLabelFontSize;  // relative font size
   TGLFont           fLabelFont;      // font used to render labels
   TGLFont           fMenuFont;       // font used to render menu buttons

   Pixel_t           fBackColor;      // background color
   Pixel_t           fBackHighColor;  // background active color
   Pixel_t           fTextColor;      // text color
   Pixel_t           fTextHighColor;  // text active color
   Float_t           fAlpha;          // label transparency

   Float_t           fPosX;           // x position [0, 1]
   Float_t           fPosY;           // y position [0, 1]

   Int_t             fMouseX, fMouseY; //! last mouse position
   Bool_t            fInDrag;          //!

   TGLVector3        fPointer;         // picked location in 3D space
   Bool_t            fActive;          // active item identifier

public:
   TGLAnnotation(TGLViewerBase *parent, const char *text, Float_t posx, Float_t posy, TGLVector3 ref);
   virtual ~TGLAnnotation();

   virtual Bool_t MouseEnter(TGLOvlSelectRecord& selRec);
   virtual Bool_t Handle(TGLRnrCtx& rnrCtx, TGLOvlSelectRecord& selRec,
                         Event_t* event);
   virtual void   MouseLeave();

   void CloseEditor();

   void UpdateText();

   virtual void   Render(TGLRnrCtx& rnrCtx);

   ClassDef(TGLAnnotation, 0); // GL-annotation.
};

#endif
 TGLAnnotation.h:1
 TGLAnnotation.h:2
 TGLAnnotation.h:3
 TGLAnnotation.h:4
 TGLAnnotation.h:5
 TGLAnnotation.h:6
 TGLAnnotation.h:7
 TGLAnnotation.h:8
 TGLAnnotation.h:9
 TGLAnnotation.h:10
 TGLAnnotation.h:11
 TGLAnnotation.h:12
 TGLAnnotation.h:13
 TGLAnnotation.h:14
 TGLAnnotation.h:15
 TGLAnnotation.h:16
 TGLAnnotation.h:17
 TGLAnnotation.h:18
 TGLAnnotation.h:19
 TGLAnnotation.h:20
 TGLAnnotation.h:21
 TGLAnnotation.h:22
 TGLAnnotation.h:23
 TGLAnnotation.h:24
 TGLAnnotation.h:25
 TGLAnnotation.h:26
 TGLAnnotation.h:27
 TGLAnnotation.h:28
 TGLAnnotation.h:29
 TGLAnnotation.h:30
 TGLAnnotation.h:31
 TGLAnnotation.h:32
 TGLAnnotation.h:33
 TGLAnnotation.h:34
 TGLAnnotation.h:35
 TGLAnnotation.h:36
 TGLAnnotation.h:37
 TGLAnnotation.h:38
 TGLAnnotation.h:39
 TGLAnnotation.h:40
 TGLAnnotation.h:41
 TGLAnnotation.h:42
 TGLAnnotation.h:43
 TGLAnnotation.h:44
 TGLAnnotation.h:45
 TGLAnnotation.h:46
 TGLAnnotation.h:47
 TGLAnnotation.h:48
 TGLAnnotation.h:49
 TGLAnnotation.h:50
 TGLAnnotation.h:51
 TGLAnnotation.h:52
 TGLAnnotation.h:53
 TGLAnnotation.h:54
 TGLAnnotation.h:55
 TGLAnnotation.h:56
 TGLAnnotation.h:57
 TGLAnnotation.h:58
 TGLAnnotation.h:59
 TGLAnnotation.h:60
 TGLAnnotation.h:61
 TGLAnnotation.h:62
 TGLAnnotation.h:63
 TGLAnnotation.h:64
 TGLAnnotation.h:65
 TGLAnnotation.h:66
 TGLAnnotation.h:67
 TGLAnnotation.h:68
 TGLAnnotation.h:69
 TGLAnnotation.h:70
 TGLAnnotation.h:71
 TGLAnnotation.h:72
 TGLAnnotation.h:73
 TGLAnnotation.h:74
 TGLAnnotation.h:75
 TGLAnnotation.h:76
 TGLAnnotation.h:77