]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/propgrid/sampleprops.cpp
Support using GetTextExtent() with empty string to get descent in wxOSX.
[wxWidgets.git] / samples / propgrid / sampleprops.cpp
index 18b608fbc534a43f604614e902cabe2755ef9af3..61438b748808e430e8a6c3e6e320e9c663e809d3 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     2006-03-05
 // RCS-ID:      $Id$
 // Copyright:   (c) Jaakko Salli
 // Created:     2006-03-05
 // RCS-ID:      $Id$
 // Copyright:   (c) Jaakko Salli
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // For compilers that support precompilation, includes "wx/wx.h".
 /////////////////////////////////////////////////////////////////////////////
 
 // For compilers that support precompilation, includes "wx/wx.h".
@@ -22,6 +22,8 @@
     #include "wx/wx.h"
 #endif
 
     #include "wx/wx.h"
 #endif
 
+#include "wx/fontdlg.h"
+
 // -----------------------------------------------------------------------
 
 
 // -----------------------------------------------------------------------
 
 
@@ -46,8 +48,6 @@ bool operator == (const wxFontData&, const wxFontData&)
 // Custom version of wxFontProperty that also holds colour in the value.
 // Original version by Vladimir Vainer.
 
 // Custom version of wxFontProperty that also holds colour in the value.
 // Original version by Vladimir Vainer.
 
-#include <wx/fontdlg.h>
-
 IMPLEMENT_VARIANT_OBJECT_SHALLOWCMP(wxFontData)
 
 WX_PG_IMPLEMENT_PROPERTY_CLASS(wxFontDataProperty,wxFontProperty,
 IMPLEMENT_VARIANT_OBJECT_SHALLOWCMP(wxFontData)
 
 WX_PG_IMPLEMENT_PROPERTY_CLASS(wxFontDataProperty,wxFontProperty,
@@ -60,7 +60,7 @@ wxFontDataProperty::wxFontDataProperty( const wxString& label, const wxString& n
 
     // Fix value.
     fontData.SetChosenFont(value.GetInitialFont());
 
     // Fix value.
     fontData.SetChosenFont(value.GetInitialFont());
-    if ( !fontData.GetColour().Ok() )
+    if ( !fontData.GetColour().IsOk() )
         fontData.SetColour(*wxBLACK);
 
     // Set initial value - should be done in a simpler way like this
         fontData.SetColour(*wxBLACK);
 
     // Set initial value - should be done in a simpler way like this
@@ -113,7 +113,7 @@ void wxFontDataProperty::OnSetValue()
         fontData << m_value_wxFontData;
 
         wxFont font = fontData.GetChosenFont();
         fontData << m_value_wxFontData;
 
         wxFont font = fontData.GetChosenFont();
-        if ( !font.Ok() )
+        if ( !font.IsOk() )
             font = wxFont(10,wxSWISS,wxNORMAL,wxNORMAL);
 
         m_value = WXVARIANT(font);
             font = wxFont(10,wxSWISS,wxNORMAL,wxNORMAL);
 
         m_value = WXVARIANT(font);
@@ -277,7 +277,8 @@ wxVariant wxPointProperty::ChildChanged( wxVariant& thisValue,
 // Dirs Property
 // -----------------------------------------------------------------------
 
 // Dirs Property
 // -----------------------------------------------------------------------
 
-WX_PG_IMPLEMENT_ARRAYSTRING_PROPERTY_WITH_VALIDATOR(wxDirsProperty,wxT(','),wxT("Browse"))
+WX_PG_IMPLEMENT_ARRAYSTRING_PROPERTY_WITH_VALIDATOR(wxDirsProperty, ',',
+                                                    "Browse")
 
 #if wxUSE_VALIDATORS
 
 
 #if wxUSE_VALIDATORS
 
@@ -314,7 +315,7 @@ bool wxDirsProperty::OnCustomStringEdit( wxWindow* parent, wxString& value )
 // by replacing each ArrayDouble with ArrayXXX.
 //
 
 // by replacing each ArrayDouble with ArrayXXX.
 //
 
-class wxArrayDoubleEditorDialog : public wxArrayEditorDialog
+class wxArrayDoubleEditorDialog : public wxPGArrayEditorDialog
 {
 public:
     wxArrayDoubleEditorDialog();
 {
 public:
     wxArrayDoubleEditorDialog();
@@ -368,7 +369,7 @@ private:
     DECLARE_DYNAMIC_CLASS_NO_COPY(wxArrayDoubleEditorDialog)
 };
 
     DECLARE_DYNAMIC_CLASS_NO_COPY(wxArrayDoubleEditorDialog)
 };
 
-IMPLEMENT_DYNAMIC_CLASS(wxArrayDoubleEditorDialog, wxArrayEditorDialog)
+IMPLEMENT_DYNAMIC_CLASS(wxArrayDoubleEditorDialog, wxPGArrayEditorDialog)
 
 //
 // Array dialog array access and manipulation
 
 //
 // Array dialog array access and manipulation
@@ -426,14 +427,14 @@ void wxArrayDoubleEditorDialog::ArraySwap( size_t first, size_t second )
 //
 
 wxArrayDoubleEditorDialog::wxArrayDoubleEditorDialog()
 //
 
 wxArrayDoubleEditorDialog::wxArrayDoubleEditorDialog()
-    : wxArrayEditorDialog()
+    : wxPGArrayEditorDialog()
 {
     Init();
 }
 
 void wxArrayDoubleEditorDialog::Init()
 {
 {
     Init();
 }
 
 void wxArrayDoubleEditorDialog::Init()
 {
-    wxArrayEditorDialog::Init();
+    wxPGArrayEditorDialog::Init();
     SetPrecision(-1);
 }
 
     SetPrecision(-1);
 }
 
@@ -444,7 +445,7 @@ wxArrayDoubleEditorDialog::wxArrayDoubleEditorDialog(wxWindow *parent,
                               long style,
                               const wxPoint& pos,
                               const wxSize& sz )
                               long style,
                               const wxPoint& pos,
                               const wxSize& sz )
-                              : wxArrayEditorDialog()
+                              : wxPGArrayEditorDialog()
 {
     Init();
     Create(parent,message,caption,array,style,pos,sz);
 {
     Init();
     Create(parent,message,caption,array,style,pos,sz);
@@ -461,7 +462,7 @@ bool wxArrayDoubleEditorDialog::Create(wxWindow *parent,
 
     m_array = array;
 
 
     m_array = array;
 
-    return wxArrayEditorDialog::Create (parent,message,caption,style,pos,sz);
+    return wxPGArrayEditorDialog::Create (parent,message,caption,style,pos,sz);
 }
 
 // -----------------------------------------------------------------------
 }
 
 // -----------------------------------------------------------------------
@@ -617,7 +618,7 @@ bool wxArrayDoubleProperty::StringToValue( wxVariant& variant, const wxString& t
 
     WX_PG_TOKENIZER1_BEGIN(text,delimiter)
 
 
     WX_PG_TOKENIZER1_BEGIN(text,delimiter)
 
-        if ( token.length() )
+        if ( !token.empty() )
         {
 
             // If token was invalid, exit the loop now
         {
 
             // If token was invalid, exit the loop now