]> git.saurik.com Git - wxWidgets.git/blame - samples/opengl/penguin/penguin.h
Also reset DatePicker property editor's global pointer (fixes #11787)
[wxWidgets.git] / samples / opengl / penguin / penguin.h
CommitLineData
8b089c5e
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: penguin.h
3// Purpose: wxGLCanvas demo program
4// Author: Robert Roebling
5// Modified by:
6// Created: 04/01/98
7// RCS-ID: $Id$
8// Copyright: (c) Robert Roebling
2f6c54eb 9// Licence: wxWindows licence
8b089c5e
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_PENGUIN_H_
13#define _WX_PENGUIN_H_
14
15
16#include "wx/defs.h"
17#include "wx/app.h"
18#include "wx/menu.h"
19#include "wx/dcclient.h"
4b764db3
JS
20#include "wx/wfstream.h"
21#if wxUSE_ZLIB
22#include "wx/zstream.h"
23#endif
8b089c5e
JS
24
25#include "wx/glcanvas.h"
26
5cf036d0
DS
27extern "C"
28{
8b089c5e
JS
29#include "trackball.h"
30}
31
4b764db3 32#include "dxfrenderer.h"
8b089c5e 33
451c13c8 34
4b764db3
JS
35// OpenGL view data
36struct GLData
37{
38 bool initialized; // have OpenGL been initialized?
39 float beginx, beginy; // position of mouse
40 float quat[4]; // orientation of object
41 float zoom; // field of view in degrees
42};
8b089c5e 43
451c13c8 44
4b764db3 45// Define a new application type
451c13c8 46class MyApp : public wxApp
8b089c5e
JS
47{
48public:
451c13c8 49 virtual bool OnInit();
8b089c5e
JS
50};
51
451c13c8 52
4b764db3 53// Define a new frame type
8b089c5e 54class TestGLCanvas;
bcc4c541 55
451c13c8
VZ
56
57class MyFrame : public wxFrame
8b089c5e
JS
58{
59public:
5cf036d0 60 MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos,
451c13c8 61 const wxSize& size, long style = wxDEFAULT_FRAME_STYLE);
8b089c5e 62
4b764db3
JS
63 void OnMenuFileOpen(wxCommandEvent& event);
64 void OnMenuFileExit(wxCommandEvent& event);
65 void OnMenuHelpAbout(wxCommandEvent& event);
5cf036d0 66
451c13c8 67 void SetCanvas(TestGLCanvas *canvas) { m_canvas = canvas; }
5cf036d0
DS
68 TestGLCanvas *GetCanvas() { return m_canvas; }
69
bcc4c541 70private:
5cf036d0 71 TestGLCanvas *m_canvas;
8b089c5e 72
bcc4c541 73 DECLARE_EVENT_TABLE()
8b089c5e
JS
74};
75
2db98bf5 76
451c13c8 77class TestGLCanvas : public wxGLCanvas
8b089c5e 78{
bcc4c541 79public:
5cf036d0
DS
80 TestGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY,
81 const wxPoint& pos = wxDefaultPosition,
82 const wxSize& size = wxDefaultSize, long style = 0,
83 const wxString& name = wxT("TestGLCanvas"));
84
451c13c8 85 virtual ~TestGLCanvas();
bcc4c541 86
4b764db3
JS
87 void LoadDXF(const wxString& filename);
88
89protected:
bcc4c541
RR
90 void OnPaint(wxPaintEvent& event);
91 void OnSize(wxSizeEvent& event);
92 void OnEraseBackground(wxEraseEvent& event);
4b764db3
JS
93 void OnMouse(wxMouseEvent& event);
94
95private:
5cf036d0 96 void InitGL();
4b764db3 97 void ResetProjectionMode();
5cf036d0 98
451c13c8
VZ
99 wxGLContext* m_glRC;
100 GLData m_gldata;
101 DXFRenderer m_renderer;
8b089c5e 102
c0c133e1 103 wxDECLARE_NO_COPY_CLASS(TestGLCanvas);
bcc4c541 104 DECLARE_EVENT_TABLE()
8b089c5e
JS
105};
106
5cf036d0 107#endif // #ifndef _WX_PENGUIN_H_