summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vcl/openglwin.hxx15
-rw-r--r--vcl/source/window/openglwin.cxx31
2 files changed, 39 insertions, 7 deletions
diff --git a/include/vcl/openglwin.hxx b/include/vcl/openglwin.hxx
index 5c57d4507926..9c4e6113c18e 100644
--- a/include/vcl/openglwin.hxx
+++ b/include/vcl/openglwin.hxx
@@ -11,16 +11,23 @@
#define INCLUDED_VCL_OPENGLWIN_HXX
#include <vcl/syschild.hxx>
-#include <vcl/opengl/OpenGLContext.hxx>
+#include <vcl/vclopengl_dllapi.hxx>
-class OpenGLWindow : public SystemChildWindow
+#include <boost/scoped_ptr.hpp>
+
+class OpenGLContext;
+class OpenGLWindowImpl;
+
+// pImpl Pattern to avoid linking against OpenGL libs when using the class without the context
+class VCLOPENGL_DLLPUBLIC OpenGLWindow : public SystemChildWindow
{
public:
OpenGLWindow(Window* pParent);
- OpenGLContext& getContext();
+ ~OpenGLWindow();
+ OpenGLContext* getContext();
private:
- OpenGLContext maContext;
+ boost::scoped_ptr<OpenGLWindowImpl> mpImpl;
};
#endif
diff --git a/vcl/source/window/openglwin.cxx b/vcl/source/window/openglwin.cxx
index 29a21a2ada81..3065718464b2 100644
--- a/vcl/source/window/openglwin.cxx
+++ b/vcl/source/window/openglwin.cxx
@@ -8,15 +8,40 @@
*/
#include <vcl/openglwin.hxx>
+#include <vcl/opengl/OpenGLContext.hxx>
+
+class OpenGLWindowImpl
+{
+public:
+ OpenGLWindowImpl(SystemChildWindow* pWindow);
+ OpenGLContext* getContext();
+private:
+ OpenGLContext maContext;
+};
+
+OpenGLWindowImpl::OpenGLWindowImpl(SystemChildWindow* pWindow)
+{
+ maContext.init(pWindow);
+}
+
+OpenGLContext* OpenGLWindowImpl::getContext()
+{
+ return &maContext;
+}
OpenGLWindow::OpenGLWindow(Window* pParent):
- SystemChildWindow(pParent, 0)
+ SystemChildWindow(pParent, 0),
+ mpImpl(new OpenGLWindowImpl(this))
+{
+}
+
+OpenGLWindow::~OpenGLWindow()
{
}
-OpenGLContext& OpenGLWindow::getContext()
+OpenGLContext* OpenGLWindow::getContext()
{
- return maContext;
+ return mpImpl->getContext();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */