1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #ifndef INCLUDED_VCL_OPENGLWIN_HXX
11 #define INCLUDED_VCL_OPENGLWIN_HXX
14 #include <vcl/event.hxx>
15 #include <vcl/syschild.hxx>
16 #include <vcl/dllapi.h>
19 class OpenGLWindowImpl
;
21 class VCL_DLLPUBLIC IRenderer
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
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
;
55 std::unique_ptr
<OpenGLWindowImpl
> mxImpl
;
56 IRenderer
* mpRenderer
;
63 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */