]> git.saurik.com Git - wxWidgets.git/blob - contrib/samples/gizmos/editlbox/test.cpp
wxX11:
[wxWidgets.git] / contrib / samples / gizmos / editlbox / test.cpp
1 // For compilers that support precompilation, includes "wx/wx.h".
2 #include "wx/wxprec.h"
3
4 #ifdef __BORLANDC__
5 #pragma hdrstop
6 #endif
7
8 // for all others, include the necessary headers (this file is usually all you
9 // need because it includes almost all "standard" wxWindows headers)
10 #ifndef WX_PRECOMP
11 #include "wx/wx.h"
12 #endif
13
14 #include "wx/gizmos/editlbox.h"
15 #include "wx/sizer.h"
16
17 class MyApp : public wxApp
18 {
19 public:
20 virtual bool OnInit();
21 };
22
23 IMPLEMENT_APP(MyApp)
24
25
26 bool MyApp::OnInit()
27 {
28 wxDialog dlg(NULL, -1, _("Test dialog"), wxDefaultPosition, wxDefaultSize,
29 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
30
31 wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
32 sizer->Add(new wxEditableListBox(&dlg, -1, _("Match these wildcards:"),
33 wxDefaultPosition,wxSize(300,200)),
34 1, wxEXPAND|wxALL, 10);
35
36 sizer->Add(5,5);
37
38 wxEditableListBox *lb = new wxEditableListBox(&dlg, -1, _("Except:"),
39 wxDefaultPosition,wxSize(300,200));
40 wxArrayString ar;
41 ar.Add(_T("*.cpp"));
42 ar.Add(_T("*.h"));
43 ar.Add(_T("*.c"));
44 lb->SetStrings(ar);
45
46 sizer->Add(lb, 1, wxEXPAND|wxALL, 10);
47
48 sizer->Add(5,5);
49
50 sizer->Add(new wxButton(&dlg, wxID_OK, _("OK")), 0, wxALIGN_RIGHT | wxALL, 10);
51 dlg.SetAutoLayout(TRUE);
52 dlg.SetSizer(sizer);
53 sizer->Fit(&dlg);
54 dlg.Centre();
55
56 dlg.ShowModal();
57
58 wxString res = _("'Except' contains these strings:\n\n");
59 lb->GetStrings(ar);
60 for (size_t i = 0; i < ar.GetCount(); i++)
61 res << ar[i] << _T("\n");
62 wxMessageBox(res);
63
64 return FALSE;
65 }