33#ifdef G4VIS_BUILD_OPENGLWT_DRIVER
43G4OpenGLImmediateWtViewer::G4OpenGLImmediateWtViewer
54 printf(
"G4OpenGLImmediateWtViewer INIT\n");
69G4OpenGLImmediateWtViewer::~G4OpenGLImmediateWtViewer() {
74void G4OpenGLImmediateWtViewer::DrawView() {
76 printf(
"G4OpenGLImmediateWtViewer DrawView\n");
78 fQtViewer->updateQWidget();
83void G4OpenGLImmediateWtViewer::WtMousePressEvent(Wt::WMouseEvent event)
86 printf(
"G4OpenGLImmediateWtViewer mousePress\n");
89 fQtViewer->G4MousePressEvent(ConvertWtMouseEventToQt(event));
92void G4OpenGLImmediateWtViewer::WtKeyPressEvent (Wt::WKeyEvent event)
95 printf(
"G4OpenGLImmediateWtViewer keyPressEvent\n");
97 fQtViewer->G4keyPressEvent(ConvertWtKeyEventToQt(event));
100void G4OpenGLImmediateWtViewer::WtWheelEvent (Wt::WMouseEvent event)
102#ifdef G4DEBUG_VIS_OGL
103 printf(
"G4OpenGLImmediateWtViewer wheelEvent\n");
105 fQtViewer->G4wheelEvent(ConvertWtWheelEventToQt(event));
119void G4OpenGLImmediateWtViewer::WtMouseDoubleClickEvent(Wt::WMouseEvent )
121#ifdef G4DEBUG_VIS_OGL
122 printf(
"G4OpenGLImmediateWtViewer mouseDoubleClickEvent\n");
124 fQtViewer->G4MouseDoubleClickEvent();
134void G4OpenGLImmediateWtViewer::WtMouseMoveEvent(Wt::WMouseEvent event)
136#ifdef G4DEBUG_VIS_OGL
137 printf(
"G4OpenGLImmediateWtViewer mouseMoveEvent\n");
139 fQtViewer->G4MouseMoveEvent(ConvertWtMouseEventToQt(event));
151void G4OpenGLImmediateWtViewer::paintEvent(Wt::WPaintDevice * painter) {
152#ifdef G4DEBUG_VIS_OGL
153 printf(
"G4OpenGLImmediateWtViewer paintEvent\n");
155 fQtViewer->updateQWidget();
162void G4OpenGLImmediateWtViewer::ShowView (
167#ifdef G4DEBUG_VIS_OGL
168 printf(
"G4OpenGLImmediateWtViewer ShowView\n");
170 fQtViewer->activateWindow();
174QMouseEvent * G4OpenGLImmediateWtViewer::ConvertWtMouseEventToQt(Wt::WMouseEvent event) {
176 if (event.button() == (Wt::WMouseEvent::NoButton)) {
178 }
else if (event.button() == (Wt::WMouseEvent::LeftButton)) {
180 }
else if (event.button() == (Wt::WMouseEvent::RightButton)) {
181 bt = Qt::RightButton;
182 }
else if (event.button() == (Wt::WMouseEvent::MiddleButton)) {
186 Qt::KeyboardModifiers km;
187 if (event.modifiers() == Wt::NoModifier) {
189 }
else if (event.modifiers() == Wt::ControlModifier) {
190 km = Qt::ControlModifier;
191 }
else if (event.modifiers() == Wt::ShiftModifier) {
192 km = Qt::ShiftModifier;
193 }
else if (event.modifiers() == Wt::AltModifier) {
194 km = Qt::AltModifier;
195 }
else if (event.modifiers() == Wt::MetaModifier) {
196 km = Qt::MetaModifier;
198 QPoint pt = QPoint(event.widget().x,event.widget().y);
199 QMouseEvent *e =
new QMouseEvent(QEvent::None, pt, bt, bt, km);
204QWheelEvent * G4OpenGLImmediateWtViewer::ConvertWtWheelEventToQt(Wt::WMouseEvent event) {
206 if (event.button() == (Wt::WMouseEvent::NoButton)) {
208 }
else if (event.button() == (Wt::WMouseEvent::LeftButton)) {
210 }
else if (event.button() == (Wt::WMouseEvent::RightButton)) {
211 bt = Qt::RightButton;
212 }
else if (event.button() == (Wt::WMouseEvent::MiddleButton)) {
216 Qt::KeyboardModifiers km;
217 if (event.modifiers() == Wt::NoModifier) {
219 }
else if (event.modifiers() == Wt::ControlModifier) {
220 km = Qt::ControlModifier;
221 }
else if (event.modifiers() == Wt::ShiftModifier) {
222 km = Qt::ShiftModifier;
223 }
else if (event.modifiers() == Wt::AltModifier) {
224 km = Qt::AltModifier;
225 }
else if (event.modifiers() == Wt::MetaModifier) {
226 km = Qt::MetaModifier;
228 QPoint pt = QPoint(event.widget().x,event.widget().y);
229 QWheelEvent *e =
new QWheelEvent( pt, event.wheelDelta (), bt, km);
234QKeyEvent * G4OpenGLImmediateWtViewer::ConvertWtKeyEventToQt(Wt::WKeyEvent event) {
236 Qt::KeyboardModifiers km;
237 if (event.modifiers() == Wt::NoModifier) {
239 }
else if (event.modifiers() == Wt::ControlModifier) {
240 km = Qt::ControlModifier;
241 }
else if (event.modifiers() == Wt::ShiftModifier) {
242 km = Qt::ShiftModifier;
243 }
else if (event.modifiers() == Wt::AltModifier) {
244 km = Qt::AltModifier;
245 }
else if (event.modifiers() == Wt::MetaModifier) {
246 km = Qt::MetaModifier;
248 QKeyEvent *e =
new QKeyEvent( QEvent::None, event.charCode(), km );