Browse Source

Hook remove button up.

tags/v0.1
Starbeamrainbowlabs 3 years ago
parent
commit
b806b34b17
2 changed files with 18 additions and 1 deletions
  1. 8
    1
      SpritePacker-GUI/MainWindow.cs
  2. 10
    0
      SpritePacker/SpritePacker.cs

+ 8
- 1
SpritePacker-GUI/MainWindow.cs View File

@@ -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);

+ 10
- 0
SpritePacker/SpritePacker.cs View File

@@ -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…
Cancel
Save