]>
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"
18 #include "wx/palette.h"
19 #include "wx/bitmap.h"
23 #include "wx/module.h"
25 IMPLEMENT_ABSTRACT_CLASS(wxBitmapBase
, wxGDIObject
)
26 IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandlerBase
,wxObject
)
28 wxList
wxBitmapBase::sm_handlers
;
30 void wxBitmapBase::AddHandler(wxBitmapHandlerBase
*handler
)
32 sm_handlers
.Append(handler
);
35 void wxBitmapBase::InsertHandler(wxBitmapHandlerBase
*handler
)
37 sm_handlers
.Insert(handler
);
40 bool wxBitmapBase::RemoveHandler(const wxString
& name
)
42 wxBitmapHandler
*handler
= FindHandler(name
);
45 sm_handlers
.DeleteObject(handler
);
52 wxBitmapHandler
*wxBitmapBase::FindHandler(const wxString
& name
)
54 wxNode
*node
= sm_handlers
.First();
57 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
58 if ( handler
->GetName() == name
)
65 wxBitmapHandler
*wxBitmapBase::FindHandler(const wxString
& extension
, wxBitmapType bitmapType
)
67 wxNode
*node
= sm_handlers
.First();
70 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
71 if ( handler
->GetExtension() == extension
&&
72 (bitmapType
== -1 || handler
->GetType() == bitmapType
) )
79 wxBitmapHandler
*wxBitmapBase::FindHandler(wxBitmapType bitmapType
)
81 wxNode
*node
= sm_handlers
.First();
84 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
85 if (handler
->GetType() == bitmapType
)
92 void wxBitmapBase::CleanUpHandlers()
94 wxNode
*node
= sm_handlers
.First();
97 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->Data();
98 wxNode
*next
= node
->Next();
107 class wxBitmapBaseModule
: public wxModule
109 DECLARE_DYNAMIC_CLASS(wxBitmapBaseModule
)
111 wxBitmapBaseModule() {}
112 bool OnInit() { wxBitmap::InitStandardHandlers(); return TRUE
; };
113 void OnExit() { wxBitmap::CleanUpHandlers(); };
116 IMPLEMENT_DYNAMIC_CLASS(wxBitmapBaseModule
, wxModule
)