- Timestamp:
- 05/14/09 17:34:15 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgViewer/api/Cocoa/GraphicsWindowCocoa
r9879 r10208 24 24 #ifdef __OBJC__ 25 25 @class GraphicsWindowCocoaWindow; 26 @class GraphicsWindowCocoaGLView; 26 27 @class NSOpenGLContext; 27 28 @class NSWindow; 29 @class NSView; 28 30 #else 31 class GraphicsWindowCocoaGLView; 29 32 class GraphicsWindowCocoaWindow; 30 33 class NSOpenGLContext; 31 34 class NSWindow; 35 class NSView; 32 36 #endif 33 37 … … 42 46 { 43 47 public: 44 class Implementation;48 class Implementation; 45 49 46 50 GraphicsWindowCocoa(osg::GraphicsContext::Traits* traits): … … 48 52 _initialized(false), 49 53 _realized(false), 54 _closeRequested(false), 55 _checkForEvents(true), 50 56 _ownsWindow(true), 51 _currentCursor(RightArrowCursor) 57 _currentCursor(RightArrowCursor), 58 _window(NULL), 59 _context(NULL) 52 60 { 53 61 _traits = traits; … … 122 130 { 123 131 public: 124 WindowData(NSWindow* window) 125 : _window(window) 126 { 127 } 128 129 inline NSWindow* getNativeWindowRef() { return _window; } 130 132 enum Options { CreateOnlyView = 1, CheckForEvents = 2, PoseAsStandaloneApp = 4}; 133 WindowData(unsigned int options) 134 : _createOnlyView(options & CreateOnlyView), 135 _checkForEvents(options & CheckForEvents), 136 _poseAsStandaloneApp(options & PoseAsStandaloneApp), 137 _view(NULL) 138 { 139 } 140 141 inline NSView* getCreatedNSView() { return _view; } 142 bool createOnlyView() const { return _createOnlyView; } 143 bool checkForEvents() const { return _checkForEvents; } 144 bool poseAsStandaloneApp() const { return _poseAsStandaloneApp; } 145 146 protected: 147 inline void setCreatedNSView(NSView* view) { _view = view; } 148 131 149 private: 132 NSWindow* _window;133 bool _installEventHandler;150 bool _createOnlyView, _checkForEvents, _poseAsStandaloneApp; 151 NSView* _view; 134 152 153 friend class GraphicsWindowCocoa; 154 135 155 }; 136 156 … … 139 159 140 160 void setVSync(bool f); 141 142 /** adapts a resize / move of the window, coords in global screen space */143 void adaptResize(int x, int y, int w, int h);161 162 /** adapts a resize / move of the window, coords in global screen space */ 163 void adaptResize(int x, int y, int w, int h); 144 164 145 165 protected: … … 158 178 bool _realized; 159 179 bool _useWindowDecoration; 160 bool _ownsWindow;161 180 162 181 163 182 164 183 private: 165 184 166 185 167 bool _closeRequested; 168 MouseCursor _currentCursor; 169 GraphicsWindowCocoaWindow* _window; 170 NSOpenGLContext* _context; 186 bool _closeRequested, _checkForEvents,_ownsWindow; 187 MouseCursor _currentCursor; 188 GraphicsWindowCocoaWindow* _window; 189 GraphicsWindowCocoaGLView* _view; 190 NSOpenGLContext* _context; 171 191 }; 172 192
