Hook remove button up.
This commit is contained in:
parent
fad5799c7e
commit
b806b34b17
2 changed files with 18 additions and 1 deletions
|
@ -80,7 +80,7 @@ namespace SpritePacker.GUI
|
|||
|
||||
// Create the ListView to display the added sprites
|
||||
spriteListDisplay = new SpriteListView() { Margin = 10, MarginTop = 5 };
|
||||
spriteListDisplay.AddItem(new Sprite("/home/sbrl/Pictures/Spaghetti.png"));
|
||||
spriteListDisplay.EnableSearch = true;
|
||||
|
||||
openImageButton = new Button("Add Sprites") { Margin = 10, MarginTop = 0, MarginBottom = 0 };
|
||||
removeImageButton = new Button("Remove Selected Sprites") { Margin = 10, MarginTop = 0, MarginBottom = 0 };
|
||||
|
@ -100,6 +100,13 @@ namespace SpritePacker.GUI
|
|||
throw new Exception($"Unknown sprite file chooser response type {response}.");
|
||||
}
|
||||
};
|
||||
removeImageButton.Released += (object sender, EventArgs e) => {
|
||||
foreach(Sprite currentSprite in spriteListDisplay.SelectedItems)
|
||||
spritePacker.Remove(currentSprite);
|
||||
spriteListDisplay.ClearItems();
|
||||
foreach(Sprite currentSprite in spritePacker.CurrentSprites)
|
||||
spriteListDisplay.AddItem(currentSprite);
|
||||
};
|
||||
|
||||
// Populate the control button row
|
||||
controlButtonRow.PackStart(openImageButton, true, false, 0);
|
||||
|
|
|
@ -23,6 +23,16 @@ namespace SpritePacker
|
|||
/// <value><c>true</c> if verbose; <c>false</c> otherwise.</value>
|
||||
public bool Verbose { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of the current sprites.
|
||||
/// </summary>
|
||||
public Sprite[] CurrentSprites
|
||||
{
|
||||
get {
|
||||
return sprites.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new SpritePacker.
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in a new issue