2014-05-07 03:45:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INCLUDED_VCL_OPENGLWIN_HXX
|
|
|
|
#define INCLUDED_VCL_OPENGLWIN_HXX
|
|
|
|
|
2017-04-14 08:42:15 +10:00
|
|
|
#include <memory>
|
2014-05-24 16:43:05 +01:00
|
|
|
#include <vcl/event.hxx>
|
2014-05-07 03:45:41 +02:00
|
|
|
#include <vcl/syschild.hxx>
|
2015-04-23 13:44:47 +03:00
|
|
|
#include <vcl/dllapi.h>
|
2014-05-07 03:45:41 +02:00
|
|
|
|
2014-05-07 04:16:54 +02:00
|
|
|
class OpenGLContext;
|
|
|
|
class OpenGLWindowImpl;
|
|
|
|
|
2015-04-23 13:44:47 +03:00
|
|
|
class VCL_DLLPUBLIC IRenderer
|
2014-05-13 05:12:55 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~IRenderer() {}
|
|
|
|
virtual void update() = 0;
|
2014-05-26 03:20:12 +02:00
|
|
|
virtual void clickedAt(const Point& rPos, sal_uInt16 nButtons) = 0;
|
2014-05-24 23:28:06 +02:00
|
|
|
virtual void mouseDragMove(const Point& rPosBegin, const Point& rPosEnd, sal_uInt16 nButtons) = 0;
|
|
|
|
virtual void scroll(long nDelta) = 0;
|
2014-05-23 01:19:19 +02:00
|
|
|
|
|
|
|
virtual void contextDestroyed() = 0;
|
2014-05-13 05:12:55 +02:00
|
|
|
};
|
|
|
|
|
2014-05-07 04:16:54 +02:00
|
|
|
// pImpl Pattern to avoid linking against OpenGL libs when using the class without the context
|
2015-04-23 13:44:47 +03:00
|
|
|
class VCL_DLLPUBLIC OpenGLWindow : public vcl::Window
|
2014-05-07 03:45:41 +02:00
|
|
|
{
|
|
|
|
public:
|
2016-09-14 12:26:36 +02:00
|
|
|
OpenGLWindow(vcl::Window* pParent, bool bInit);
|
2016-09-13 13:09:01 +02:00
|
|
|
virtual ~OpenGLWindow() override;
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void dispose() override;
|
2015-01-09 15:26:08 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
OpenGLContext& getContext();
|
2014-05-07 03:45:41 +02:00
|
|
|
|
2014-05-13 05:12:55 +02:00
|
|
|
void setRenderer(IRenderer* pRenderer);
|
|
|
|
|
2017-03-30 20:27:55 +02:00
|
|
|
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
|
2014-05-24 16:43:05 +01:00
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
|
|
|
|
virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
|
|
|
|
virtual void MouseMove( const MouseEvent& rMEvt ) override;
|
|
|
|
virtual void Command( const CommandEvent& rCEvt ) override;
|
2014-05-09 03:55:06 +02:00
|
|
|
|
2016-06-07 16:11:02 +02:00
|
|
|
void Initialize();
|
|
|
|
|
2014-05-07 03:45:41 +02:00
|
|
|
private:
|
2015-02-15 20:41:33 +00:00
|
|
|
std::unique_ptr<OpenGLWindowImpl> mxImpl;
|
2014-05-13 05:12:55 +02:00
|
|
|
IRenderer* mpRenderer;
|
2014-05-24 23:28:06 +02:00
|
|
|
|
|
|
|
Point maStartPoint;
|
2014-05-07 03:45:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|