]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/proplist.cpp
cleaned up the checkbox creation code (~70 lines of code became 3)
[wxWidgets.git] / src / generic / proplist.cpp
index fd6901f6627a1c2d026d5bdbd98927305eb944e8..a9e3b83c39ecbe170c1303b9a63d63dba844962a 100644 (file)
@@ -45,6 +45,7 @@
 #include "wx/sizer.h"
 #include "wx/module.h"
 #include "wx/intl.h"
 #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 "wx/colordlg.h"
 #include "wx/proplist.h"
 #include <math.h>
 #include <string.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
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // Property text edit control
 // ----------------------------------------------------------------------------
@@ -436,8 +416,7 @@ bool wxPropertyListView::CreateControls()
     if (!panel)
         return FALSE;
 
     if (!panel)
         return FALSE;
 
-    wxSystemSettings settings;
-    wxFont guiFont = settings.GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
+    wxFont guiFont = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
 
 #ifdef __WXMSW__
     wxFont *boringFont =
 
 #ifdef __WXMSW__
     wxFont *boringFont =
@@ -460,13 +439,13 @@ bool wxPropertyListView::CreateControls()
 
     if (m_buttonFlags & wxPROP_BUTTON_CHECK_CROSS)
     {
 
     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
         {
         }
         else
         {
@@ -610,6 +589,7 @@ void wxPropertyListView::OnOk(wxCommandEvent& event)
   OnCheck(event);
 
   m_managedWindow->Close(TRUE);
   OnCheck(event);
 
   m_managedWindow->Close(TRUE);
+  sm_dialogCancelled = FALSE;
 }
 
 void wxPropertyListView::OnCancel(wxCommandEvent& WXUNUSED(event))
 }
 
 void wxPropertyListView::OnCancel(wxCommandEvent& WXUNUSED(event))
@@ -1846,47 +1826,5 @@ void wxPropertyStringListEditorDialog::ShowCurrentSelection()
   m_stringText->Enable(TRUE);
 }
 
   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
 
 #endif // wxUSE_PROPSHEET