SpritePacker/SpritePacker-GUI/SpriteListView.cs
Starbeamrainbowlabs 4d42de98ab Namespace SilentorBit -> Ext.SilentorBit + docs.
Where docs = SilentorBit namespace documentation.
2016-08-01 20:26:20 +01:00

32 lines
656 B
C#

using System;
using Ext.SilentorBit;
using System.IO;
namespace SpritePacker.GUI
{
public class SpriteListView : ListView<Sprite>
{
public SpriteListView() : base("#", "Filename", "Image Size")
{
}
protected override void RenderCell(Gtk.CellRendererText render, int index, Sprite sprite)
{
switch(index)
{
case 0:
render.Text = index.ToString();
break;
case 1:
render.Text = System.IO.Path.GetFileName(sprite.Filename);
break;
case 2:
render.Text = $"{sprite.Width} x {sprite.Height}";
break;
default:
throw new InvalidDataException($"Invalid column index {index}");
}
}
}
}