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/vclopengl_dllapi.hxx>
16 :
17 : #include <boost/scoped_ptr.hpp>
18 :
19 : class OpenGLContext;
20 : class OpenGLWindowImpl;
21 :
22 606 : class VCLOPENGL_DLLPUBLIC IRenderer
23 : {
24 : public:
25 574 : virtual ~IRenderer() {}
26 : virtual void update() = 0;
27 : virtual void clickedAt(const Point& rPos, sal_uInt16 nButtons) = 0;
28 : virtual void mouseDragMove(const Point& rPosBegin, const Point& rPosEnd, sal_uInt16 nButtons) = 0;
29 : virtual void scroll(long nDelta) = 0;
30 :
31 : virtual void contextDestroyed() = 0;
32 : };
33 :
34 : // pImpl Pattern to avoid linking against OpenGL libs when using the class without the context
35 : class VCLOPENGL_DLLPUBLIC OpenGLWindow : public vcl::Window
36 : {
37 : public:
38 : OpenGLWindow(vcl::Window* pParent);
39 : virtual ~OpenGLWindow();
40 : OpenGLContext& getContext();
41 :
42 : void setRenderer(IRenderer* pRenderer);
43 :
44 : virtual void Paint(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 : boost::scoped_ptr<OpenGLWindowImpl> mpImpl;
53 : IRenderer* mpRenderer;
54 :
55 : Point maStartPoint;
56 : };
57 :
58 : #endif
59 :
60 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|