]>
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__) || defined(__WXMOTIF__)
26 #include "wx/palette.h"
27 #include "wx/bitmap.h"
31 #include "wx/module.h"
33 IMPLEMENT_ABSTRACT_CLASS(wxBitmapBase
, wxGDIObject
)
34 IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandlerBase
,wxObject
)
36 wxList
wxBitmapBase::sm_handlers
;
38 void wxBitmapBase::AddHandler(wxBitmapHandlerBase
*handler
)
40 sm_handlers
.Append(handler
);
43 void wxBitmapBase::InsertHandler(wxBitmapHandlerBase
*handler
)
45 sm_handlers
.Insert(handler
);
48 bool wxBitmapBase::RemoveHandler(const wxString
& name
)
50 wxBitmapHandler
*handler
= FindHandler(name
);
53 sm_handlers
.DeleteObject(handler
);
60 wxBitmapHandler
*wxBitmapBase::FindHandler(const wxString
& name
)
62 wxList::Node
*node
= sm_handlers
.GetFirst();
65 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->GetData();
66 if ( handler
->GetName() == name
)
68 node
= node
->GetNext();
73 wxBitmapHandler
*wxBitmapBase::FindHandler(const wxString
& extension
, wxBitmapType bitmapType
)
75 wxList::Node
*node
= sm_handlers
.GetFirst();
78 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->GetData();
79 if ( handler
->GetExtension() == extension
&&
80 (bitmapType
== -1 || handler
->GetType() == bitmapType
) )
82 node
= node
->GetNext();
87 wxBitmapHandler
*wxBitmapBase::FindHandler(wxBitmapType bitmapType
)
89 wxList::Node
*node
= sm_handlers
.GetFirst();
92 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->GetData();
93 if (handler
->GetType() == bitmapType
)
95 node
= node
->GetNext();
100 void wxBitmapBase::CleanUpHandlers()
102 wxList::Node
*node
= sm_handlers
.GetFirst();
105 wxBitmapHandler
*handler
= (wxBitmapHandler
*)node
->GetData();
106 wxList::Node
*next
= node
->GetNext();
113 class wxBitmapBaseModule
: public wxModule
115 DECLARE_DYNAMIC_CLASS(wxBitmapBaseModule
)
117 wxBitmapBaseModule() {}
118 bool OnInit() { wxBitmap::InitStandardHandlers(); return TRUE
; };
119 void OnExit() { wxBitmap::CleanUpHandlers(); };
122 IMPLEMENT_DYNAMIC_CLASS(wxBitmapBaseModule
, wxModule
)
124 #endif // defined(__WXMGL__) || defined(__WXMAC__) || defined(__WXMOTIF__)