(ugly) compilation fix for wxUSE_STL==1 build
[wxWidgets.git] / samples / widgets / itemcontainer.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Program: wxWidgets Widgets Sample
3 // Name: itemcontainer.h
4 // Purpose: Part of the widgets sample showing wxComboBox
5 // Created: 20.07.07
6 // Id: $Id$
7 // License: wxWindows license
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_SAMPLE_WIDGETS_ITEMCONTAINER_H_
11 #define _WX_SAMPLE_WIDGETS_ITEMCONTAINER_H_
12
13 // for compilers that support precompilation, includes "wx/wx.h".
14 #include "wx/wxprec.h"
15
16 #include "widgets.h"
17
18 // define a common base class for sorted and normal string arrays
19 #if wxUSE_STL
20 typedef wxBaseArrayStringBase wxMaybeSortedArrayString;
21 #else
22 // in non-STL build wxSortedArrayString derives from wxArrayString
23 typedef wxArrayString wxMaybeSortedArrayString;
24 #endif
25
26 class ItemContainerWidgetsPage : public WidgetsPage
27 {
28 public:
29 ItemContainerWidgetsPage(WidgetsBookCtrl *book,
30 wxImageList *image_list,
31 char* icon[]);
32 virtual ~ItemContainerWidgetsPage();
33
34 void OnButtonTestItemContainer(wxCommandEvent& event);
35
36 virtual wxItemContainer* GetContainer() const = 0;
37
38 private:
39 void StartTest(const wxString& label);
40 void EndTest(const wxMaybeSortedArrayString& result);
41
42 // Track client data in wxItemContainer instances
43 wxClientData* CreateClientData(int value);
44 void StartTrackingData();
45 void StopTrackingData();
46 friend class TrackedClientData;
47
48 bool VerifyAllClientDataDestroyed();
49 bool VerifyClientData(wxUIntPtr i, const wxString& str);
50
51 wxString DumpContainerData(const wxMaybeSortedArrayString& expected) const;
52
53 wxArrayString m_items;
54 wxSortedArrayString m_itemsSorted;
55 int m_trackedDataObjects;
56
57 // holds pointer to the widget being tested
58 wxItemContainer *m_container;
59 };
60
61 #endif // _WX_SAMPLE_WIDGETS_ITEMCONTAINER_H_