Evita  0.16
evGUIVisualizerWindow.h
Go to the documentation of this file.
1 /*
2  *
3  * EVITA: Efficient Visualization of Terascale Datasets
4  * Copyright (C) 2000-2016 Team Evita
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
19  * MA 02139, USA.
20  *
21  */
22 
23 
24 #ifndef __evGUIVisualizerWindow_h
25 #define __evGUIVisualizerWindow_h
26 
27 
28 #include <FL/Fl.H>
29 #include <FL/Fl_Button.H>
30 #include <FL/Fl_Window.H>
31 #include "vtkRenderWindow.h"
32 #include "vtkCommand.h"
33 #include "vtkInteractorStyle.h"
35 #include "evGUIObject.h"
36 #include "evGUIWindow.h"
37 
38 
40 {
41 public:
42  evGUIVisualizerWindow(const int width,
43  const int height,
44  const char *title);
45  virtual ~evGUIVisualizerWindow(void);
46 
47  virtual const evString GetClassName(void) const
48  {
49  return(evString("evGUIVisualizerWindow"));
50  }
51 
52  virtual void show(void);
53 
55  vtkRenderWindow *GetRenderWindow(void) const;
56 
57  virtual int Render(void);
58 
59 protected:
60 
61 private:
62 
63  vtkRenderWindow *RenderWindow;
65 
66  Fl_Button *CloseButton;
67 
68  static void CloseCallback(Fl_Widget *widget, void *data);
69 };
70 
71 
73 {
74  if (this->RenderWindow != NULL)
75  this->RenderWindow->Delete();
76  if (this->WindowInteractor != NULL)
77  this->WindowInteractor->Delete();
78 }
79 
80 
83 {
84  return(this->WindowInteractor);
85 }
86 
87 
88 inline vtkRenderWindow *evGUIVisualizerWindow::GetRenderWindow(void) const
89 {
90  return(this->RenderWindow);
91 }
92 
93 
94 inline void evGUIVisualizerWindow::show(void)
95 {
96  this->Fl_Window::show();
97  this->WindowInteractor->show();
98 
99  this->WindowInteractor->GetInteractorStyle()->InvokeEvent(vtkCommand::UserEvent, NULL);
100 
101 }
102 
103 
104 inline void evGUIVisualizerWindow::CloseCallback(Fl_Widget *widget, void *data)
105 {
106  evGUIVisualizerWindow *visualizer_window = (evGUIVisualizerWindow *)data;
107 
108  visualizer_window->do_callback();
109 }
110 
111 
113 {
114  this->RenderWindow->Render();
115 
116  return(0);
117 }
118 
119 
120 #endif
evGUIVisualizerWindow(const int width, const int height, const char *title)
virtual int Render(void)
Definition: evGUIVisualizerWindow.h:112
virtual void show(void)
Definition: evGUIVisualizerWindow.h:94
evRenderWindowInteractor * WindowInteractor
Definition: evGUIVisualizerWindow.h:64
Definition: evRenderWindowInteractor.h:69
virtual const evString GetClassName(void) const
Definition: evGUIVisualizerWindow.h:47
virtual ~evGUIVisualizerWindow(void)
Definition: evGUIVisualizerWindow.h:72
Definition: evGUIWindow.h:33
vtkRenderWindow * RenderWindow
Definition: evGUIVisualizerWindow.h:63
Definition: evGUIVisualizerWindow.h:39
Fl_Button * CloseButton
Definition: evGUIVisualizerWindow.h:66
static void CloseCallback(Fl_Widget *widget, void *data)
Definition: evGUIVisualizerWindow.h:104
evRenderWindowInteractor * GetWindowInteractor(void) const
Definition: evGUIVisualizerWindow.h:82
Definition: evString.h:30
vtkRenderWindow * GetRenderWindow(void) const
Definition: evGUIVisualizerWindow.h:88