]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/proplist.cpp
Fix HTML help on Mac.
[wxWidgets.git] / src / generic / proplist.cpp
index bdb7dead26405c54fe028cd1512c8fbf6be01a61..55722a5c10817961542531e10d1d7ec3945deb4a 100644 (file)
@@ -9,47 +9,72 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
 #ifdef __GNUG__
-#pragma implementation "proplist.h"
+    #pragma implementation "proplist.h"
 #endif
 
 // For compilers that support precompilation, includes "wx/wx.h".
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
-#pragma hdrstop
+    #pragma hdrstop
 #endif
 
+#if wxUSE_PROPSHEET
+
 #ifndef WX_PRECOMP
-#include "wx/wx.h"
+    #include "wx/window.h"
+    #include "wx/font.h"
+    #include "wx/button.h"
+    #include "wx/bmpbuttn.h"
+    #include "wx/textctrl.h"
+    #include "wx/listbox.h"
+    #include "wx/settings.h"
+    #include "wx/msgdlg.h"
+    #include "wx/filedlg.h"
 #endif
 
+#include "wx/sizer.h"
+#include "wx/module.h"
+#include "wx/intl.h"
+
+#include "wx/colordlg.h"
+#include "wx/proplist.h"
+
 #include <ctype.h>
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
 
-#if wxUSE_IOSTREAMH
-#if defined(__WXMSW__) && !defined(__GNUWIN32__)
-#include <strstrea.h>
-#else
-#include <strstream.h>
-#endif
-#else
-#include <strstream>
+// ----------------------------------------------------------------------------
+// XPMs
+// ----------------------------------------------------------------------------
+
+#ifndef __WXMSW__
+    #include "wx/generic/cross.xpm"
+    #include "wx/generic/tick.xpm"
 #endif
 
-#include "wx/window.h"
-#include "wx/utils.h"
-#include "wx/list.h"
-#include "wx/colordlg.h"
-#include "wx/proplist.h"
+// ----------------------------------------------------------------------------
+// accessor functions for the bitmaps (may return NULL, check for it!)
+// ----------------------------------------------------------------------------
 
-/*
- * Property text edit control
- */
+static wxBitmap *GetTickBitmap();
+static wxBitmap *GetCrossBitmap();
+
+// ----------------------------------------------------------------------------
+// Property text edit control
+// ----------------------------------------------------------------------------
 
-IMPLEMENT_CLASS(wxPropertyTextEdit, wxTextCtrl)
+IMPLEMENT_DYNAMIC_CLASS(wxPropertyTextEdit, wxTextCtrl)
 
 wxPropertyTextEdit::wxPropertyTextEdit(wxPropertyListView *v, wxWindow *parent,
     const wxWindowID id, const wxString& value,
@@ -60,17 +85,19 @@ wxPropertyTextEdit::wxPropertyTextEdit(wxPropertyListView *v, wxWindow *parent,
   m_view = v;
 }
 
-void wxPropertyTextEdit::OnSetFocus(void)
+void wxPropertyTextEdit::OnSetFocus()
 {
 }
 
-void wxPropertyTextEdit::OnKillFocus(void)
+void wxPropertyTextEdit::OnKillFocus()
 {
 }
 
-/*
- * Property list view
- */
+// ----------------------------------------------------------------------------
+// Property list view
+// ----------------------------------------------------------------------------
+
+bool wxPropertyListView::sm_dialogCancelled = FALSE;
 
 IMPLEMENT_DYNAMIC_CLASS(wxPropertyListView, wxPropertyView)
 
@@ -88,10 +115,6 @@ BEGIN_EVENT_TABLE(wxPropertyListView, wxPropertyView)
     EVT_LISTBOX(wxID_PROP_VALUE_SELECT, wxPropertyListView::OnValueListSelect)
 END_EVENT_TABLE()
 
-bool wxPropertyListView::sm_dialogCancelled = FALSE;
-wxBitmap *wxPropertyListView::sm_tickBitmap = NULL;
-wxBitmap *wxPropertyListView::sm_crossBitmap = NULL;
-
 wxPropertyListView::wxPropertyListView(wxPanel *propPanel, long flags):wxPropertyView(flags)
 {
   m_propertyScrollingList = NULL;
@@ -110,14 +133,8 @@ wxPropertyListView::wxPropertyListView(wxPanel *propPanel, long flags):wxPropert
   m_detailedEditing = FALSE;
 }
 
-wxPropertyListView::~wxPropertyListView(void)
+wxPropertyListView::~wxPropertyListView()
 {
-/*
-  if (m_tickBitmap)
-    delete m_tickBitmap;
-  if (m_crossBitmap)
-    delete m_crossBitmap;
-*/
 }
 
 void wxPropertyListView::ShowView(wxPropertySheet *ps, wxPanel *panel)
@@ -133,7 +150,7 @@ void wxPropertyListView::ShowView(wxPropertySheet *ps, wxPanel *panel)
 
 // Update this view of the viewed object, called e.g. by
 // the object itself.
-bool wxPropertyListView::OnUpdateView(void)
+bool wxPropertyListView::OnUpdateView()
 {
   return TRUE;
 }
@@ -157,8 +174,7 @@ bool wxPropertyListView::UpdatePropertyList(bool clearEditArea)
     wxProperty *property = (wxProperty *)node->Data();
     wxString stringValueRepr(property->GetValue().GetStringRepresentation());
     wxString paddedString(MakeNameValueString(property->GetName(), stringValueRepr));
-
-    m_propertyScrollingList->Append(paddedString.GetData(), (char *)property);
+    m_propertyScrollingList->Append(paddedString.GetData(), (void *)property);
     node = node->Next();
   }
   return TRUE;
@@ -201,7 +217,7 @@ bool wxPropertyListView::UpdatePropertyDisplayInList(wxProperty *property)
 // Find the wxListBox index corresponding to this property
 int wxPropertyListView::FindListIndexForProperty(wxProperty *property)
 {
-  int n = m_propertyScrollingList->Number();
+  int n = m_propertyScrollingList->GetCount();
   for (int i = 0; i < n; i++)
   {
     if (property == (wxProperty *)m_propertyScrollingList->wxListBox::GetClientData(i))
@@ -295,7 +311,7 @@ bool wxPropertyListView::EndShowingProperty(wxProperty *property)
   return TRUE;
 }
 
-void wxPropertyListView::BeginDetailedEditing(void)
+void wxPropertyListView::BeginDetailedEditing()
 {
   if (!m_currentValidator)
     return;
@@ -314,7 +330,7 @@ void wxPropertyListView::BeginDetailedEditing(void)
     m_detailedEditing = TRUE;
 }
 
-void wxPropertyListView::EndDetailedEditing(void)
+void wxPropertyListView::EndDetailedEditing()
 {
   if (!m_currentValidator)
     return;
@@ -402,258 +418,125 @@ void wxPropertyListView::OnPropertySelect(wxCommandEvent& WXUNUSED(event))
   }
 }
 
-bool wxPropertyListView::CreateControls(void)
+bool wxPropertyListView::CreateControls()
 {
-  wxPanel *panel = (wxPanel *)m_propertyWindow;
-
-  int largeButtonWidth = 60;
-  int largeButtonHeight = 25;
-
-  int smallButtonWidth = 25;
-  int smallButtonHeight = 20;
-
-  // XView must be allowed to choose its own sized buttons
-#ifdef __XVIEW__
-  largeButtonWidth = -1;
-  largeButtonHeight = -1;
-
-  smallButtonWidth = -1;
-  smallButtonHeight = -1;
-#endif
+    wxPanel *panel = (wxPanel *)m_propertyWindow;
 
-  if (m_valueText)
-    return TRUE;
+    wxSize largeButtonSize( 70, 25 );
+    wxSize smallButtonSize( 23, 23 );
 
-  if (!panel)
-    return FALSE;
+    if (m_valueText)
+        return TRUE;
 
-  wxWindow *leftMostWindow = panel;
-/*
-  wxWindow *topMostWindow = panel;
-  wxWindow *rightMostWindow = panel;
-*/
+    if (!panel)
+        return FALSE;
 
-  wxSystemSettings settings;
-  wxFont guiFont = settings.GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
+    wxSystemSettings settings;
+    wxFont guiFont = settings.GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
 
 #ifdef __WXMSW__
-  wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize(), wxMODERN, wxNORMAL, wxNORMAL, FALSE, "Courier New");
+    wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize(), wxMODERN, wxNORMAL, wxNORMAL, FALSE, "Courier New");
 #else
-  wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize(), wxTELETYPE, wxNORMAL, wxNORMAL);
+    wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize(), wxTELETYPE, wxNORMAL, wxNORMAL);
 #endif
 
-  // May need to be changed in future to eliminate clashes with app.
-  // WHAT WAS THIS FOR?
+    // May need to be changed in future to eliminate clashes with app.
+    // WHAT WAS THIS FOR?
 //  panel->SetClientData((char *)this);
 
-  // These buttons are at the bottom of the window, but create them now
-  // so the constraints are evaluated in the correct order
-  if (m_buttonFlags & wxPROP_BUTTON_OK)
-  {
-    m_windowCloseButton = new wxButton(panel, wxID_OK, "OK",
-     wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
-    m_windowCloseButton->SetDefault();
-    m_windowCloseButton->SetFocus();
-  }
-  else if (m_buttonFlags & wxPROP_BUTTON_CLOSE)
-  {
-    m_windowCloseButton = new wxButton(panel, wxID_OK, "Close",
-     wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
-  }
-  if (m_buttonFlags & wxPROP_BUTTON_CANCEL)
-  {
-    m_windowCancelButton = new wxButton(panel, wxID_CANCEL, "Cancel",
-     wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
-  }
-  if (m_buttonFlags & wxPROP_BUTTON_HELP)
-  {
-    m_windowHelpButton = new wxButton(panel, wxID_HELP, "Help",
-     wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
-  }
+    wxBoxSizer *mainsizer = new wxBoxSizer( wxVERTICAL );
 
-  if (m_windowCloseButton)
-  {
-    wxLayoutConstraints *c1 = new wxLayoutConstraints;
-
-    c1->left.SameAs       (panel, wxLeft, 2);
-    c1->bottom.SameAs        (panel, wxBottom, 2);
-    c1->width.AsIs();
-    c1->height.AsIs();
-    m_windowCloseButton->SetConstraints(c1);
-    leftMostWindow = m_windowCloseButton;
-  }
-  if (m_windowCancelButton)
-  {
-    wxLayoutConstraints *c2 = new wxLayoutConstraints;
-
-    c2->right.SameAs       (panel, wxRight, 2);
-    c2->bottom.SameAs          (panel, wxBottom, 2);
-    c2->width.AsIs();
-    c2->height.AsIs();
-    m_windowCancelButton->SetConstraints(c2);
-    leftMostWindow = m_windowCancelButton;
-  }
-  if (m_windowHelpButton)
-  {
-    wxLayoutConstraints *c2 = new wxLayoutConstraints;
-    if (leftMostWindow == panel)
-      c2->left.SameAs       (panel, wxLeft, 2);
-    else
-      c2->left.RightOf      (leftMostWindow, 2);
+    // top row with optional buttons and input line
 
-    c2->bottom.SameAs          (panel, wxBottom, 2);
-    c2->width.AsIs();
-    c2->height.AsIs();
-    m_windowHelpButton->SetConstraints(c2);
-    leftMostWindow = m_windowHelpButton;
-  }
+    wxBoxSizer *topsizer = new wxBoxSizer( wxHORIZONTAL );
+    int buttonborder = 3;
 
-  if (m_buttonFlags & wxPROP_BUTTON_CHECK_CROSS)
-  {
-/*
-    if (!tickBitmap)
-    {
-#ifdef __WXMSW__
-      tickBitmap = new wxBitmap("tick_bmp", wxBITMAP_TYPE_RESOURCE);
-      crossBitmap =  new wxBitmap("cross_bmp", wxBITMAP_TYPE_RESOURCE);
-      if (!tickBitmap || !crossBitmap || !tickBitmap->Ok() || !crossBitmap->Ok())
-      {
-        if (tickBitmap)
-          delete tickBitmap;
-        if (crossBitmap)
-          delete crossBitmap;
-        tickBitmap = NULL;
-        crossBitmap = NULL;
-      }
-#endif
-    }
-*/
-/*
-    if (tickBitmap && crossBitmap)
+    if (m_buttonFlags & wxPROP_BUTTON_CHECK_CROSS)
     {
-      m_confirmButton = new wxBitmapButton(panel, wxID_PROP_CHECK, tickBitmap,
-       wxPoint(-1, -1), wxSize(smallButtonWidth-5, smallButtonHeight-5));
-      m_cancelButton = new wxBitmapButton(panel, wxID_PROP_CROSS, crossBitmap,
-       wxPoint(-1, -1), wxSize(smallButtonWidth-5, smallButtonHeight-5));
-    }
-    else
-*/
-    {
-      m_confirmButton = new wxButton(panel, wxID_PROP_CHECK, ":-)",
-       wxPoint(-1, -1), wxSize(smallButtonWidth, smallButtonHeight));
-      m_cancelButton = new wxButton(panel, wxID_PROP_CROSS, "X",
-       wxPoint(-1, -1), wxSize(smallButtonWidth, smallButtonHeight));
-    }
-
-    wxLayoutConstraints *c = new wxLayoutConstraints;
-    c->left.SameAs         (panel, wxLeft, 2);
-/*
-    if (windowCloseButton)
-      c->top.Below         (m_windowCloseButton, 2);
-    else
-*/
-      c->top.SameAs        (panel, wxTop, 2);
-
-    c->width.AsIs();
-    c->height.AsIs();
+        wxBitmap *tickBitmap = GetTickBitmap();
+        wxBitmap *crossBitmap = GetCrossBitmap();
 
-    m_cancelButton->SetConstraints(c);
-
-    c = new wxLayoutConstraints;
-    c->left.RightOf        (m_cancelButton, 2);
-    c->top.SameAs          (m_cancelButton, wxTop, 0);
-    c->width.AsIs();
-    c->height.AsIs();
-
-    m_confirmButton->SetConstraints(c);
-
-    m_cancelButton->Enable(FALSE);
-    m_confirmButton->Enable(FALSE);
-  }
-
-  if (m_buttonFlags & wxPROP_PULLDOWN)
-  {
-    m_editButton = new wxButton(panel, wxID_PROP_EDIT, "...",
-     wxPoint(-1, -1), wxSize(smallButtonWidth, smallButtonHeight));
-    m_editButton->Enable(FALSE);
-    wxLayoutConstraints *c = new wxLayoutConstraints;
-
-/*
-    if (m_windowCloseButton)
-      c->top.Below           (m_windowCloseButton, 2);
-    else
-*/
-      c->top.SameAs          (panel, wxTop, 2);
-
-    c->right.SameAs          (panel, wxRight, 2);
-    c->width.AsIs();
-    c->height.AsIs();
-    m_editButton->SetConstraints(c);
-  }
-
-  m_valueText = new wxPropertyTextEdit(this, panel, wxID_PROP_TEXT, "", wxPoint(-1, -1), wxSize(-1, -1), wxPROCESS_ENTER);
-  m_valueText->Enable(FALSE);
-
-  wxLayoutConstraints *c = new wxLayoutConstraints;
-
-  if (m_cancelButton)
-    c->left.RightOf        (m_confirmButton, 2);
-  else
-    c->left.SameAs         (panel, wxLeft, 2);
-/*
-  if (m_windowCloseButton)
-    c->top.Below           (m_windowCloseButton, 2);
-  else
-*/
-    c->top.SameAs          (panel, wxTop, 2);
+        if ( tickBitmap && crossBitmap )
+        {
+            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
+        {
+            m_confirmButton = new wxButton(panel, wxID_PROP_CHECK, ":-)", wxPoint(-1, -1), smallButtonSize );
+            m_cancelButton = new wxButton(panel, wxID_PROP_CROSS, "X", wxPoint(-1, -1), smallButtonSize );
+        }
 
-  if (m_editButton)
-    c->right.LeftOf        (m_editButton, 2);
-  else
-    c->right.SameAs        (panel, wxRight, 2);
-  c->height.AsIs();
+        topsizer->Add( m_confirmButton, 0, wxLEFT|wxTOP|wxBOTTOM | wxEXPAND, buttonborder );
+        topsizer->Add( m_cancelButton, 0, wxLEFT|wxTOP|wxBOTTOM | wxEXPAND, buttonborder );
+    }
 
-  m_valueText->SetConstraints(c);
+    m_valueText = new wxPropertyTextEdit(this, panel, wxID_PROP_TEXT, "",
+       wxPoint(-1, -1), wxSize(-1, smallButtonSize.y), wxPROCESS_ENTER);
+    m_valueText->Enable(FALSE);
+    topsizer->Add( m_valueText, 1, wxALL | wxEXPAND, buttonborder );
 
-  m_valueList = new wxListBox(panel, wxID_PROP_VALUE_SELECT, wxPoint(-1, -1), wxSize(-1, 60));
-  m_valueList->Show(FALSE);
+    if (m_buttonFlags & wxPROP_PULLDOWN)
+    {
+        m_editButton = new wxButton(panel, wxID_PROP_EDIT, "...",  wxPoint(-1, -1), smallButtonSize);
+        m_editButton->Enable(FALSE);
+        topsizer->Add( m_editButton, 0, wxRIGHT|wxTOP|wxBOTTOM | wxEXPAND, buttonborder );
+    }
 
-  c = new wxLayoutConstraints;
+    mainsizer->Add( topsizer, 0, wxEXPAND );
 
-  c->left.SameAs         (panel, wxLeft, 2);
-  c->top.Below           (m_valueText, 2);
-  c->right.SameAs        (panel, wxRight, 2);
-  c->height.Absolute(60);
+    // middle section with two list boxes
 
-  m_valueList->SetConstraints(c);
+    m_middleSizer = new wxBoxSizer( wxVERTICAL );
 
-  m_propertyScrollingList = new wxListBox(panel, wxID_PROP_SELECT,
-    wxPoint(-1, -1), wxSize(300, 300));
-  m_propertyScrollingList->SetFont(* boringFont);
+    m_valueList = new wxListBox(panel, wxID_PROP_VALUE_SELECT, wxPoint(-1, -1), wxSize(-1, 60));
+    m_valueList->Show(FALSE);
 
-  c = new wxLayoutConstraints;
+    m_propertyScrollingList = new wxListBox(panel, wxID_PROP_SELECT, wxPoint(-1, -1), wxSize(100, 100));
+    m_propertyScrollingList->SetFont(* boringFont);
+    m_middleSizer->Add( m_propertyScrollingList, 1, wxALL|wxEXPAND, buttonborder );
 
-  c->left.SameAs         (panel, wxLeft, 2);
+    mainsizer->Add( m_middleSizer, 1, wxEXPAND );
 
-  if (m_buttonFlags & wxPROP_DYNAMIC_VALUE_FIELD)
-    c->top.Below         (m_valueText, 2);
-  else
-    c->top.Below         (m_valueList, 2);
+    // bottom row with buttons
 
-  c->right.SameAs        (panel, wxRight, 2);
+    if ((m_buttonFlags & wxPROP_BUTTON_OK) ||
+        (m_buttonFlags & wxPROP_BUTTON_CLOSE) ||
+        (m_buttonFlags & wxPROP_BUTTON_CANCEL) ||
+        (m_buttonFlags & wxPROP_BUTTON_HELP))
+    {
+        wxBoxSizer *bottomsizer = new wxBoxSizer( wxHORIZONTAL );
+        buttonborder = 5;
 
-  if (m_windowCloseButton)
-    c->bottom.Above       (m_windowCloseButton, -2);
-  else
-    c->bottom.SameAs       (panel, wxBottom, 2);
+        if (m_buttonFlags & wxPROP_BUTTON_OK)
+        {
+            m_windowCloseButton = new wxButton(panel, wxID_OK, _("OK"), wxPoint(-1, -1), largeButtonSize );
+            m_windowCloseButton->SetDefault();
+            m_windowCloseButton->SetFocus();
+            bottomsizer->Add( m_windowCloseButton, 0, wxALL, buttonborder );
+        }
+        else if (m_buttonFlags & wxPROP_BUTTON_CLOSE)
+        {
+            m_windowCloseButton = new wxButton(panel, wxID_OK, _("Close"), wxPoint(-1, -1), largeButtonSize );
+            bottomsizer->Add( m_windowCloseButton, 0, wxALL, buttonborder );
+        }
+        if (m_buttonFlags & wxPROP_BUTTON_CANCEL)
+        {
+            m_windowCancelButton = new wxButton(panel, wxID_CANCEL, _("Cancel"), wxPoint(-1, -1), largeButtonSize );
+            bottomsizer->Add( m_windowCancelButton, 0, wxALL, buttonborder );
+        }
+        if (m_buttonFlags & wxPROP_BUTTON_HELP)
+        {
+            m_windowHelpButton = new wxButton(panel, wxID_HELP, _("Help"), wxPoint(-1, -1), largeButtonSize );
+            bottomsizer->Add( m_windowHelpButton, 0, wxALL, buttonborder );
+        }
 
-  m_propertyScrollingList->SetConstraints(c);
+        mainsizer->Add( bottomsizer, 0, wxALIGN_RIGHT | wxEXPAND );
+    }
 
-  // Note: if this is called now, it causes a GPF.
-  // Why?
-//  panel->Layout();
+    panel->SetSizer( mainsizer );
 
-  return TRUE;
+    return TRUE;
 }
 
 void wxPropertyListView::ShowTextControl(bool show)
@@ -664,30 +547,19 @@ void wxPropertyListView::ShowTextControl(bool show)
 
 void wxPropertyListView::ShowListBoxControl(bool show)
 {
-  if (m_valueList)
-  {
+    if (!m_valueList) return;
+
     m_valueList->Show(show);
+
     if (m_buttonFlags & wxPROP_DYNAMIC_VALUE_FIELD)
     {
-      wxLayoutConstraints *constraints = m_propertyScrollingList->GetConstraints();
-      if (constraints)
-      {
         if (show)
-        {
-          constraints->top.Below(m_valueList, 2);
-          // Maintain back-pointer so when valueList is deleted,
-          // any reference to it from this window is removed.
-          m_valueList->AddConstraintReference(m_propertyScrollingList);
-        }
+            m_middleSizer->Prepend( m_valueList, 0, wxTOP|wxLEFT|wxRIGHT | wxEXPAND, 3 );
         else
-        {
-          constraints->top.Below(m_valueText, 2);
-          m_valueText->AddConstraintReference(m_propertyScrollingList);
-        }
+            m_middleSizer->Remove( 0 );
+
         m_propertyWindow->Layout();
-      }
     }
-  }
 }
 
 void wxPropertyListView::EnableCheck(bool show)
@@ -702,7 +574,7 @@ void wxPropertyListView::EnableCross(bool show)
     m_cancelButton->Enable(show);
 }
 
-bool wxPropertyListView::OnClose(void)
+bool wxPropertyListView::OnClose()
 {
   // Retrieve the value if any
   wxCommandEvent event;
@@ -801,11 +673,11 @@ void wxPropertyListView::OnText(wxCommandEvent& event)
   }
 }
 
-/*
- * Property dialog box
- */
+// ----------------------------------------------------------------------------
+// Property dialog box
+// ----------------------------------------------------------------------------
 
-IMPLEMENT_CLASS(wxPropertyListDialog, wxDialog)
+IMPLEMENT_DYNAMIC_CLASS(wxPropertyListDialog, wxDialog)
 
 BEGIN_EVENT_TABLE(wxPropertyListDialog, wxDialog)
     EVT_BUTTON(wxID_CANCEL,                wxPropertyListDialog::OnCancel)
@@ -861,11 +733,11 @@ bool wxPropertyListDialog::ProcessEvent(wxEvent& event)
         return TRUE;
 }
 
-/*
- * Property panel
- */
+// ----------------------------------------------------------------------------
+// Property panel
+// ----------------------------------------------------------------------------
 
-IMPLEMENT_CLASS(wxPropertyListPanel, wxPanel)
+IMPLEMENT_DYNAMIC_CLASS(wxPropertyListPanel, wxPanel)
 
 BEGIN_EVENT_TABLE(wxPropertyListPanel, wxPanel)
     EVT_SIZE(wxPropertyListPanel::OnSize)
@@ -897,11 +769,11 @@ void wxPropertyListPanel::OnSize(wxSizeEvent& WXUNUSED(event))
     Layout();
 }
 
-/*
- * Property frame
- */
+// ----------------------------------------------------------------------------
+// Property frame
+// ----------------------------------------------------------------------------
 
-IMPLEMENT_CLASS(wxPropertyListFrame, wxFrame)
+IMPLEMENT_DYNAMIC_CLASS(wxPropertyListFrame, wxFrame)
 
 BEGIN_EVENT_TABLE(wxPropertyListFrame, wxFrame)
     EVT_CLOSE(wxPropertyListFrame::OnCloseWindow)
@@ -928,7 +800,7 @@ wxPropertyListPanel *wxPropertyListFrame::OnCreatePanel(wxFrame *parent, wxPrope
   return new wxPropertyListPanel(v, parent);
 }
 
-bool wxPropertyListFrame::Initialize(void)
+bool wxPropertyListFrame::Initialize()
 {
   m_propertyPanel = OnCreatePanel(this, m_view);
   if (m_propertyPanel)
@@ -942,9 +814,9 @@ bool wxPropertyListFrame::Initialize(void)
     return FALSE;
 }
 
- /*
-  * Property list specific validator
-  */
+// ----------------------------------------------------------------------------
+// Property list specific validator
+// ----------------------------------------------------------------------------
 
 IMPLEMENT_ABSTRACT_CLASS(wxPropertyListValidator, wxPropertyValidator)
 
@@ -960,7 +832,7 @@ bool wxPropertyListValidator::OnSelect(bool select, wxProperty *property, wxProp
 bool wxPropertyListValidator::OnValueListSelect(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow))
 {
   wxString s(view->GetValueList()->GetStringSelection());
-  if (s != "")
+  if (s != wxT(""))
   {
     view->GetValueText()->SetValue(s);
     view->RetrieveProperty(property);
@@ -1006,9 +878,9 @@ bool wxPropertyListValidator::OnClearControls(wxProperty *WXUNUSED(property), wx
   return TRUE;
 }
 
-/*
- * Default validators
- */
+// ----------------------------------------------------------------------------
+// Default validators
+// ----------------------------------------------------------------------------
 
 IMPLEMENT_DYNAMIC_CLASS(wxRealListValidator, wxPropertyListValidator)
 
@@ -1027,9 +899,9 @@ bool wxRealListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPropert
   float val = 0.0;
   if (!StringToFloat(WXSTRINGCAST value, &val))
   {
-    char buf[200];
-    sprintf(buf, "Value %s is not a valid real number!", value.GetData());
-    wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
+    wxChar buf[200];
+    wxSprintf(buf, wxT("Value %s is not a valid real number!"), value.GetData());
+    wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
     return FALSE;
   }
 
@@ -1051,11 +923,11 @@ bool wxRealListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListVi
   if (!view->GetValueText())
     return FALSE;
 
-  if (strlen(view->GetValueText()->GetValue()) == 0)
+  if (wxStrlen(view->GetValueText()->GetValue()) == 0)
     return FALSE;
 
   wxString value(view->GetValueText()->GetValue());
-  float f = (float)atof(value.GetData());
+  float f = (float)wxAtof(value.GetData());
   property->GetValue() = f;
   return TRUE;
 }
@@ -1090,16 +962,16 @@ bool wxIntegerListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxProp
   long val = 0;
   if (!StringToLong(WXSTRINGCAST value, &val))
   {
-    char buf[200];
-    sprintf(buf, "Value %s is not a valid integer!", value.GetData());
-    wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
+    wxChar buf[200];
+    wxSprintf(buf, wxT("Value %s is not a valid integer!"), value.GetData());
+    wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
     return FALSE;
   }
   if (val < m_integerMin || val > m_integerMax)
   {
-    char buf[200];
-    sprintf(buf, "Value must be an integer between %ld and %ld!", m_integerMin, m_integerMax);
-    wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
+    wxChar buf[200];
+    wxSprintf(buf, wxT("Value must be an integer between %ld and %ld!"), m_integerMin, m_integerMax);
+    wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
     return FALSE;
   }
   return TRUE;
@@ -1113,11 +985,11 @@ bool wxIntegerListValidator::OnRetrieveValue(wxProperty *property, wxPropertyLis
   if (!view->GetValueText())
     return FALSE;
 
-  if (strlen(view->GetValueText()->GetValue()) == 0)
+  if (wxStrlen(view->GetValueText()->GetValue()) == 0)
     return FALSE;
 
   wxString value(view->GetValueText()->GetValue());
-  long val = (long)atoi(value.GetData());
+  long val = (long)wxAtoi(value.GetData());
   property->GetValue() = (long)val;
   return TRUE;
 }
@@ -1145,9 +1017,9 @@ bool wxBoolListValidator::OnCheckValue(wxProperty *WXUNUSED(property), wxPropert
   if (!view->GetValueText())
     return FALSE;
   wxString value(view->GetValueText()->GetValue());
-  if (value != "True" && value != "False")
+  if (value != wxT("True") && value != wxT("False"))
   {
-    wxMessageBox("Value must be True or False!", "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow);
+    wxMessageBox(wxT("Value must be True or False!"), wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
     return FALSE;
   }
   return TRUE;
@@ -1161,12 +1033,12 @@ bool wxBoolListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListVi
   if (!view->GetValueText())
     return FALSE;
 
-  if (strlen(view->GetValueText()->GetValue()) == 0)
+  if (wxStrlen(view->GetValueText()->GetValue()) == 0)
     return FALSE;
 
   wxString value(view->GetValueText()->GetValue());
   bool boolValue = FALSE;
-  if (value == "True")
+  if (value == wxT("True"))
     boolValue = TRUE;
   else
     boolValue = FALSE;
@@ -1209,9 +1081,9 @@ bool wxBoolListValidator::OnPrepareDetailControls(wxProperty *WXUNUSED(property)
     view->ShowListBoxControl(TRUE);
     view->GetValueList()->Enable(TRUE);
 
-    view->GetValueList()->Append("True");
-    view->GetValueList()->Append("False");
-    char *currentString = copystring(view->GetValueText()->GetValue());
+    view->GetValueList()->Append(wxT("True"));
+    view->GetValueList()->Append(wxT("False"));
+    wxChar *currentString = copystring(view->GetValueText()->GetValue());
     view->GetValueList()->SetStringSelection(currentString);
     delete[] currentString;
   }
@@ -1300,7 +1172,7 @@ bool wxStringListValidator::OnDisplayValue(wxProperty *property, wxPropertyListV
     return FALSE;
   wxString str(property->GetValue().GetStringRepresentation());
   view->GetValueText()->SetValue(str);
-  if (m_strings && view->GetValueList() && view->GetValueList()->IsShown() && view->GetValueList()->Number() > 0)
+  if (m_strings && view->GetValueList() && view->GetValueList()->IsShown() && view->GetValueList()->GetCount() > 0)
   {
     view->GetValueList()->SetStringSelection(str);
   }
@@ -1346,11 +1218,11 @@ bool wxStringListValidator::OnPrepareDetailControls(wxProperty *property, wxProp
     wxNode *node = m_strings->First();
     while (node)
     {
-      char *s = (char *)node->Data();
+      wxChar *s = (wxChar *)node->Data();
       view->GetValueList()->Append(s);
       node = node->Next();
     }
-    char *currentString = property->GetValue().StringValue();
+    wxChar *currentString = property->GetValue().StringValue();
     view->GetValueList()->SetStringSelection(currentString);
   }
   return TRUE;
@@ -1382,17 +1254,17 @@ bool wxStringListValidator::OnDoubleClick(wxProperty *property, wxPropertyListVi
     return FALSE;
 
   wxNode *node = m_strings->First();
-  char *currentString = property->GetValue().StringValue();
+  wxChar *currentString = property->GetValue().StringValue();
   while (node)
   {
-    char *s = (char *)node->Data();
-    if (strcmp(s, currentString) == 0)
+    wxChar *s = (wxChar *)node->Data();
+    if (wxStrcmp(s, currentString) == 0)
     {
-      char *nextString = NULL;
+      wxChar *nextString = NULL;
       if (node->Next())
-        nextString = (char *)node->Next()->Data();
+        nextString = (wxChar *)node->Next()->Data();
       else
-        nextString = (char *)m_strings->First()->Data();
+        nextString = (wxChar *)m_strings->First()->Data();
       property->GetValue() = wxString(nextString);
       view->DisplayProperty(property);
       view->UpdatePropertyDisplayInList(property);
@@ -1414,7 +1286,7 @@ wxFilenameListValidator::wxFilenameListValidator(wxString message , wxString wil
 {
 }
 
-wxFilenameListValidator::~wxFilenameListValidator(void)
+wxFilenameListValidator::~wxFilenameListValidator()
 {
 }
 
@@ -1483,7 +1355,7 @@ void wxFilenameListValidator::OnEdit(wxProperty *property, wxPropertyListView *v
      m_filenameWildCard.GetData(),
      0,
      parentWindow);
-  if (s != "")
+  if (s != wxT(""))
   {
     property->GetValue() = s;
     view->DisplayProperty(property);
@@ -1502,7 +1374,7 @@ wxColourListValidator::wxColourListValidator(long flags):
 {
 }
 
-wxColourListValidator::~wxColourListValidator(void)
+wxColourListValidator::~wxColourListValidator()
 {
 }
 
@@ -1564,7 +1436,7 @@ void wxColourListValidator::OnEdit(wxProperty *property, wxPropertyListView *vie
   if (!view->GetValueText())
     return;
 
-  char *s = property->GetValue().StringValue();
+  wxChar *s = property->GetValue().StringValue();
   int r = 0;
   int g = 0;
   int b = 0;
@@ -1593,7 +1465,7 @@ void wxColourListValidator::OnEdit(wxProperty *property, wxPropertyListView *vie
     wxColourData retData = dialog.GetColourData();
     col = retData.GetColour();
 
-    char buf[7];
+    wxChar buf[7];
     wxDecToHex(col.Red(), buf);
     wxDecToHex(col.Green(), buf+2);
     wxDecToHex(col.Blue(), buf+4);
@@ -1670,13 +1542,13 @@ void wxListOfStringsListValidator::OnEdit(wxProperty *property, wxPropertyListVi
   wxPropertyValue *expr = property->GetValue().GetFirst();
   while (expr)
   {
-    char *s = expr->StringValue();
+    wxChar *s = expr->StringValue();
     if (s)
       stringList->Add(s);
     expr = expr->GetNext();
   }
 
-  wxString title("Editing ");
+  wxString title(wxT("Editing "));
   title += property->GetName();
 
   if (EditStringList(parentWindow, stringList, title.GetData()))
@@ -1686,7 +1558,7 @@ void wxListOfStringsListValidator::OnEdit(wxProperty *property, wxPropertyListVi
     wxNode *node = stringList->First();
     while (node)
     {
-      char *s = (char *)node->Data();
+      wxChar *s = (wxChar *)node->Data();
       oldValue.Append(new wxPropertyValue(s));
 
       node = node->Next();
@@ -1758,7 +1630,7 @@ class wxPropertyStringListEditorText: public wxTextCtrl
      wxTextCtrl(parent, id, val, pos, size, windowStyle, wxDefaultValidator, name)
   {
   }
-  void OnKillFocus(void)
+  void OnKillFocus()
   {
     wxPropertyStringListEditorDialog *dialog = (wxPropertyStringListEditorDialog *)GetParent();
     dialog->SaveCurrentSelection();
@@ -1768,7 +1640,7 @@ class wxPropertyStringListEditorText: public wxTextCtrl
 bool wxPropertyStringListEditorDialog::sm_dialogCancelled = FALSE;
 
 // Edit the string list.
-bool wxListOfStringsListValidator::EditStringList(wxWindow *parent, wxStringList *stringList, const char *title)
+bool wxListOfStringsListValidator::EditStringList(wxWindow *parent, wxStringList *stringList, const wxChar *title)
 {
   int largeButtonWidth = 60;
   int largeButtonHeight = 25;
@@ -1792,7 +1664,9 @@ bool wxListOfStringsListValidator::EditStringList(wxWindow *parent, wxStringList
   wxButton *cancelButton = new wxButton(dialog, wxID_CANCEL, "Cancel", wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
   wxButton *okButton = new wxButton(dialog, wxID_OK, "OK", wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight));
 
+#ifndef __WXGTK__
   okButton->SetDefault();
+#endif
 
   wxLayoutConstraints *c = new wxLayoutConstraints;
 
@@ -1884,7 +1758,7 @@ void wxPropertyStringListEditorDialog::OnDelete(wxCommandEvent& WXUNUSED(event))
     return;
 
   m_listBox->Delete(sel);
-  delete[] (char *)node->Data();
+  delete[] (wxChar *)node->Data();
   delete node;
   m_currentSelection = -1;
   m_stringText->SetValue("");
@@ -1894,9 +1768,9 @@ void wxPropertyStringListEditorDialog::OnAdd(wxCommandEvent& WXUNUSED(event))
 {
   SaveCurrentSelection();
 
-  char *initialText = "";
+  wxChar *initialText = wxT("");
   wxNode *node = m_stringList->Add(initialText);
-  m_listBox->Append(initialText, (char *)node);
+  m_listBox->Append(initialText, (void *)node);
   m_currentSelection = m_stringList->Number() - 1;
   m_listBox->SetSelection(m_currentSelection);
   ShowCurrentSelection();
@@ -1927,13 +1801,15 @@ void wxPropertyStringListEditorDialog::OnText(wxCommandEvent& event)
   }
 }
 
-void wxPropertyStringListEditorDialog::OnCloseWindow(wxCloseEvent& event)
+void
+wxPropertyStringListEditorDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
 {
   SaveCurrentSelection();
-  this->Destroy();
+
+  Destroy();
 }
 
-void wxPropertyStringListEditorDialog::SaveCurrentSelection(void)
+void wxPropertyStringListEditorDialog::SaveCurrentSelection()
 {
   if (m_currentSelection == -1)
     return;
@@ -1950,7 +1826,7 @@ void wxPropertyStringListEditorDialog::SaveCurrentSelection(void)
   m_listBox->SetString(m_currentSelection, (char *)node->Data());
 }
 
-void wxPropertyStringListEditorDialog::ShowCurrentSelection(void)
+void wxPropertyStringListEditorDialog::ShowCurrentSelection()
 {
   if (m_currentSelection == -1)
   {
@@ -1963,3 +1839,47 @@ void wxPropertyStringListEditorDialog::ShowCurrentSelection(void)
   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("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("cross_bmp", wxBITMAP_TYPE_RESOURCE);
+        #else // XPMs
+            s_crossBitmap =  new wxBitmap( cross_xpm );
+        #endif // BMPs/XPMs
+    }
+
+    return s_crossBitmap;
+}
+
+#endif // wxUSE_PROPSHEET