OpenSceneGraph 3.6.5
GraphicsWindowWin32
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14/* Note, elements of GraphicsWindowX11 have used Prodcer/RenderSurface_X11.cpp as both
15 * a guide to use of X11/GLX and copiying directly in the case of setBorder().
16 * These elements are license under OSGPL as above, with Copyright (C) 2001-2004 Don Burns.
17 */
18
19#ifndef OSGVIEWER_GRAPHICSWINDOWWIN32
20#define OSGVIEWER_GRAPHICSWINDOWWIN32 1
21
24
25namespace osgViewer
26{
27
29{
30 public:
31
33
35
36 virtual bool isSameKindAs(const Object* object) const { return dynamic_cast<const GraphicsWindowWin32*>(object)!=0; }
37 virtual const char* libraryName() const { return "osgViewer"; }
38 virtual const char* className() const { return "GraphicsWindowWin32"; }
39
40 virtual bool valid() const { return _valid; }
41
43 virtual bool realizeImplementation();
44
46 virtual bool isRealizedImplementation() const { return _realized; }
47
49 virtual void closeImplementation();
50
53
56
59
61 virtual bool checkEvents();
62
64 virtual bool setWindowRectangleImplementation(int x, int y, int width, int height);
65
67 virtual bool setWindowDecorationImplementation(bool flag);
68
70 virtual void grabFocus();
71
74
76 virtual void requestWarpPointer(float x,float y);
77
79 virtual void raiseWindow();
80
82 virtual void setWindowName(const std::string& /*name*/);
83
85 virtual void useCursor(bool /*cursorOn*/);
86
88 virtual void setCursor(MouseCursor cursor);
89
91 virtual void setSyncToVBlank(bool on);
92
94 virtual void setSwapGroup(bool on, GLuint group, GLuint barrier);
95
97 virtual LRESULT handleNativeWindowingEvent( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
98
101 {
102 WindowData(HWND window, bool installEventHandler = true):
103 _hwnd(window), _installEventHandler(installEventHandler) {}
104
105 HWND _hwnd;
107 };
108
109 protected:
110
111 virtual void init();
112
113 virtual void registerWindow();
114 virtual void unregisterWindow();
115
118
120 virtual bool createWindow();
121 virtual bool setWindow( HWND handle );
122
123 virtual void destroyWindow( bool deleteNativeWindow = true );
124
125 virtual bool determineWindowPositionAndStyle( unsigned int screenNum,
126 int clientAreaX,
127 int clientAreaY,
128 unsigned int clientAreaWidth,
129 unsigned int clientAreaHeight,
130 bool decorated,
131 int& x,
132 int& y,
133 unsigned int& w,
134 unsigned int& h,
135 unsigned int& style,
136 unsigned int& extendedStyle );
137
138 virtual bool setPixelFormat();
139
140 virtual void adaptKey( WPARAM wParam, LPARAM lParam, int& keySymbol, unsigned int& modifierMask, int& unmodifiedKeySymbol );
141
142 virtual void transformMouseXY(float& x, float& y);
143
144 virtual void setCursorImpl(MouseCursor cursor);
145
146 virtual HCURSOR getOrCreateCursor(MouseCursor mouseShape);
147
149
151
153
154
155
156
159 unsigned int _screenWidth;
160 unsigned int _screenHeight;
161
166
168 bool _valid;
170
175
177
180
181 std::map<MouseCursor,HCURSOR> _mouseCursorMap;
182
183 std::map<std::pair<int, int>, bool> _keyMap;
184
186
188};
189
190}
191
192#endif
The osgViewer library provides high level viewer functionality designed to make it easier to write a ...
GraphicsContext Traits object provides the specification of what type of graphics context is required...
Definition GraphicsContext:70
Object()
Construct an object.
Definition Object:69
Base class for providing reference counted objects.
Definition Referenced:44
Class to encapsulate platform-specific OpenGL context handle variables.
Definition GraphicsHandleWin32:41
int _windowOriginYToRealize
Definition GraphicsWindowWin32:163
virtual LRESULT handleNativeWindowingEvent(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Handle a native (Win32) windowing event as received from the system.
int _windowOriginXToRealize
Definition GraphicsWindowWin32:162
virtual bool releaseContextImplementation()
Release the graphics context.
virtual void destroyWindow(bool deleteNativeWindow=true)
bool _initialized
Definition GraphicsWindowWin32:167
MouseCursor _appMouseCursor
Persist which mouse cursor was used before switching to the resize cursors.
Definition GraphicsWindowWin32:179
virtual void useCursor(bool)
Switch on/off the cursor.
virtual void setSyncToVBlank(bool on)
Set sync-to-vblank.
virtual bool setWindowDecorationImplementation(bool flag)
Set Window decoration.
unsigned int _windowHeightToRealize
Definition GraphicsWindowWin32:165
bool _ownsWindow
Definition GraphicsWindowWin32:171
GraphicsWindowWin32(osg::GraphicsContext::Traits *traits)
virtual bool valid() const
Return whether a valid and usable GraphicsContext has been created.
Definition GraphicsWindowWin32:40
std::map< std::pair< int, int >, bool > _keyMap
Definition GraphicsWindowWin32:183
virtual void setSwapGroup(bool on, GLuint group, GLuint barrier)
Set swap group.
bool _closeWindow
Definition GraphicsWindowWin32:172
virtual bool setWindow(HWND handle)
virtual void transformMouseXY(float &x, float &y)
bool _destroyWindow
Definition GraphicsWindowWin32:173
virtual HGLRC createContextImplementation()
virtual bool makeCurrentImplementation()
Make this graphics context current.
virtual void grabFocusIfPointerInWindow()
Get focus on if the pointer is in this window.
bool _destroying
Definition GraphicsWindowWin32:174
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)
unsigned int _screenHeight
Definition GraphicsWindowWin32:160
virtual void swapBuffersImplementation()
Swap the front and back buffers.
virtual const char * className() const
return the name of the object's class type.
Definition GraphicsWindowWin32:38
bool _valid
Definition GraphicsWindowWin32:168
virtual void adaptKey(WPARAM wParam, LPARAM lParam, int &keySymbol, unsigned int &modifierMask, int &unmodifiedKeySymbol)
virtual bool unregisterWindowProcedure()
unsigned int _screenWidth
Definition GraphicsWindowWin32:159
unsigned int _windowWidthToRealize
Definition GraphicsWindowWin32:164
virtual const char * libraryName() const
return the name of the object's library.
Definition GraphicsWindowWin32:37
virtual bool realizeImplementation()
Realize the GraphicsContext.
virtual bool registerWindowProcedure()
virtual void raiseWindow()
Raise specified window.
int _screenOriginY
Definition GraphicsWindowWin32:158
bool _realized
Definition GraphicsWindowWin32:169
bool _applyWorkaroundForMultimonitorMultithreadNVidiaWin32Issues
Definition GraphicsWindowWin32:187
HCURSOR _currentCursor
Definition GraphicsWindowWin32:148
int _screenOriginX
Definition GraphicsWindowWin32:157
WNDPROC _windowProcedure
Definition GraphicsWindowWin32:150
virtual HCURSOR getOrCreateCursor(MouseCursor mouseShape)
virtual bool checkEvents()
Check to see if any events have been generated.
MouseCursor _mouseCursor
Definition GraphicsWindowWin32:176
virtual void setCursor(MouseCursor cursor)
Set mouse cursor to a specific shape.
double _timeOfLastCheckEvents
Definition GraphicsWindowWin32:152
virtual bool isSameKindAs(const Object *object) const
Definition GraphicsWindowWin32:36
virtual bool isRealizedImplementation() const
Return true if the graphics context has been realized and is ready to use.
Definition GraphicsWindowWin32:46
virtual void requestWarpPointer(float x, float y)
Override from GUIActionAdapter.
virtual void setWindowName(const std::string &)
Set the name of the window.
virtual void setCursorImpl(MouseCursor cursor)
virtual bool setWindowRectangleImplementation(int x, int y, int width, int height)
Set the window's position and size.
std::set< int > _capturedMouseButtons
Definition GraphicsWindowWin32:185
std::map< MouseCursor, HCURSOR > _mouseCursorMap
Definition GraphicsWindowWin32:181
virtual void closeImplementation()
Close the graphics context.
virtual void grabFocus()
Get focus.
WindowData(HWND window, bool installEventHandler=true)
Definition GraphicsWindowWin32:102
bool _installEventHandler
Definition GraphicsWindowWin32:106
HWND _hwnd
Definition GraphicsWindowWin32:105
Base class for providing Windowing API agnostic access to creating and managing graphics window and e...
Definition GraphicsWindow:43
MouseCursor
Mouse cursor types, the same ones already present with ancient glut ...
Definition GraphicsWindow:100
#define OSGVIEWER_EXPORT
Definition Export:40

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.