// @(#)root/eve:$Id$
// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007

/*************************************************************************
 * Copyright (C) 1995-2007, 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_TEveViewer
#define ROOT_TEveViewer

#include "TEveElement.h"
#include "TEveWindow.h"

class TGWindow;
class TGedEditor;
class TGLViewer;
class TGLSAViewer;
class TGLEmbeddedViewer;

class TEveScene;

/******************************************************************************/
// TEveViewer
/******************************************************************************/

class TEveViewer : public TEveWindowFrame
{
private:
   TEveViewer(const TEveViewer&);            // Not implemented
   TEveViewer& operator=(const TEveViewer&); // Not implemented

protected:
   TGLViewer    *fGLViewer;
   TGFrame      *fGLViewerFrame;

   static Bool_t fgInitInternal;
   static Bool_t fgRecreateGlOnDockOps;
   static void   InitInternal();

public:
   TEveViewer(const char* n="TEveViewer", const char* t="");
   virtual ~TEveViewer();

   virtual void PreUndock();
   virtual void PostDock();

   TGLViewer* GetGLViewer() const { return fGLViewer; }
   void SetGLViewer(TGLViewer* viewer, TGFrame* frame);

   TGLSAViewer*       SpawnGLViewer(TGedEditor* ged=0, Bool_t stereo=kFALSE, Bool_t quad_buf=kTRUE);
   TGLEmbeddedViewer* SpawnGLEmbeddedViewer(TGedEditor* ged=0, Int_t border=0);

   void Redraw(Bool_t resetCameras=kFALSE);
   void SwitchStereo();

   virtual void AddScene(TEveScene* scene);

   virtual void RemoveElementLocal(TEveElement* el);
   virtual void RemoveElementsLocal();

   virtual TObject* GetEditorObject(const TEveException& eh="TEveViewer::GetEditorObject ") const;

   virtual Bool_t HandleElementPaste(TEveElement* el);

   virtual const TGPicture* GetListTreeIcon(Bool_t open=kFALSE);

   ClassDef(TEveViewer, 0); // Reve representation of TGLViewer.
};


/******************************************************************************/
// TEveViewerList
/******************************************************************************/

class TEveViewerList : public TEveElementList
{
private:
   TEveViewerList(const TEveViewerList&);            // Not implemented
   TEveViewerList& operator=(const TEveViewerList&); // Not implemented

protected:
   Bool_t        fShowTooltip;

   Float_t       fBrightness;
   Bool_t        fUseLightColorSet;

   void HandleTooltip();

public:
   TEveViewerList(const char* n="TEveViewerList", const char* t="");
   virtual ~TEveViewerList();

   virtual void AddElement(TEveElement* el);
   virtual void RemoveElementLocal(TEveElement* el);
   virtual void RemoveElementsLocal();

   // --------------------------------

   virtual void Connect();
   virtual void Disconnect();

   void RepaintChangedViewers(Bool_t resetCameras, Bool_t dropLogicals);
   void RepaintAllViewers(Bool_t resetCameras, Bool_t dropLogicals);
   void DeleteAnnotations();

   void SceneDestructing(TEveScene* scene);

   // --------------------------------

   void OnMouseOver(TObject* obj, UInt_t state);
   void OnReMouseOver(TObject* obj, UInt_t state);
   void OnUnMouseOver(TObject* obj, UInt_t state);
   void OnClicked(TObject *obj, UInt_t button, UInt_t state);
   void OnReClicked(TObject *obj, UInt_t button, UInt_t state);
   void OnUnClicked(TObject *obj, UInt_t button, UInt_t state);

   // --------------------------------

   Bool_t  GetShowTooltip()     const { return fShowTooltip; }
   void    SetShowTooltip(Bool_t x)   { fShowTooltip = x; }

   Float_t GetColorBrightness() const { return fBrightness; }
   void    SetColorBrightness(Float_t b);

   Bool_t  UseLightColorSet()   const { return fUseLightColorSet; }
   void    SwitchColorSet();

   ClassDef(TEveViewerList, 0); // List of Viewers providing common operations on TEveViewer collections.
};

#endif
 TEveViewer.h:1
 TEveViewer.h:2
 TEveViewer.h:3
 TEveViewer.h:4
 TEveViewer.h:5
 TEveViewer.h:6
 TEveViewer.h:7
 TEveViewer.h:8
 TEveViewer.h:9
 TEveViewer.h:10
 TEveViewer.h:11
 TEveViewer.h:12
 TEveViewer.h:13
 TEveViewer.h:14
 TEveViewer.h:15
 TEveViewer.h:16
 TEveViewer.h:17
 TEveViewer.h:18
 TEveViewer.h:19
 TEveViewer.h:20
 TEveViewer.h:21
 TEveViewer.h:22
 TEveViewer.h:23
 TEveViewer.h:24
 TEveViewer.h:25
 TEveViewer.h:26
 TEveViewer.h:27
 TEveViewer.h:28
 TEveViewer.h:29
 TEveViewer.h:30
 TEveViewer.h:31
 TEveViewer.h:32
 TEveViewer.h:33
 TEveViewer.h:34
 TEveViewer.h:35
 TEveViewer.h:36
 TEveViewer.h:37
 TEveViewer.h:38
 TEveViewer.h:39
 TEveViewer.h:40
 TEveViewer.h:41
 TEveViewer.h:42
 TEveViewer.h:43
 TEveViewer.h:44
 TEveViewer.h:45
 TEveViewer.h:46
 TEveViewer.h:47
 TEveViewer.h:48
 TEveViewer.h:49
 TEveViewer.h:50
 TEveViewer.h:51
 TEveViewer.h:52
 TEveViewer.h:53
 TEveViewer.h:54
 TEveViewer.h:55
 TEveViewer.h:56
 TEveViewer.h:57
 TEveViewer.h:58
 TEveViewer.h:59
 TEveViewer.h:60
 TEveViewer.h:61
 TEveViewer.h:62
 TEveViewer.h:63
 TEveViewer.h:64
 TEveViewer.h:65
 TEveViewer.h:66
 TEveViewer.h:67
 TEveViewer.h:68
 TEveViewer.h:69
 TEveViewer.h:70
 TEveViewer.h:71
 TEveViewer.h:72
 TEveViewer.h:73
 TEveViewer.h:74
 TEveViewer.h:75
 TEveViewer.h:76
 TEveViewer.h:77
 TEveViewer.h:78
 TEveViewer.h:79
 TEveViewer.h:80
 TEveViewer.h:81
 TEveViewer.h:82
 TEveViewer.h:83
 TEveViewer.h:84
 TEveViewer.h:85
 TEveViewer.h:86
 TEveViewer.h:87
 TEveViewer.h:88
 TEveViewer.h:89
 TEveViewer.h:90
 TEveViewer.h:91
 TEveViewer.h:92
 TEveViewer.h:93
 TEveViewer.h:94
 TEveViewer.h:95
 TEveViewer.h:96
 TEveViewer.h:97
 TEveViewer.h:98
 TEveViewer.h:99
 TEveViewer.h:100
 TEveViewer.h:101
 TEveViewer.h:102
 TEveViewer.h:103
 TEveViewer.h:104
 TEveViewer.h:105
 TEveViewer.h:106
 TEveViewer.h:107
 TEveViewer.h:108
 TEveViewer.h:109
 TEveViewer.h:110
 TEveViewer.h:111
 TEveViewer.h:112
 TEveViewer.h:113
 TEveViewer.h:114
 TEveViewer.h:115
 TEveViewer.h:116
 TEveViewer.h:117
 TEveViewer.h:118
 TEveViewer.h:119
 TEveViewer.h:120
 TEveViewer.h:121
 TEveViewer.h:122
 TEveViewer.h:123
 TEveViewer.h:124
 TEveViewer.h:125
 TEveViewer.h:126
 TEveViewer.h:127
 TEveViewer.h:128
 TEveViewer.h:129
 TEveViewer.h:130
 TEveViewer.h:131
 TEveViewer.h:132
 TEveViewer.h:133
 TEveViewer.h:134
 TEveViewer.h:135