~ubuntu-branches/ubuntu/lucid/cmake/lucid

« back to all changes in this revision

Viewing changes to Tests/UseWX/WX.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Artur Rona
  • Date: 2009-12-16 11:11:54 UTC
  • mfrom: (3.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20091216111154-6accvv6yq86h2hkc
Tags: 2.8.0-5ubuntu1
* Merge from debian testing (LP: #497349). Remaining changes:
  - Keep the Replaces: on cmake-data to cover the Kubuntu version from
    Jaunty in case someone decides to do an (unsupported) Jaunty->Lucid
    upgrade.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//For wx
2
 
#include <wx/app.h>
3
 
#include <wx/dir.h>
4
 
 
5
 
static void TestDirEnumHelper(wxDir& dir,
6
 
                              int flags = wxDIR_DEFAULT,
7
 
                              const wxString& filespec = wxEmptyString)
8
 
{
9
 
    wxString filename;
10
 
 
11
 
    if ( !dir.IsOpened() )
12
 
        return;
13
 
 
14
 
    bool cont = dir.GetFirst(&filename, filespec, flags);
15
 
    while ( cont )
16
 
    {
17
 
        wxPrintf(_T("\t%s\n"), filename.c_str());
18
 
 
19
 
        cont = dir.GetNext(&filename);
20
 
    }
21
 
 
22
 
    wxPuts(_T(""));
23
 
}
24
 
 
25
 
 
26
 
//----------------------------------------------------------------------------
27
 
// MyApp
28
 
//----------------------------------------------------------------------------
29
 
 
30
 
class MyApp: public wxApp
31
 
{
32
 
public:
33
 
    MyApp();
34
 
    
35
 
    bool OnInit();
36
 
    int MainLoop();
37
 
};
38
 
 
39
 
 
40
 
IMPLEMENT_APP(MyApp)
41
 
 
42
 
MyApp::MyApp()
43
 
{
44
 
}
45
 
 
46
 
bool MyApp::OnInit()
47
 
{
48
 
    //test a directory that exist:
49
 
    wxDir dir(wxT("."));  //wxDir dir("/tmp");
50
 
    TestDirEnumHelper(dir, wxDIR_DEFAULT | wxDIR_DOTDOT);
51
 
 
52
 
    //Testing if link to wx debug library
53
 
#ifdef __WXDEBUG__
54
 
    printf("If you read this you're in __WXDEBUG__ debug mode.\n");
55
 
#endif  //__WXDEBUG__
56
 
 
57
 
#ifdef _DEBUG
58
 
    printf("If you read this then _DEBUG is defined.\n");
59
 
#endif  //_DEBUG
60
 
 
61
 
    wxChar ch = wxT('*');
62
 
    wxString s = wxT("Hello, world!");
63
 
    int len = s.Len();
64
 
    printf("Length of string is: %d\n", len);
65
 
 
66
 
    //Force testing of Unicode mode
67
 
#ifdef __UNICODE__
68
 
    wprintf(L"Unicode: %s \n", s.c_str());
69
 
    wprintf(:"Char: %c\n", ch);
70
 
#else
71
 
    printf("ANSI: %s \n", s.c_str());
72
 
    printf("Char: %c\n", ch);
73
 
#endif  //__UNICODE__
74
 
 
75
 
    //return immediately
76
 
    return TRUE;
77
 
}
78
 
 
79
 
int MyApp::MainLoop()
80
 
{
81
 
  return 0;
82
 
}