2004-10-01 10:23:59 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/cocoa/glcanvas.h
|
|
|
|
// Purpose: wxGLCanvas class
|
|
|
|
// Author: David Elliott
|
|
|
|
// Modified by:
|
|
|
|
// Created: 2004/09/29
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 2004 David Elliott
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_COCOA_GLCANVAS_H__
|
|
|
|
#define _WX_COCOA_GLCANVAS_H__
|
|
|
|
|
2006-11-03 14:22:38 -05:00
|
|
|
#include "wx/window.h"
|
|
|
|
|
2004-10-01 10:23:59 -04:00
|
|
|
// #include "wx/cocoa/NSOpenGLView.h"
|
|
|
|
// Include gl.h from the OpenGL framework
|
|
|
|
#include <OpenGL/gl.h>
|
|
|
|
|
2007-07-09 06:09:52 -04:00
|
|
|
class WXDLLIMPEXP_FWD_GL wxGLCanvas;
|
2004-10-01 10:23:59 -04:00
|
|
|
DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext);
|
2007-04-10 13:38:55 -04:00
|
|
|
DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLView);
|
2004-10-01 10:23:59 -04:00
|
|
|
|
|
|
|
// ========================================================================
|
|
|
|
// wxGLContext
|
|
|
|
// ========================================================================
|
2007-04-10 13:38:55 -04:00
|
|
|
|
|
|
|
class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase
|
2004-10-01 10:23:59 -04:00
|
|
|
{
|
|
|
|
public:
|
2007-04-10 13:38:55 -04:00
|
|
|
wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL);
|
2004-10-01 10:23:59 -04:00
|
|
|
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxGLContext();
|
2004-10-01 10:23:59 -04:00
|
|
|
|
2007-04-10 13:38:55 -04:00
|
|
|
virtual void SetCurrent(const wxGLCanvas& win) const;
|
2004-10-01 10:23:59 -04:00
|
|
|
|
2007-04-10 13:38:55 -04:00
|
|
|
WX_NSOpenGLContext GetNSOpenGLContext() const
|
|
|
|
{ return m_cocoaNSOpenGLContext; }
|
2004-10-01 10:23:59 -04:00
|
|
|
|
2007-04-10 13:38:55 -04:00
|
|
|
private:
|
2004-10-01 10:23:59 -04:00
|
|
|
WX_NSOpenGLContext m_cocoaNSOpenGLContext;
|
|
|
|
};
|
|
|
|
|
|
|
|
// ========================================================================
|
|
|
|
// wxGLCanvas
|
|
|
|
// ========================================================================
|
2007-04-10 13:38:55 -04:00
|
|
|
|
|
|
|
class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase
|
|
|
|
// , protected wxCocoaNSOpenGLView
|
2004-10-01 10:23:59 -04:00
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxGLCanvas)
|
|
|
|
// WX_DECLARE_COCOA_OWNER(NSOpenGLView,NSView,NSView)
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// initialization
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
public:
|
|
|
|
wxGLCanvas(wxWindow *parent,
|
2007-04-10 13:38:55 -04:00
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const int *attribList = NULL,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxGLCanvasName,
|
|
|
|
const wxPalette& palette = wxNullPalette)
|
|
|
|
{
|
|
|
|
Create(parent, id, pos, size, style, name, attribList, palette);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxGLCanvasName,
|
|
|
|
const int *attribList = NULL,
|
|
|
|
const wxPalette& palette = wxNullPalette);
|
2004-10-01 10:23:59 -04:00
|
|
|
|
|
|
|
virtual ~wxGLCanvas();
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// Cocoa callbacks
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
protected:
|
|
|
|
// NSOpenGLView cannot be enabled/disabled
|
|
|
|
virtual void CocoaSetEnabled(bool enable) { }
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// Implementation
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
public:
|
2007-04-10 13:38:55 -04:00
|
|
|
virtual void SwapBuffers();
|
2004-10-01 10:23:59 -04:00
|
|
|
|
2007-04-10 13:38:55 -04:00
|
|
|
|
|
|
|
NSOpenGLView *GetNSOpenGLView() const
|
|
|
|
{ return (NSOpenGLView *)m_cocoaNSView; }
|
2004-10-01 10:23:59 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //ndef _WX_COCOA_GLCANVAS_H__
|