STYLE: Nightly Version update
[cmake.git] / Tests / UseWX / WX.cxx
blob69717bb43cc134c445dfc1a6957daf6b61c78662
1 //For wx
2 #include <wx/app.h>
3 #include <wx/dir.h>
5 static void TestDirEnumHelper(wxDir& dir,
6 int flags = wxDIR_DEFAULT,
7 const wxString& filespec = wxEmptyString)
9 wxString filename;
11 if ( !dir.IsOpened() )
12 return;
14 bool cont = dir.GetFirst(&filename, filespec, flags);
15 while ( cont )
17 wxPrintf(_T("\t%s\n"), filename.c_str());
19 cont = dir.GetNext(&filename);
22 wxPuts(_T(""));
26 //----------------------------------------------------------------------------
27 // MyApp
28 //----------------------------------------------------------------------------
30 class MyApp: public wxApp
32 public:
33 MyApp();
35 bool OnInit();
36 int MainLoop();
40 IMPLEMENT_APP(MyApp)
42 MyApp::MyApp()
46 bool MyApp::OnInit()
48 //test a directory that exist:
49 wxDir dir(wxT(".")); //wxDir dir("/tmp");
50 TestDirEnumHelper(dir, wxDIR_DEFAULT | wxDIR_DOTDOT);
52 //Testing if link to wx debug library
53 #ifdef __WXDEBUG__
54 printf("If you read this you're in debug mode.\n");
55 #endif //__WXDEBUG__
57 wxChar ch = wxT('*');
58 wxString s = wxT("Hello, world!");
59 int len = s.Len();
60 printf("Length of string is: %d\n", len);
62 //Force testing of Unicode mode
63 #ifdef __UNICODE__
64 wprintf(L"Unicode: %s \n", s.c_str());
65 wprintf(:"Char: %c\n", ch);
66 #else
67 printf("ANSI: %s \n", s.c_str());
68 printf("Char: %c\n", ch);
69 #endif //__UNICODE__
71 //return immediately
72 return TRUE;
75 int MyApp::MainLoop()
77 return 0;