| 1 |
|
| 2 |
#ifndef _WX_MAIN_H_ |
| 3 |
#define _WX_MAIN_H_ |
| 4 |
|
| 5 |
|
| 6 |
#include <wx/defs.h> |
| 7 |
#include <wx/app.h> |
| 8 |
#include <wx/menu.h> |
| 9 |
#include <wx/dcclient.h> |
| 10 |
|
| 11 |
#include <wx/glcanvas.h> |
| 12 |
|
| 13 |
extern "C" |
| 14 |
{ |
| 15 |
//#include "lw.h" |
| 16 |
//#include "trackball.h" |
| 17 |
} |
| 18 |
|
| 19 |
/* information needed to display lightwave mesh */ |
| 20 |
//typedef struct |
| 21 |
//{ |
| 22 |
// gint do_init; /* true if initgl not yet called */ |
| 23 |
// bool do_init; |
| 24 |
// //lwObject *lwobject; /* lightwave object mesh */ |
| 25 |
// float beginx,beginy; /* position of mouse */ |
| 26 |
// float quat[4]; /* orientation of object */ |
| 27 |
// float zoom; /* field of view in degrees */ |
| 28 |
//} mesh_info; |
| 29 |
|
| 30 |
|
| 31 |
/* Define a new application type */ |
| 32 |
class MyApp: public wxApp |
| 33 |
{ |
| 34 |
public: |
| 35 |
bool OnInit(); |
| 36 |
}; |
| 37 |
|
| 38 |
class MyToolbar: public wxPanel |
| 39 |
{ |
| 40 |
public: |
| 41 |
MyToolbar(wxTopLevelWindow *parent, wxWindowID id = wxID_ANY, |
| 42 |
const wxPoint& pos = wxDefaultPosition, |
| 43 |
const wxSize& size = wxDefaultSize, long style = 0, |
| 44 |
const wxString& name = wxT("ToolBar")); |
| 45 |
void OnDrag(wxMouseEvent &event); |
| 46 |
wxSizer *topsizer; |
| 47 |
|
| 48 |
void UpdateGearsIcon(bool b); |
| 49 |
|
| 50 |
void UpdateGearsIcon(); |
| 51 |
|
| 52 |
void SetTitleText( wxString = wxEmptyString ); |
| 53 |
|
| 54 |
private: |
| 55 |
wxTopLevelWindow *parent; |
| 56 |
|
| 57 |
wxStaticText *titleText; |
| 58 |
wxSizer *titleTextSizer; |
| 59 |
|
| 60 |
bool gearPresent; |
| 61 |
wxStaticBitmap *gear; |
| 62 |
wxBoxSizer *gearS; |
| 63 |
|
| 64 |
DECLARE_EVENT_TABLE() |
| 65 |
}; |
| 66 |
|
| 67 |
/* Define a new frame type */ |
| 68 |
class TestGLCanvas; |
| 69 |
|
| 70 |
class MyFrame: public wxFrame |
| 71 |
{ |
| 72 |
public: |
| 73 |
MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, |
| 74 |
const wxSize& size, long style = wxDEFAULT_FRAME_STYLE); |
| 75 |
|
| 76 |
void OnExit(wxCommandEvent& event); |
| 77 |
void OnOpenFile (wxCommandEvent & event); // open the open-file dialogs |
| 78 |
void OnReadFile (wxString filename); // reads the file |
| 79 |
void OnSaveSnap (wxCommandEvent & event); |
| 80 |
void OnAbout (wxCommandEvent & event); |
| 81 |
void OnSize(wxSizeEvent& event); |
| 82 |
void Maximize(bool max); |
| 83 |
//#if defined(_WIN32) |
| 84 |
void OnEraseBackground(wxEraseEvent& event); |
| 85 |
//#endif |
| 86 |
void SetToolbar( MyToolbar *tb ) { m_tb = tb; } |
| 87 |
MyToolbar *GetToolbar() { return m_tb; } |
| 88 |
|
| 89 |
void OnPaint( wxPaintEvent& WXUNUSED(event) ); |
| 90 |
|
| 91 |
#if wxUSE_GLCANVAS |
| 92 |
|
| 93 |
void SetCanvas( TestGLCanvas *canvas ) { m_canvas = canvas; } |
| 94 |
|
| 95 |
TestGLCanvas *GetCanvas() { return m_canvas; } |
| 96 |
|
| 97 |
void OnKeyUp( wxKeyEvent& event ); |
| 98 |
void OnKeyDown( wxKeyEvent& event ); |
| 99 |
|
| 100 |
void ResetAO(); |
| 101 |
void OnIdle(wxIdleEvent& event); |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
private: |
| 106 |
|
| 107 |
enum {NATURAL, CUSTOM, FORCED} resize_mode; |
| 108 |
TestGLCanvas *m_canvas; |
| 109 |
#endif |
| 110 |
|
| 111 |
MyToolbar *m_tb; |
| 112 |
|
| 113 |
DECLARE_EVENT_TABLE() |
| 114 |
}; |
| 115 |
|
| 116 |
#if wxUSE_GLCANVAS |
| 117 |
|
| 118 |
class TestGLCanvas: public wxGLCanvas |
| 119 |
{ |
| 120 |
public: |
| 121 |
TestGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY, |
| 122 |
const wxPoint& pos = wxDefaultPosition, |
| 123 |
const wxSize& size = wxDefaultSize, long style = 0, |
| 124 |
const wxString& name = wxT("GLCanvas")); |
| 125 |
|
| 126 |
~TestGLCanvas(); |
| 127 |
|
| 128 |
void OnPaint(wxPaintEvent& event); |
| 129 |
void OnSize(wxSizeEvent& event); |
| 130 |
void OnEraseBackground(wxEraseEvent& event); |
| 131 |
void OnMouse( wxMouseEvent& event ); |
| 132 |
void OnKeyUp( wxKeyEvent& event ); |
| 133 |
void OnKeyDown( wxKeyEvent& event ); |
| 134 |
void InitGL(); |
| 135 |
|
| 136 |
void SceneChanged(); // redraw! |
| 137 |
|
| 138 |
bool initdone; |
| 139 |
|
| 140 |
bool shownHQ; |
| 141 |
|
| 142 |
private: |
| 143 |
//wxWindow *parent; |
| 144 |
DECLARE_EVENT_TABLE() |
| 145 |
}; |
| 146 |
|
| 147 |
#endif // #if wxUSE_GLCANVAS |
| 148 |
|
| 149 |
#endif // #ifndef _WX_MAIN_H_ |
| 150 |
|