1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxBitmapBase
4 // Author: VaclavSlavik
7 // Copyright: (c) 2001, Vaclav Slavik
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
12 #pragma implementation "bitmapbase.h"
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
22 #if defined(__WXMGL__) || \
23 defined(__WXMAC__) || \
24 defined(__WXGTK__) || \
25 defined(__WXMOTIF__) || \
30 #include "wx/palette.h"
31 #include "wx/bitmap.h"
35 #include "wx/module.h"
37 IMPLEMENT_ABSTRACT_CLASS(wxBitmapBase
, wxGDIObject
)
38 IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandlerBase
,wxObject
)
40 wxList
wxBitmapBase::sm_handlers
;
42 void wxBitmapBase::AddHandler(wxBitmapHandlerBase
*handler
)
44 sm_handlers
.Append(handler
);
47 void wxBitmapBase::InsertHandler(wxBitmapHandlerBase
*handler
)
49 sm_handlers
.Insert(handler
);
52 bool wxBitmapBase::RemoveHandler(const wxString
& name
)
54 wxBitmapHandler
*handler
= FindHandler(name
);
57 sm_handlers
.DeleteObject(handler
);
64 wxBitmapHandler
*wxBitmapBase::FindHandler(const wxString
& name
)
66 wxList::compatibility_iterator node
= sm_handlers
.GetFirst();
69 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->GetData();
70 if ( handler
->GetName() == name
)
72 node
= node
->GetNext();
77 wxBitmapHandler
*wxBitmapBase::FindHandler(const wxString
& extension
, wxBitmapType bitmapType
)
79 wxList::compatibility_iterator node
= sm_handlers
.GetFirst();
82 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->GetData();
83 if ( handler
->GetExtension() == extension
&&
84 (bitmapType
== -1 || handler
->GetType() == bitmapType
) )
86 node
= node
->GetNext();
91 wxBitmapHandler
*wxBitmapBase::FindHandler(wxBitmapType bitmapType
)
93 wxList::compatibility_iterator node
= sm_handlers
.GetFirst();
96 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->GetData();
97 if (handler
->GetType() == bitmapType
)
99 node
= node
->GetNext();
104 void wxBitmapBase::CleanUpHandlers()
106 wxList::compatibility_iterator node
= sm_handlers
.GetFirst();
109 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->GetData();
110 wxList::compatibility_iterator next
= node
->GetNext();
112 sm_handlers
.Erase(node
);
117 class wxBitmapBaseModule
: public wxModule
119 DECLARE_DYNAMIC_CLASS(wxBitmapBaseModule
)
121 wxBitmapBaseModule() {}
122 bool OnInit() { wxBitmap::InitStandardHandlers(); return true; };
123 void OnExit() { wxBitmap::CleanUpHandlers(); };
126 IMPLEMENT_DYNAMIC_CLASS(wxBitmapBaseModule
, wxModule
)
128 #endif // __WXMGL__ || __WXMAC__ || __WXCOCOA__ || __WXMOTIF__ || __WXX11__