]>
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"
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 wxNode
*node
= sm_handlers
.First();
64 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
65 if ( handler
->GetName() == name
)
72 wxBitmapHandler
*wxBitmapBase::FindHandler(const wxString
& extension
, wxBitmapType bitmapType
)
74 wxNode
*node
= sm_handlers
.First();
77 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
78 if ( handler
->GetExtension() == extension
&&
79 (bitmapType
== -1 || handler
->GetType() == bitmapType
) )
86 wxBitmapHandler
*wxBitmapBase::FindHandler(wxBitmapType bitmapType
)
88 wxNode
*node
= sm_handlers
.First();
91 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
92 if (handler
->GetType() == bitmapType
)
99 void wxBitmapBase::CleanUpHandlers()
101 wxNode
*node
= sm_handlers
.First();
104 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
105 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
)