1 ///////////////////////////////////////////////////////////////////////////// 
   2 // Name:        src/common/bmpbase.cpp 
   3 // Purpose:     wxBitmapBase 
   4 // Author:      VaclavSlavik 
   7 // Copyright:   (c) 2001, Vaclav Slavik 
   8 // Licence:     wxWindows licence 
   9 ///////////////////////////////////////////////////////////////////////////// 
  11 // For compilers that support precompilation, includes "wx.h". 
  12 #include "wx/wxprec.h" 
  18 #if defined(__WXMGL__)   || \ 
  19     defined(__WXMAC__)   || \ 
  20     defined(__WXGTK__)   || \ 
  21     defined(__WXMOTIF__) || \ 
  25 #include "wx/palette.h" 
  26 #include "wx/bitmap.h" 
  30 #include "wx/module.h" 
  32 IMPLEMENT_ABSTRACT_CLASS(wxBitmapBase
, wxGDIObject
) 
  33 IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandlerBase
,wxObject
) 
  35 wxList 
wxBitmapBase::sm_handlers
; 
  37 void wxBitmapBase::AddHandler(wxBitmapHandlerBase 
*handler
) 
  39     sm_handlers
.Append(handler
); 
  42 void wxBitmapBase::InsertHandler(wxBitmapHandlerBase 
*handler
) 
  44     sm_handlers
.Insert(handler
); 
  47 bool wxBitmapBase::RemoveHandler(const wxString
& name
) 
  49     wxBitmapHandler 
*handler 
= FindHandler(name
); 
  52         sm_handlers
.DeleteObject(handler
); 
  59 wxBitmapHandler 
*wxBitmapBase::FindHandler(const wxString
& name
) 
  61     wxList::compatibility_iterator node 
= sm_handlers
.GetFirst(); 
  64         wxBitmapHandler 
*handler 
= (wxBitmapHandler 
*)node
->GetData(); 
  65         if ( handler
->GetName() == name 
) 
  67         node 
= node
->GetNext(); 
  72 wxBitmapHandler 
*wxBitmapBase::FindHandler(const wxString
& extension
, wxBitmapType bitmapType
) 
  74     wxList::compatibility_iterator node 
= sm_handlers
.GetFirst(); 
  77         wxBitmapHandler 
*handler 
= (wxBitmapHandler 
*)node
->GetData(); 
  78         if ( handler
->GetExtension() == extension 
&& 
  79                     (bitmapType 
== wxBITMAP_TYPE_ANY 
|| handler
->GetType() == bitmapType
) ) 
  81         node 
= node
->GetNext(); 
  86 wxBitmapHandler 
*wxBitmapBase::FindHandler(wxBitmapType bitmapType
) 
  88     wxList::compatibility_iterator node 
= sm_handlers
.GetFirst(); 
  91         wxBitmapHandler 
*handler 
= (wxBitmapHandler 
*)node
->GetData(); 
  92         if (handler
->GetType() == bitmapType
) 
  94         node 
= node
->GetNext(); 
  99 void wxBitmapBase::CleanUpHandlers() 
 101     wxList::compatibility_iterator node 
= sm_handlers
.GetFirst(); 
 104         wxBitmapHandler 
*handler 
= (wxBitmapHandler 
*)node
->GetData(); 
 105         wxList::compatibility_iterator next 
= node
->GetNext(); 
 107         sm_handlers
.Erase(node
); 
 112 class wxBitmapBaseModule
: public wxModule
 
 114 DECLARE_DYNAMIC_CLASS(wxBitmapBaseModule
) 
 116     wxBitmapBaseModule() {} 
 117     bool OnInit() { wxBitmap::InitStandardHandlers(); return true; }; 
 118     void OnExit() { wxBitmap::CleanUpHandlers(); }; 
 121 IMPLEMENT_DYNAMIC_CLASS(wxBitmapBaseModule
, wxModule
) 
 123 #endif // __WXMGL__ || __WXMAC__ || __WXCOCOA__ || __WXMOTIF__ || __WXX11__