Browse Source

Hook remove button up.

tags/v0.1
Starbeamrainbowlabs 2 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
80 80
 
81 81
 			// Create the ListView to display the added sprites
82 82
 			spriteListDisplay = new SpriteListView() { Margin = 10, MarginTop = 5 };
83
-			spriteListDisplay.AddItem(new Sprite("/home/sbrl/Pictures/Spaghetti.png"));
83
+			spriteListDisplay.EnableSearch = true;
84 84
 
85 85
 			openImageButton = new Button("Add Sprites") { Margin = 10, MarginTop = 0, MarginBottom = 0 };
86 86
 			removeImageButton = new Button("Remove Selected Sprites") { Margin = 10, MarginTop = 0, MarginBottom = 0 };
@@ -100,6 +100,13 @@ namespace SpritePacker.GUI
100 100
 						throw new Exception($"Unknown sprite file chooser response type {response}.");
101 101
 				}
102 102
 			};
103
+			removeImageButton.Released += (object sender, EventArgs e) => {
104
+				foreach(Sprite currentSprite in spriteListDisplay.SelectedItems)
105
+					spritePacker.Remove(currentSprite);
106
+				spriteListDisplay.ClearItems();
107
+				foreach(Sprite currentSprite in spritePacker.CurrentSprites)
108
+					spriteListDisplay.AddItem(currentSprite);
109
+			};
103 110
 
104 111
 			// Populate the control button row
105 112
 			controlButtonRow.PackStart(openImageButton, true, false, 0);

+ 10
- 0
SpritePacker/SpritePacker.cs View File

@@ -23,6 +23,16 @@ namespace SpritePacker
23 23
 		/// <value><c>true</c> if verbose; <c>false</c> otherwise.</value>
24 24
 		public bool Verbose { get; private set; }
25 25
 
26
+		/// <summary>
27
+		/// Gets a list of the current sprites.
28
+		/// </summary>
29
+		public Sprite[] CurrentSprites
30
+		{
31
+			get {
32
+				return sprites.ToArray();
33
+			}
34
+		}
35
+
26 36
 		/// <summary>
27 37
 		/// Initializes a new SpritePacker.
28 38
 		/// </summary>

Loading…
Cancel
Save