]> git.saurik.com Git - wxWidgets.git/blob - samples/typetest/typetest.cpp
fixed mouse input handling in wxUniv: the static boxes ust be transparent
[wxWidgets.git] / samples / typetest / typetest.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: typetest.cpp
3 // Purpose: Types wxWindows sample
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "typetest.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx/wx.h".
17 #include "wx/wxprec.h"
18
19 #ifdef __BORLANDC__
20 #pragma hdrstop
21 #endif
22
23 #ifndef WX_PRECOMP
24 #include "wx/wx.h"
25 #endif
26
27 #include "wx/time.h"
28 #include "wx/date.h"
29 #include "wx/variant.h"
30 #include "wx/mimetype.h"
31
32 #include "typetest.h"
33
34 #if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__)
35 #include "mondrian.xpm"
36 #endif
37
38 #ifdef new
39 #undef new
40 #endif
41
42 #include "wx/ioswrap.h"
43
44 #if wxUSE_IOSTREAMH
45 #include <fstream.h>
46 #else
47 #include <fstream>
48 #endif
49
50 #include "wx/wfstream.h"
51 #include "wx/datstrm.h"
52 #include "wx/txtstrm.h"
53 #include "wx/mstream.h"
54
55 // Create a new application object
56 IMPLEMENT_APP (MyApp)
57
58 IMPLEMENT_DYNAMIC_CLASS (MyApp, wxApp)
59
60 BEGIN_EVENT_TABLE(MyApp, wxApp)
61 #if wxUSE_TIMEDATE
62 EVT_MENU(TYPES_DATE, MyApp::DoDateDemo)
63 EVT_MENU(TYPES_TIME, MyApp::DoTimeDemo)
64 #endif // wxUSE_TIMEDATE
65 EVT_MENU(TYPES_VARIANT, MyApp::DoVariantDemo)
66 EVT_MENU(TYPES_BYTEORDER, MyApp::DoByteOrderDemo)
67 #if wxUSE_UNICODE
68 EVT_MENU(TYPES_UNICODE, MyApp::DoUnicodeDemo)
69 #endif // wxUSE_UNICODE
70 EVT_MENU(TYPES_STREAM, MyApp::DoStreamDemo)
71 EVT_MENU(TYPES_STREAM2, MyApp::DoStreamDemo2)
72 EVT_MENU(TYPES_STREAM3, MyApp::DoStreamDemo3)
73 EVT_MENU(TYPES_STREAM4, MyApp::DoStreamDemo4)
74 EVT_MENU(TYPES_STREAM5, MyApp::DoStreamDemo5)
75 EVT_MENU(TYPES_MIME, MyApp::DoMIMEDemo)
76 END_EVENT_TABLE()
77
78 bool MyApp::OnInit()
79 {
80 // Create the main frame window
81 MyFrame *frame = new MyFrame((wxFrame *) NULL, "wxWindows Types Demo",
82 wxPoint(50, 50), wxSize(450, 340));
83
84 // Give it an icon
85 frame->SetIcon(wxICON(mondrian));
86
87 // Make a menubar
88 wxMenu *file_menu = new wxMenu;
89
90 file_menu->Append(TYPES_ABOUT, "&About");
91 file_menu->AppendSeparator();
92 file_menu->Append(TYPES_QUIT, "E&xit\tAlt-X");
93
94 wxMenu *test_menu = new wxMenu;
95 #if wxUSE_TIMEDATE
96 test_menu->Append(TYPES_DATE, "&Date test");
97 #endif // wxUSE_TIMEDATE
98 test_menu->Append(TYPES_TIME, "&Time test");
99 test_menu->Append(TYPES_VARIANT, "&Variant test");
100 test_menu->Append(TYPES_BYTEORDER, "&Byteorder test");
101 #if wxUSE_UNICODE
102 test_menu->Append(TYPES_UNICODE, "&Unicode test");
103 #endif // wxUSE_UNICODE
104 test_menu->Append(TYPES_STREAM, "&Stream test");
105 test_menu->Append(TYPES_STREAM2, "&Stream seek test");
106 test_menu->Append(TYPES_STREAM3, "&Stream error test");
107 test_menu->Append(TYPES_STREAM4, "&Stream buffer test");
108 test_menu->Append(TYPES_STREAM5, "&Stream peek test");
109 test_menu->AppendSeparator();
110 test_menu->Append(TYPES_MIME, "&MIME database test");
111
112 wxMenuBar *menu_bar = new wxMenuBar;
113 menu_bar->Append(file_menu, "&File");
114 menu_bar->Append(test_menu, "&Tests");
115 frame->SetMenuBar(menu_bar);
116
117 m_textCtrl = new wxTextCtrl(frame, -1, "", wxPoint(0, 0), wxDefaultSize, wxTE_MULTILINE);
118
119 // Show the frame
120 frame->Show(TRUE);
121
122 SetTopWindow(frame);
123
124 return TRUE;
125 }
126
127 void MyApp::DoStreamDemo(wxCommandEvent& WXUNUSED(event))
128 {
129 wxTextCtrl& textCtrl = * GetTextCtrl();
130
131 textCtrl.Clear();
132 textCtrl << _T("\nTest fstream vs. wxFileStream:\n\n");
133
134 textCtrl.WriteText( "Writing to ofstream and wxFileOutputStream:\n" );
135
136 wxSTD ofstream std_file_output( "test_std.dat" );
137 wxFileOutputStream file_output( wxString("test_wx.dat") );
138 wxBufferedOutputStream buf_output( file_output );
139 wxTextOutputStream text_output( buf_output );
140
141 wxString tmp;
142 signed int si = 0xFFFFFFFF;
143 tmp.Printf( _T("Signed int: %d\n"), si );
144 textCtrl.WriteText( tmp );
145 text_output << si << "\n";
146 std_file_output << si << "\n";
147
148 unsigned int ui = 0xFFFFFFFF;
149 tmp.Printf( _T("Unsigned int: %u\n"), ui );
150 textCtrl.WriteText( tmp );
151 text_output << ui << "\n";
152 std_file_output << ui << "\n";
153
154 double d = 2.01234567890123456789;
155 tmp.Printf( _T("Double: %f\n"), d );
156 textCtrl.WriteText( tmp );
157 text_output << d << "\n";
158 std_file_output << d << "\n";
159
160 float f = (float)0.00001;
161 tmp.Printf( _T("Float: %f\n"), f );
162 textCtrl.WriteText( tmp );
163 text_output << f << "\n";
164 std_file_output << f << "\n";
165
166 wxString str( _T("Hello!") );
167 tmp.Printf( _T("String: %s\n"), str.c_str() );
168 textCtrl.WriteText( tmp );
169 text_output << str << "\n";
170 std_file_output << str.c_str() << "\n";
171
172 textCtrl.WriteText( "\nReading from ifstream:\n" );
173
174 wxSTD ifstream std_file_input( "test_std.dat" );
175
176 std_file_input >> si;
177 tmp.Printf( _T("Signed int: %d\n"), si );
178 textCtrl.WriteText( tmp );
179
180 std_file_input >> ui;
181 tmp.Printf( _T("Unsigned int: %u\n"), ui );
182 textCtrl.WriteText( tmp );
183
184 std_file_input >> d;
185 tmp.Printf( _T("Double: %f\n"), d );
186 textCtrl.WriteText( tmp );
187
188 std_file_input >> f;
189 tmp.Printf( _T("Float: %f\n"), f );
190 textCtrl.WriteText( tmp );
191
192 // Why doesn't this work?
193 #if 0
194 char std_buf[200];
195 std_file_input >> std_buf;
196 tmp.Printf( _T("String: %s\n"), std_buf );
197 textCtrl.WriteText( tmp );
198 #endif
199
200 textCtrl.WriteText( "\nReading from wxFileInputStream:\n" );
201
202 buf_output.Sync();
203
204 wxFileInputStream file_input( wxString("test_wx.dat") );
205 wxBufferedInputStream buf_input( file_input );
206 wxTextInputStream text_input( file_input );
207
208 text_input >> si;
209 tmp.Printf( _T("Signed int: %d\n"), si );
210 textCtrl.WriteText( tmp );
211
212 text_input >> ui;
213 tmp.Printf( _T("Unsigned int: %u\n"), ui );
214 textCtrl.WriteText( tmp );
215
216 text_input >> d;
217 tmp.Printf( _T("Double: %f\n"), d );
218 textCtrl.WriteText( tmp );
219
220 text_input >> f;
221 tmp.Printf( _T("Float: %f\n"), f );
222 textCtrl.WriteText( tmp );
223
224 text_input >> str;
225 tmp.Printf( _T("String: %s\n"), str.c_str() );
226 textCtrl.WriteText( tmp );
227
228
229
230 textCtrl << "\nTest for wxDataStream:\n\n";
231
232 textCtrl.WriteText( "Writing to wxDataOutputStream:\n" );
233
234 file_output.SeekO( 0 );
235 wxDataOutputStream data_output( buf_output );
236
237 wxInt16 i16 = (unsigned short)0xFFFF;
238 tmp.Printf( _T("Signed int16: %d\n"), (int)i16 );
239 textCtrl.WriteText( tmp );
240 data_output.Write16( i16 );
241
242 wxUint16 ui16 = 0xFFFF;
243 tmp.Printf( _T("Unsigned int16: %u\n"), (unsigned int) ui16 );
244 textCtrl.WriteText( tmp );
245 data_output.Write16( ui16 );
246
247 d = 2.01234567890123456789;
248 tmp.Printf( _T("Double: %f\n"), d );
249 textCtrl.WriteText( tmp );
250 data_output.WriteDouble( d );
251
252 str = "Hello!";
253 tmp.Printf( _T("String: %s\n"), str.c_str() );
254 textCtrl.WriteText( tmp );
255 data_output.WriteString( str );
256
257 buf_output.Sync();
258
259 textCtrl.WriteText( "\nReading from wxDataInputStream:\n" );
260
261 file_input.SeekI( 0 );
262 wxDataInputStream data_input( buf_input );
263
264 i16 = data_input.Read16();
265 tmp.Printf( _T("Signed int16: %d\n"), (int)i16 );
266 textCtrl.WriteText( tmp );
267
268 ui16 = data_input.Read16();
269 tmp.Printf( _T("Unsigned int16: %u\n"), (unsigned int) ui16 );
270 textCtrl.WriteText( tmp );
271
272 d = data_input.ReadDouble();
273 tmp.Printf( _T("Double: %f\n"), d );
274 textCtrl.WriteText( tmp );
275
276 str = data_input.ReadString();
277 tmp.Printf( _T("String: %s\n"), str.c_str() );
278 textCtrl.WriteText( tmp );
279 }
280
281 void MyApp::DoStreamDemo2(wxCommandEvent& WXUNUSED(event))
282 {
283 wxTextCtrl& textCtrl = * GetTextCtrl();
284
285 textCtrl.Clear();
286 textCtrl << _T("\nTesting wxBufferedStream:\n\n");
287
288 char ch,ch2;
289
290 textCtrl.WriteText( "Writing number 0 to 9 to buffered wxFileOutputStream:\n\n" );
291
292 wxFileOutputStream file_output( wxString("test_wx.dat") );
293 wxBufferedOutputStream buf_output( file_output );
294 for (ch = 0; ch < 10; ch++)
295 buf_output.Write( &ch, 1 );
296 buf_output.Sync();
297
298 wxFileInputStream file_input( wxString("test_wx.dat") );
299 for (ch2 = 0; ch2 < 10; ch2++)
300 {
301 file_input.Read( &ch, 1 );
302 textCtrl.WriteText( (wxChar)(ch + '0') );
303 }
304 textCtrl.WriteText( "\n\n\n" );
305
306 textCtrl.WriteText( "Writing number 0 to 9 to buffered wxFileOutputStream, then\n" );
307 textCtrl.WriteText( "seeking back to #3 and writing 3:\n\n" );
308
309 wxFileOutputStream file_output2( wxString("test_wx2.dat") );
310 wxBufferedOutputStream buf_output2( file_output2 );
311 for (ch = 0; ch < 10; ch++)
312 buf_output2.Write( &ch, 1 );
313 buf_output2.SeekO( 3 );
314 ch = 3;
315 buf_output2.Write( &ch, 1 );
316 buf_output2.Sync();
317
318 wxFileInputStream file_input2( wxString("test_wx2.dat") );
319 for (ch2 = 0; ch2 < 10; ch2++)
320 {
321 file_input2.Read( &ch, 1 );
322 textCtrl.WriteText( (wxChar)(ch + '0') );
323 }
324 textCtrl.WriteText( "\n\n\n" );
325
326 // now append 2000 bytes to file (bigger than buffer)
327 buf_output2.SeekO( 0, wxFromEnd );
328 ch = 1;
329 for (int i = 0; i < 2000; i++)
330 buf_output2.Write( &ch, 1 );
331 buf_output2.Sync();
332
333 textCtrl.WriteText( "Reading number 0 to 9 from buffered wxFileInputStream, then\n" );
334 textCtrl.WriteText( "seeking back to #3 and reading 3:\n\n" );
335
336 wxFileInputStream file_input3( wxString("test_wx2.dat") );
337 wxBufferedInputStream buf_input3( file_input3 );
338 for (ch2 = 0; ch2 < 10; ch2++)
339 {
340 buf_input3.Read( &ch, 1 );
341 textCtrl.WriteText( (wxChar)(ch + '0') );
342 }
343 for (int j = 0; j < 2000; j++)
344 buf_input3.Read( &ch, 1 );
345 textCtrl.WriteText( "\n" );
346 buf_input3.SeekI( 3 );
347 buf_input3.Read( &ch, 1 );
348 textCtrl.WriteText( (wxChar)(ch + '0') );
349 textCtrl.WriteText( "\n\n\n" );
350
351 }
352
353 void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event))
354 {
355 wxTextCtrl& textCtrl = * GetTextCtrl();
356
357 textCtrl.Clear();
358 textCtrl << "\nTesting wxFileInputStream's and wxFFileInputStream's error handling:\n\n";
359
360 char ch,ch2;
361
362 textCtrl.WriteText( "Writing number 0 to 9 to wxFileOutputStream:\n\n" );
363
364 wxFileOutputStream file_output( wxString("test_wx.dat") );
365 for (ch = 0; ch < 10; ch++)
366 file_output.Write( &ch, 1 );
367
368 // Testing wxFileInputStream
369
370 textCtrl.WriteText( "Reading 0 to 10 to wxFileInputStream:\n\n" );
371
372 wxFileInputStream file_input( wxString("test_wx.dat") );
373 for (ch2 = 0; ch2 < 11; ch2++)
374 {
375 file_input.Read( &ch, 1 );
376 textCtrl.WriteText( "Value read: " );
377 textCtrl.WriteText( (wxChar)(ch + '0') );
378 textCtrl.WriteText( "; stream.LastError() returns: " );
379 switch (file_input.LastError())
380 {
381 case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break;
382 case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break;
383 case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break;
384 case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break;
385 default: textCtrl.WriteText( "Huh?\n" ); break;
386 }
387 }
388 textCtrl.WriteText( "\n" );
389
390 textCtrl.WriteText( "Seeking to 0; stream.LastError() returns: " );
391 file_input.SeekI( 0 );
392 switch (file_input.LastError())
393 {
394 case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break;
395 case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break;
396 case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break;
397 case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break;
398 default: textCtrl.WriteText( "Huh?\n" ); break;
399 }
400 textCtrl.WriteText( "\n" );
401
402 file_input.Read( &ch, 1 );
403 textCtrl.WriteText( "Value read: " );
404 textCtrl.WriteText( (wxChar)(ch + '0') );
405 textCtrl.WriteText( "; stream.LastError() returns: " );
406 switch (file_input.LastError())
407 {
408 case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break;
409 case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break;
410 case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break;
411 case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break;
412 default: textCtrl.WriteText( "Huh?\n" ); break;
413 }
414 textCtrl.WriteText( "\n\n" );
415
416
417 // Testing wxFFileInputStream
418
419 textCtrl.WriteText( "Reading 0 to 10 to wxFFileInputStream:\n\n" );
420
421 wxFFileInputStream ffile_input( wxString("test_wx.dat") );
422 for (ch2 = 0; ch2 < 11; ch2++)
423 {
424 ffile_input.Read( &ch, 1 );
425 textCtrl.WriteText( "Value read: " );
426 textCtrl.WriteText( (wxChar)(ch + '0') );
427 textCtrl.WriteText( "; stream.LastError() returns: " );
428 switch (ffile_input.LastError())
429 {
430 case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break;
431 case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break;
432 case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break;
433 case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break;
434 default: textCtrl.WriteText( "Huh?\n" ); break;
435 }
436 }
437 textCtrl.WriteText( "\n" );
438
439 textCtrl.WriteText( "Seeking to 0; stream.LastError() returns: " );
440 ffile_input.SeekI( 0 );
441 switch (ffile_input.LastError())
442 {
443 case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break;
444 case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break;
445 case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break;
446 case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break;
447 default: textCtrl.WriteText( "Huh?\n" ); break;
448 }
449 textCtrl.WriteText( "\n" );
450
451 ffile_input.Read( &ch, 1 );
452 textCtrl.WriteText( "Value read: " );
453 textCtrl.WriteText( (wxChar)(ch + '0') );
454 textCtrl.WriteText( "; stream.LastError() returns: " );
455 switch (ffile_input.LastError())
456 {
457 case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break;
458 case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break;
459 case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break;
460 case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break;
461 default: textCtrl.WriteText( "Huh?\n" ); break;
462 }
463 textCtrl.WriteText( "\n\n" );
464
465 // Testing wxFFileInputStream
466
467 textCtrl.WriteText( "Reading 0 to 10 to buffered wxFFileInputStream:\n\n" );
468
469 wxFFileInputStream ffile_input2( wxString("test_wx.dat") );
470 wxBufferedInputStream buf_input( ffile_input2 );
471 for (ch2 = 0; ch2 < 11; ch2++)
472 {
473 buf_input.Read( &ch, 1 );
474 textCtrl.WriteText( "Value read: " );
475 textCtrl.WriteText( (wxChar)(ch + '0') );
476 textCtrl.WriteText( "; stream.LastError() returns: " );
477 switch (buf_input.LastError())
478 {
479 case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break;
480 case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break;
481 case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break;
482 case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break;
483 default: textCtrl.WriteText( "Huh?\n" ); break;
484 }
485 }
486 textCtrl.WriteText( "\n" );
487
488 textCtrl.WriteText( "Seeking to 0; stream.LastError() returns: " );
489 buf_input.SeekI( 0 );
490 switch (buf_input.LastError())
491 {
492 case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break;
493 case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break;
494 case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break;
495 case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break;
496 default: textCtrl.WriteText( "Huh?\n" ); break;
497 }
498 textCtrl.WriteText( "\n" );
499
500 buf_input.Read( &ch, 1 );
501 textCtrl.WriteText( "Value read: " );
502 textCtrl.WriteText( (wxChar)(ch + '0') );
503 textCtrl.WriteText( "; stream.LastError() returns: " );
504 switch (buf_input.LastError())
505 {
506 case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break;
507 case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break;
508 case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break;
509 case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break;
510 default: textCtrl.WriteText( "Huh?\n" ); break;
511 }
512 }
513
514 void MyApp::DoStreamDemo4(wxCommandEvent& WXUNUSED(event))
515 {
516 wxTextCtrl& textCtrl = * GetTextCtrl();
517
518 wxString msg;
519
520 textCtrl.Clear();
521 textCtrl << "\nTesting wxStreamBuffer:\n\n";
522
523 // bigger than buffer
524 textCtrl.WriteText( "Writing 2000x 1 to wxFileOutputStream.\n\n" );
525
526 wxFileOutputStream file_output( wxString("test_wx.dat") );
527 for (int i = 0; i < 2000; i++)
528 {
529 char ch = 1;
530 file_output.Write( &ch, 1 );
531 }
532
533 textCtrl.WriteText( "Opening with a buffered wxFileInputStream:\n\n" );
534
535 wxFileInputStream file_input( wxString("test_wx.dat") );
536 wxBufferedInputStream buf_input( file_input );
537
538 textCtrl.WriteText( "wxBufferedInputStream.LastError() returns: " );
539 switch (buf_input.LastError())
540 {
541 case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break;
542 case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break;
543 case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break;
544 case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break;
545 default: textCtrl.WriteText( "Huh?\n" ); break;
546 }
547 msg.Printf( wxT("wxBufferedInputStream.LastRead() returns: %d\n"), (int)buf_input.LastRead() );
548 textCtrl.WriteText( msg );
549 msg.Printf( wxT("wxBufferedInputStream.TellI() returns: %d\n"), (int)buf_input.TellI() );
550 textCtrl.WriteText( msg );
551 textCtrl.WriteText( "\n\n" );
552
553
554 textCtrl.WriteText( "Seeking to position 300:\n\n" );
555
556 buf_input.SeekI( 300 );
557
558 textCtrl.WriteText( "wxBufferedInputStream.LastError() returns: " );
559 switch (buf_input.LastError())
560 {
561 case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break;
562 case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break;
563 case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break;
564 case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break;
565 default: textCtrl.WriteText( "Huh?\n" ); break;
566 }
567 msg.Printf( wxT("wxBufferedInputStream.LastRead() returns: %d\n"), (int)buf_input.LastRead() );
568 textCtrl.WriteText( msg );
569 msg.Printf( wxT("wxBufferedInputStream.TellI() returns: %d\n"), (int)buf_input.TellI() );
570 textCtrl.WriteText( msg );
571 textCtrl.WriteText( "\n\n" );
572
573
574 char buf[2000];
575
576 textCtrl.WriteText( "Reading 500 bytes:\n\n" );
577
578 buf_input.Read( buf, 500 );
579
580 textCtrl.WriteText( "wxBufferedInputStream.LastError() returns: " );
581 switch (buf_input.LastError())
582 {
583 case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break;
584 case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break;
585 case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break;
586 case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break;
587 default: textCtrl.WriteText( "Huh?\n" ); break;
588 }
589 msg.Printf( wxT("wxBufferedInputStream.LastRead() returns: %d\n"), (int)buf_input.LastRead() );
590 textCtrl.WriteText( msg );
591 msg.Printf( wxT("wxBufferedInputStream.TellI() returns: %d\n"), (int)buf_input.TellI() );
592 textCtrl.WriteText( msg );
593 textCtrl.WriteText( "\n\n" );
594
595 textCtrl.WriteText( "Reading another 500 bytes:\n\n" );
596
597 buf_input.Read( buf, 500 );
598
599 textCtrl.WriteText( "wxBufferedInputStream.LastError() returns: " );
600 switch (buf_input.LastError())
601 {
602 case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break;
603 case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break;
604 case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break;
605 case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break;
606 default: textCtrl.WriteText( "Huh?\n" ); break;
607 }
608 msg.Printf( wxT("wxBufferedInputStream.LastRead() returns: %d\n"), (int)buf_input.LastRead() );
609 textCtrl.WriteText( msg );
610 msg.Printf( wxT("wxBufferedInputStream.TellI() returns: %d\n"), (int)buf_input.TellI() );
611 textCtrl.WriteText( msg );
612 textCtrl.WriteText( "\n\n" );
613
614 textCtrl.WriteText( "Reading another 500 bytes:\n\n" );
615
616 buf_input.Read( buf, 500 );
617
618 textCtrl.WriteText( "wxBufferedInputStream.LastError() returns: " );
619 switch (buf_input.LastError())
620 {
621 case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break;
622 case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break;
623 case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break;
624 case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break;
625 default: textCtrl.WriteText( "Huh?\n" ); break;
626 }
627 msg.Printf( wxT("wxBufferedInputStream.LastRead() returns: %d\n"), (int)buf_input.LastRead() );
628 textCtrl.WriteText( msg );
629 msg.Printf( wxT("wxBufferedInputStream.TellI() returns: %d\n"), (int)buf_input.TellI() );
630 textCtrl.WriteText( msg );
631 textCtrl.WriteText( "\n\n" );
632
633 textCtrl.WriteText( "Reading another 500 bytes:\n\n" );
634
635 buf_input.Read( buf, 500 );
636
637 textCtrl.WriteText( "wxBufferedInputStream.LastError() returns: " );
638 switch (buf_input.LastError())
639 {
640 case wxSTREAM_NOERROR: textCtrl.WriteText( "wxSTREAM_NOERROR\n" ); break;
641 case wxSTREAM_EOF: textCtrl.WriteText( "wxSTREAM_EOF\n" ); break;
642 case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break;
643 case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break;
644 default: textCtrl.WriteText( "Huh?\n" ); break;
645 }
646 msg.Printf( wxT("wxBufferedInputStream.LastRead() returns: %d\n"), (int)buf_input.LastRead() );
647 textCtrl.WriteText( msg );
648 msg.Printf( wxT("wxBufferedInputStream.TellI() returns: %d\n"), (int)buf_input.TellI() );
649 textCtrl.WriteText( msg );
650 textCtrl.WriteText( "\n\n" );
651 }
652
653 void MyApp::DoStreamDemo5(wxCommandEvent& WXUNUSED(event))
654 {
655 wxTextCtrl& textCtrl = * GetTextCtrl();
656
657 textCtrl.Clear();
658 textCtrl << "\nTesting wxFileInputStream's Peek():\n\n";
659
660 char ch;
661 wxString str;
662
663 textCtrl.WriteText( "Writing number 0 to 9 to wxFileOutputStream:\n\n" );
664
665 wxFileOutputStream file_output( wxString("test_wx.dat") );
666 for (ch = 0; ch < 10; ch++)
667 file_output.Write( &ch, 1 );
668
669 file_output.Sync();
670
671 wxFileInputStream file_input( wxString("test_wx.dat") );
672
673 ch = file_input.Peek();
674 str.Printf( wxT("First char peeked: %d\n"), (int) ch );
675 textCtrl.WriteText( str );
676
677 ch = file_input.GetC();
678 str.Printf( wxT("First char read: %d\n"), (int) ch );
679 textCtrl.WriteText( str );
680
681 ch = file_input.Peek();
682 str.Printf( wxT("Second char peeked: %d\n"), (int) ch );
683 textCtrl.WriteText( str );
684
685 ch = file_input.GetC();
686 str.Printf( wxT("Second char read: %d\n"), (int) ch );
687 textCtrl.WriteText( str );
688
689 ch = file_input.Peek();
690 str.Printf( wxT("Third char peeked: %d\n"), (int) ch );
691 textCtrl.WriteText( str );
692
693 ch = file_input.GetC();
694 str.Printf( wxT("Third char read: %d\n"), (int) ch );
695 textCtrl.WriteText( str );
696
697
698 textCtrl << "\n\n\nTesting wxMemoryInputStream's Peek():\n\n";
699
700 char buf[] = { 0,1,2,3,4,5,6,7,8,9,10 };
701 wxMemoryInputStream input( buf, 10 );
702
703 ch = input.Peek();
704 str.Printf( wxT("First char peeked: %d\n"), (int) ch );
705 textCtrl.WriteText( str );
706
707 ch = input.GetC();
708 str.Printf( wxT("First char read: %d\n"), (int) ch );
709 textCtrl.WriteText( str );
710
711 ch = input.Peek();
712 str.Printf( wxT("Second char peeked: %d\n"), (int) ch );
713 textCtrl.WriteText( str );
714
715 ch = input.GetC();
716 str.Printf( wxT("Second char read: %d\n"), (int) ch );
717 textCtrl.WriteText( str );
718
719 ch = input.Peek();
720 str.Printf( wxT("Third char peeked: %d\n"), (int) ch );
721 textCtrl.WriteText( str );
722
723 ch = input.GetC();
724 str.Printf( wxT("Third char read: %d\n"), (int) ch );
725 textCtrl.WriteText( str );
726 }
727
728 #if wxUSE_UNICODE
729 void MyApp::DoUnicodeDemo(wxCommandEvent& WXUNUSED(event))
730 {
731 wxTextCtrl& textCtrl = * GetTextCtrl();
732
733 textCtrl.Clear();
734 textCtrl << "\nTest wchar_t to char (Unicode to ANSI/Multibyte) converions:";
735
736 wxString str;
737 str = _T("Robert Röbling\n");
738
739 printf( "\n\nConversion with wxConvLocal:\n" );
740 wxConvCurrent = &wxConvLocal;
741 printf( (const char*) str.mbc_str() );
742 #if defined(__WXGTK__)
743 printf( "\n\nConversion with wxConvGdk:\n" );
744 wxConvCurrent = &wxConvGdk;
745 printf( (const char*) str.mbc_str() );
746 #endif
747 printf( "\n\nConversion with wxConvLibc:\n" );
748 wxConvCurrent = &wxConvLibc;
749 printf( (const char*) str.mbc_str() );
750
751 }
752 #endif
753
754 void MyApp::DoMIMEDemo(wxCommandEvent& WXUNUSED(event))
755 {
756 static wxString s_defaultExt = "xyz";
757
758 wxString ext = wxGetTextFromUser("Enter a file extension: ",
759 "MIME database test",
760 s_defaultExt);
761 if ( !!ext )
762 {
763 s_defaultExt = ext;
764
765 // init MIME database if not done yet
766 if ( !m_mimeDatabase )
767 {
768 m_mimeDatabase = new wxMimeTypesManager;
769
770 static const wxFileTypeInfo fallbacks[] =
771 {
772 wxFileTypeInfo("application/xyz",
773 "XyZ %s",
774 "XyZ -p %s",
775 "The one and only XYZ format file",
776 "xyz", "123", NULL),
777 wxFileTypeInfo("text/html",
778 "lynx %s",
779 "lynx -dump %s | lpr",
780 "HTML document (from fallback)",
781 "htm", "html", NULL),
782
783 // must terminate the table with this!
784 wxFileTypeInfo()
785 };
786
787 m_mimeDatabase->AddFallbacks(fallbacks);
788 }
789
790 wxTextCtrl& textCtrl = * GetTextCtrl();
791
792 wxFileType *filetype = m_mimeDatabase->GetFileTypeFromExtension(ext);
793 if ( !filetype )
794 {
795 textCtrl << "Unknown extension '" << ext << "'\n";
796 }
797 else
798 {
799 wxString type, desc, open;
800 filetype->GetMimeType(&type);
801 filetype->GetDescription(&desc);
802
803 wxString filename = "filename";
804 filename << "." << ext;
805 wxFileType::MessageParameters params(filename, type);
806 filetype->GetOpenCommand(&open, params);
807
808 textCtrl << "MIME information about extension '" << ext << "'\n"
809 << "\tMIME type: " << ( !type ? wxT("unknown")
810 : type.c_str() ) << '\n'
811 << "\tDescription: " << ( !desc ? wxT("") : desc.c_str() )
812 << '\n'
813 << "\tCommand to open: " << ( !open ? wxT("no") : open.c_str() )
814 << '\n';
815
816 delete filetype;
817 }
818 }
819 //else: cancelled by user
820 }
821
822 void MyApp::DoByteOrderDemo(wxCommandEvent& WXUNUSED(event))
823 {
824 wxTextCtrl& textCtrl = * GetTextCtrl();
825
826 textCtrl.Clear();
827 textCtrl << "\nTest byte order macros:\n\n";
828
829 if (wxBYTE_ORDER == wxLITTLE_ENDIAN)
830 textCtrl << "This is a little endian system.\n\n";
831 else
832 textCtrl << "This is a big endian system.\n\n";
833
834 wxString text;
835
836 wxInt32 var = 0xF1F2F3F4;
837 text = "";
838 text.Printf( _T("Value of wxInt32 is now: %#x.\n\n"), var );
839 textCtrl.WriteText( text );
840
841 text = "";
842 text.Printf( _T("Value of swapped wxInt32 is: %#x.\n\n"), wxINT32_SWAP_ALWAYS( var ) );
843 textCtrl.WriteText( text );
844
845 text = "";
846 text.Printf( _T("Value of wxInt32 swapped on little endian is: %#x.\n\n"), wxINT32_SWAP_ON_LE( var ) );
847 textCtrl.WriteText( text );
848
849 text = "";
850 text.Printf( _T("Value of wxInt32 swapped on big endian is: %#x.\n\n"), wxINT32_SWAP_ON_BE( var ) );
851 textCtrl.WriteText( text );
852 }
853
854 #if wxUSE_TIMEDATE
855
856 void MyApp::DoTimeDemo(wxCommandEvent& WXUNUSED(event))
857 {
858 wxTextCtrl& textCtrl = * GetTextCtrl();
859
860 textCtrl.Clear();
861 textCtrl << "\nTest class wxTime:\n";
862 wxTime now;
863 textCtrl << "It is now " << (wxString) now << "\n";
864 }
865
866 void MyApp::DoDateDemo(wxCommandEvent& WXUNUSED(event))
867 {
868 wxTextCtrl& textCtrl = * GetTextCtrl();
869
870 textCtrl.Clear();
871 textCtrl << "\nTest class wxDate" << "\n";
872
873 // Various versions of the constructors
874 // and various output
875
876 wxDate x(10,20,1962);
877
878 textCtrl << x.FormatDate(wxFULL) << " (full)\n";
879
880 // constuctor with a string, just printing the day of the week
881 wxDate y("8/8/1988");
882
883 textCtrl << y.FormatDate(wxDAY) << " (just day)\n";
884
885 // constructor with a julian
886 wxDate z( 2450000L );
887 textCtrl << z.FormatDate(wxFULL) << " (full)\n";
888
889 // using date addition and subtraction
890 wxDate a = x + 10;
891 textCtrl << a.FormatDate(wxFULL) << " (full)\n";
892 a = a - 25;
893 textCtrl << a.FormatDate(wxEUROPEAN) << " (European)\n";
894
895 // Using subtraction of two date objects
896 wxDate a1 = wxString("7/13/1991");
897 wxDate a2 = a1 + 14;
898 textCtrl << (a1-a2) << "\n";
899 textCtrl << (a2+=10) << "\n";
900
901 a1++;
902 textCtrl << "Tomorrow= " << a1.FormatDate(wxFULL) << "\n";
903
904 wxDate tmpDate1("08/01/1991");
905 wxDate tmpDate2("07/14/1991");
906 textCtrl << "a1 (7-14-91) < 8-01-91 ? ==> " << ((a1 < tmpDate1) ? "TRUE" : "FALSE") << "\n";
907 textCtrl << "a1 (7-14-91) > 8-01-91 ? ==> " << ((a1 > tmpDate1) ? "TRUE" : "FALSE") << "\n";
908 textCtrl << "a1 (7-14-91)== 7-14-91 ? ==> " << ((a1==tmpDate2) ? "TRUE" : "FALSE") << "\n";
909
910 wxDate a3 = a1;
911 textCtrl << "a1 (7-14-91)== a3 (7-14-91) ? ==> " << ((a1==a3) ? "TRUE" : "FALSE") << "\n";
912 wxDate a4 = a1;
913 textCtrl << "a1 (7-14-91)== a4 (7-15-91) ? ==> " << ((a1==++a4) ? "TRUE" : "FALSE") << "\n";
914
915 wxDate a5 = wxString("today");
916 textCtrl << "Today is: " << a5 << "\n";
917 a4 = "TODAY";
918 textCtrl << "Today (a4) is: " << a4 << "\n";
919
920 textCtrl << "Today + 4 is: " << (a4+=4) << "\n";
921 a4 = "TODAY";
922 textCtrl << "Today - 4 is: " << (a4-=4) << "\n";
923
924 textCtrl << "=========== Leap Year Test ===========\n";
925 a1 = "1/15/1992";
926 textCtrl << a1.FormatDate(wxFULL) << " " << ((a1.IsLeapYear()) ? "Leap" : "non-Leap");
927 textCtrl << " " << "day of year: " << a1.GetDayOfYear() << "\n";
928
929 a1 = "2/16/1993";
930 textCtrl << a1.FormatDate(wxFULL) << " " << ((a1.IsLeapYear()) ? "Leap" : "non-Leap");
931 textCtrl << " " << "day of year: " << a1.GetDayOfYear() << "\n";
932
933 textCtrl << "================== string assignment test ====================\n";
934 wxString date_string=a1;
935 textCtrl << "a1 as a string (s/b 2/16/1993) ==> " << date_string << "\n";
936
937 textCtrl << "================== SetFormat test ============================\n";
938 a1.SetFormat(wxFULL);
939 textCtrl << "a1 (s/b FULL format) ==> " << a1 << "\n";
940 a1.SetFormat(wxEUROPEAN);
941 textCtrl << "a1 (s/b EUROPEAN format) ==> " << a1 << "\n";
942
943 textCtrl << "================== SetOption test ============================\n";
944 textCtrl << "Date abbreviation ON\n";
945
946 a1.SetOption(wxDATE_ABBR);
947 a1.SetFormat(wxMONTH);
948 textCtrl << "a1 (s/b MONTH format) ==> " << a1 << "\n";
949 a1.SetFormat(wxDAY);
950 textCtrl << "a1 (s/b DAY format) ==> " << a1 << "\n";
951 a1.SetFormat(wxFULL);
952 textCtrl << "a1 (s/b FULL format) ==> " << a1 << "\n";
953 a1.SetFormat(wxEUROPEAN);
954 textCtrl << "a1 (s/b EUROPEAN format) ==> " << a1 << "\n";
955 textCtrl << "Century suppression ON\n";
956 a1.SetOption(wxNO_CENTURY);
957 a1.SetFormat(wxMDY);
958 textCtrl << "a1 (s/b MDY format) ==> " << a1 << "\n";
959 textCtrl << "Century suppression OFF\n";
960 a1.SetOption(wxNO_CENTURY,FALSE);
961 textCtrl << "a1 (s/b MDY format) ==> " << a1 << "\n";
962 textCtrl << "Century suppression ON\n";
963 a1.SetOption(wxNO_CENTURY);
964 textCtrl << "a1 (s/b MDY format) ==> " << a1 << "\n";
965 a1.SetFormat(wxFULL);
966 textCtrl << "a1 (s/b FULL format) ==> " << a1 << "\n";
967
968 textCtrl << "\n=============== Version 4.0 Enhancement Test =================\n";
969
970 wxDate v4("11/26/1966");
971 textCtrl << "\n---------- Set Stuff -----------\n";
972 textCtrl << "First, 'Set' to today..." << "\n";
973 textCtrl << "Before 'Set' => " << v4 << "\n";
974 textCtrl << "After 'Set' => " << v4.Set() << "\n\n";
975
976 textCtrl << "Set to 11/26/66 => " << v4.Set(11,26,1966) << "\n";
977 textCtrl << "Current Julian => " << v4.GetJulianDate() << "\n";
978 textCtrl << "Set to Julian 2450000L => " << v4.Set(2450000L) << "\n";
979 textCtrl << "See! => " << v4.GetJulianDate() << "\n";
980
981 textCtrl << "---------- Add Stuff -----------\n";
982 textCtrl << "Start => " << v4 << "\n";
983 textCtrl << "Add 4 Weeks => " << v4.AddWeeks(4) << "\n";
984 textCtrl << "Sub 1 Month => " << v4.AddMonths(-1) << "\n";
985 textCtrl << "Add 2 Years => " << v4.AddYears(2) << "\n";
986
987 textCtrl << "---------- Misc Stuff -----------\n";
988 textCtrl << "The date aboves' day of the month is => " << v4.GetDay() << "\n";
989 textCtrl << "There are " << v4.GetDaysInMonth() << " days in this month.\n";
990 textCtrl << "The first day of this month lands on " << v4.GetFirstDayOfMonth() << "\n";
991 textCtrl << "This day happens to be " << v4.GetDayOfWeekName() << "\n";
992 textCtrl << "the " << v4.GetDayOfWeek() << " day of the week," << "\n";
993 textCtrl << "on the " << v4.GetWeekOfYear() << " week of the year," << "\n";
994 textCtrl << "on the " << v4.GetWeekOfMonth() << " week of the month, " << "\n";
995 textCtrl << "(which is " << v4.GetMonthName() << ")\n";
996 textCtrl << "the "<< v4.GetMonth() << "th month in the year.\n";
997 textCtrl << "The year alone is " << v4.GetYear() << "\n";
998
999 textCtrl << "---------- First and Last Stuff -----------\n";
1000 v4.Set();
1001 textCtrl << "The first date of this month is " << v4.GetMonthStart() << "\n";
1002 textCtrl << "The last date of this month is " << v4.GetMonthEnd() << "\n";
1003 textCtrl << "The first date of this year is " << v4.GetYearStart() << "\n";
1004 textCtrl << "The last date of this year is " << v4.GetYearEnd() << "\n";
1005 }
1006
1007 #endif // wxUSE_TIMEDATE
1008
1009 void MyApp::DoVariantDemo(wxCommandEvent& WXUNUSED(event) )
1010 {
1011 wxTextCtrl& textCtrl = * GetTextCtrl();
1012
1013 wxVariant var1 = "String value";
1014 textCtrl << "var1 = " << var1.MakeString() << "\n";
1015
1016 // Conversion
1017 wxString str = var1.MakeString();
1018
1019 var1 = 123.456;
1020 textCtrl << "var1 = " << var1.GetReal() << "\n";
1021
1022 // Implicit conversion
1023 double v = var1;
1024
1025 var1 = 9876L;
1026 textCtrl << "var1 = " << var1.GetLong() << "\n";
1027
1028 // Implicit conversion
1029 long l = var1;
1030
1031 // suppress compile warnings about unused variables
1032 if ( l < v )
1033 {
1034 ;
1035 }
1036
1037 wxStringList stringList;
1038 stringList.Add(_T("one")); stringList.Add(_T("two")); stringList.Add(_T("three"));
1039 var1 = stringList;
1040 textCtrl << "var1 = " << var1.MakeString() << "\n";
1041
1042 var1.ClearList();
1043 var1.Append(wxVariant(1.2345));
1044 var1.Append(wxVariant("hello"));
1045 var1.Append(wxVariant(54321L));
1046
1047 textCtrl << "var1 = " << var1.MakeString() << "\n";
1048
1049 size_t n = var1.GetCount();
1050 size_t i;
1051 for (i = (size_t) 0; i < n; i++)
1052 {
1053 textCtrl << "var1[" << (int) i << "] (type " << var1[i].GetType() << ") = " << var1[i].MakeString() << "\n";
1054 }
1055 }
1056
1057 BEGIN_EVENT_TABLE(MyFrame, wxFrame)
1058 EVT_MENU(TYPES_QUIT, MyFrame::OnQuit)
1059 EVT_MENU(TYPES_ABOUT, MyFrame::OnAbout)
1060 END_EVENT_TABLE()
1061
1062 // My frame constructor
1063 MyFrame::MyFrame(wxFrame *parent, const wxString& title,
1064 const wxPoint& pos, const wxSize& size):
1065 wxFrame(parent, -1, title, pos, size)
1066 {}
1067
1068 void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) )
1069 {
1070 Close(TRUE);
1071 }
1072
1073 void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
1074 {
1075 wxMessageDialog dialog(this, "Tests various wxWindows types",
1076 "About Types", wxYES_NO|wxCANCEL);
1077
1078 dialog.ShowModal();
1079 }
1080
1081