19 #ifndef OSGVIEWER_GRAPHICSWINDOWCARBON
20 #define OSGVIEWER_GRAPHICSWINDOWCARBON 1
22 #if defined (__APPLE__) && (!__LP64__)
24 #include <osgViewer/GraphicsWindow>
25 #include <osgViewer/api/Carbon/GraphicsHandleCarbon>
39 _currentCursor(RightArrowCursor),
49 getState()->setGraphicsContext(
this);
51 if (_traits.valid() && _traits->sharedContext.valid())
53 getState()->setContextID( _traits->sharedContext->getState()->getContextID() );
54 incrementContextIDUsageCount( getState()->getContextID() );
63 virtual bool isSameKindAs(
const Object*
object)
const {
return dynamic_cast<const GraphicsWindowCarbon*
>(object)!=0; }
64 virtual const char* libraryName()
const {
return "osgViewer"; }
65 virtual const char* className()
const {
return "GraphicsWindowCarbon"; }
67 virtual bool valid()
const {
return _valid; }
70 virtual bool realizeImplementation();
73 virtual bool isRealizedImplementation()
const {
return _realized; }
76 virtual void closeImplementation();
79 virtual bool makeCurrentImplementation();
82 virtual bool releaseContextImplementation();
85 virtual void swapBuffersImplementation();
88 virtual bool checkEvents();
91 virtual bool setWindowRectangleImplementation(
int x,
int y,
int width,
int height);
94 virtual bool setWindowDecorationImplementation(
bool flag);
97 virtual void requestWarpPointer(
float x,
float y);
100 virtual void grabFocus();
103 virtual void grabFocusIfPointerInWindow();
105 void requestClose() { _closeRequested =
true; }
107 virtual void resizedImplementation(
int x,
int y,
int width,
int height);
109 virtual void setWindowName (
const std::string & name);
110 virtual void useCursor(
bool cursorOn);
111 virtual void setCursor(MouseCursor mouseCursor);
114 virtual void setSyncToVBlank(
bool on);
116 WindowRef getNativeWindowRef() {
return _window; }
118 bool handleMouseEvent(EventRef theEvent);
119 bool handleKeyboardEvent(EventRef theEvent);
120 bool handleModifierKeys(EventRef theEvent);
126 WindowData(WindowRef window, AGLDrawable* drawable=
NULL ):
127 _window(window), _AGLDrawable(drawable) ,_installEventHandler(false) {}
129 WindowRef getNativeWindowRef() {
return _window; }
130 void setInstallEventHandler(
bool flag) { _installEventHandler = flag; }
131 bool installEventHandler() {
return _installEventHandler; }
132 AGLDrawable* getAGLDrawable() {
return _AGLDrawable; }
136 AGLDrawable* _AGLDrawable;
137 bool _installEventHandler;
142 void installEventHandler();
145 AGLPixelFormat getAGLPixelFormat() {
return _pixelFormat; }
147 void adaptResize(
int x,
int y,
int w,
int h);
153 void transformMouseXY(
float& x,
float& y);
159 bool _useWindowDecoration;
163 AGLPixelFormat _pixelFormat;
165 int _windowTitleHeight;
168 WindowAttributes computeWindowAttributes(
bool useWindowDecoration,
bool supportsResize);
172 bool _closeRequested;
173 UInt32 _lastModifierKeys;
174 MouseCursor _currentCursor;
GLint GLenum GLsizei width
static unsigned int createNewContextID()
GLint GLenum GLsizei GLsizei height