NBTExplorer/NBTExplorerMac/Mac/IconRegistry.cs

33 lines
560 B
C#
Raw Normal View History

2012-11-04 05:45:51 +00:00
using System;
2012-11-05 04:18:25 +00:00
using System.Collections.Generic;
using MonoMac.AppKit;
2012-11-04 05:45:51 +00:00
namespace NBTExplorer.Mac
{
public class IconRegistry
{
2012-11-05 04:18:25 +00:00
private Dictionary<Type, NSImage> _iconRegistry;
2012-11-04 05:45:51 +00:00
public IconRegistry ()
{
2012-11-05 04:18:25 +00:00
_iconRegistry = new Dictionary<Type, NSImage>();
}
public NSImage DefaultIcon { get; set; }
public NSImage Lookup (Type type)
{
if (_iconRegistry.ContainsKey(type))
return _iconRegistry[type];
else
return DefaultIcon;
}
public void Register (Type type, NSImage icon)
{
_iconRegistry[type] = icon;
2012-11-04 05:45:51 +00:00
}
}
}