+#define _WX_DEFINE_SORTED_ARRAY(T, name) \
+typedef int (CMPFUNC_CONV *SCMPFUNC##T)(T pItem1, T pItem2); \
+class WXDLLEXPORTLOCAL name : public wxBaseArray \
+{ \
+public: \
+ name(SCMPFUNC##T fn) \
+ { wxASSERT( sizeof(T) <= sizeof(long) ); m_fnCompare = fn; } \
+ \
+ name& operator=(const name& src) \
+ { wxBaseArray* temp = (wxBaseArray*) this; \
+ (*temp) = ((const wxBaseArray&)src); \
+ m_fnCompare = src.m_fnCompare; \
+ return *this; } \
+ \
+ T& operator[](size_t uiIndex) const \
+ { return (T&)(wxBaseArray::Item(uiIndex)); } \
+ T& Item(size_t uiIndex) const \
+ { return (T&)(wxBaseArray::Item(uiIndex)); } \
+ T& Last() const \
+ { return (T&)(wxBaseArray::Item(Count() - 1)); } \
+ \
+ int Index(T Item) const \
+ { return wxBaseArray::Index((long)Item, (CMPFUNC)m_fnCompare); }\
+ \
+ void Add(T Item) \
+ { wxBaseArray::Add((long)Item, (CMPFUNC)m_fnCompare); } \
+ \
+ void Remove(size_t uiIndex) { wxBaseArray::Remove(uiIndex); } \
+ void Remove(T Item) \
+ { int iIndex = Index(Item); \
+ wxCHECK2_MSG( iIndex != wxNOT_FOUND, return, \
+ _T("removing inexisting element in wxArray::Remove") ); \
+ wxBaseArray::Remove((size_t)iIndex); } \
+ \
+private: \
+ SCMPFUNC##T m_fnCompare; \
+}
+
+// ----------------------------------------------------------------------------
+// see WX_DECLARE_OBJARRAY and WX_DEFINE_OBJARRAY
+// ----------------------------------------------------------------------------
+#define _WX_DECLARE_OBJARRAY(T, name) \