4 * Author: Robert Roebling
6 * Copyright: (C) 1998, Robert Roebling
9 // For compilers that support precompilation, includes "wx/wx.h".
15 #pragma interface "test.cpp"
26 #include <wx/splitter.h>
28 #include "wx/canvas/canvas.h"
29 #include "wx/canvas/polygon.h"
34 class MywxCanvasObjectRef
: public wxCanvasObjectRef
36 DECLARE_DYNAMIC_CLASS(MywxCanvasObjectRef
)
39 MywxCanvasObjectRef();
40 MywxCanvasObjectRef(double x
, double y
, wxCanvasObjectGroup
* group
);
41 ~MywxCanvasObjectRef();
43 void OnMouseEvent(wxMouseEvent
&event
);
50 class MyEventHandler
: public wxEvtHandler
55 void OnMouseEvent(wxMouseEvent
&event
);
63 class MySplitterWindow
: public wxSplitterWindow
66 MySplitterWindow(wxFrame
*parent
, wxWindowID id
)
67 : wxSplitterWindow(parent
, id
, wxDefaultPosition
, wxDefaultSize
, wxSP_3D
)
72 virtual bool OnSashPositionChange(int newSashPosition
)
74 if ( !wxSplitterWindow::OnSashPositionChange(newSashPosition
) )
78 str
.Printf( _T("Sash position = %d"), newSashPosition
);
79 m_frame
->SetStatusText(str
);
84 void SetStatusText(const wxString
& str
){m_frame
->SetStatusText(str
);}
92 const int ID_ABOUT
= 109;
95 class MyFrame
: public wxFrame
98 MyFrame(wxFrame
* frame
, const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
);
102 void SplitHorizontal(wxCommandEvent
& event
);
103 void SplitVertical(wxCommandEvent
& event
);
104 void Unsplit(wxCommandEvent
& event
);
105 void SetMinSize(wxCommandEvent
& event
);
106 void Quit(wxCommandEvent
& event
);
108 // Menu command update functions
109 void UpdateUIHorizontal(wxUpdateUIEvent
& event
);
110 void UpdateUIVertical(wxUpdateUIEvent
& event
);
111 void UpdateUIUnsplit(wxUpdateUIEvent
& event
);
113 void OnAbout( wxCommandEvent
&event
);
114 void OnNewFrame( wxCommandEvent
&event
);
115 void OnQuit( wxCommandEvent
&event
);
116 void OnTimer( wxTimerEvent
&event
);
118 wxCanvasObject
*m_sm1
;
119 wxCanvasObject
*m_sm2
;
120 wxCanvasObject
*m_sm3
;
121 wxCanvasObject
*m_sm4
;
123 MywxCanvasObjectRef
*m_ref
;
124 MywxCanvasObjectRef
*m_ref2
;
129 wxBitmap gs_bmp36_mono
;
133 void UpdatePosition();
139 MySplitterWindow
* m_splitter
;
141 wxCanvasAdmin m_canvasadmin
;
143 wxCanvasObjectGroup
* m_datatree
;
145 DECLARE_EVENT_TABLE()
147 MyEventHandler
* m_eventhandler
;
150 // ID for the menu commands
161 #define SPLITTER_WINDOW 100
162 #define SPLITTER_FRAME 101
166 class MyCanvas
: public wxVectorCanvas
169 MyCanvas( wxCanvasAdmin
* admin
, MySplitterWindow
*parent
, wxWindowID id
= -1,
170 const wxPoint
& pos
= wxDefaultPosition
,
171 const wxSize
& size
= wxDefaultSize
,
172 long style
= wxScrolledWindowStyle
);
174 void OnMouseEvent(wxMouseEvent
& event
);
178 //mouse position used for displaying it in the statusbar
180 //mouse position used for displaying it in the statusbar
182 //mouse position used for displaying it in the statusbar
183 double m_mouse_worldx
;
184 //mouse position used for displaying it in the statusbar
185 double m_mouse_worldy
;
187 //mouse position used for zooming
189 //mouse position used for zooming
191 //mouse position used for zooming
193 //mouse position used for zooming
197 DECLARE_EVENT_TABLE()
199 //parent of the canvas
200 MySplitterWindow
*m_parent
;
205 class MyApp
: public wxApp
208 virtual bool OnInit();
210 const wxString
& GetFontPath() const { return m_fontpath
; }