GraphicsWindowWin32
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
/* Note, elements of GraphicsWindowX11 have used Prodcer/RenderSurface_X11.cpp as both
* a guide to use of X11/GLX and copiying directly in the case of setBorder().
* These elements are license under OSGPL as above, with Copyright (C) 2001-2004 Don Burns.
*/
#ifndef OSGVIEWER_GRAPHICSWINDOWWIN32
#define OSGVIEWER_GRAPHICSWINDOWWIN32 1
#include <osgViewer/GraphicsWindow>
#include <osgViewer/api/Win32/GraphicsHandleWin32>
namespace osgViewer
{
class OSGVIEWER_EXPORT GraphicsWindowWin32 : public osgViewer::GraphicsWindow, public osgViewer::GraphicsHandleWin32
{
public:
GraphicsWindowWin32(osg::GraphicsContext::Traits* traits);
~GraphicsWindowWin32();
virtual bool isSameKindAs(const Object* object) const { return dynamic_cast<const GraphicsWindowWin32*>(object)!=0; }
virtual const char* libraryName() const { return "osgViewer"; }
virtual const char* className() const { return "GraphicsWindowWin32"; }
virtual bool valid() const { return _valid; }
virtual bool realizeImplementation();
virtual bool isRealizedImplementation() const { return _realized; }
virtual void closeImplementation();
virtual bool makeCurrentImplementation();
virtual bool releaseContextImplementation();
virtual void swapBuffersImplementation();
virtual bool checkEvents();
virtual bool setWindowRectangleImplementation(int x, int y, int width, int height);
virtual bool setWindowDecorationImplementation(bool flag);
virtual void grabFocus();
virtual void grabFocusIfPointerInWindow();
virtual void requestWarpPointer(float x,float y);
virtual void raiseWindow();
virtual void setWindowName(const std::string& /*name*/);
virtual void useCursor(bool /*cursorOn*/);
virtual void setCursor(MouseCursor cursor);
virtual void setSyncToVBlank(bool on);
virtual void setSwapGroup(bool on, GLuint group, GLuint barrier);
virtual LRESULT handleNativeWindowingEvent( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
struct WindowData : public osg::Referenced
{
WindowData(HWND window, bool installEventHandler = true):
_hwnd(window), _installEventHandler(installEventHandler) {}
HWND _hwnd;
bool _installEventHandler;
};
protected:
virtual void init();
virtual void registerWindow();
virtual void unregisterWindow();
virtual bool registerWindowProcedure();
virtual bool unregisterWindowProcedure();
virtual HGLRC createContextImplementation();
virtual bool createWindow();
virtual bool setWindow( HWND handle );
virtual void destroyWindow( bool deleteNativeWindow = true );
virtual bool determineWindowPositionAndStyle( unsigned int screenNum,
int clientAreaX,
int clientAreaY,
unsigned int clientAreaWidth,
unsigned int clientAreaHeight,
bool decorated,
int& x,
int& y,
unsigned int& w,
unsigned int& h,
unsigned int& style,
unsigned int& extendedStyle );
virtual bool setPixelFormat();
virtual void adaptKey( WPARAM wParam, LPARAM lParam, int& keySymbol, unsigned int& modifierMask, int& unmodifiedKeySymbol );
virtual void transformMouseXY(float& x, float& y);
virtual void setCursorImpl(MouseCursor cursor);
virtual HCURSOR getOrCreateCursor(MouseCursor mouseShape);
HCURSOR _currentCursor;
WNDPROC _windowProcedure;
double _timeOfLastCheckEvents;
int _screenOriginX;
int _screenOriginY;
unsigned int _screenWidth;
unsigned int _screenHeight;
int _windowOriginXToRealize;
int _windowOriginYToRealize;
unsigned int _windowWidthToRealize;
unsigned int _windowHeightToRealize;
bool _initialized;
bool _valid;
bool _realized;
bool _ownsWindow;
bool _closeWindow;
bool _destroyWindow;
bool _destroying;
MouseCursor _mouseCursor;
MouseCursor _appMouseCursor;
std::map<MouseCursor,HCURSOR> _mouseCursorMap;
std::map<std::pair<int, int>, bool> _keyMap;
std::set<int> _capturedMouseButtons;
bool _applyWorkaroundForMultimonitorMultithreadNVidiaWin32Issues;
};
}
#endif
GraphicsHandleWin32
GraphicsWindow
osgViewer::GraphicsHandleWin32
Definition GraphicsHandleWin32:41
osgViewer::GraphicsWindowWin32::_windowOriginYToRealize
int _windowOriginYToRealize
Definition GraphicsWindowWin32:163
osgViewer::GraphicsWindowWin32::handleNativeWindowingEvent
virtual LRESULT handleNativeWindowingEvent(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
osgViewer::GraphicsWindowWin32::_windowOriginXToRealize
int _windowOriginXToRealize
Definition GraphicsWindowWin32:162
osgViewer::GraphicsWindowWin32::releaseContextImplementation
virtual bool releaseContextImplementation()
osgViewer::GraphicsWindowWin32::destroyWindow
virtual void destroyWindow(bool deleteNativeWindow=true)
osgViewer::GraphicsWindowWin32::_initialized
bool _initialized
Definition GraphicsWindowWin32:167
osgViewer::GraphicsWindowWin32::_appMouseCursor
MouseCursor _appMouseCursor
Persist which mouse cursor was used before switching to the resize cursors.
Definition GraphicsWindowWin32:179
osgViewer::GraphicsWindowWin32::useCursor
virtual void useCursor(bool)
osgViewer::GraphicsWindowWin32::setSyncToVBlank
virtual void setSyncToVBlank(bool on)
osgViewer::GraphicsWindowWin32::setWindowDecorationImplementation
virtual bool setWindowDecorationImplementation(bool flag)
osgViewer::GraphicsWindowWin32::_windowHeightToRealize
unsigned int _windowHeightToRealize
Definition GraphicsWindowWin32:165
osgViewer::GraphicsWindowWin32::_ownsWindow
bool _ownsWindow
Definition GraphicsWindowWin32:171
osgViewer::GraphicsWindowWin32::GraphicsWindowWin32
GraphicsWindowWin32(osg::GraphicsContext::Traits *traits)
osgViewer::GraphicsWindowWin32::valid
virtual bool valid() const
Definition GraphicsWindowWin32:40
osgViewer::GraphicsWindowWin32::_keyMap
std::map< std::pair< int, int >, bool > _keyMap
Definition GraphicsWindowWin32:183
osgViewer::GraphicsWindowWin32::setSwapGroup
virtual void setSwapGroup(bool on, GLuint group, GLuint barrier)
osgViewer::GraphicsWindowWin32::_closeWindow
bool _closeWindow
Definition GraphicsWindowWin32:172
osgViewer::GraphicsWindowWin32::setWindow
virtual bool setWindow(HWND handle)
osgViewer::GraphicsWindowWin32::transformMouseXY
virtual void transformMouseXY(float &x, float &y)
osgViewer::GraphicsWindowWin32::_destroyWindow
bool _destroyWindow
Definition GraphicsWindowWin32:173
osgViewer::GraphicsWindowWin32::createWindow
virtual bool createWindow()
osgViewer::GraphicsWindowWin32::createContextImplementation
virtual HGLRC createContextImplementation()
osgViewer::GraphicsWindowWin32::makeCurrentImplementation
virtual bool makeCurrentImplementation()
osgViewer::GraphicsWindowWin32::grabFocusIfPointerInWindow
virtual void grabFocusIfPointerInWindow()
osgViewer::GraphicsWindowWin32::_destroying
bool _destroying
Definition GraphicsWindowWin32:174
osgViewer::GraphicsWindowWin32::determineWindowPositionAndStyle
virtual bool determineWindowPositionAndStyle(unsigned int screenNum, int clientAreaX, int clientAreaY, unsigned int clientAreaWidth, unsigned int clientAreaHeight, bool decorated, int &x, int &y, unsigned int &w, unsigned int &h, unsigned int &style, unsigned int &extendedStyle)
osgViewer::GraphicsWindowWin32::_screenHeight
unsigned int _screenHeight
Definition GraphicsWindowWin32:160
osgViewer::GraphicsWindowWin32::swapBuffersImplementation
virtual void swapBuffersImplementation()
osgViewer::GraphicsWindowWin32::className
virtual const char * className() const
Definition GraphicsWindowWin32:38
osgViewer::GraphicsWindowWin32::_valid
bool _valid
Definition GraphicsWindowWin32:168
osgViewer::GraphicsWindowWin32::adaptKey
virtual void adaptKey(WPARAM wParam, LPARAM lParam, int &keySymbol, unsigned int &modifierMask, int &unmodifiedKeySymbol)
osgViewer::GraphicsWindowWin32::unregisterWindowProcedure
virtual bool unregisterWindowProcedure()
osgViewer::GraphicsWindowWin32::_screenWidth
unsigned int _screenWidth
Definition GraphicsWindowWin32:159
osgViewer::GraphicsWindowWin32::_windowWidthToRealize
unsigned int _windowWidthToRealize
Definition GraphicsWindowWin32:164
osgViewer::GraphicsWindowWin32::libraryName
virtual const char * libraryName() const
Definition GraphicsWindowWin32:37
osgViewer::GraphicsWindowWin32::realizeImplementation
virtual bool realizeImplementation()
osgViewer::GraphicsWindowWin32::registerWindowProcedure
virtual bool registerWindowProcedure()
osgViewer::GraphicsWindowWin32::init
virtual void init()
osgViewer::GraphicsWindowWin32::raiseWindow
virtual void raiseWindow()
osgViewer::GraphicsWindowWin32::_screenOriginY
int _screenOriginY
Definition GraphicsWindowWin32:158
osgViewer::GraphicsWindowWin32::_realized
bool _realized
Definition GraphicsWindowWin32:169
osgViewer::GraphicsWindowWin32::_applyWorkaroundForMultimonitorMultithreadNVidiaWin32Issues
bool _applyWorkaroundForMultimonitorMultithreadNVidiaWin32Issues
Definition GraphicsWindowWin32:187
osgViewer::GraphicsWindowWin32::_currentCursor
HCURSOR _currentCursor
Definition GraphicsWindowWin32:148
osgViewer::GraphicsWindowWin32::~GraphicsWindowWin32
~GraphicsWindowWin32()
osgViewer::GraphicsWindowWin32::unregisterWindow
virtual void unregisterWindow()
osgViewer::GraphicsWindowWin32::_screenOriginX
int _screenOriginX
Definition GraphicsWindowWin32:157
osgViewer::GraphicsWindowWin32::_windowProcedure
WNDPROC _windowProcedure
Definition GraphicsWindowWin32:150
osgViewer::GraphicsWindowWin32::getOrCreateCursor
virtual HCURSOR getOrCreateCursor(MouseCursor mouseShape)
osgViewer::GraphicsWindowWin32::checkEvents
virtual bool checkEvents()
osgViewer::GraphicsWindowWin32::_mouseCursor
MouseCursor _mouseCursor
Definition GraphicsWindowWin32:176
osgViewer::GraphicsWindowWin32::setCursor
virtual void setCursor(MouseCursor cursor)
osgViewer::GraphicsWindowWin32::_timeOfLastCheckEvents
double _timeOfLastCheckEvents
Definition GraphicsWindowWin32:152
osgViewer::GraphicsWindowWin32::isSameKindAs
virtual bool isSameKindAs(const Object *object) const
Definition GraphicsWindowWin32:36
osgViewer::GraphicsWindowWin32::isRealizedImplementation
virtual bool isRealizedImplementation() const
Definition GraphicsWindowWin32:46
osgViewer::GraphicsWindowWin32::requestWarpPointer
virtual void requestWarpPointer(float x, float y)
osgViewer::GraphicsWindowWin32::setWindowName
virtual void setWindowName(const std::string &)
osgViewer::GraphicsWindowWin32::setCursorImpl
virtual void setCursorImpl(MouseCursor cursor)
osgViewer::GraphicsWindowWin32::setWindowRectangleImplementation
virtual bool setWindowRectangleImplementation(int x, int y, int width, int height)
osgViewer::GraphicsWindowWin32::_capturedMouseButtons
std::set< int > _capturedMouseButtons
Definition GraphicsWindowWin32:185
osgViewer::GraphicsWindowWin32::_mouseCursorMap
std::map< MouseCursor, HCURSOR > _mouseCursorMap
Definition GraphicsWindowWin32:181
osgViewer::GraphicsWindowWin32::closeImplementation
virtual void closeImplementation()
osgViewer::GraphicsWindowWin32::grabFocus
virtual void grabFocus()
osgViewer::GraphicsWindowWin32::setPixelFormat
virtual bool setPixelFormat()
osgViewer::GraphicsWindowWin32::registerWindow
virtual void registerWindow()
osgViewer::GraphicsWindow
Definition GraphicsWindow:43
osgViewer::GraphicsWindow::MouseCursor
MouseCursor
Definition GraphicsWindow:100
osg::Object::Object
Object()
Definition Object:69
osg::Referenced
Definition Referenced:44
osgViewer
OSGVIEWER_EXPORT
#define OSGVIEWER_EXPORT
Definition osgViewer/Export:40
osgViewer::GraphicsWindowWin32::WindowData::WindowData
WindowData(HWND window, bool installEventHandler=true)
Definition GraphicsWindowWin32:102
osgViewer::GraphicsWindowWin32::WindowData::_installEventHandler
bool _installEventHandler
Definition GraphicsWindowWin32:106
osgViewer::GraphicsWindowWin32::WindowData::_hwnd
HWND _hwnd
Definition GraphicsWindowWin32:105
osg::GraphicsContext::Traits
Definition GraphicsContext:70