]>
git.saurik.com Git - wxWidgets.git/blob - samples/typetest/typetest.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Types wxWindows sample
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "typetest.h"
16 // For compilers that support precompilation, includes "wx/wx.h".
17 #include "wx/wxprec.h"
29 #include "wx/variant.h"
30 #include "wx/mimetype.h"
34 #if defined(__WXGTK__) || defined(__WXMOTIF__)
35 #include "mondrian.xpm"
38 #include "wx/ioswrap.h"
46 #include "wx/wfstream.h"
47 #include "wx/datstrm.h"
48 #include "wx/txtstrm.h"
50 // Create a new application object
53 IMPLEMENT_DYNAMIC_CLASS (MyApp
, wxApp
)
55 BEGIN_EVENT_TABLE(MyApp
, wxApp
)
56 EVT_MENU(TYPES_DATE
, MyApp::DoDateDemo
)
57 EVT_MENU(TYPES_TIME
, MyApp::DoTimeDemo
)
58 EVT_MENU(TYPES_VARIANT
, MyApp::DoVariantDemo
)
59 EVT_MENU(TYPES_BYTEORDER
, MyApp::DoByteOrderDemo
)
61 EVT_MENU(TYPES_UNICODE
, MyApp::DoUnicodeDemo
)
63 EVT_MENU(TYPES_STREAM2
, MyApp::DoStreamDemo2
)
64 EVT_MENU(TYPES_STREAM
, MyApp::DoStreamDemo
)
65 EVT_MENU(TYPES_MIME
, MyApp::DoMIMEDemo
)
70 // Create the main frame window
71 MyFrame
*frame
= new MyFrame((wxFrame
*) NULL
, "wxWindows Types Demo",
72 wxPoint(50, 50), wxSize(450, 340));
75 frame
->SetIcon(wxICON(mondrian
));
78 wxMenu
*file_menu
= new wxMenu
;
80 file_menu
->Append(TYPES_ABOUT
, "&About");
81 file_menu
->AppendSeparator();
82 file_menu
->Append(TYPES_QUIT
, "E&xit\tAlt-X");
84 wxMenu
*test_menu
= new wxMenu
;
85 test_menu
->Append(TYPES_DATE
, "&Date test");
86 test_menu
->Append(TYPES_TIME
, "&Time test");
87 test_menu
->Append(TYPES_VARIANT
, "&Variant test");
88 test_menu
->Append(TYPES_BYTEORDER
, "&Byteorder test");
90 test_menu
->Append(TYPES_UNICODE
, "&Unicode test");
92 test_menu
->Append(TYPES_STREAM
, "&Stream test");
93 test_menu
->Append(TYPES_STREAM2
, "&Stream seek test");
94 test_menu
->AppendSeparator();
95 test_menu
->Append(TYPES_MIME
, "&MIME database test");
97 wxMenuBar
*menu_bar
= new wxMenuBar
;
98 menu_bar
->Append(file_menu
, "&File");
99 menu_bar
->Append(test_menu
, "&Tests");
100 frame
->SetMenuBar(menu_bar
);
102 m_textCtrl
= new wxTextCtrl(frame
, -1, "", wxPoint(0, 0), wxDefaultSize
, wxTE_MULTILINE
);
112 void MyApp::DoStreamDemo(wxCommandEvent
& WXUNUSED(event
))
114 wxTextCtrl
& textCtrl
= * GetTextCtrl();
117 textCtrl
<< _T("\nTest fstream vs. wxFileStream:\n\n");
119 textCtrl
.WriteText( "Writing to ofstream and wxFileOutputStream:\n" );
121 ofstream
std_file_output( "test_std.dat" );
122 wxFileOutputStream
file_output( "test_wx.dat" );
123 wxBufferedOutputStream
buf_output( file_output
);
124 wxTextOutputStream
text_output( buf_output
);
127 signed int si
= 0xFFFFFFFF;
128 tmp
.Printf( _T("Signed int: %d\n"), si
);
129 textCtrl
.WriteText( tmp
);
130 text_output
<< si
<< "\n";
131 std_file_output
<< si
<< "\n";
133 unsigned int ui
= 0xFFFFFFFF;
134 tmp
.Printf( _T("Unsigned int: %u\n"), ui
);
135 textCtrl
.WriteText( tmp
);
136 text_output
<< ui
<< "\n";
137 std_file_output
<< ui
<< "\n";
139 double d
= 2.01234567890123456789;
140 tmp
.Printf( _T("Double: %f\n"), d
);
141 textCtrl
.WriteText( tmp
);
142 text_output
<< d
<< "\n";
143 std_file_output
<< d
<< "\n";
145 float f
= (float)0.00001;
146 tmp
.Printf( _T("Float: %f\n"), f
);
147 textCtrl
.WriteText( tmp
);
148 text_output
<< f
<< "\n";
149 std_file_output
<< f
<< "\n";
151 wxString
str( _T("Hello!") );
152 tmp
.Printf( _T("String: %s\n"), str
.c_str() );
153 textCtrl
.WriteText( tmp
);
154 text_output
<< str
<< "\n";
155 std_file_output
<< str
.c_str() << "\n";
157 textCtrl
.WriteText( "\nReading from ifstream:\n" );
159 ifstream
std_file_input( "test_std.dat" );
161 std_file_input
>> si
;
162 tmp
.Printf( _T("Signed int: %d\n"), si
);
163 textCtrl
.WriteText( tmp
);
165 std_file_input
>> ui
;
166 tmp
.Printf( _T("Unsigned int: %u\n"), ui
);
167 textCtrl
.WriteText( tmp
);
170 tmp
.Printf( _T("Double: %f\n"), d
);
171 textCtrl
.WriteText( tmp
);
174 tmp
.Printf( _T("Float: %f\n"), f
);
175 textCtrl
.WriteText( tmp
);
177 std_file_input
>> str
;
178 tmp
.Printf( _T("String: %s\n"), str
.c_str() );
179 textCtrl
.WriteText( tmp
);
181 textCtrl
.WriteText( "\nReading from wxFileInputStream:\n" );
185 wxFileInputStream
file_input( "test_wx.dat" );
186 wxBufferedInputStream
buf_input( file_input
);
187 wxTextInputStream
text_input( buf_input
);
190 tmp
.Printf( _T("Signed int: %d\n"), si
);
191 textCtrl
.WriteText( tmp
);
194 tmp
.Printf( _T("Unsigned int: %u\n"), ui
);
195 textCtrl
.WriteText( tmp
);
198 tmp
.Printf( _T("Double: %f\n"), d
);
199 textCtrl
.WriteText( tmp
);
202 tmp
.Printf( _T("Float: %f\n"), f
);
203 textCtrl
.WriteText( tmp
);
206 tmp
.Printf( _T("String: %s\n"), str
.c_str() );
207 textCtrl
.WriteText( tmp
);
210 textCtrl
<< "\nTest for wxDataStream:\n\n";
212 textCtrl
.WriteText( "Writing to wxDataOutputStream:\n" );
214 file_output
.SeekO( 0 );
215 wxDataOutputStream
data_output( buf_output
);
217 wxInt16 i16
= (short)0xFFFF;
218 tmp
.Printf( _T("Signed int16: %d\n"), (int)i16
);
219 textCtrl
.WriteText( tmp
);
220 data_output
.Write16( i16
);
222 wxUint16 ui16
= 0xFFFF;
223 tmp
.Printf( _T("Unsigned int16: %u\n"), (unsigned int) ui16
);
224 textCtrl
.WriteText( tmp
);
225 data_output
.Write16( ui16
);
227 d
= 2.01234567890123456789;
228 tmp
.Printf( _T("Double: %f\n"), d
);
229 textCtrl
.WriteText( tmp
);
230 data_output
.WriteDouble( d
);
233 tmp
.Printf( _T("String: %s\n"), str
.c_str() );
234 textCtrl
.WriteText( tmp
);
235 data_output
.WriteString( str
);
239 textCtrl
.WriteText( "\nReading from wxDataInputStream:\n" );
241 file_input
.SeekI( 0 );
242 wxDataInputStream
data_input( buf_input
);
244 i16
= data_input
.Read16();
245 tmp
.Printf( _T("Signed int16: %d\n"), (int)i16
);
246 textCtrl
.WriteText( tmp
);
248 ui16
= data_input
.Read16();
249 tmp
.Printf( _T("Unsigned int16: %u\n"), (unsigned int) ui16
);
250 textCtrl
.WriteText( tmp
);
252 d
= data_input
.ReadDouble();
253 tmp
.Printf( _T("Double: %f\n"), d
);
254 textCtrl
.WriteText( tmp
);
256 str
= data_input
.ReadString();
257 tmp
.Printf( _T("String: %s\n"), str
.c_str() );
258 textCtrl
.WriteText( tmp
);
261 void MyApp::DoStreamDemo2(wxCommandEvent
& WXUNUSED(event
))
263 wxTextCtrl
& textCtrl
= * GetTextCtrl();
266 textCtrl
<< _T("\nTest wxBufferedStream:\n\n");
270 textCtrl
.WriteText( "Writing number 0 to 9 to buffered wxFileOutputStream:\n\n" );
272 wxFileOutputStream
file_output( "test_wx.dat" );
273 wxBufferedOutputStream
buf_output( file_output
);
274 for (ch
= 0; ch
< 10; ch
++)
275 buf_output
.Write( &ch
, 1 );
278 wxFileInputStream
file_input( "test_wx.dat" );
279 for (ch2
= 0; ch2
< 10; ch2
++)
281 file_input
.Read( &ch
, 1 );
282 textCtrl
.WriteText( (char)(ch
+ '0') );
284 textCtrl
.WriteText( "\n\n\n" );
286 textCtrl
.WriteText( "Writing number 0 to 9 to buffered wxFileOutputStream, then\n" );
287 textCtrl
.WriteText( "seeking back to #3 and writing 3:\n\n" );
289 wxFileOutputStream
file_output2( "test_wx2.dat" );
290 wxBufferedOutputStream
buf_output2( file_output2
);
291 for (ch
= 0; ch
< 10; ch
++)
292 buf_output2
.Write( &ch
, 1 );
293 buf_output2
.SeekO( 3 );
295 buf_output2
.Write( &ch
, 1 );
298 wxFileInputStream
file_input2( "test_wx2.dat" );
299 for (ch2
= 0; ch2
< 10; ch2
++)
301 file_input2
.Read( &ch
, 1 );
302 textCtrl
.WriteText( (char)(ch
+ '0') );
304 textCtrl
.WriteText( "\n\n\n" );
306 // now append 2000 bytes to file (bigger than buffer)
307 buf_output2
.SeekO( 0, wxFromEnd
);
309 for (int i
= 0; i
< 2000; i
++)
310 buf_output2
.Write( &ch
, 1 );
313 textCtrl
.WriteText( "Reading number 0 to 9 from buffered wxFileInputStream, then\n" );
314 textCtrl
.WriteText( "seeking back to #3 and reading 3:\n\n" );
316 wxFileInputStream
file_input3( "test_wx2.dat" );
317 wxBufferedInputStream
buf_input3( file_input3
);
318 for (ch2
= 0; ch2
< 10; ch2
++)
320 buf_input3
.Read( &ch
, 1 );
321 textCtrl
.WriteText( (char)(ch
+ '0') );
323 for (int j
= 0; j
< 2000; j
++)
324 buf_input3
.Read( &ch
, 1 );
325 textCtrl
.WriteText( "\n" );
326 buf_input3
.SeekI( 3 );
327 buf_input3
.Read( &ch
, 1 );
328 textCtrl
.WriteText( (char)(ch
+ '0') );
329 textCtrl
.WriteText( "\n\n\n" );
334 void MyApp::DoUnicodeDemo(wxCommandEvent
& WXUNUSED(event
))
336 wxTextCtrl
& textCtrl
= * GetTextCtrl();
339 textCtrl
<< "\nTest wchar_t to char (Unicode to ANSI/Multibyte) converions:";
342 str
= _T("Robert Röbling\n");
344 printf( "\n\nConversion with wxConvLocal:\n" );
345 wxConvCurrent
= &wxConvLocal
;
346 printf( (const char*) str
.mbc_str() );
348 printf( "\n\nConversion with wxConvGdk:\n" );
349 wxConvCurrent
= &wxConvGdk
;
350 printf( (const char*) str
.mbc_str() );
352 printf( "\n\nConversion with wxConvLibc:\n" );
353 wxConvCurrent
= &wxConvLibc
;
354 printf( (const char*) str
.mbc_str() );
359 void MyApp::DoMIMEDemo(wxCommandEvent
& WXUNUSED(event
))
361 static wxString s_defaultExt
= "xyz";
363 wxString ext
= wxGetTextFromUser("Enter a file extension: ",
364 "MIME database test",
370 // init MIME database if not done yet
371 if ( !m_mimeDatabase
)
373 m_mimeDatabase
= new wxMimeTypesManager
;
375 static const wxFileTypeInfo fallbacks
[] =
377 wxFileTypeInfo("application/xyz",
380 "The one and only XYZ format file",
382 wxFileTypeInfo("text/html",
384 "lynx -dump %s | lpr",
385 "HTML document (from fallback)",
386 "htm", "html", NULL
),
388 // must terminate the table with this!
392 m_mimeDatabase
->AddFallbacks(fallbacks
);
395 wxTextCtrl
& textCtrl
= * GetTextCtrl();
397 wxFileType
*filetype
= m_mimeDatabase
->GetFileTypeFromExtension(ext
);
400 textCtrl
<< "Unknown extension '" << ext
<< "'\n";
404 wxString type
, desc
, open
;
405 filetype
->GetMimeType(&type
);
406 filetype
->GetDescription(&desc
);
408 wxString filename
= "filename";
409 filename
<< "." << ext
;
410 wxFileType::MessageParameters
params(filename
, type
);
411 filetype
->GetOpenCommand(&open
, params
);
413 textCtrl
<< "MIME information about extension '" << ext
<< "'\n"
414 << "\tMIME type: " << ( !type
? "unknown"
415 : type
.c_str() ) << '\n'
416 << "\tDescription: " << ( !desc
? "" : desc
.c_str() )
418 << "\tCommand to open: " << ( !open
? "no" : open
.c_str() )
424 //else: cancelled by user
427 void MyApp::DoByteOrderDemo(wxCommandEvent
& WXUNUSED(event
))
429 wxTextCtrl
& textCtrl
= * GetTextCtrl();
432 textCtrl
<< "\nTest byte order macros:\n\n";
434 if (wxBYTE_ORDER
== wxLITTLE_ENDIAN
)
435 textCtrl
<< "This is a little endian system.\n\n";
437 textCtrl
<< "This is a big endian system.\n\n";
441 wxInt32 var
= 0xF1F2F3F4;
443 text
.Printf( _T("Value of wxInt32 is now: %#x.\n\n"), var
);
444 textCtrl
.WriteText( text
);
447 text
.Printf( _T("Value of swapped wxInt32 is: %#x.\n\n"), wxINT32_SWAP_ALWAYS( var
) );
448 textCtrl
.WriteText( text
);
451 text
.Printf( _T("Value of wxInt32 swapped on little endian is: %#x.\n\n"), wxINT32_SWAP_ON_LE( var
) );
452 textCtrl
.WriteText( text
);
455 text
.Printf( _T("Value of wxInt32 swapped on big endian is: %#x.\n\n"), wxINT32_SWAP_ON_BE( var
) );
456 textCtrl
.WriteText( text
);
459 void MyApp::DoTimeDemo(wxCommandEvent
& WXUNUSED(event
))
461 wxTextCtrl
& textCtrl
= * GetTextCtrl();
464 textCtrl
<< "\nTest class wxTime:\n";
466 textCtrl
<< "It is now " << (wxString
) now
<< "\n";
469 void MyApp::DoDateDemo(wxCommandEvent
& WXUNUSED(event
))
471 wxTextCtrl
& textCtrl
= * GetTextCtrl();
474 textCtrl
<< "\nTest class wxDate" << "\n";
476 // Various versions of the constructors
477 // and various output
479 wxDate
x(10,20,1962);
481 textCtrl
<< x
.FormatDate(wxFULL
) << " (full)\n";
483 // constuctor with a string, just printing the day of the week
484 wxDate
y("8/8/1988");
486 textCtrl
<< y
.FormatDate(wxDAY
) << " (just day)\n";
488 // constructor with a julian
489 wxDate
z( 2450000L );
490 textCtrl
<< z
.FormatDate(wxFULL
) << " (full)\n";
492 // using date addition and subtraction
494 textCtrl
<< a
.FormatDate(wxFULL
) << " (full)\n";
496 textCtrl
<< a
.FormatDate(wxEUROPEAN
) << " (European)\n";
498 // Using subtraction of two date objects
499 wxDate a1
= wxString("7/13/1991");
501 textCtrl
<< (a1
-a2
) << "\n";
502 textCtrl
<< (a2
+=10) << "\n";
505 textCtrl
<< "Tomorrow= " << a1
.FormatDate(wxFULL
) << "\n";
507 wxDate
tmpDate1("08/01/1991");
508 wxDate
tmpDate2("07/14/1991");
509 textCtrl
<< "a1 (7-14-91) < 8-01-91 ? ==> " << ((a1
< tmpDate1
) ? "TRUE" : "FALSE") << "\n";
510 textCtrl
<< "a1 (7-14-91) > 8-01-91 ? ==> " << ((a1
> tmpDate1
) ? "TRUE" : "FALSE") << "\n";
511 textCtrl
<< "a1 (7-14-91)== 7-14-91 ? ==> " << ((a1
==tmpDate2
) ? "TRUE" : "FALSE") << "\n";
514 textCtrl
<< "a1 (7-14-91)== a3 (7-14-91) ? ==> " << ((a1
==a3
) ? "TRUE" : "FALSE") << "\n";
516 textCtrl
<< "a1 (7-14-91)== a4 (7-15-91) ? ==> " << ((a1
==++a4
) ? "TRUE" : "FALSE") << "\n";
518 wxDate a5
= wxString("today");
519 textCtrl
<< "Today is: " << a5
<< "\n";
521 textCtrl
<< "Today (a4) is: " << a4
<< "\n";
523 textCtrl
<< "Today + 4 is: " << (a4
+=4) << "\n";
525 textCtrl
<< "Today - 4 is: " << (a4
-=4) << "\n";
527 textCtrl
<< "=========== Leap Year Test ===========\n";
529 textCtrl
<< a1
.FormatDate(wxFULL
) << " " << ((a1
.IsLeapYear()) ? "Leap" : "non-Leap");
530 textCtrl
<< " " << "day of year: " << a1
.GetDayOfYear() << "\n";
533 textCtrl
<< a1
.FormatDate(wxFULL
) << " " << ((a1
.IsLeapYear()) ? "Leap" : "non-Leap");
534 textCtrl
<< " " << "day of year: " << a1
.GetDayOfYear() << "\n";
536 textCtrl
<< "================== string assignment test ====================\n";
537 wxString date_string
=a1
;
538 textCtrl
<< "a1 as a string (s/b 2/16/1993) ==> " << date_string
<< "\n";
540 textCtrl
<< "================== SetFormat test ============================\n";
541 a1
.SetFormat(wxFULL
);
542 textCtrl
<< "a1 (s/b FULL format) ==> " << a1
<< "\n";
543 a1
.SetFormat(wxEUROPEAN
);
544 textCtrl
<< "a1 (s/b EUROPEAN format) ==> " << a1
<< "\n";
546 textCtrl
<< "================== SetOption test ============================\n";
547 textCtrl
<< "Date abbreviation ON\n";
549 a1
.SetOption(wxDATE_ABBR
);
550 a1
.SetFormat(wxMONTH
);
551 textCtrl
<< "a1 (s/b MONTH format) ==> " << a1
<< "\n";
553 textCtrl
<< "a1 (s/b DAY format) ==> " << a1
<< "\n";
554 a1
.SetFormat(wxFULL
);
555 textCtrl
<< "a1 (s/b FULL format) ==> " << a1
<< "\n";
556 a1
.SetFormat(wxEUROPEAN
);
557 textCtrl
<< "a1 (s/b EUROPEAN format) ==> " << a1
<< "\n";
558 textCtrl
<< "Century suppression ON\n";
559 a1
.SetOption(wxNO_CENTURY
);
561 textCtrl
<< "a1 (s/b MDY format) ==> " << a1
<< "\n";
562 textCtrl
<< "Century suppression OFF\n";
563 a1
.SetOption(wxNO_CENTURY
,FALSE
);
564 textCtrl
<< "a1 (s/b MDY format) ==> " << a1
<< "\n";
565 textCtrl
<< "Century suppression ON\n";
566 a1
.SetOption(wxNO_CENTURY
);
567 textCtrl
<< "a1 (s/b MDY format) ==> " << a1
<< "\n";
568 a1
.SetFormat(wxFULL
);
569 textCtrl
<< "a1 (s/b FULL format) ==> " << a1
<< "\n";
571 textCtrl
<< "\n=============== Version 4.0 Enhancement Test =================\n";
573 wxDate
v4("11/26/1966");
574 textCtrl
<< "\n---------- Set Stuff -----------\n";
575 textCtrl
<< "First, 'Set' to today..." << "\n";
576 textCtrl
<< "Before 'Set' => " << v4
<< "\n";
577 textCtrl
<< "After 'Set' => " << v4
.Set() << "\n\n";
579 textCtrl
<< "Set to 11/26/66 => " << v4
.Set(11,26,1966) << "\n";
580 textCtrl
<< "Current Julian => " << v4
.GetJulianDate() << "\n";
581 textCtrl
<< "Set to Julian 2450000L => " << v4
.Set(2450000L) << "\n";
582 textCtrl
<< "See! => " << v4
.GetJulianDate() << "\n";
584 textCtrl
<< "---------- Add Stuff -----------\n";
585 textCtrl
<< "Start => " << v4
<< "\n";
586 textCtrl
<< "Add 4 Weeks => " << v4
.AddWeeks(4) << "\n";
587 textCtrl
<< "Sub 1 Month => " << v4
.AddMonths(-1) << "\n";
588 textCtrl
<< "Add 2 Years => " << v4
.AddYears(2) << "\n";
590 textCtrl
<< "---------- Misc Stuff -----------\n";
591 textCtrl
<< "The date aboves' day of the month is => " << v4
.GetDay() << "\n";
592 textCtrl
<< "There are " << v4
.GetDaysInMonth() << " days in this month.\n";
593 textCtrl
<< "The first day of this month lands on " << v4
.GetFirstDayOfMonth() << "\n";
594 textCtrl
<< "This day happens to be " << v4
.GetDayOfWeekName() << "\n";
595 textCtrl
<< "the " << v4
.GetDayOfWeek() << " day of the week," << "\n";
596 textCtrl
<< "on the " << v4
.GetWeekOfYear() << " week of the year," << "\n";
597 textCtrl
<< "on the " << v4
.GetWeekOfMonth() << " week of the month, " << "\n";
598 textCtrl
<< "(which is " << v4
.GetMonthName() << ")\n";
599 textCtrl
<< "the "<< v4
.GetMonth() << "th month in the year.\n";
600 textCtrl
<< "The year alone is " << v4
.GetYear() << "\n";
602 textCtrl
<< "---------- First and Last Stuff -----------\n";
604 textCtrl
<< "The first date of this month is " << v4
.GetMonthStart() << "\n";
605 textCtrl
<< "The last date of this month is " << v4
.GetMonthEnd() << "\n";
606 textCtrl
<< "The first date of this year is " << v4
.GetYearStart() << "\n";
607 textCtrl
<< "The last date of this year is " << v4
.GetYearEnd() << "\n";
610 void MyApp::DoVariantDemo(wxCommandEvent
& WXUNUSED(event
) )
612 wxTextCtrl
& textCtrl
= * GetTextCtrl();
614 wxVariant var1
= "String value";
615 textCtrl
<< "var1 = " << var1
.MakeString() << "\n";
618 wxString str
= var1
.MakeString();
621 textCtrl
<< "var1 = " << var1
.GetReal() << "\n";
623 // Implicit conversion
627 textCtrl
<< "var1 = " << var1
.GetLong() << "\n";
629 // Implicit conversion
632 // suppress compile warnings about unused variables
638 wxStringList stringList
;
639 stringList
.Add(_T("one")); stringList
.Add(_T("two")); stringList
.Add(_T("three"));
641 textCtrl
<< "var1 = " << var1
.MakeString() << "\n";
644 var1
.Append(wxVariant(1.2345));
645 var1
.Append(wxVariant("hello"));
646 var1
.Append(wxVariant(54321L));
648 textCtrl
<< "var1 = " << var1
.MakeString() << "\n";
650 size_t n
= var1
.GetCount();
652 for (i
= (size_t) 0; i
< n
; i
++)
654 textCtrl
<< "var1[" << (int) i
<< "] (type " << var1
[i
].GetType() << ") = " << var1
[i
].MakeString() << "\n";
658 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
659 EVT_MENU(TYPES_QUIT
, MyFrame::OnQuit
)
660 EVT_MENU(TYPES_ABOUT
, MyFrame::OnAbout
)
663 // My frame constructor
664 MyFrame::MyFrame(wxFrame
*parent
, const wxString
& title
,
665 const wxPoint
& pos
, const wxSize
& size
):
666 wxFrame(parent
, -1, title
, pos
, size
)
669 void MyFrame::OnQuit(wxCommandEvent
& WXUNUSED(event
) )
674 void MyFrame::OnAbout(wxCommandEvent
& WXUNUSED(event
) )
676 wxMessageDialog
dialog(this, "Tests various wxWindows types",
677 "About Types", wxYES_NO
|wxCANCEL
);