Return an approriately-sized empty icon from icon::get if no icon exists

Originally committed to SVN as r5756.
This commit is contained in:
Thomas Goyne 2011-10-18 00:10:02 +00:00
parent 1da6f46cb2
commit 4009d24e73

View file

@ -41,21 +41,31 @@ iconMap icon24;
wxBitmap const& get(std::string const& name, const int size) {
// XXX: This code will go away with dynamic icon generation so I'm not
// concerned about it.
iconMap::iterator index;
if (size != 24) {
iconMap::iterator index;
if ((index = icon16.find(name)) != icon16.end())
return index->second;
}
else {
iconMap::iterator index;
if ((index = icon24.find(name)) != icon24.end())
return index->second;
}
LOG_W("icon/get") << "Icon not found: " << name << " " << size;
static wxBitmap empty;
return empty;
static wxBitmap empty16(16, 16, 1);
static wxBitmap empty24(24, 24, 1);
static bool initialized = false;
if (!initialized) {
empty16.SetMask(new wxMask(empty16));
empty24.SetMask(new wxMask(empty24));
initialized = true;
}
if (size != 24)
return empty16;
return empty24;
}