use wxString, not wxChar*, in wxDataFormat ctor and SetId() method

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46254 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2007-05-30 22:02:19 +00:00
parent b9b8b59c0d
commit a1eb65c246
16 changed files with 25 additions and 63 deletions

View File

@@ -16,7 +16,7 @@ class wxDataFormat
{
public:
wxDataFormat(unsigned int uFormat = wxDF_INVALID) { m_uFormat = uFormat; }
wxDataFormat(const wxChar* zFormat) { SetId(zFormat); }
wxDataFormat(const wxString& zFormat) { SetId(zFormat); }
wxDataFormat& operator=(unsigned int uFormat) { m_uFormat = uFormat; return(*this); }
wxDataFormat& operator=(const wxDataFormat& rFormat) {m_uFormat = rFormat.m_uFormat; return(*this); }
@@ -42,7 +42,7 @@ public:
// application-specific formats
//
wxString GetId(void) const;
void SetId(const wxChar* WXUNUSED(pId)) { /* TODO */ }
void SetId(const wxString& WXUNUSED(pId)) { /* TODO */ }
private:
unsigned int m_uFormat;

View File

@@ -55,7 +55,7 @@ public:
typedef <integral type> NativeFormat;
wxDataFormat(NativeFormat format = wxDF_INVALID);
wxDataFormat(const wxChar *format);
wxDataFormat(const wxString& format);
wxDataFormat& operator=(NativeFormat format);
wxDataFormat& operator=(const wxDataFormat& format);
@@ -67,7 +67,7 @@ public:
NativeFormat GetType() const;
wxString GetId() const;
void SetId(const wxChar *format);
void SetId(const wxString& format);
};
*/

View File

@@ -21,7 +21,6 @@ public:
wxDataFormat();
wxDataFormat( wxDataFormatId type );
wxDataFormat( const wxString &id );
wxDataFormat( const wxChar *id );
wxDataFormat( NativeFormat format );
wxDataFormat& operator=(const wxDataFormat& format)
@@ -50,7 +49,7 @@ public:
// string ids are used for custom types - this SetId() must be used for
// application-specific formats
wxString GetId() const;
void SetId( const wxChar *id );
void SetId( const wxString& id );
// implementation
wxDataFormatId GetType() const;

View File

@@ -21,7 +21,6 @@ public:
wxDataFormat();
wxDataFormat( wxDataFormatId type );
wxDataFormat( const wxString &id );
wxDataFormat( const wxChar *id );
wxDataFormat( NativeFormat format );
wxDataFormat& operator=(const wxDataFormat& format)
@@ -50,7 +49,7 @@ public:
// string ids are used for custom types - this SetId() must be used for
// application-specific formats
wxString GetId() const;
void SetId( const wxChar *id );
void SetId( const wxString& id );
// implementation
wxDataFormatId GetType() const;

View File

@@ -20,7 +20,6 @@ public:
wxDataFormat();
wxDataFormat(wxDataFormatId vType);
wxDataFormat(const wxString& rId);
wxDataFormat(const wxChar* pId);
wxDataFormat(NativeFormat vFormat);
wxDataFormat& operator=(NativeFormat vFormat)
@@ -46,7 +45,7 @@ public:
// string ids are used for custom types - this SetId() must be used for
// application-specific formats
wxString GetId() const;
void SetId(const wxChar* pId);
void SetId(const wxString& pId);
// implementation
wxDataFormatId GetType() const { return m_type; }

View File

@@ -21,7 +21,6 @@ public:
wxDataFormat();
wxDataFormat( wxDataFormatId type );
wxDataFormat( const wxString &id );
wxDataFormat( const wxChar *id );
wxDataFormat( NativeFormat format );
wxDataFormat& operator=(NativeFormat format)
@@ -48,7 +47,7 @@ public:
// string ids are used for custom types - this SetId() must be used for
// application-specific formats
wxString GetId() const;
void SetId( const wxChar *id );
void SetId( const wxString& id );
// implementation
wxDataFormatId GetType() const;

View File

@@ -23,7 +23,7 @@ public:
typedef unsigned short NativeFormat;
wxDataFormat(NativeFormat format = wxDF_INVALID) { m_format = format; }
wxDataFormat(const wxChar *format) { SetId(format); }
wxDataFormat(const wxString& format) { SetId(format); }
wxDataFormat& operator=(NativeFormat format)
{ m_format = format; return *this; }
@@ -55,7 +55,7 @@ public:
// string ids are used for custom types - this SetId() must be used for
// application-specific formats
wxString GetId() const;
void SetId(const wxChar *format);
void SetId(const wxString& format);
// returns true if the format is one of those defined in wxDataFormatId
bool IsStandard() const { return m_format > 0 && m_format < wxDF_PRIVATE; }

View File

@@ -16,7 +16,7 @@ class wxDataFormat
{
public:
wxDataFormat(unsigned int uFormat = wxDF_INVALID) { m_uFormat = uFormat; }
wxDataFormat(const wxChar* zFormat) { SetId(zFormat); }
wxDataFormat(const wxString& zFormat) { SetId(zFormat); }
wxDataFormat& operator=(unsigned int uFormat) { m_uFormat = uFormat; return(*this); }
wxDataFormat& operator=(const wxDataFormat& rFormat) {m_uFormat = rFormat.m_uFormat; return(*this); }
@@ -42,7 +42,7 @@ public:
// application-specific formats
//
wxString GetId(void) const;
void SetId(const wxChar* pId);
void SetId(const wxString& pId);
private:
unsigned int m_uFormat;

View File

@@ -21,7 +21,6 @@ public:
wxDataFormat();
wxDataFormat( wxDataFormatId type );
wxDataFormat( const wxString &id );
wxDataFormat( const wxChar *id );
wxDataFormat( NativeFormat format );
wxDataFormat& operator=(NativeFormat format)
@@ -48,7 +47,7 @@ public:
// string ids are used for custom types - this SetId() must be used for
// application-specific formats
wxString GetId() const;
void SetId( const wxChar *id );
void SetId( const wxString& id );
// implementation
wxDataFormatId GetType() const;

View File

@@ -58,12 +58,6 @@ wxDataFormat::wxDataFormat( wxDataFormatId type )
SetType( type );
}
wxDataFormat::wxDataFormat( const wxChar *id )
{
PrepareFormats();
SetId( id );
}
wxDataFormat::wxDataFormat( const wxString &id )
{
PrepareFormats();
@@ -138,12 +132,11 @@ void wxDataFormat::SetId( NativeFormat format )
m_type = wxDF_PRIVATE;
}
void wxDataFormat::SetId( const wxChar *id )
void wxDataFormat::SetId( const wxString& id )
{
PrepareFormats();
m_type = wxDF_PRIVATE;
wxString tmp( id );
m_format = gdk_atom_intern( (const char*) tmp.ToAscii(), FALSE );
m_format = gdk_atom_intern( id.ToAscii(), FALSE );
}
void wxDataFormat::PrepareFormats()

View File

@@ -58,12 +58,6 @@ wxDataFormat::wxDataFormat( wxDataFormatId type )
SetType( type );
}
wxDataFormat::wxDataFormat( const wxChar *id )
{
PrepareFormats();
SetId( id );
}
wxDataFormat::wxDataFormat( const wxString &id )
{
PrepareFormats();
@@ -140,12 +134,11 @@ void wxDataFormat::SetId( NativeFormat format )
m_type = wxDF_PRIVATE;
}
void wxDataFormat::SetId( const wxChar *id )
void wxDataFormat::SetId( const wxString& id )
{
PrepareFormats();
m_type = wxDF_PRIVATE;
wxString tmp( id );
m_format = gdk_atom_intern( (const char*) tmp.ToAscii(), FALSE );
m_format = gdk_atom_intern( id.ToAscii(), FALSE );
}
void wxDataFormat::PrepareFormats()

View File

@@ -49,11 +49,6 @@ wxDataFormat::wxDataFormat( wxDataFormatId vType )
SetType( vType );
}
wxDataFormat::wxDataFormat( const wxChar *zId )
{
SetId( zId );
}
wxDataFormat::wxDataFormat( const wxString& rId )
{
SetId( rId );
@@ -137,7 +132,7 @@ void wxDataFormat::SetId( NativeFormat format )
}
}
void wxDataFormat::SetId( const wxChar* zId )
void wxDataFormat::SetId( const wxString& zId )
{
m_type = wxDF_PRIVATE;
m_id = zId;

View File

@@ -61,12 +61,6 @@ wxDataFormat::wxDataFormat( wxDataFormatId type )
SetType( type );
}
wxDataFormat::wxDataFormat( const wxChar *id )
{
PrepareFormats();
SetId( id );
}
wxDataFormat::wxDataFormat( const wxString &id )
{
PrepareFormats();
@@ -129,13 +123,12 @@ void wxDataFormat::SetId( NativeFormat format )
m_type = wxDF_PRIVATE;
}
void wxDataFormat::SetId( const wxChar *id )
void wxDataFormat::SetId( const wxString& id )
{
PrepareFormats();
m_type = wxDF_PRIVATE;
wxString tmp( id );
m_format = XInternAtom( wxGlobalDisplay(),
tmp.mbc_str(), False );
id.mbc_str(), False );
}
void wxDataFormat::PrepareFormats()

View File

@@ -137,7 +137,7 @@ private:
// wxDataFormat
// ----------------------------------------------------------------------------
void wxDataFormat::SetId(const wxChar *format)
void wxDataFormat::SetId(const wxString& format)
{
m_format = (wxDataFormat::NativeFormat)::RegisterClipboardFormat(format);
if ( !m_format )

View File

@@ -57,11 +57,11 @@ wxString wxDataFormat::GetId() const
} // end of wxDataFormat::GetId()
void wxDataFormat::SetId (
const wxChar* zId
const wxString& zId
)
{
m_uFormat = ::WinAddAtom( ::WinQuerySystemAtomTable()
,(PSZ)zId
,zId.char_str()
);
} // end of wxDataFormat::SetId

View File

@@ -57,12 +57,6 @@ wxDataFormat::wxDataFormat( wxDataFormatId type )
SetType( type );
}
wxDataFormat::wxDataFormat( const wxChar *id )
{
PrepareFormats();
SetId( id );
}
wxDataFormat::wxDataFormat( const wxString &id )
{
PrepareFormats();
@@ -129,13 +123,12 @@ void wxDataFormat::SetId( NativeFormat format )
m_type = wxDF_PRIVATE;
}
void wxDataFormat::SetId( const wxChar *id )
void wxDataFormat::SetId( const wxString& id )
{
#if !wxUSE_NANOX
PrepareFormats();
m_type = wxDF_PRIVATE;
wxString tmp( id );
m_format = XInternAtom( (Display*) wxGetDisplay(), tmp.ToAscii(), FALSE );
m_format = XInternAtom( (Display*) wxGetDisplay(), id.ToAscii(), FALSE );
#endif
}