コード例 #1
0
// wxString xsPropIO::ToString(T value) -> creates a string representation of the given value
wxString xsColourDataPropIO::ToString(wxColourData value)
{
    wxString out;

    out << xsColourPropIO::ToString(value.GetColour());
    for(int i = 0; i < 16; i++)
    {
        out << wxT("|") << xsColourPropIO::ToString(value.GetCustomColour(i));
    }

    return out;
}
コード例 #2
0
ファイル: CustomColors.cpp プロジェクト: pthiben/Helium
///////////////////////////////////////////////////////////////////////////////
// Iterates over all the custom colors in colorData and builds a delimited
// string representation of the information.  This information can be persisted
// by the application and reloaded later by calling Load.
// 
tstring CustomColors::Save( wxColourData& colorData )
{
  tostringstream result;
  
  for ( i32 colorIndex = 0; colorIndex < NumColors; ++colorIndex )
  {
    if ( colorIndex > 0 )
    {
      result << s_ColorDelimiter;
    }

    const wxColour& color = colorData.GetCustomColour( colorIndex );
    if ( color.IsOk() )
    {
      // GetAsString returns HTML format (example: #FF00FF).  Strip the leading #.
      result << color.GetAsString( wxC2S_HTML_SYNTAX ).substr( 1 ).c_str();
    }
  }

  return result.str();
}