2012-08-31 05:29:32 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
2012-11-05 03:32:18 +00:00
|
|
|
|
namespace NBTExplorer.Windows
|
2012-08-31 05:29:32 +00:00
|
|
|
|
{
|
|
|
|
|
public class IconRegistry
|
|
|
|
|
{
|
2012-09-03 03:25:23 +00:00
|
|
|
|
private Dictionary<Type, int> _iconRegistry;
|
2012-08-31 05:29:32 +00:00
|
|
|
|
|
|
|
|
|
public IconRegistry ()
|
|
|
|
|
{
|
|
|
|
|
_iconRegistry = new Dictionary<Type, int>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int DefaultIcon { get; set; }
|
|
|
|
|
|
|
|
|
|
public int Lookup (Type type)
|
|
|
|
|
{
|
|
|
|
|
if (_iconRegistry.ContainsKey(type))
|
|
|
|
|
return _iconRegistry[type];
|
|
|
|
|
else
|
|
|
|
|
return DefaultIcon;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-09 02:48:05 +00:00
|
|
|
|
public int Lookup<T> ()
|
|
|
|
|
{
|
|
|
|
|
return Lookup(typeof(T));
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-31 05:29:32 +00:00
|
|
|
|
public void Register (Type type, int iconIndex)
|
|
|
|
|
{
|
|
|
|
|
_iconRegistry[type] = iconIndex;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|