summaryrefslogtreecommitdiff
path: root/cad/plugins/QuteMol/qutemol/src/main.h
blob: 995d787a203615e5e158d604925f1292d2109fbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149

#ifndef _WX_MAIN_H_
#define _WX_MAIN_H_


#include <wx/defs.h>
#include <wx/app.h>
#include <wx/menu.h>
#include <wx/dcclient.h>

#include <wx/glcanvas.h>

extern "C"
{
//#include "lw.h"
//#include "trackball.h"
}

/* information needed to display lightwave mesh */
//typedef struct
//{
//  gint do_init;         /* true if initgl not yet called */
//    bool do_init;
//    //lwObject *lwobject;   /* lightwave object mesh */
//    float beginx,beginy;  /* position of mouse */
//    float quat[4];        /* orientation of object */
//    float zoom;           /* field of view in degrees */
//} mesh_info;


/* Define a new application type */
class MyApp: public wxApp
{
public:
    bool OnInit();
};

class MyToolbar: public wxPanel
{
public:
  MyToolbar(wxTopLevelWindow *parent, wxWindowID id = wxID_ANY,
        const wxPoint& pos = wxDefaultPosition,
        const wxSize& size = wxDefaultSize, long style = 0,
        const wxString& name = wxT("ToolBar"));
  void OnDrag(wxMouseEvent &event);
  wxSizer *topsizer;
  
  void UpdateGearsIcon(bool b);

  void UpdateGearsIcon();

  void SetTitleText( wxString = wxEmptyString );
  
private:
  wxTopLevelWindow *parent;
  
  wxStaticText *titleText;
  wxSizer *titleTextSizer;
  
  bool gearPresent;
  wxStaticBitmap *gear;
  wxBoxSizer *gearS;  
  
  DECLARE_EVENT_TABLE()
};

/* Define a new frame type */
class TestGLCanvas;

class MyFrame: public wxFrame
{
public:
    MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos,
        const wxSize& size, long style = wxDEFAULT_FRAME_STYLE);

    void OnExit(wxCommandEvent& event);
    void OnOpenFile (wxCommandEvent & event); // open the open-file dialogs
    void OnReadFile (wxString filename); // reads the file
    void OnSaveSnap (wxCommandEvent & event);
    void OnAbout (wxCommandEvent & event);
    void OnSize(wxSizeEvent& event);
    void Maximize(bool max);
//#if defined(_WIN32)
    void OnEraseBackground(wxEraseEvent& event);
//#endif
    void SetToolbar( MyToolbar *tb ) { m_tb = tb; }
    MyToolbar *GetToolbar() { return m_tb; }

    void OnPaint( wxPaintEvent& WXUNUSED(event) );

#if wxUSE_GLCANVAS

    void SetCanvas( TestGLCanvas *canvas ) { m_canvas = canvas; }
       
    TestGLCanvas *GetCanvas() { return m_canvas; }
    
    void OnKeyUp( wxKeyEvent& event );
    void OnKeyDown( wxKeyEvent& event );

    void ResetAO();
    void OnIdle(wxIdleEvent& event);
    


private:
  
    enum {NATURAL, CUSTOM, FORCED} resize_mode;
    TestGLCanvas *m_canvas;
#endif

    MyToolbar *m_tb;

    DECLARE_EVENT_TABLE()
};

#if wxUSE_GLCANVAS

class TestGLCanvas: public wxGLCanvas
{
public:
    TestGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY,
        const wxPoint& pos = wxDefaultPosition,
        const wxSize& size = wxDefaultSize, long style = 0,
        const wxString& name = wxT("GLCanvas"));

    ~TestGLCanvas();

    void OnPaint(wxPaintEvent& event);
    void OnSize(wxSizeEvent& event);
    void OnEraseBackground(wxEraseEvent& event);
    void OnMouse( wxMouseEvent& event );
    void OnKeyUp( wxKeyEvent& event );
    void OnKeyDown( wxKeyEvent& event );
    
    void SceneChanged(); // redraw!
 
    bool initdone;

    bool shownHQ;
    
private:
    //wxWindow *parent;
    DECLARE_EVENT_TABLE()
};

#endif // #if wxUSE_GLCANVAS

#endif // #ifndef _WX_MAIN_H_