source: trunk/src/org/expeditee/items/widgets/RubbishBin.java@ 1005

Last change on this file since 1005 was 1005, checked in by davidb, 8 years ago

Change to allow SVG buttons to be resizeable. Also tidy up of import statements

File size: 1.5 KB
Line 
1package org.expeditee.items.widgets;
2
3import java.awt.event.ActionEvent;
4import java.awt.event.ActionListener;
5
6import org.expeditee.gui.DisplayIO;
7import org.expeditee.gui.FrameMouseActions;
8import org.expeditee.gui.FreeItems;
9import org.expeditee.items.Item;
10import 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
13public class RubbishBin extends ButtonWidget{
14
15 public RubbishBin(Text source, String[] args){
16
17 super(80, "org/expeditee/assets/images/bin.svg", source, args);
18
19 clicked_.addActionListener(new ActionListener() {
20 public void actionPerformed(ActionEvent e) {
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){
30 freeItems.setParent(DisplayIO.getCurrentFrame());
31
32 try{
33
34 FrameMouseActions.delete(freeItems);
35 }
36 catch(Exception e){
37
38 e.printStackTrace();
39 }
40 }
41 return true;
42 }
43
44 @Override
45 protected String[] getArgs() {
46 // TODO Auto-generated method stub
47 return null;
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
60}
Note: See TracBrowser for help on using the repository browser.