]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/list.h
Allow wxStaticText to have a custom fg without a custom bg
[wxWidgets.git] / include / wx / list.h
index 62d6c44aa0eb913ad2c46a7d4c1dcb714ff59a70..97a965b24662d4cbf8f50bce0aefbe80a6c96e56 100644 (file)
@@ -99,30 +99,40 @@ enum wxKeyType
     WX_DECLARE_LIST_XO(elT*, liT, decl)
 
 #define WX_DECLARE_LIST_XO(elT, liT, decl)                                    \
-    decl liT : public std::list<elT>                                          \
+    decl liT;                                                                 \
+                                                                              \
+    /* Workaround for broken VC6 STL incorrectly requires a std::greater<> */ \
+    /* to be passed into std::list::sort() */                                 \
+    template <>                                                               \
+    struct std::greater<elT>                                                  \
     {                                                                         \
-    private:                                                                  \
-        bool m_destroy;                                                       \
-    private:                                                                  \
-        class SortCompareFunction                                             \
-        {                                                                     \
         private:                                                              \
             wxSortCompareFunction m_CompFunc;                                 \
         public:                                                               \
-            SortCompareFunction( wxSortCompareFunction compfunc )             \
+            greater( wxSortCompareFunction compfunc = NULL )                  \
                 : m_CompFunc( compfunc ) {}                                   \
-            bool operator()( const elT X, const elT Y ) const                 \
-                { return ( m_CompFunc( X, Y ) < 0 ); }                        \
-        };                                                                    \
+            bool operator()(const elT X, const elT Y) const                   \
+                {                                                             \
+                    return m_CompFunc ?                                       \
+                        ( m_CompFunc( X, Y ) < 0 ) :                          \
+                        ( X > Y );                                            \
+                }                                                             \
+    };                                                                        \
                                                                               \
+    decl liT : public std::list<elT>                                          \
+    {                                                                         \
+    private:                                                                  \
+        bool m_destroy;                                                       \
+    private:                                                                  \
         typedef elT _WX_LIST_ITEM_TYPE_##liT;                                 \
         static void DeleteFunction( const _WX_LIST_ITEM_TYPE_##liT X );       \
     public:                                                                   \
         class compatibility_iterator                                          \
         {                                                                     \
         private:                                                              \
-            typedef liT::iterator iterator;                                   \
-            friend class liT;                                                 \
+          /* Workaround for broken VC6 nested class name resolution */        \
+          typedef std::list<elT>::iterator iterator;                          \
+          friend class liT;                                                   \
         private:                                                              \
             iterator m_iter;                                                  \
             liT * m_list;                                                     \
@@ -260,8 +270,9 @@ enum wxKeyType
             clear();                                                          \
         }                                                                     \
                                                                               \
+        /* Workaround for broken VC6 std::list::sort() see above */           \
         void Sort( wxSortCompareFunction compfunc )                           \
-            { sort( SortCompareFunction( compfunc ) ); }                      \
+            { sort( std::greater<elT>( compfunc ) ); }                        \
                                                                               \
         ~liT() { Clear(); }                                                   \
     }
@@ -1170,9 +1181,9 @@ private:
 
 #else // if wxUSE_STL
 
-WX_DECLARE_LIST_XO(wxString, wxStringListBase, class WXDLLEXPORT);
+WX_DECLARE_LIST_XO(wxString, wxStringListBase, class WXDLLIMPEXP_BASE);
 
-class WXDLLEXPORT wxStringList : public wxStringListBase
+class WXDLLIMPEXP_BASE wxStringList : public wxStringListBase
 {
 public:
     compatibility_iterator Append(wxChar* s)