]>
git.saurik.com Git - wxWidgets.git/blob - src/common/bmpbase.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxBitmapBase
4 // Author: VaclavSlavik
7 // Copyright: (c) 2001, Vaclav Slavik
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
12 #pragma implementation "bitmapbase.h"
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
22 #if defined(__WXMGL__) || defined(__WXMAC__)
27 #include "wx/palette.h"
28 #include "wx/bitmap.h"
32 #include "wx/module.h"
34 IMPLEMENT_ABSTRACT_CLASS(wxBitmapBase
, wxGDIObject
)
35 IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandlerBase
,wxObject
)
37 wxList
wxBitmapBase::sm_handlers
;
39 void wxBitmapBase::AddHandler(wxBitmapHandlerBase
*handler
)
41 sm_handlers
.Append(handler
);
44 void wxBitmapBase::InsertHandler(wxBitmapHandlerBase
*handler
)
46 sm_handlers
.Insert(handler
);
49 bool wxBitmapBase::RemoveHandler(const wxString
& name
)
51 wxBitmapHandler
*handler
= FindHandler(name
);
54 sm_handlers
.DeleteObject(handler
);
61 wxBitmapHandler
*wxBitmapBase::FindHandler(const wxString
& name
)
63 wxNode
*node
= sm_handlers
.First();
66 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
67 if ( handler
->GetName() == name
)
74 wxBitmapHandler
*wxBitmapBase::FindHandler(const wxString
& extension
, wxBitmapType bitmapType
)
76 wxNode
*node
= sm_handlers
.First();
79 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
80 if ( handler
->GetExtension() == extension
&&
81 (bitmapType
== -1 || handler
->GetType() == bitmapType
) )
88 wxBitmapHandler
*wxBitmapBase::FindHandler(wxBitmapType bitmapType
)
90 wxNode
*node
= sm_handlers
.First();
93 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
94 if (handler
->GetType() == bitmapType
)
101 void wxBitmapBase::CleanUpHandlers()
103 wxNode
*node
= sm_handlers
.First();
106 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
107 wxNode
*next
= node
->Next();
114 class wxBitmapBaseModule
: public wxModule
116 DECLARE_DYNAMIC_CLASS(wxBitmapBaseModule
)
118 wxBitmapBaseModule() {}
119 bool OnInit() { wxBitmap::InitStandardHandlers(); return TRUE
; };
120 void OnExit() { wxBitmap::CleanUpHandlers(); };
123 IMPLEMENT_DYNAMIC_CLASS(wxBitmapBaseModule
, wxModule
)
125 #endif // defined(__WXMGL__) || defined(__WXMAC__)