SpritePacker/SpritePacker-GUI/SpriteListView.cs

33 lines
656 B
C#
Raw Normal View History

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