Branch libreoffice-5-0-4
[LibreOffice.git] / include / vcl / openglwin.hxx
blobb20ba446c92521fb58dfe4b6c36a3f34d8bca7f9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #ifndef INCLUDED_VCL_OPENGLWIN_HXX
11 #define INCLUDED_VCL_OPENGLWIN_HXX
13 #include <vcl/event.hxx>
14 #include <vcl/syschild.hxx>
15 #include <vcl/dllapi.h>
17 class OpenGLContext;
18 class OpenGLWindowImpl;
20 class VCL_DLLPUBLIC IRenderer
22 public:
23 virtual ~IRenderer() {}
24 virtual void update() = 0;
25 virtual void clickedAt(const Point& rPos, sal_uInt16 nButtons) = 0;
26 virtual void mouseDragMove(const Point& rPosBegin, const Point& rPosEnd, sal_uInt16 nButtons) = 0;
27 virtual void scroll(long nDelta) = 0;
29 virtual void contextDestroyed() = 0;
32 // pImpl Pattern to avoid linking against OpenGL libs when using the class without the context
33 class VCL_DLLPUBLIC OpenGLWindow : public vcl::Window
35 public:
36 OpenGLWindow(vcl::Window* pParent);
37 virtual ~OpenGLWindow();
38 virtual void dispose() SAL_OVERRIDE;
40 OpenGLContext& getContext();
42 void setRenderer(IRenderer* pRenderer);
44 virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle&) SAL_OVERRIDE;
46 virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
47 virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
48 virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
49 virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
51 private:
52 std::unique_ptr<OpenGLWindowImpl> mxImpl;
53 IRenderer* mpRenderer;
55 Point maStartPoint;
58 #endif
60 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */