/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtOpenGL module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the 
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.digia.com
** $QT_END_LICENSE$
**
****************************************************************************/

#ifndef QPLATFORM_GL_CONTEXT_H
#define QPLATFORM_GL_CONTEXT_H

#include <QtCore/qnamespace.h>
#include <QtGui/QPlatformWindowFormat>

QT_BEGIN_HEADER

QT_BEGIN_NAMESPACE

QT_MODULE(Gui)

class QPlatformGLContextPrivate;

class Q_OPENGL_EXPORT QPlatformGLContext
{
Q_DECLARE_PRIVATE(QPlatformGLContext);

public:
    explicit QPlatformGLContext();
    virtual ~QPlatformGLContext();

    virtual void makeCurrent();
    virtual void doneCurrent();
    virtual void swapBuffers() = 0;
    virtual void* getProcAddress(const QString& procName) = 0;

    virtual QPlatformWindowFormat platformWindowFormat() const = 0;

    const static QPlatformGLContext *currentContext();

protected:
    QScopedPointer<QPlatformGLContextPrivate> d_ptr;

private:
    //hack to make it work with QGLContext::CurrentContext
    friend class QGLContext;
    friend class QWidgetPrivate;
    void *qGLContextHandle() const;
    void setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *));
    void deleteQGLContext();
    Q_DISABLE_COPY(QPlatformGLContext);
};

QT_END_NAMESPACE

QT_END_HEADER


#endif // QPLATFORM_GL_INTEGRATION_P_H
