]> git.saurik.com Git - wxWidgets.git/blob - samples/widgets/itemcontainer.h
cleanup
[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 #include "widgets.h"
14
15 // define a common base class for sorted and normal string arrays
16 #if wxUSE_STL
17 typedef wxBaseArrayStringBase wxMaybeSortedArrayString;
18 #else
19 // in non-STL build wxSortedArrayString derives from wxArrayString
20 typedef wxArrayString wxMaybeSortedArrayString;
21 #endif
22
23 class ItemContainerWidgetsPage : public WidgetsPage
24 {
25 public:
26 ItemContainerWidgetsPage(WidgetsBookCtrl *book,
27 wxImageList *image_list,
28 char* icon[]);
29 virtual ~ItemContainerWidgetsPage();
30
31 void OnButtonTestItemContainer(wxCommandEvent& event);
32
33 virtual wxItemContainer* GetContainer() const = 0;
34
35 private:
36 void StartTest(const wxString& label);
37 void EndTest(const wxMaybeSortedArrayString& result);
38
39 // Track client data in wxItemContainer instances
40 wxClientData* CreateClientData(int value);
41 void StartTrackingData();
42 void StopTrackingData();
43 friend class TrackedClientData;
44
45 bool VerifyAllClientDataDestroyed();
46 bool VerifyClientData(wxUIntPtr i, const wxString& str);
47
48 wxString DumpContainerData(const wxMaybeSortedArrayString& expected) const;
49
50 wxArrayString m_items;
51 wxSortedArrayString m_itemsSorted;
52 int m_trackedDataObjects;
53
54 // holds pointer to the widget being tested
55 wxItemContainer *m_container;
56 };
57
58 #endif // _WX_SAMPLE_WIDGETS_ITEMCONTAINER_H_