1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/*
* Created on 02-dic-2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package org.herac.tuxguitar.gui.items.tool;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.herac.tuxguitar.gui.TuxGuitar;
import org.herac.tuxguitar.gui.actions.track.AddTrackAction;
import org.herac.tuxguitar.gui.actions.track.RemoveTrackAction;
import org.herac.tuxguitar.gui.items.ToolItems;
/**
* @author julian
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class TrackToolItems extends ToolItems{
public static final String NAME = "track.items";
private ToolItem add;
private ToolItem remove;
public TrackToolItems(){
super(NAME);
}
public void showItems(ToolBar toolBar){
this.add = new ToolItem(toolBar, SWT.PUSH);
this.add.addSelectionListener(TuxGuitar.instance().getAction(AddTrackAction.NAME));
this.remove = new ToolItem(toolBar, SWT.PUSH);
this.remove.addSelectionListener(TuxGuitar.instance().getAction(RemoveTrackAction.NAME));
this.loadIcons();
this.loadProperties();
}
public void loadProperties(){
this.add.setToolTipText(TuxGuitar.getProperty("track.add"));
this.remove.setToolTipText(TuxGuitar.getProperty("track.remove"));
}
public void loadIcons(){
this.add.setImage(TuxGuitar.instance().getIconManager().getTrackAdd());
this.remove.setImage(TuxGuitar.instance().getIconManager().getTrackRemove());
}
public void update(){
boolean running = TuxGuitar.instance().getPlayer().isRunning();
this.add.setEnabled(!running);
this.remove.setEnabled(!running);
}
}
|