Add wxImage::CanRead, wasn't in 1.59 ?

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4047 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Sylvain Bougnoux 1999-10-18 14:18:15 +00:00
parent ae8b97cf4b
commit 87202f787c
2 changed files with 26 additions and 0 deletions

View File

@ -290,10 +290,12 @@ public:
unsigned char GetGreen( int x, int y );
unsigned char GetBlue( int x, int y );
static bool CanRead( const wxString& name );
virtual bool LoadFile( const wxString& name, long type = wxBITMAP_TYPE_ANY );
virtual bool LoadFile( const wxString& name, const wxString& mimetype );
#if wxUSE_STREAMS
static bool CanRead( wxInputStream& stream );
virtual bool LoadFile( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY );
virtual bool LoadFile( wxInputStream& stream, const wxString& mimetype );
#endif

View File

@ -437,7 +437,31 @@ bool wxImage::SaveFile( const wxString& filename, const wxString& mimetype )
return FALSE;
}
bool wxImage::CanRead( const wxString &name )
{
#if wxUSE_STREAMS
wxFileInputStream stream(name);
return CanRead(stream);
#else
return FALSE;
#endif
}
#if wxUSE_STREAMS
bool wxImage::CanRead( wxInputStream &stream )
{
wxList &list=GetHandlers();
for ( wxList::Node *node = list.GetFirst(); node; node = node->GetNext() )
{
wxImageHandler *handler=(wxImageHandler*)node->GetData();
if (handler->CanRead( stream ))
return TRUE;
}
return FALSE;
}
bool wxImage::LoadFile( wxInputStream& stream, long type )
{