| 32 | | class WindowAdapter : public osg::Referenced { |
| 33 | | |
| 34 | | public: |
| 35 | | WindowAdapter() : osg::Referenced() {} |
| 36 | | |
| 37 | | virtual bool valid() = 0; |
| 38 | | virtual void getWindowBounds(CGRect& rect) = 0; |
| 39 | | virtual osgViewer::GraphicsWindow* getWindow() = 0; |
| 40 | | |
| 41 | | protected: |
| 42 | | virtual ~WindowAdapter() {} |
| 43 | | }; |
| 44 | | |
| | 32 | class WindowAdapter : public osg::Referenced { |
| | 33 | |
| | 34 | public: |
| | 35 | WindowAdapter() : osg::Referenced() {} |
| | 36 | |
| | 37 | virtual bool valid() = 0; |
| | 38 | virtual void getWindowBounds(CGRect& rect) = 0; |
| | 39 | virtual osgViewer::GraphicsWindow* getWindow() = 0; |
| | 40 | |
| | 41 | protected: |
| | 42 | virtual ~WindowAdapter() {} |
| | 43 | }; |
| | 44 | |
| 67 | | DarwinWindowingSystemInterface(); |
| 68 | | |
| 69 | | /** dtor */ |
| 70 | | ~DarwinWindowingSystemInterface(); |
| 71 | | |
| 72 | | /** @return a CGDirectDisplayID for a ScreenIdentifier */ |
| 73 | | CGDirectDisplayID getDisplayID(const osg::GraphicsContext::ScreenIdentifier& si); |
| 74 | | |
| 75 | | /** @return count of attached screens */ |
| 76 | | virtual unsigned int getNumScreens(const osg::GraphicsContext::ScreenIdentifier& si) ; |
| 77 | | |
| 78 | | virtual void getScreenSettings(const osg::GraphicsContext::ScreenIdentifier& si, osg::GraphicsContext::ScreenSettings & resolution); |
| | 67 | DarwinWindowingSystemInterface(); |
| 82 | | /** return the top left coord of a specific screen in global screen space */ |
| 83 | | void getScreenTopLeft(const osg::GraphicsContext::ScreenIdentifier& si, int& x, int& y); |
| 84 | | |
| 85 | | /** implementation of setScreenResolution */ |
| 86 | | virtual bool setScreenResolution(const osg::GraphicsContext::ScreenIdentifier& screenIdentifier, unsigned int width, unsigned int height) ; |
| | 72 | /** @return a CGDirectDisplayID for a ScreenIdentifier */ |
| | 73 | CGDirectDisplayID getDisplayID(const osg::GraphicsContext::ScreenIdentifier& si); |
| 88 | | /** implementation of setScreenRefreshRate */ |
| 89 | | virtual bool setScreenRefreshRate(const osg::GraphicsContext::ScreenIdentifier& screenIdentifier, double refreshRate); |
| 90 | | |
| 91 | | |
| 92 | | /** returns screen-ndx containing rect x,y,w,h */ |
| 93 | | unsigned int getScreenContaining(int x, int y, int w, int h); |
| 94 | | |
| 95 | | protected: |
| 96 | | |
| 97 | | template<class PixelBufferImplementation, class GraphicsWindowImplementation> |
| 98 | | osg::GraphicsContext* createGraphicsContextImplementation(osg::GraphicsContext::Traits* traits) |
| 99 | | { |
| 100 | | if (traits->pbuffer) |
| 101 | | { |
| 102 | | osg::ref_ptr<PixelBufferImplementation> pbuffer = new PixelBufferImplementation(traits); |
| 103 | | if (pbuffer->valid()) return pbuffer.release(); |
| 104 | | else return 0; |
| 105 | | } |
| 106 | | else |
| 107 | | { |
| 108 | | osg::ref_ptr<GraphicsWindowImplementation> window = new GraphicsWindowImplementation(traits); |
| 109 | | if (window->valid()) return window.release(); |
| 110 | | else return 0; |
| 111 | | } |
| 112 | | } |
| 113 | | |
| | 75 | /** @return count of attached screens */ |
| | 76 | virtual unsigned int getNumScreens(const osg::GraphicsContext::ScreenIdentifier& si) ; |
| | 77 | |
| | 78 | virtual void getScreenSettings(const osg::GraphicsContext::ScreenIdentifier& si, osg::GraphicsContext::ScreenSettings & resolution); |
| | 79 | |
| | 80 | virtual void enumerateScreenSettings(const osg::GraphicsContext::ScreenIdentifier& screenIdentifier, osg::GraphicsContext::ScreenSettingsList & resolutionList); |
| | 81 | |
| | 82 | /** return the top left coord of a specific screen in global screen space */ |
| | 83 | void getScreenTopLeft(const osg::GraphicsContext::ScreenIdentifier& si, int& x, int& y); |
| | 84 | |
| | 85 | /** implementation of setScreenResolution */ |
| | 86 | virtual bool setScreenResolution(const osg::GraphicsContext::ScreenIdentifier& screenIdentifier, unsigned int width, unsigned int height) ; |
| | 87 | |
| | 88 | /** implementation of setScreenRefreshRate */ |
| | 89 | virtual bool setScreenRefreshRate(const osg::GraphicsContext::ScreenIdentifier& screenIdentifier, double refreshRate); |
| | 90 | |
| | 91 | |
| | 92 | /** returns screen-ndx containing rect x,y,w,h */ |
| | 93 | unsigned int getScreenContaining(int x, int y, int w, int h); |