]> git.saurik.com Git - wxWidgets.git/commitdiff
port proplist.cpp to wxArtProvider
authorVáclav Slavík <vslavik@fastmail.fm>
Fri, 22 Mar 2002 23:22:02 +0000 (23:22 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Fri, 22 Mar 2002 23:22:02 +0000 (23:22 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14736 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

art/cross.xpm [new file with mode: 0644]
art/tick.xpm [new file with mode: 0644]
include/wx/artprov.h
include/wx/generic/cross.xpm [deleted file]
include/wx/generic/tick.xpm [deleted file]
include/wx/msw/cross.bmp [deleted file]
include/wx/msw/tick.bmp [deleted file]
include/wx/msw/wx.rc
src/common/artstd.cpp
src/generic/proplist.cpp

diff --git a/art/cross.xpm b/art/cross.xpm
new file mode 100644 (file)
index 0000000..5192b65
--- /dev/null
@@ -0,0 +1,32 @@
+/* XPM */
+static char *cross_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"10 10 16 1",
+"  c Gray0",
+". c #bf0000",
+"X c #00bf00",
+"o c #bfbf00",
+"O c #0000bf",
+"+ c #bf00bf",
+"@ c #00bfbf",
+"# c None",
+"$ c #808080",
+"% c Red",
+"& c Green",
+"* c Yellow",
+"= c Blue",
+"- c Magenta",
+"; c Cyan",
+": c Gray100",
+/* pixels */
+" ######## ",
+"   ####   ",
+"#   ##   #",
+"##      ##",
+"###    ###",
+"###    ###",
+"##      ##",
+"#   ##   #",
+"   ####   ",
+"  ######  "
+};
diff --git a/art/tick.xpm b/art/tick.xpm
new file mode 100644 (file)
index 0000000..630eaf4
--- /dev/null
@@ -0,0 +1,32 @@
+/* XPM */
+static char *tick_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"10 10 16 1",
+"  c Gray0",
+". c #bf0000",
+"X c #00bf00",
+"o c #bfbf00",
+"O c #0000bf",
+"+ c #bf00bf",
+"@ c #00bfbf",
+"# c None",
+"$ c #808080",
+"% c Red",
+"& c Green",
+"* c Yellow",
+"= c Blue",
+"- c Magenta",
+"; c Cyan",
+": c Gray100",
+/* pixels */
+"##########",
+"######## #",
+"#######   ",
+"######    ",
+"#####    #",
+"  ##    ##",
+"       ###",
+"#     ####",
+"##   #####",
+"### ######"
+};
index 9fb5f85feed65e4269feeba84c05ba4982fb9e85..01cb255a9a61463476565f60fac08ad351ba59ca 100644 (file)
@@ -71,6 +71,8 @@ typedef wxString wxArtID;
 #define wxART_GO_DIR_UP                _T("go_dir_up")
 #define wxART_EXECUTABLE_FILE          _T("executable_file")
 #define wxART_NORMAL_FILE              _T("normal_file")
+#define wxART_TICK_MARK                _T("tick")
+#define wxART_CROSS_MARK               _T("cross")
 
 // ----------------------------------------------------------------------------
 // wxArtProvider class
diff --git a/include/wx/generic/cross.xpm b/include/wx/generic/cross.xpm
deleted file mode 100644 (file)
index 5192b65..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* XPM */
-static char *cross_xpm[] = {
-/* columns rows colors chars-per-pixel */
-"10 10 16 1",
-"  c Gray0",
-". c #bf0000",
-"X c #00bf00",
-"o c #bfbf00",
-"O c #0000bf",
-"+ c #bf00bf",
-"@ c #00bfbf",
-"# c None",
-"$ c #808080",
-"% c Red",
-"& c Green",
-"* c Yellow",
-"= c Blue",
-"- c Magenta",
-"; c Cyan",
-": c Gray100",
-/* pixels */
-" ######## ",
-"   ####   ",
-"#   ##   #",
-"##      ##",
-"###    ###",
-"###    ###",
-"##      ##",
-"#   ##   #",
-"   ####   ",
-"  ######  "
-};
diff --git a/include/wx/generic/tick.xpm b/include/wx/generic/tick.xpm
deleted file mode 100644 (file)
index 630eaf4..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* XPM */
-static char *tick_xpm[] = {
-/* columns rows colors chars-per-pixel */
-"10 10 16 1",
-"  c Gray0",
-". c #bf0000",
-"X c #00bf00",
-"o c #bfbf00",
-"O c #0000bf",
-"+ c #bf00bf",
-"@ c #00bfbf",
-"# c None",
-"$ c #808080",
-"% c Red",
-"& c Green",
-"* c Yellow",
-"= c Blue",
-"- c Magenta",
-"; c Cyan",
-": c Gray100",
-/* pixels */
-"##########",
-"######## #",
-"#######   ",
-"######    ",
-"#####    #",
-"  ##    ##",
-"       ###",
-"#     ####",
-"##   #####",
-"### ######"
-};
diff --git a/include/wx/msw/cross.bmp b/include/wx/msw/cross.bmp
deleted file mode 100644 (file)
index 079cb0d..0000000
Binary files a/include/wx/msw/cross.bmp and /dev/null differ
diff --git a/include/wx/msw/tick.bmp b/include/wx/msw/tick.bmp
deleted file mode 100644 (file)
index 3673eda..0000000
Binary files a/include/wx/msw/tick.bmp and /dev/null differ
index 4e617e8f00245450bfebb0108b6d735addb9d9e9..b1dc54050d40782112c633a3f728279a4fef51b5 100644 (file)
@@ -83,14 +83,6 @@ WXCURSOR_RIGHT_ARROW    CURSOR  DISCARDABLE     "wx/msw/rightarr.cur"
 //wxDEFAULT_MDIPARENTFRAME      ICON "wx/msw/mdi.ico"
 //wxDEFAULT_MDICHILDFRAME       ICON "wx/msw/child.ico"
 
-// Standard large icons
-/* we don't use these files any more, use Windows standard icons instead
-wxICON_QUESTION        ICON "wx/msw/question.ico"
-wxICON_WARNING ICON "wx/msw/warning.ico"
-wxICON_ERROR   ICON "wx/msw/error.ico"
-wxICON_INFO    ICON "wx/msw/info.ico"
-*/
-
 // Standard small icons
 wxICON_SMALL_CLOSED_FOLDER      ICON "wx/msw/folder1.ico"
 wxICON_SMALL_OPEN_FOLDER        ICON "wx/msw/folder2.ico"
@@ -113,10 +105,6 @@ wxDISABLE_BUTTON_BITMAP         BITMAP  "wx/msw/disable.bmp"
 #endif
 
 
-// For src/generic/proplist.cpp
-tick_bmp                BITMAP  "wx/msw/tick.bmp"
-cross_bmp               BITMAP  "wx/msw/cross.bmp"
-
 // For wxContextHelpButton
 csquery                 BITMAP "wx/msw/csquery.bmp"
 
index fe55f9d2f3ae9ccb42893d64bcb9cdafefbc3182..fb05b05047eba7425231e754be4d8199adc23ed4 100644 (file)
@@ -92,6 +92,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxDefaultArtProviderModule, wxModule)
 #include "../../art/dir_up.xpm"
 #include "../../art/exefile.xpm"
 #include "../../art/deffile.xpm"
+#include "../../art/tick.xpm"
+#include "../../art/cross.xpm"
 
 #undef static
 
@@ -129,6 +131,8 @@ wxBitmap wxDefaultArtProvider::CreateBitmap(const wxArtID& id,
     ART(wxART_GO_DIR_UP,                           dir_up)
     ART(wxART_EXECUTABLE_FILE,                     exefile)
     ART(wxART_NORMAL_FILE,                         deffile)
+    ART(wxART_TICK_MARK,                           tick)
+    ART(wxART_CROSS_MARK,                          cross)
 
     return wxNullBitmap;
 }
index fd6901f6627a1c2d026d5bdbd98927305eb944e8..03a78cd577ca605faed05e878bcb7e8d02062815 100644 (file)
@@ -45,6 +45,7 @@
 #include "wx/sizer.h"
 #include "wx/module.h"
 #include "wx/intl.h"
+#include "wx/artprov.h"
 
 #include "wx/colordlg.h"
 #include "wx/proplist.h"
 #include <math.h>
 #include <string.h>
 
-// ----------------------------------------------------------------------------
-// XPMs
-// ----------------------------------------------------------------------------
-
-// XPM hack: make the arrays const
-#define static static const
-
-#ifndef __WXMSW__
-    #include "wx/generic/cross.xpm"
-    #include "wx/generic/tick.xpm"
-#endif
-
-#undef static
-
-// ----------------------------------------------------------------------------
-// accessor functions for the bitmaps (may return NULL, check for it!)
-// ----------------------------------------------------------------------------
-
-static wxBitmap *GetTickBitmap();
-static wxBitmap *GetCrossBitmap();
-
 // ----------------------------------------------------------------------------
 // Property text edit control
 // ----------------------------------------------------------------------------
@@ -460,13 +440,13 @@ bool wxPropertyListView::CreateControls()
 
     if (m_buttonFlags & wxPROP_BUTTON_CHECK_CROSS)
     {
-        wxBitmap *tickBitmap = GetTickBitmap();
-        wxBitmap *crossBitmap = GetCrossBitmap();
+        wxBitmap tickBitmap = wxArtProvider::GetBitmap(wxART_TICK_MARK);
+        wxBitmap crossBitmap = wxArtProvider::GetBitmap(wxART_CROSS_MARK);
 
-        if ( tickBitmap && crossBitmap )
+        if ( tickBitmap.Ok() && crossBitmap.Ok() )
         {
-            m_confirmButton = new wxBitmapButton(panel, wxID_PROP_CHECK, *tickBitmap, wxPoint(-1, -1), smallButtonSize );
-            m_cancelButton = new wxBitmapButton(panel, wxID_PROP_CROSS, *crossBitmap, wxPoint(-1, -1), smallButtonSize );
+            m_confirmButton = new wxBitmapButton(panel, wxID_PROP_CHECK, tickBitmap, wxPoint(-1, -1), smallButtonSize );
+            m_cancelButton = new wxBitmapButton(panel, wxID_PROP_CROSS, crossBitmap, wxPoint(-1, -1), smallButtonSize );
         }
         else
         {
@@ -1846,47 +1826,5 @@ void wxPropertyStringListEditorDialog::ShowCurrentSelection()
   m_stringText->Enable(TRUE);
 }
 
-// ----------------------------------------------------------------------------
-// global functions
-// ----------------------------------------------------------------------------
-
-// FIXME MT-UNSAFE
-static wxBitmap *GetTickBitmap()
-{
-    static wxBitmap* s_tickBitmap = (wxBitmap *) NULL;
-    static bool s_loaded = FALSE;
-
-    if ( !s_loaded )
-    {
-        s_loaded = TRUE; // set it to TRUE anyhow, we won't try again
-
-        #if defined(__WXMSW__) || defined(__WXPM__)
-            s_tickBitmap = new wxBitmap(_T("tick_bmp"), wxBITMAP_TYPE_RESOURCE);
-        #else
-            s_tickBitmap = new wxBitmap( tick_xpm );
-        #endif
-    }
-
-    return s_tickBitmap;
-}
-
-static wxBitmap *GetCrossBitmap()
-{
-    static wxBitmap* s_crossBitmap = (wxBitmap *) NULL;
-    static bool s_loaded = FALSE;
-
-    if ( !s_loaded )
-    {
-        s_loaded = TRUE; // set it to TRUE anyhow, we won't try again
-
-        #if defined(__WXMSW__) || defined(__WXPM__)
-            s_crossBitmap =  new wxBitmap(_T("cross_bmp"), wxBITMAP_TYPE_RESOURCE);
-        #else // XPMs
-            s_crossBitmap =  new wxBitmap( cross_xpm );
-        #endif // BMPs/XPMs
-    }
-
-    return s_crossBitmap;
-}
 
 #endif // wxUSE_PROPSHEET