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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
/*
* 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.menu;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.herac.tuxguitar.gui.TuxGuitar;
import org.herac.tuxguitar.gui.actions.marker.AddMarkerAction;
import org.herac.tuxguitar.gui.actions.marker.GoFirstMarkerAction;
import org.herac.tuxguitar.gui.actions.marker.GoLastMarkerAction;
import org.herac.tuxguitar.gui.actions.marker.GoNextMarkerAction;
import org.herac.tuxguitar.gui.actions.marker.GoPreviousMarkerAction;
import org.herac.tuxguitar.gui.actions.marker.ListMarkersAction;
import org.herac.tuxguitar.gui.items.MenuItems;
/**
* @author julian
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class MarkerMenuItem implements MenuItems{
private MenuItem markerMenuItem;
private Menu menu;
private MenuItem add;
private MenuItem list;
private MenuItem first;
private MenuItem last;
private MenuItem next;
private MenuItem previous;
public MarkerMenuItem(Shell shell,Menu parent, int style) {
this.markerMenuItem = new MenuItem(parent, style);
this.menu = new Menu(shell, SWT.DROP_DOWN);
}
public void showItems(){
//--ADD--
this.add = new MenuItem(this.menu, SWT.PUSH);
this.add.addSelectionListener(TuxGuitar.instance().getAction(AddMarkerAction.NAME));
//--LIST--
this.list = new MenuItem(this.menu, SWT.PUSH);
this.list.addSelectionListener(TuxGuitar.instance().getAction(ListMarkersAction.NAME));
//--SEPARATOR--
new MenuItem(this.menu, SWT.SEPARATOR);
//--FIRST--
this.first = new MenuItem(this.menu, SWT.PUSH);
this.first.addSelectionListener(TuxGuitar.instance().getAction(GoFirstMarkerAction.NAME));
//--PREVIOUS--
this.previous = new MenuItem(this.menu, SWT.PUSH);
this.previous.addSelectionListener(TuxGuitar.instance().getAction(GoPreviousMarkerAction.NAME));
//--PREVIOUS--
this.next = new MenuItem(this.menu, SWT.PUSH);
this.next.addSelectionListener(TuxGuitar.instance().getAction(GoNextMarkerAction.NAME));
//--LAST--
this.last = new MenuItem(this.menu, SWT.PUSH);
this.last.addSelectionListener(TuxGuitar.instance().getAction(GoLastMarkerAction.NAME));
this.markerMenuItem.setMenu(this.menu);
this.loadIcons();
this.loadProperties();
}
public void update(){
//Nothing to do
}
public void loadProperties(){
this.markerMenuItem.setText(TuxGuitar.getProperty("marker"));
this.add.setText(TuxGuitar.getProperty("marker.add"));
this.list.setText(TuxGuitar.getProperty("marker.list"));
this.first.setText(TuxGuitar.getProperty("marker.first"));
this.last.setText(TuxGuitar.getProperty("marker.last"));
this.previous.setText(TuxGuitar.getProperty("marker.previous"));
this.next.setText(TuxGuitar.getProperty("marker.next"));
}
public void loadIcons(){
this.add.setImage(TuxGuitar.instance().getIconManager().getMarkerAdd());
this.list.setImage(TuxGuitar.instance().getIconManager().getMarkerList());
this.first.setImage(TuxGuitar.instance().getIconManager().getMarkerFirst());
this.previous.setImage(TuxGuitar.instance().getIconManager().getMarkerPrevious());
this.next.setImage(TuxGuitar.instance().getIconManager().getMarkerNext());
this.last.setImage(TuxGuitar.instance().getIconManager().getMarkerLast());
}
}
|