]> git.saurik.com Git - wxWidgets.git/commitdiff
Added (dummy) handler for loading bitmap from file instead of resource.
authorStefan Neis <Stefan.Neis@t-online.de>
Sun, 18 Sep 2005 23:27:28 +0000 (23:27 +0000)
committerStefan Neis <Stefan.Neis@t-online.de>
Sun, 18 Sep 2005 23:27:28 +0000 (23:27 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35585 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/os2/bitmap.h
src/os2/bitmap.cpp

index 555184acc83c71aa2c0a473ae856a885d170eca7..5b5e917b4d8991dd8adf4a8da0ed0c5c2b5914be 100644 (file)
@@ -162,6 +162,9 @@ public:
     virtual bool LoadFile( int             nId
                           ,long            lType = wxBITMAP_TYPE_BMP_RESOURCE
                          );
+    virtual bool LoadFile( const wxString& rName
+                          ,long            lType = wxBITMAP_TYPE_XPM
+                         );
     virtual bool SaveFile( const wxString&  rName
                           ,int              lType
                           ,const wxPalette* pCmap = NULL
@@ -312,6 +315,12 @@ public:
                           ,int             nDesiredWidth
                           ,int             nDesiredHeight
                          );
+    virtual bool LoadFile( wxBitmap*       pBitmap
+                          ,const wxString& rName
+                          ,long            lFlags
+                          ,int             nDesiredWidth
+                          ,int             nDesiredHeight
+                         );
     virtual bool SaveFile( wxBitmap*        pBitmap
                           ,const wxString&  rName
                           ,int              lType
index 51b5cfdc4c787ee9dd96dba3ad5392e2c9a07a38..8f74051db4727a2316bc36aa20d6ff1e764e0e98 100644 (file)
@@ -407,6 +407,34 @@ bool wxBitmap::CreateFromXpm(
 #endif
 } // end of wxBitmap::CreateFromXpm
 
+bool wxBitmap::LoadFile(const wxString& filename, long type)
+{
+    UnRef();
+
+    wxBitmapHandler *handler = wxDynamicCast(FindHandler(type), wxBitmapHandler);
+
+    if ( handler )
+    {
+        m_refData = new wxBitmapRefData;
+
+        return handler->LoadFile(this, filename, type, -1, -1);
+    }
+#if wxUSE_IMAGE
+    else // no bitmap handler found
+    {
+        wxImage image;
+        if ( image.LoadFile( filename, type ) && image.Ok() )
+        {
+            *this = wxBitmap(image);
+
+            return true;
+        }
+    }
+#endif // wxUSE_IMAGE
+
+    return false;
+}
+
 bool wxBitmap::LoadFile(
   int                               nId
 , long                              lType
@@ -1505,6 +1533,17 @@ bool wxBitmapHandler::LoadFile(
     return false;
 }
 
+bool wxBitmapHandler::LoadFile(
+  wxBitmap*                         WXUNUSED(pBitmap)
+, const wxString&                   WXUNUSED(rName)
+, long                              WXUNUSED(lType)
+, int                               WXUNUSED(nDesiredWidth)
+, int                               WXUNUSED(nDesiredHeight)
+)
+{
+    return false;
+}
+
 bool wxBitmapHandler::SaveFile(
   wxBitmap*                         WXUNUSED(pBitmap)
 , const wxString&                   WXUNUSED(rName)