[981] | 1 | package org.expeditee.items.widgets;
|
---|
| 2 |
|
---|
| 3 | import java.awt.event.ActionEvent;
|
---|
| 4 | import java.awt.event.ActionListener;
|
---|
| 5 |
|
---|
[994] | 6 | import org.expeditee.gui.DisplayIO;
|
---|
[981] | 7 | import org.expeditee.gui.FrameMouseActions;
|
---|
| 8 | import org.expeditee.gui.FreeItems;
|
---|
| 9 | import org.expeditee.items.Item;
|
---|
| 10 | import org.expeditee.items.Text;
|
---|
| 11 |
|
---|
| 12 | //When the Rubbish Bin Widget is clicked by any of the mouse buttons, whatever is currently being picked up by the mouse is destroyed
|
---|
[994] | 13 | public class RubbishBin extends ButtonWidget{
|
---|
[981] | 14 |
|
---|
| 15 | public RubbishBin(Text source, String[] args){
|
---|
[994] | 16 |
|
---|
| 17 | super(80, "org/expeditee/assets/images/bin.svg", source, args);
|
---|
| 18 |
|
---|
[1005] | 19 | clicked_.addActionListener(new ActionListener() {
|
---|
[994] | 20 | public void actionPerformed(ActionEvent e) {
|
---|
[981] | 21 |
|
---|
| 22 | }
|
---|
| 23 | });
|
---|
| 24 | }
|
---|
| 25 | public boolean ItemsLeftClickDropped() {
|
---|
| 26 |
|
---|
| 27 | //Find what the mouse was holding at the time and delete it
|
---|
| 28 | Item freeItems = FreeItems.getItemAttachedToCursor();
|
---|
| 29 | if( freeItems != null){
|
---|
[994] | 30 | freeItems.setParent(DisplayIO.getCurrentFrame());
|
---|
[981] | 31 |
|
---|
[994] | 32 | try{
|
---|
| 33 |
|
---|
[981] | 34 | FrameMouseActions.delete(freeItems);
|
---|
[994] | 35 | }
|
---|
| 36 | catch(Exception e){
|
---|
| 37 |
|
---|
| 38 | e.printStackTrace();
|
---|
| 39 | }
|
---|
[981] | 40 | }
|
---|
| 41 | return true;
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | @Override
|
---|
| 45 | protected String[] getArgs() {
|
---|
| 46 | // TODO Auto-generated method stub
|
---|
| 47 | return null;
|
---|
[994] | 48 | }
|
---|
| 49 | //this should be a generic method for any widget that is clicked while an item is being held
|
---|
| 50 | public boolean itemHeldWhileClicked(InteractiveWidget iw){
|
---|
| 51 |
|
---|
| 52 | ItemsLeftClickDropped();
|
---|
| 53 | return true;
|
---|
| 54 |
|
---|
| 55 | }
|
---|
| 56 | public boolean getdropInteractableStatus(){
|
---|
| 57 | return true;
|
---|
| 58 | }
|
---|
| 59 |
|
---|
[981] | 60 | }
|
---|