Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / vcl / openglwin.hxx
blob3775b62491e6b56ac20f0fbbe4c2cbac9095b725
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 <memory>
14 #include <vcl/event.hxx>
15 #include <vcl/syschild.hxx>
16 #include <vcl/dllapi.h>
18 class OpenGLContext;
19 class OpenGLWindowImpl;
21 class VCL_DLLPUBLIC IRenderer
23 public:
24 virtual ~IRenderer() {}
25 virtual void update() = 0;
26 virtual void clickedAt(const Point& rPos, sal_uInt16 nButtons) = 0;
27 virtual void mouseDragMove(const Point& rPosBegin, const Point& rPosEnd, sal_uInt16 nButtons) = 0;
28 virtual void scroll(long nDelta) = 0;
30 virtual void contextDestroyed() = 0;
33 // pImpl Pattern to avoid linking against OpenGL libs when using the class without the context
34 class VCL_DLLPUBLIC OpenGLWindow : public vcl::Window
36 public:
37 OpenGLWindow(vcl::Window* pParent, bool bInit);
38 virtual ~OpenGLWindow() override;
39 virtual void dispose() override;
41 OpenGLContext& getContext();
43 void setRenderer(IRenderer* pRenderer);
45 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
47 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
48 virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
49 virtual void MouseMove( const MouseEvent& rMEvt ) override;
50 virtual void Command( const CommandEvent& rCEvt ) override;
52 void Initialize();
54 private:
55 std::unique_ptr<OpenGLWindowImpl> mxImpl;
56 IRenderer* mpRenderer;
58 Point maStartPoint;
61 #endif
63 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */