Fix wxIconBundle::GetIcon(wxDefaultSize) in wxOSX

GetIcon() relies on wxSYS_ICON_X/Y to determine the size to return if it
isn't specified and FALLBACK_SYSTEM is used. But wxSYS_ICON_X/Y is not
implemented in many ports and this code fails.

If wxSYS_ICON_X is -1, usea reasonable default that is the same as other
platforms use (32) and also add FALLBACK_NEAREST_LARGER to allow picking
some other size if 32x32 isn't available.

Doing this fixes an assert in wxLogDialog on macOS if a non-native art
provider (such as Tango) isn't available.
This commit is contained in:
Václav Slavík
2017-02-06 12:57:54 +01:00
parent 2675579371
commit b68853ae62

View File

@@ -215,6 +215,14 @@ wxIcon wxIconBundle::GetIcon(const wxSize& size, int flags) const
sizeX = sysX;
sizeY = sysY;
// Not all ports provide this metric, so if they don't, fall back to
// something reasonable _and_ allow searching for a closer match.
if ( sizeX == -1 && sizeY == -1 )
{
sizeX = sizeY = 32;
flags |= FALLBACK_NEAREST_LARGER;
}
}
// Iterate over all icons searching for the exact match or the closest icon