From 934ed30314b1ccde2ae837c4c93297e2e212a84e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 13 Apr 2007 14:23:10 +0000 Subject: [PATCH] Added setWindowRectangle implementation for GraphicsWindowWin32, and place holder for setWindowRectangle implementation for GraphicsWindowCarbon. --- include/osgViewer/api/Carbon/GraphicsWindowCarbon | 3 +++ include/osgViewer/api/Win32/GraphicsWindowWin32 | 3 +++ src/osgViewer/GraphicsWindowCarbon.cpp | 5 +++++ src/osgViewer/GraphicsWindowWin32.cpp | 8 ++++++++ 4 files changed, 19 insertions(+) diff --git a/include/osgViewer/api/Carbon/GraphicsWindowCarbon b/include/osgViewer/api/Carbon/GraphicsWindowCarbon index 1e6014b1d..08d45d82c 100644 --- a/include/osgViewer/api/Carbon/GraphicsWindowCarbon +++ b/include/osgViewer/api/Carbon/GraphicsWindowCarbon @@ -81,6 +81,9 @@ class GraphicsWindowCarbon : public osgViewer::GraphicsWindow /** Check to see if any events have been generated.*/ virtual void checkEvents(); + /** Set the window's position and size.*/ + virtual void setWindowRectangle(int x, int y, int width, int height); + /** Set Window decoration.*/ virtual void setWindowDecoration(bool flag); diff --git a/include/osgViewer/api/Win32/GraphicsWindowWin32 b/include/osgViewer/api/Win32/GraphicsWindowWin32 index aa7455819..c67b353c5 100644 --- a/include/osgViewer/api/Win32/GraphicsWindowWin32 +++ b/include/osgViewer/api/Win32/GraphicsWindowWin32 @@ -60,6 +60,9 @@ class GraphicsWindowWin32 : public osgViewer::GraphicsWindow /** Check to see if any events have been generated.*/ virtual void checkEvents(); + /** Set the window's position and size.*/ + virtual void setWindowRectangle(int x, int y, int width, int height); + /** Set Window decoration.*/ virtual void setWindowDecoration(bool flag); diff --git a/src/osgViewer/GraphicsWindowCarbon.cpp b/src/osgViewer/GraphicsWindowCarbon.cpp index 55b2a2c6f..a6c68b74a 100644 --- a/src/osgViewer/GraphicsWindowCarbon.cpp +++ b/src/osgViewer/GraphicsWindowCarbon.cpp @@ -1060,6 +1060,11 @@ void GraphicsWindowCarbon::checkEvents() } +void GraphicsWindowCarbon::setWindowRectangle(int x, int y, int width, int height) +{ + // TODO: implement + osg::notify(osg::NOTICE)<<"GraphicsWindowCarbon::setWindowRectangle(..) not implemented."<mouseWarped(x,y); } +void GraphicsWindowWin32::setWindowRectangle(int x, int y, int width, int height) +{ + if (!::SetWindowPos(_hwnd, HWND_TOP, x, y, width, height, SWP_SHOWWINDOW | SWP_FRAMECHANGED)) + { + reportErrorForScreen("GraphicsWindowWin32::setWindowRectangle() - Unable to set new window position and size", _traits->screenNum, ::GetLastError()); + } +} + void GraphicsWindowWin32::useCursor( bool cursorOn ) { _traits->useCursor = cursorOn;