Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGLSAViewer.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Richard Maunder / Timur Pocheptsov
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, 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 #ifndef ROOT_TGLSAViewer
13 #define ROOT_TGLSAViewer
14 
15 #include "TGLViewer.h"
16 #include "TString.h"
17 
18 class TGLSAFrame;
19 class TGLFormat;
20 class TGWindow;
21 class TGFrame;
22 class TGCompositeFrame;
23 class TGPopupMenu;
24 class TGButton;
25 
26 class TGedEditor;
27 class TGLEventHandler;
28 class TGMenuBar;
29 
30 //______________________________________________________________________________
31 //
32 // TGLSAViewer
33 //
34 // The top-level standalone GL viewer.
35 
36 
37 class TGLSAViewer : public TGLViewer
38 {
39 public:
40  enum EGLSACommands {
41  kGLHelpAbout, kGLHelpViewer,
42  kGLPerspYOZ, kGLPerspXOZ, kGLPerspXOY,
43  kGLXOY, kGLXOZ, kGLZOY, kGLZOX,
44  kGLXnOY, kGLXnOZ, kGLZnOY, kGLZnOX,
45  kGLOrthoRotate, kGLOrthoDolly,
46  kGLSaveEPS, kGLSavePDF, kGLSavePNG, kGLSaveGIF, kGLSaveAnimGIF,
47  kGLSaveJPG, kGLSaveAS, kGLCloseViewer, kGLQuitROOT,
48  kGLEditObject, kGLHideMenus };
49 
50 private:
51  // GUI components
52  TGLSAFrame *fFrame;
53  TGLFormat *fFormat;
54  TGPopupMenu *fFileMenu;
55  TGPopupMenu *fFileSaveMenu;
56  TGPopupMenu *fCameraMenu;
57  TGPopupMenu *fHelpMenu;
58 
59  // Ged
60  TGCompositeFrame *fLeftVerticalFrame;
61 
62  TGCompositeFrame *fRightVerticalFrame;
63 
64  TString fDirName;
65  Int_t fTypeIdx;
66  Bool_t fOverwrite;
67  TGMenuBar *fMenuBar;
68  TGButton *fMenuBut;
69  Bool_t fHideMenuBar;
70  TTimer *fMenuHidingTimer;
71  Bool_t fMenuHidingShowMenu;
72 
73  Bool_t fDeleteMenuBar;
74 
75  static Long_t fgMenuHidingTimeout;
76 
77  void ResetMenuHidingTimer(Bool_t show_menu);
78 
79  // Initial window positioning
80  static const Int_t fgInitX;
81  static const Int_t fgInitY;
82  static const Int_t fgInitW;
83  static const Int_t fgInitH;
84 
85  static const char *fgHelpText1;
86  static const char *fgHelpText2;
87 
88  void CreateMenus();
89  void CreateFrames();
90 
91  // non-copyable class
92  TGLSAViewer(const TGLSAViewer &);
93  TGLSAViewer & operator = (const TGLSAViewer &);
94 
95 public:
96  TGLSAViewer(TVirtualPad* pad, TGLFormat* format=0);
97  TGLSAViewer(const TGWindow* parent, TVirtualPad *pad, TGedEditor *ged=0,
98  TGLFormat* format=0);
99  ~TGLSAViewer();
100 
101  virtual void CreateGLWidget();
102  virtual void DestroyGLWidget();
103 
104  virtual const char* GetName() const { return "GLViewer"; }
105 
106  virtual void SelectionChanged();
107 
108  void Show();
109  void Close();
110  void DeleteMenuBar();
111  void DisableCloseMenuEntries();
112  void EnableMenuBarHiding();
113  void DisableMenuBarHiding();
114  void MenuHidingTimeout();
115 
116  void HandleMenuBarHiding(Event_t* ev);
117 
118  // GUI events - editors, frame etc
119  Bool_t ProcessFrameMessage(Long_t msg, Long_t parm1, Long_t);
120 
121  TGCompositeFrame* GetFrame() const;
122  TGCompositeFrame* GetLeftVerticalFrame() const { return fLeftVerticalFrame; }
123 
124  TGLFormat* GetFormat() const { return fFormat; }
125 
126  void ToggleEditObject();
127  void ToggleOrthoRotate();
128  void ToggleOrthoDolly();
129 
130  static void SetMenuHidingTimeout(Long_t timeout);
131 
132  ClassDef(TGLSAViewer, 0); // Standalone GL viewer.
133 };
134 
135 #endif
136