Added virtual wxPGProperty::ValueToString(). In derived property classes, now it must be implemented instead of GetValueAsString (assertion failure is raised at run-time if you fail to do so). This change is needed to properly support wxEVT_PG_CHANGING for nested composite string properties. wxPGProperty::GenerateComposedValue() partially updated to support this.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56363 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2008-10-16 17:19:50 +00:00
parent f7ca1dd416
commit 1425eca550
12 changed files with 388 additions and 167 deletions

View File

@@ -287,6 +287,7 @@ void wxAdvImageFileProperty::OnSetValue()
if ( imagename.length() )
{
wxFileName filename = GetFileName();
size_t prevCount = g_myImageArray.GetCount();
int index = ms_choices.Index(imagename);
@@ -294,7 +295,7 @@ void wxAdvImageFileProperty::OnSetValue()
if ( index == wxNOT_FOUND )
{
ms_choices.Add( imagename );
g_myImageArray.Add( new wxMyImageInfo( m_filename.GetFullPath() ) );
g_myImageArray.Add( new wxMyImageInfo( filename.GetFullPath() ) );
index = g_myImageArray.GetCount() - 1;
}
@@ -303,8 +304,8 @@ void wxAdvImageFileProperty::OnSetValue()
if ( !g_myImageArray[index].m_pThumbnail2 )
{
// Load if file exists.
if ( m_filename.FileExists() )
m_pImage = new wxImage( m_filename.GetFullPath() );
if ( filename.FileExists() )
m_pImage = new wxImage( filename.GetFullPath() );
}
m_index = index;
@@ -365,9 +366,10 @@ void wxAdvImageFileProperty::LoadThumbnails( size_t index )
if ( !mii.m_pThumbnail2 )
{
wxFileName filename = GetFileName();
if ( !m_pImage || !m_pImage->Ok() ||
m_filename != mii.m_path
filename != mii.m_path
)
{
if ( m_pImage )

View File

@@ -513,16 +513,29 @@ wxArrayDoubleProperty::~wxArrayDoubleProperty () { }
void wxArrayDoubleProperty::OnSetValue()
{
// Generate cached display string, to optimize grid drawing
GenerateValueAsString( m_display, m_precision, true );
}
wxString wxArrayDoubleProperty::GetValueAsString( int arg_flags ) const
wxString wxArrayDoubleProperty::ValueToString( wxVariant& value,
int argFlags ) const
{
if ( !(arg_flags & wxPG_FULL_VALUE ))
return m_display;
wxString s;
GenerateValueAsString(s,-1,false);
if ( argFlags & wxPG_FULL_VALUE )
{
GenerateValueAsString(s,-1,false);
}
else
{
//
// Display cached string only if value truly matches m_value
if ( value.GetData() == m_value.GetData() )
return m_display;
else
GenerateValueAsString( s, m_precision, true );
}
return s;
}

View File

@@ -113,7 +113,7 @@ public:
virtual ~wxArrayDoubleProperty ();
virtual void OnSetValue();
virtual wxString GetValueAsString( int argFlags = 0 ) const;
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
virtual bool StringToValue( wxVariant& variant,
const wxString& text,
int argFlags = 0 ) const;