]> git.saurik.com Git - wxWidgets.git/blob - samples/widgets/itemcontainer.h
Make storing non-trivial data in wxThreadSpecificInfo possible.
[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 // License: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9 #ifndef _WX_SAMPLE_WIDGETS_ITEMCONTAINER_H_
10 #define _WX_SAMPLE_WIDGETS_ITEMCONTAINER_H_
11
12 #include "widgets.h"
13
14 class ItemContainerWidgetsPage : public WidgetsPage
15 {
16 public:
17 ItemContainerWidgetsPage(WidgetsBookCtrl *book,
18 wxImageList *image_list,
19 const char *const icon[]);
20 virtual ~ItemContainerWidgetsPage();
21
22 void OnButtonTestItemContainer(wxCommandEvent& event);
23
24 virtual wxItemContainer* GetContainer() const = 0;
25
26 private:
27 void StartTest(const wxString& label);
28 void EndTest(const wxArrayString& result);
29
30 // Track client data in wxItemContainer instances
31 wxClientData* CreateClientData(int value);
32 void StartTrackingData();
33 void StopTrackingData();
34 friend class TrackedClientData;
35
36 bool VerifyAllClientDataDestroyed();
37 bool VerifyClientData(wxUIntPtr i, const wxString& str);
38
39 wxString DumpContainerData(const wxArrayString& expected) const;
40
41 static wxArrayString MakeArray(const wxSortedArrayString& sorted);
42
43 wxArrayString m_items;
44 wxSortedArrayString m_itemsSorted;
45 int m_trackedDataObjects;
46
47 // holds pointer to the widget being tested
48 wxItemContainer *m_container;
49 };
50
51 #endif // _WX_SAMPLE_WIDGETS_ITEMCONTAINER_H_