]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/propgrid/sampleprops.cpp
Use template class instead of template function in wxVectorSort().
[wxWidgets.git] / samples / propgrid / sampleprops.cpp
index 5791ebae837293d458478d38d7bec75872f66dbe..18b608fbc534a43f604614e902cabe2755ef9af3 100644 (file)
@@ -67,11 +67,9 @@ wxFontDataProperty::wxFontDataProperty( const wxString& label, const wxString& n
     // (instead of calling SetValue) in derived (wxObject) properties.
     m_value_wxFontData << value;
 
     // (instead of calling SetValue) in derived (wxObject) properties.
     m_value_wxFontData << value;
 
-    SetParentalType(wxPG_PROP_AGGREGATE);
-
     // Add extra children.
     // Add extra children.
-    AddChild( new wxColourProperty(_("Colour"), wxPG_LABEL,
-                                   fontData.GetColour() ) );
+    AddPrivateChild( new wxColourProperty(_("Colour"), wxPG_LABEL,
+                                          fontData.GetColour() ) );
 }
 
 wxFontDataProperty::~wxFontDataProperty () { }
 }
 
 wxFontDataProperty::~wxFontDataProperty () { }
@@ -163,7 +161,9 @@ void wxFontDataProperty::RefreshChildren()
     Item(6)->SetValue( variant );
 }
 
     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;
 {
     wxFontData fontData;
     fontData << thisValue;
@@ -185,7 +185,9 @@ void wxFontDataProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxV
             fontData.SetChosenFont(font);
     }
 
             fontData.SetChosenFont(font);
     }
 
-    thisValue << fontData;
+    wxVariant newVariant;
+    newVariant << fontData;
+    return newVariant;
 }
 
 // -----------------------------------------------------------------------
 }
 
 // -----------------------------------------------------------------------
@@ -199,9 +201,8 @@ wxSizeProperty::wxSizeProperty( const wxString& label, const wxString& name,
     const wxSize& value) : wxPGProperty(label,name)
 {
     SetValueI(value);
     const wxSize& value) : wxPGProperty(label,name)
 {
     SetValueI(value);
-    SetParentalType(wxPG_PROP_AGGREGATE);
-    AddChild( new wxIntProperty(wxT("Width"),wxPG_LABEL,value.x) );
-    AddChild( new wxIntProperty(wxT("Height"),wxPG_LABEL,value.y) );
+    AddPrivateChild( new wxIntProperty(wxT("Width"),wxPG_LABEL,value.x) );
+    AddPrivateChild( new wxIntProperty(wxT("Height"),wxPG_LABEL,value.y) );
 }
 
 wxSizeProperty::~wxSizeProperty() { }
 }
 
 wxSizeProperty::~wxSizeProperty() { }
@@ -214,15 +215,20 @@ void wxSizeProperty::RefreshChildren()
     Item(1)->SetValue( (long)size.y );
 }
 
     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);
 {
     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;
     }
     switch ( childIndex )
     {
         case 0: size.x = val; break;
         case 1: size.y = val; break;
     }
+    wxVariant newVariant;
+    newVariant << size;
+    return newVariant;
 }
 
 // -----------------------------------------------------------------------
 }
 
 // -----------------------------------------------------------------------
@@ -236,9 +242,8 @@ wxPointProperty::wxPointProperty( const wxString& label, const wxString& name,
     const wxPoint& value) : wxPGProperty(label,name)
 {
     SetValueI(value);
     const wxPoint& value) : wxPGProperty(label,name)
 {
     SetValueI(value);
-    SetParentalType(wxPG_PROP_AGGREGATE);
-    AddChild( new wxIntProperty(wxT("X"),wxPG_LABEL,value.x) );
-    AddChild( new wxIntProperty(wxT("Y"),wxPG_LABEL,value.y) );
+    AddPrivateChild( new wxIntProperty(wxT("X"),wxPG_LABEL,value.x) );
+    AddPrivateChild( new wxIntProperty(wxT("Y"),wxPG_LABEL,value.y) );
 }
 
 wxPointProperty::~wxPointProperty() { }
 }
 
 wxPointProperty::~wxPointProperty() { }
@@ -251,15 +256,20 @@ void wxPointProperty::RefreshChildren()
     Item(1)->SetValue( (long)point.y );
 }
 
     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);
 {
     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;
     }
     switch ( childIndex )
     {
         case 0: point.x = val; break;
         case 1: point.y = val; break;
     }
+    wxVariant newVariant;
+    newVariant << point;
+    return newVariant;
 }
 
 
 }