]> git.saurik.com Git - wxWidgets.git/blame - src/common/bmpbase.cpp
removed focus assert
[wxWidgets.git] / src / common / bmpbase.cpp
CommitLineData
a04eec87
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: bitmap.cpp
3// Purpose: wxBitmapBase
4// Author: VaclavSlavik
5// Created: 2001/04/11
6// RCS-ID: $Id$
7// Copyright: (c) 2001, Vaclav Slavik
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11#ifdef __GNUG__
12#pragma implementation "bitmapbase.h"
13#endif
14
15#include "wx/wx.h"
16#include "wx/setup.h"
17#include "wx/utils.h"
18#include "wx/palette.h"
19#include "wx/bitmap.h"
20#include "wx/icon.h"
21#include "wx/log.h"
22#include "wx/image.h"
23#include "wx/module.h"
24
25IMPLEMENT_ABSTRACT_CLASS(wxBitmapBase, wxGDIObject)
26IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandlerBase,wxObject)
27
28wxList wxBitmapBase::sm_handlers;
29
30void wxBitmapBase::AddHandler(wxBitmapHandlerBase *handler)
31{
32 sm_handlers.Append(handler);
33}
34
35void wxBitmapBase::InsertHandler(wxBitmapHandlerBase *handler)
36{
37 sm_handlers.Insert(handler);
38}
39
40bool wxBitmapBase::RemoveHandler(const wxString& name)
41{
42 wxBitmapHandler *handler = FindHandler(name);
43 if ( handler )
44 {
45 sm_handlers.DeleteObject(handler);
46 return TRUE;
47 }
48 else
49 return FALSE;
50}
51
52wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& name)
53{
54 wxNode *node = sm_handlers.First();
55 while ( node )
56 {
57 wxBitmapHandler *handler = (wxBitmapHandler *)node->Data();
58 if ( handler->GetName() == name )
59 return handler;
60 node = node->Next();
61 }
62 return NULL;
63}
64
65wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& extension, wxBitmapType bitmapType)
66{
67 wxNode *node = sm_handlers.First();
68 while ( node )
69 {
70 wxBitmapHandler *handler = (wxBitmapHandler *)node->Data();
71 if ( handler->GetExtension() == extension &&
72 (bitmapType == -1 || handler->GetType() == bitmapType) )
73 return handler;
74 node = node->Next();
75 }
76 return NULL;
77}
78
79wxBitmapHandler *wxBitmapBase::FindHandler(wxBitmapType bitmapType)
80{
81 wxNode *node = sm_handlers.First();
82 while ( node )
83 {
84 wxBitmapHandler *handler = (wxBitmapHandler *)node->Data();
85 if (handler->GetType() == bitmapType)
86 return handler;
87 node = node->Next();
88 }
89 return NULL;
90}
91
92void wxBitmapBase::CleanUpHandlers()
93{
94 wxNode *node = sm_handlers.First();
95 while ( node )
96 {
97 wxBitmapHandler *handler = (wxBitmapHandler *)node->Data();
98 wxNode *next = node->Next();
99 delete handler;
100 delete node;
101 node = next;
102 }
103}
104
105
106
107class wxBitmapBaseModule: public wxModule
108{
109DECLARE_DYNAMIC_CLASS(wxBitmapBaseModule)
110public:
111 wxBitmapBaseModule() {}
112 bool OnInit() { wxBitmap::InitStandardHandlers(); return TRUE; };
113 void OnExit() { wxBitmap::CleanUpHandlers(); };
114};
115
116IMPLEMENT_DYNAMIC_CLASS(wxBitmapBaseModule, wxModule)