wxPGProperty::AddChild() can now be used to add normal child properties (previously it was only used to add private children of derived property classes such as wxFontProperty and wxFlagsProperty). However, to allow backwards compatibility, SetParentalStyle(wxPG_PROP_MISC_PARENT) needs to be called before doing so. Also done: merged property initialization code from PrepareToAddItem() and PrepareSubProperties() to InitAfterAdded().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56309 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2008-10-14 17:15:59 +00:00
parent c8c86bd0ba
commit 2fd4a52415
11 changed files with 261 additions and 201 deletions

View File

@@ -476,6 +476,7 @@ wxVectorProperty::wxVectorProperty( const wxString& label,
: wxPGProperty(label,name)
{
SetValue( WXVARIANT(value) );
SetParentalType(wxPG_PROP_AGGREGATE);
AddChild( new wxFloatProperty(wxT("X"),wxPG_LABEL,value.x) );
AddChild( new wxFloatProperty(wxT("Y"),wxPG_LABEL,value.y) );
AddChild( new wxFloatProperty(wxT("Z"),wxPG_LABEL,value.z) );
@@ -524,6 +525,7 @@ wxTriangleProperty::wxTriangleProperty( const wxString& label,
: wxPGProperty(label,name)
{
SetValue( WXVARIANT(value) );
SetParentalType(wxPG_PROP_AGGREGATE);
AddChild( new wxVectorProperty(wxT("A"),wxPG_LABEL,value.a) );
AddChild( new wxVectorProperty(wxT("B"),wxPG_LABEL,value.b) );
AddChild( new wxVectorProperty(wxT("C"),wxPG_LABEL,value.c) );
@@ -1683,11 +1685,21 @@ void FormMain::PopulateWithExamples ()
//
// Test how non-editable composite strings appear
pid = pg->Append( new wxStringProperty(wxT("wxWidgets Traits"), wxPG_LABEL, wxT("<composed>")) );
pid = new wxStringProperty(wxT("wxWidgets Traits"), wxPG_LABEL, wxT("<composed>"));
pg->SetPropertyReadOnly(pid);
pg->AppendIn(pid, new wxStringProperty(wxT("Latest Release"), wxPG_LABEL, wxT("2.8.8")) );
pg->AppendIn(pid, new wxBoolProperty(wxT("Win API"), wxPG_LABEL, true) );
//
// For testing purposes, combine two methods of adding children
//
// AddChild() requires that we call this
pid->SetParentalType(wxPG_PROP_MISC_PARENT);
pid->AddChild( new wxStringProperty(wxT("Latest Release"), wxPG_LABEL, wxT("2.8.8")));
pid->AddChild( new wxBoolProperty(wxT("Win API"), wxPG_LABEL, true) );
pg->Append( pid );
pg->AppendIn(pid, new wxBoolProperty(wxT("QT"), wxPG_LABEL, false) );
pg->AppendIn(pid, new wxBoolProperty(wxT("Cocoa"), wxPG_LABEL, true) );
pg->AppendIn(pid, new wxBoolProperty(wxT("BeOS"), wxPG_LABEL, false) );