Return an approriately-sized empty icon from icon::get if no icon exists
Originally committed to SVN as r5756.
This commit is contained in:
parent
1da6f46cb2
commit
4009d24e73
1 changed files with 14 additions and 4 deletions
|
@ -41,21 +41,31 @@ iconMap icon24;
|
||||||
wxBitmap const& get(std::string const& name, const int size) {
|
wxBitmap const& get(std::string const& name, const int size) {
|
||||||
// XXX: This code will go away with dynamic icon generation so I'm not
|
// XXX: This code will go away with dynamic icon generation so I'm not
|
||||||
// concerned about it.
|
// concerned about it.
|
||||||
if (size != 24) {
|
|
||||||
iconMap::iterator index;
|
iconMap::iterator index;
|
||||||
|
if (size != 24) {
|
||||||
if ((index = icon16.find(name)) != icon16.end())
|
if ((index = icon16.find(name)) != icon16.end())
|
||||||
return index->second;
|
return index->second;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
iconMap::iterator index;
|
|
||||||
if ((index = icon24.find(name)) != icon24.end())
|
if ((index = icon24.find(name)) != icon24.end())
|
||||||
return index->second;
|
return index->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_W("icon/get") << "Icon not found: " << name << " " << size;
|
LOG_W("icon/get") << "Icon not found: " << name << " " << size;
|
||||||
|
|
||||||
static wxBitmap empty;
|
static wxBitmap empty16(16, 16, 1);
|
||||||
return empty;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue