X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/48a32cf671d960423138e567ae6835449d7dbd51..ddd7e4307b4a58a21e8a5eb04afe06e1fe65f7d8:/samples/propgrid/sampleprops.cpp diff --git a/samples/propgrid/sampleprops.cpp b/samples/propgrid/sampleprops.cpp index e7c29c9d19..cc68db21f6 100644 --- a/samples/propgrid/sampleprops.cpp +++ b/samples/propgrid/sampleprops.cpp @@ -6,7 +6,7 @@ // 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". @@ -22,6 +22,8 @@ #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. -#include - IMPLEMENT_VARIANT_OBJECT_SHALLOWCMP(wxFontData) WX_PG_IMPLEMENT_PROPERTY_CLASS(wxFontDataProperty,wxFontProperty, @@ -161,7 +161,9 @@ void wxFontDataProperty::RefreshChildren() Item(6)->SetValue( variant ); } -void wxFontDataProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const +wxVariant wxFontDataProperty::ChildChanged( wxVariant& thisValue, + int childIndex, + wxVariant& childValue ) const { wxFontData fontData; fontData << thisValue; @@ -183,7 +185,9 @@ void wxFontDataProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxV fontData.SetChosenFont(font); } - thisValue << fontData; + wxVariant newVariant; + newVariant << fontData; + return newVariant; } // ----------------------------------------------------------------------- @@ -211,15 +215,20 @@ void wxSizeProperty::RefreshChildren() Item(1)->SetValue( (long)size.y ); } -void wxSizeProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const +wxVariant wxSizeProperty::ChildChanged( wxVariant& thisValue, + int childIndex, + wxVariant& childValue ) const { wxSize& size = wxSizeRefFromVariant(thisValue); - int val = wxPGVariantToInt(childValue); + int val = childValue.GetLong(); switch ( childIndex ) { case 0: size.x = val; break; case 1: size.y = val; break; } + wxVariant newVariant; + newVariant << size; + return newVariant; } // ----------------------------------------------------------------------- @@ -247,15 +256,20 @@ void wxPointProperty::RefreshChildren() Item(1)->SetValue( (long)point.y ); } -void wxPointProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const +wxVariant wxPointProperty::ChildChanged( wxVariant& thisValue, + int childIndex, + wxVariant& childValue ) const { wxPoint& point = wxPointRefFromVariant(thisValue); - int val = wxPGVariantToInt(childValue); + int val = childValue.GetLong(); switch ( childIndex ) { case 0: point.x = val; break; case 1: point.y = val; break; } + wxVariant newVariant; + newVariant << point; + return newVariant; } @@ -263,7 +277,8 @@ void wxPointProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVari // 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 @@ -300,7 +315,7 @@ bool wxDirsProperty::OnCustomStringEdit( wxWindow* parent, wxString& value ) // by replacing each ArrayDouble with ArrayXXX. // -class wxArrayDoubleEditorDialog : public wxArrayEditorDialog +class wxArrayDoubleEditorDialog : public wxPGArrayEditorDialog { public: wxArrayDoubleEditorDialog(); @@ -354,7 +369,7 @@ private: DECLARE_DYNAMIC_CLASS_NO_COPY(wxArrayDoubleEditorDialog) }; -IMPLEMENT_DYNAMIC_CLASS(wxArrayDoubleEditorDialog, wxArrayEditorDialog) +IMPLEMENT_DYNAMIC_CLASS(wxArrayDoubleEditorDialog, wxPGArrayEditorDialog) // // Array dialog array access and manipulation @@ -412,14 +427,14 @@ void wxArrayDoubleEditorDialog::ArraySwap( size_t first, size_t second ) // wxArrayDoubleEditorDialog::wxArrayDoubleEditorDialog() - : wxArrayEditorDialog() + : wxPGArrayEditorDialog() { Init(); } void wxArrayDoubleEditorDialog::Init() { - wxArrayEditorDialog::Init(); + wxPGArrayEditorDialog::Init(); SetPrecision(-1); } @@ -430,7 +445,7 @@ wxArrayDoubleEditorDialog::wxArrayDoubleEditorDialog(wxWindow *parent, long style, const wxPoint& pos, const wxSize& sz ) - : wxArrayEditorDialog() + : wxPGArrayEditorDialog() { Init(); Create(parent,message,caption,array,style,pos,sz); @@ -447,7 +462,7 @@ bool wxArrayDoubleEditorDialog::Create(wxWindow *parent, m_array = array; - return wxArrayEditorDialog::Create (parent,message,caption,style,pos,sz); + return wxPGArrayEditorDialog::Create (parent,message,caption,style,pos,sz); } // ----------------------------------------------------------------------- @@ -603,7 +618,7 @@ bool wxArrayDoubleProperty::StringToValue( wxVariant& variant, const wxString& t WX_PG_TOKENIZER1_BEGIN(text,delimiter) - if ( token.length() ) + if ( !token.empty() ) { // If token was invalid, exit the loop now