]> git.saurik.com Git - wxWidgets.git/commitdiff
small wxArtProvider API improvements: added HasNativeProvider() and renamed confusing...
authorVáclav Slavík <vslavik@fastmail.fm>
Thu, 7 Aug 2008 11:46:59 +0000 (11:46 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Thu, 7 Aug 2008 11:46:59 +0000 (11:46 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55008 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/artprov.h
interface/wx/artprov.h
src/common/artprov.cpp

index 34f365a8e98aba52e70ccb450ef84c1a74e4f63c..9b9ffa7ca6384e5ede79bbcd3c0884220532c566 100644 (file)
@@ -117,6 +117,8 @@ public:
     // Dtor removes the provider from providers stack if it's still on it
     virtual ~wxArtProvider();
 
     // Dtor removes the provider from providers stack if it's still on it
     virtual ~wxArtProvider();
 
+    // Does this platform implement native icons theme?
+    static bool HasNativeProvider();
 
     // Add new provider to the top of providers stack (i.e. the provider will
     // be queried first of all).
 
     // Add new provider to the top of providers stack (i.e. the provider will
     // be queried first of all).
@@ -124,7 +126,12 @@ public:
 
     // Add new provider to the bottom of providers stack (i.e. the provider
     // will be queried as the last one).
 
     // Add new provider to the bottom of providers stack (i.e. the provider
     // will be queried as the last one).
-    static void Insert(wxArtProvider *provider);
+    static void PushBack(wxArtProvider *provider);
+
+#if WXWIN_COMPATIBILITY_2_8
+    // use PushBack(), it's the same thing
+    wxDEPRECATED( static void Insert(wxArtProvider *provider) );
+#endif
 
     // Remove latest added provider and delete it.
     static bool Pop();
 
     // Remove latest added provider and delete it.
     static bool Pop();
index 6ce90114e1c77a00f13e2cd6d1cd5a446a645aca..a37cbdea9e639f8c759de8998a5b78fa8198b1dd 100644 (file)
@@ -218,10 +218,21 @@ public:
                                       const wxArtClient& client = wxART_OTHER);
 
     /**
                                       const wxArtClient& client = wxART_OTHER);
 
     /**
-        Register new art provider and add it to the bottom of providers stack
-        (i.e. it will be queried as the last one).
+        Returns true if the platform uses native icons provider that should
+        take precedence over any customizations.
 
 
-        @see Push()
+        This is true for any platform that has user-customizable icon themes,
+        currently only wxGTK.
+
+        A typical use for this method is to decide whether a custom art provider
+        should be plugged in using Push() or PushBack().
+
+        @since 2.9.0
+     */
+    static bool HasNativeProvider();
+
+    /**
+        @deprecated Use PushBack() instead.
     */
     static void Insert(wxArtProvider* provider);
 
     */
     static void Insert(wxArtProvider* provider);
 
@@ -234,10 +245,21 @@ public:
         Register new art provider and add it to the top of providers stack
         (i.e. it will be queried as the first provider).
 
         Register new art provider and add it to the top of providers stack
         (i.e. it will be queried as the first provider).
 
-        @see Insert()
+        @see PushBack()
     */
     static void Push(wxArtProvider* provider);
 
     */
     static void Push(wxArtProvider* provider);
 
+    /**
+        Register new art provider and add it to the bottom of providers stack.
+        In other words, it will be queried as the last one, after all others,
+        including the default provider.
+
+        @see Push()
+
+        @since 2.9.0
+    */
+    static void PushBack(wxArtProvider* provider);
+
     /**
         Remove a provider from the stack if it is on it. The provider is not
         deleted, unlike when using Delete().
     /**
         Remove a provider from the stack if it is on it. The provider is not
         deleted, unlike when using Delete().
index 793718faabda8778d60e506d7673a7c756a8559e..267b1c2c3b3b8072aa98d652f7ae7664adbda7d6 100644 (file)
@@ -160,7 +160,7 @@ wxArtProvider::~wxArtProvider()
     sm_providers->Insert(provider);
 }
 
     sm_providers->Insert(provider);
 }
 
-/*static*/ void wxArtProvider::Insert(wxArtProvider *provider)
+/*static*/ void wxArtProvider::PushBack(wxArtProvider *provider)
 {
     CommonAddingProvider();
     sm_providers->Append(provider);
 {
     CommonAddingProvider();
     sm_providers->Append(provider);
@@ -378,6 +378,16 @@ wxIcon wxArtProvider::GetMessageBoxIcon(int flags)
 #endif // GTK+ 2/else
 }
 
 #endif // GTK+ 2/else
 }
 
+/* static */
+bool wxArtProvider::HasNativeProvider()
+{
+#ifdef __WXGTK20__
+    return true;
+#else
+    return false;
+#endif
+}
+
 // ----------------------------------------------------------------------------
 // deprecated wxArtProvider methods
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // deprecated wxArtProvider methods
 // ----------------------------------------------------------------------------
@@ -408,6 +418,13 @@ wxIcon wxArtProvider::GetMessageBoxIcon(int flags)
 
 #endif // WXWIN_COMPATIBILITY_2_6
 
 
 #endif // WXWIN_COMPATIBILITY_2_6
 
+#if WXWIN_COMPATIBILITY_2_8
+/* static */ void wxArtProvider::Insert(wxArtProvider *provider)
+{
+    PushBack(provider);
+}
+#endif // WXWIN_COMPATIBILITY_2_8
+
 // ============================================================================
 // wxArtProviderModule
 // ============================================================================
 // ============================================================================
 // wxArtProviderModule
 // ============================================================================