Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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 : */
9 :
10 : #ifndef INCLUDED_VCL_OPENGLWIN_HXX
11 : #define INCLUDED_VCL_OPENGLWIN_HXX
12 :
13 : #include <vcl/event.hxx>
14 : #include <vcl/syschild.hxx>
15 : #include <vcl/dllapi.h>
16 :
17 : class OpenGLContext;
18 : class OpenGLWindowImpl;
19 :
20 321 : class VCL_DLLPUBLIC IRenderer
21 : {
22 : public:
23 305 : 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;
28 :
29 : virtual void contextDestroyed() = 0;
30 : };
31 :
32 : // pImpl Pattern to avoid linking against OpenGL libs when using the class without the context
33 : class VCL_DLLPUBLIC OpenGLWindow : public vcl::Window
34 : {
35 : public:
36 : OpenGLWindow(vcl::Window* pParent);
37 : virtual ~OpenGLWindow();
38 : virtual void dispose() SAL_OVERRIDE;
39 :
40 : OpenGLContext& getContext();
41 :
42 : void setRenderer(IRenderer* pRenderer);
43 :
44 : virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle&) SAL_OVERRIDE;
45 :
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;
50 :
51 : private:
52 : std::unique_ptr<OpenGLWindowImpl> mxImpl;
53 : IRenderer* mpRenderer;
54 :
55 : Point maStartPoint;
56 : };
57 :
58 : #endif
59 :
60 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|