Refactor wxMultiChoiceProperty::GenerateValueAsString()
Because this function produces a string value it would more intuitive to just to return this string as a function value instead of passing it through the parameter.
This commit is contained in:
@@ -346,7 +346,14 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) wxOVERRIDE;
|
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) wxOVERRIDE;
|
||||||
|
|
||||||
void GenerateValueAsString( wxVariant& value, wxString* target ) const;
|
#if WXWIN_COMPATIBILITY_3_0
|
||||||
|
wxDEPRECATED_MSG("use function GenerateValueAsString(val) returning wxString")
|
||||||
|
void GenerateValueAsString( wxVariant& value, wxString* target ) const
|
||||||
|
{
|
||||||
|
*target = GenerateValueAsString(value);
|
||||||
|
}
|
||||||
|
#endif // WXWIN_COMPATIBILITY_3_0
|
||||||
|
wxString GenerateValueAsString(const wxVariant& value) const;
|
||||||
|
|
||||||
// Returns translation of values into string indices.
|
// Returns translation of values into string indices.
|
||||||
wxArrayInt GetValueAsIndices() const;
|
wxArrayInt GetValueAsIndices() const;
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value);
|
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value);
|
||||||
|
|
||||||
void GenerateValueAsString( wxVariant& value, wxString* target ) const;
|
wxString GenerateValueAsString(const wxVariant& value) const;
|
||||||
|
|
||||||
// Returns translation of values into string indices.
|
// Returns translation of values into string indices.
|
||||||
wxArrayInt GetValueAsIndices() const;
|
wxArrayInt GetValueAsIndices() const;
|
||||||
|
|||||||
@@ -1966,7 +1966,7 @@ wxMultiChoiceProperty::~wxMultiChoiceProperty()
|
|||||||
|
|
||||||
void wxMultiChoiceProperty::OnSetValue()
|
void wxMultiChoiceProperty::OnSetValue()
|
||||||
{
|
{
|
||||||
GenerateValueAsString(m_value, &m_display);
|
m_display = GenerateValueAsString(m_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxMultiChoiceProperty::ValueToString( wxVariant& value,
|
wxString wxMultiChoiceProperty::ValueToString( wxVariant& value,
|
||||||
@@ -1976,35 +1976,30 @@ wxString wxMultiChoiceProperty::ValueToString( wxVariant& value,
|
|||||||
if ( argFlags & wxPG_VALUE_IS_CURRENT )
|
if ( argFlags & wxPG_VALUE_IS_CURRENT )
|
||||||
return m_display;
|
return m_display;
|
||||||
|
|
||||||
wxString s;
|
return GenerateValueAsString(value);
|
||||||
GenerateValueAsString(value, &s);
|
|
||||||
return s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMultiChoiceProperty::GenerateValueAsString( wxVariant& value,
|
wxString wxMultiChoiceProperty::GenerateValueAsString(const wxVariant& value) const
|
||||||
wxString* target ) const
|
|
||||||
{
|
{
|
||||||
wxArrayString strings;
|
wxArrayString strings;
|
||||||
|
|
||||||
if ( value.IsType(wxPG_VARIANT_TYPE_ARRSTRING) )
|
if ( value.IsType(wxPG_VARIANT_TYPE_ARRSTRING) )
|
||||||
strings = value.GetArrayString();
|
strings = value.GetArrayString();
|
||||||
|
|
||||||
wxString& tempStr = *target;
|
const size_t itemCount = strings.size();
|
||||||
|
|
||||||
size_t itemCount = strings.size();
|
wxString valStr;
|
||||||
|
|
||||||
tempStr.Empty();
|
|
||||||
|
|
||||||
if ( itemCount )
|
|
||||||
tempStr.append( wxS("\"") );
|
|
||||||
|
|
||||||
for ( size_t i = 0; i < itemCount; i++ )
|
for ( size_t i = 0; i < itemCount; i++ )
|
||||||
{
|
{
|
||||||
tempStr.append( strings[i] );
|
valStr.append("\"");
|
||||||
tempStr.append( wxS("\"") );
|
valStr.append(strings[i]);
|
||||||
if ( i < (itemCount-1) )
|
valStr.append("\"");
|
||||||
tempStr.append ( wxS(" \"") );
|
if ( i < (itemCount - 1) )
|
||||||
|
valStr.append(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return valStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxArrayInt wxMultiChoiceProperty::GetValueAsIndices() const
|
wxArrayInt wxMultiChoiceProperty::GetValueAsIndices() const
|
||||||
|
|||||||
Reference in New Issue
Block a user