2016-12-12 12:35:18 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
2016-11-24 11:55:11 +00:00
|
|
|
|
using CodeImp.DoomBuilder.Config;
|
|
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.Controls.Scripting
|
|
|
|
|
{
|
|
|
|
|
internal class ScriptIconsManager
|
|
|
|
|
{
|
2016-12-12 12:35:18 +00:00
|
|
|
|
private int scripttypeiconsoffset;
|
|
|
|
|
private int scriptgroupiconsoffset;
|
|
|
|
|
private int scriptgroupopeniconsoffset;
|
2016-11-24 11:55:11 +00:00
|
|
|
|
private ImageList icons;
|
2016-12-12 12:35:18 +00:00
|
|
|
|
|
|
|
|
|
internal int ScriptTypeIconsOffset { get { return scripttypeiconsoffset; } }
|
|
|
|
|
internal int ScriptGroupIconsOffset { get { return scriptgroupiconsoffset; } }
|
|
|
|
|
internal int ScriptGroupOpenIconsOffset { get { return scriptgroupopeniconsoffset; } }
|
2016-11-24 11:55:11 +00:00
|
|
|
|
public ImageList Icons { get { return icons; } }
|
|
|
|
|
|
|
|
|
|
public ScriptIconsManager(ImageList icons)
|
|
|
|
|
{
|
|
|
|
|
this.icons = icons;
|
2016-12-12 12:35:18 +00:00
|
|
|
|
|
|
|
|
|
int numicons = Enum.GetNames(typeof(ScriptType)).Length;
|
|
|
|
|
scriptgroupopeniconsoffset = icons.Images.Count - numicons;
|
|
|
|
|
scriptgroupiconsoffset = scriptgroupopeniconsoffset - numicons;
|
|
|
|
|
scripttypeiconsoffset = scriptgroupiconsoffset - numicons;
|
2016-11-24 11:55:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int GetResourceIcon(int datalocationtype)
|
|
|
|
|
{
|
|
|
|
|
return datalocationtype;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int GetScriptIcon(ScriptType type)
|
|
|
|
|
{
|
2016-12-12 12:35:18 +00:00
|
|
|
|
int scripttype = (int)type + scripttypeiconsoffset;
|
|
|
|
|
if(scripttype >= scriptgroupiconsoffset) scripttype = scripttypeiconsoffset;
|
2016-11-24 11:55:11 +00:00
|
|
|
|
return scripttype;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int GetScriptFolderIcon(ScriptType type, bool opened)
|
|
|
|
|
{
|
|
|
|
|
int scripttype = (int)type;
|
2016-12-12 12:35:18 +00:00
|
|
|
|
if(scripttype >= scriptgroupiconsoffset - scripttypeiconsoffset)
|
|
|
|
|
scripttype = scripttypeiconsoffset;
|
2016-11-24 11:55:11 +00:00
|
|
|
|
|
2016-12-12 12:35:18 +00:00
|
|
|
|
if(opened) return scriptgroupopeniconsoffset + scripttype;
|
|
|
|
|
return scriptgroupiconsoffset + scripttype;
|
2016-11-24 11:55:11 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|