// @(#)root/x3d:$Id$
// Author: Rene Brun   05/09/99

/*************************************************************************
 * Copyright (C) 1995-2000, 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_TViewerX3D
#define ROOT_TViewerX3D


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TViewerX3D                                                           //
//                                                                      //
// C++ interface to the X3D viewer                                      //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TX3DFrame
#include "TX3DFrame.h"
#endif
#ifndef ROOT_TVirtualViewer3D
#include "TVirtualViewer3D.h"
#endif

class TVirtualPad;
class TGCanvas;
class TGMenuBar;
class TGPopupMenu;
class TGLayoutHints;
class TX3DContainer;

class TViewerX3D : public TVirtualViewer3D
{

friend class TX3DContainer;

private:
   TX3DFrame      *fMainFrame;          // the main GUI frame
   TString         fOption;             // option string to be passed to X3D
   TString         fTitle;              // viewer title
   Window_t        fX3DWin;             // X3D window
   TGCanvas       *fCanvas;             // canvas widget
   TX3DContainer  *fContainer;          // container containing X3D window
   TGMenuBar      *fMenuBar;            // menubar
   TGPopupMenu    *fFileMenu;           // file menu
   TGPopupMenu    *fHelpMenu;           // help menu
   TGLayoutHints  *fMenuBarLayout;      // menubar layout hints
   TGLayoutHints  *fMenuBarItemLayout;  // layout hints for menu in menubar
   TGLayoutHints  *fMenuBarHelpLayout;  // layout hint for help menu in menubar
   TGLayoutHints  *fCanvasLayout;       // layout for canvas widget
   UInt_t          fWidth;              // viewer width
   UInt_t          fHeight;             // viewer height
   Int_t           fXPos;               // viewer X position
   Int_t           fYPos;               // viewer Y position
   TVirtualPad    *fPad;                // pad we are attached to
   Bool_t          fBuildingScene;      // Rebuilding 3D scene
   enum EPass { kSize, kDraw };         // Multi-pass build : size then draw
   EPass           fPass;

   void     CreateViewer(const char *name);
   void     InitX3DWindow();
   void     DeleteX3DWindow();

   Bool_t   HandleContainerButton(Event_t *ev);

   static Bool_t fgCreated;    // TViewerX3D is a singleton

public:
   TViewerX3D(TVirtualPad *pad);
   TViewerX3D(TVirtualPad *pad, Option_t *option, const char *title="X3D Viewer",
              UInt_t width = 800, UInt_t height = 600);
   TViewerX3D(TVirtualPad *pad, Option_t *option, const char *title,
              Int_t x, Int_t y, UInt_t width, UInt_t height);
   virtual ~TViewerX3D();

   Int_t    ExecCommand(Int_t px, Int_t py, char command);
   void     GetPosition(Float_t &longitude, Float_t &latitude, Float_t &psi);
   void     Iconify() { }
   void     Show() { fMainFrame->MapRaised(); }
   void     Close();
   void     Update();

   void     PaintPolyMarker(const TBuffer3D & buffer) const;

   // TVirtualViewer3D interface
   virtual Bool_t PreferLocalFrame() const { return kFALSE; }
   virtual void   BeginScene();
   virtual Bool_t BuildingScene()    const { return fBuildingScene; }
   virtual void   EndScene();
   virtual Int_t  AddObject(const TBuffer3D & buffer, Bool_t * addChildren = 0);
   virtual Int_t  AddObject(UInt_t placedID, const TBuffer3D & buffer, Bool_t * addChildren = 0);

   // Composite shapes not supported on this viewer currently - ignore.
   // Will result in a set of component shapes
   virtual Bool_t OpenComposite(const TBuffer3D & /*buffer*/, Bool_t * =0) { return kTRUE; }
   virtual void   CloseComposite() {};
   virtual void   AddCompositeOp(UInt_t /*operation*/) {};

   Bool_t   ProcessFrameMessage(Long_t msg, Long_t parm1, Long_t parm2);

   ClassDef(TViewerX3D,0)  //Interface to the X3D viewer
};

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