OpenWalnut
1.5.0dev
|
Class managing a single graphics context and OSG GraphicsWindow. More...
#include <WGEGraphicsWindow.h>
Public Types | |
enum | KeyEvents { KEYPRESS , KEYRELEASE } |
Event types for the keyEvent() handler. More... | |
enum | MouseEvents { MOUSEPRESS , MOUSERELEASE , MOUSEDOUBLECLICK , MOUSEMOVE , MOUSESCROLL } |
Mouse event types for the mouseEvent() handler. More... | |
Public Member Functions | |
WGEGraphicsWindow (osg::ref_ptr< osg::Referenced > wdata, int x, int y, int width, int height) | |
Default constructor. More... | |
virtual | ~WGEGraphicsWindow () |
Destructor. More... | |
osg::ref_ptr< osgViewer::GraphicsWindow > | getGraphicsWindow () |
Getter for m_GraphicsWindow. More... | |
virtual void | resize (int width, int height) |
Updates size information. More... | |
virtual void | close () |
Initiates a close event for this viewer. More... | |
virtual void | keyEvent (KeyEvents eventType, int key) |
Handles key events (if forwarded to this Viewer instance). More... | |
virtual void | mouseEvent (MouseEvents eventType, int x, int y, int button) |
Handles mouse events forwarded from widget. More... | |
virtual bool | isClosed () const |
Check if the windows is open. More... | |
virtual void | setClosed (bool closed=true) |
Set closed state. More... | |
Protected Attributes | |
osg::ref_ptr< osgViewer::GraphicsWindow > | m_GraphicsWindow |
OpenSceneGraph render window. More... | |
Private Attributes | |
bool | m_closed |
Mark the window opened or closed. More... | |
Class managing a single graphics context and OSG GraphicsWindow.
Definition at line 36 of file WGEGraphicsWindow.h.
Event types for the keyEvent() handler.
Definition at line 66 of file WGEGraphicsWindow.h.
Mouse event types for the mouseEvent() handler.
Definition at line 74 of file WGEGraphicsWindow.h.
WGEGraphicsWindow::WGEGraphicsWindow | ( | osg::ref_ptr< osg::Referenced > | wdata, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height | ||
) |
Default constructor.
wdata | the WindowData instance for the widget to use as render widget. NULL on Mac! |
x | X coordinate of widget where to create the context. |
y | Y coordinate of widget where to create the context. |
width | Width of the widget. |
height | Height of the Widget. |
WGEInitFailed | thrown if initialization of graphics context or graphics window has failed. |
Definition at line 33 of file WGEGraphicsWindow.cpp.
References m_GraphicsWindow.
|
virtual |
Destructor.
Definition at line 39 of file WGEGraphicsWindow.cpp.
|
virtual |
Initiates a close event for this viewer.
It destroys the graphics context and invalidates the viewer. This should be called whenever a QT Widget closes to also free its OSG Viewer resources.
Reimplemented in WGEViewer.
Definition at line 60 of file WGEGraphicsWindow.cpp.
References setClosed().
Referenced by WGEViewer::close().
osg::ref_ptr< osgViewer::GraphicsWindow > WGEGraphicsWindow::getGraphicsWindow | ( | ) |
Getter for m_GraphicsWindow.
Definition at line 44 of file WGEGraphicsWindow.cpp.
References m_GraphicsWindow.
|
virtual |
Check if the windows is open.
Definition at line 112 of file WGEGraphicsWindow.cpp.
References m_closed.
|
virtual |
Handles key events (if forwarded to this Viewer instance).
key | the key code. |
eventType | the type of event. |
Definition at line 68 of file WGEGraphicsWindow.cpp.
References m_GraphicsWindow.
|
virtual |
Handles mouse events forwarded from widget.
eventType | the event type. |
x | x coordinate of event. |
y | y coordinate of event. |
button | mouse button. |
Definition at line 86 of file WGEGraphicsWindow.cpp.
References m_GraphicsWindow.
|
virtual |
Updates size information.
width | new width. |
height | new height. |
Reimplemented in WGEViewer.
Definition at line 49 of file WGEGraphicsWindow.cpp.
References m_GraphicsWindow.
Referenced by WGEViewer::resize().
|
virtual |
Set closed state.
closed | true if widget should be marked as closed. |
Definition at line 117 of file WGEGraphicsWindow.cpp.
References m_closed.
Referenced by close().
|
private |
Mark the window opened or closed.
Definition at line 135 of file WGEGraphicsWindow.h.
Referenced by isClosed(), and setClosed().
|
protected |
OpenSceneGraph render window.
Definition at line 129 of file WGEGraphicsWindow.h.
Referenced by getGraphicsWindow(), keyEvent(), mouseEvent(), resize(), WGEGraphicsWindow(), and WGEViewer::WGEViewer().