adding a string for private data identification
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35277 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -27,10 +27,9 @@ public:
|
|||||||
{ SetId(vFormat); return *this; }
|
{ SetId(vFormat); return *this; }
|
||||||
|
|
||||||
// comparison (must have both versions)
|
// comparison (must have both versions)
|
||||||
bool operator==(NativeFormat format) const
|
bool operator==(const wxDataFormat& format) const ;
|
||||||
{ return m_format == (NativeFormat)format; }
|
bool operator!=(const wxDataFormat& format) const
|
||||||
bool operator!=(NativeFormat format) const
|
{ return ! ( *this != format ); }
|
||||||
{ return m_format != (NativeFormat)format; }
|
|
||||||
bool operator==(wxDataFormatId format) const
|
bool operator==(wxDataFormatId format) const
|
||||||
{ return m_type == (wxDataFormatId)format; }
|
{ return m_type == (wxDataFormatId)format; }
|
||||||
bool operator!=(wxDataFormatId format) const
|
bool operator!=(wxDataFormatId format) const
|
||||||
@@ -53,9 +52,13 @@ public:
|
|||||||
wxDataFormatId GetType() const { return m_type; }
|
wxDataFormatId GetType() const { return m_type; }
|
||||||
void SetType( wxDataFormatId type );
|
void SetType( wxDataFormatId type );
|
||||||
|
|
||||||
|
// returns true if the format is one of those defined in wxDataFormatId
|
||||||
|
bool IsStandard() const { return m_format > 0 && m_format < wxDF_PRIVATE; }
|
||||||
private:
|
private:
|
||||||
wxDataFormatId m_type;
|
wxDataFormatId m_type;
|
||||||
NativeFormat m_format;
|
NativeFormat m_format;
|
||||||
|
// indicates the type in case of wxDF_PRIVATE :
|
||||||
|
wxString m_id ;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _WX_MAC_DATAFORM_H
|
#endif // _WX_MAC_DATAFORM_H
|
||||||
|
@@ -99,13 +99,10 @@ void wxDataFormat::SetType( wxDataFormatId Type )
|
|||||||
|
|
||||||
wxString wxDataFormat::GetId() const
|
wxString wxDataFormat::GetId() const
|
||||||
{
|
{
|
||||||
// note that m_format is not a pointer to string, it *is* itself a 4
|
wxCHECK_MSG( !IsStandard(), wxEmptyString ,
|
||||||
// character string
|
wxT("name of predefined format cannot be retrieved") );
|
||||||
char text[5] ;
|
|
||||||
strncpy( text , (char*) &m_format , 4 ) ;
|
|
||||||
text[4] = 0 ;
|
|
||||||
|
|
||||||
return wxString::FromAscii( text ) ;
|
return m_id ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDataFormat::SetId( NativeFormat format )
|
void wxDataFormat::SetId( NativeFormat format )
|
||||||
@@ -121,13 +118,32 @@ void wxDataFormat::SetId( NativeFormat format )
|
|||||||
else if (m_format == kDragFlavorTypeHFS )
|
else if (m_format == kDragFlavorTypeHFS )
|
||||||
m_type = wxDF_FILENAME;
|
m_type = wxDF_FILENAME;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_type = wxDF_PRIVATE;
|
m_type = wxDF_PRIVATE;
|
||||||
|
char text[5] ;
|
||||||
|
strncpy( text , (char*) &format , 4 ) ;
|
||||||
|
text[4] = 0 ;
|
||||||
|
m_id = wxString::FromAscii( text ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDataFormat::SetId( const wxChar* zId )
|
void wxDataFormat::SetId( const wxChar* zId )
|
||||||
{
|
{
|
||||||
m_type = wxDF_PRIVATE;
|
m_type = wxDF_PRIVATE;
|
||||||
m_format = 0;// TODO: get the format gdk_atom_intern( wxMBSTRINGCAST tmp.mbc_str(), FALSE );
|
m_id = zId ;
|
||||||
|
m_format = 'WXPR' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxDataFormat::operator==(const wxDataFormat& format) const
|
||||||
|
{
|
||||||
|
if ( IsStandard() || format.IsStandard() )
|
||||||
|
{
|
||||||
|
return ( format.m_type == m_type ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ( m_id == format.m_id ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user