~ubuntu-branches/ubuntu/oneiric/tuxguitar/oneiric

« back to all changes in this revision

Viewing changes to TuxGuitar/src/org/herac/tuxguitar/gui/items/menu/MarkerMenuItem.java

  • Committer: Bazaar Package Importer
  • Author(s): Philippe Coval
  • Date: 2008-06-19 00:30:30 UTC
  • mto: (5.1.2 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20080619003030-h719szrhsngou7c6
Tags: upstream-1.0
ImportĀ upstreamĀ versionĀ 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Created on 02-dic-2005
 
3
 *
 
4
 * TODO To change the template for this generated file go to
 
5
 * Window - Preferences - Java - Code Style - Code Templates
 
6
 */
 
7
package org.herac.tuxguitar.gui.items.menu;
 
8
 
 
9
import org.eclipse.swt.SWT;
 
10
import org.eclipse.swt.widgets.Menu;
 
11
import org.eclipse.swt.widgets.MenuItem;
 
12
import org.eclipse.swt.widgets.Shell;
 
13
import org.herac.tuxguitar.gui.TuxGuitar;
 
14
import org.herac.tuxguitar.gui.actions.marker.AddMarkerAction;
 
15
import org.herac.tuxguitar.gui.actions.marker.GoFirstMarkerAction;
 
16
import org.herac.tuxguitar.gui.actions.marker.GoLastMarkerAction;
 
17
import org.herac.tuxguitar.gui.actions.marker.GoNextMarkerAction;
 
18
import org.herac.tuxguitar.gui.actions.marker.GoPreviousMarkerAction;
 
19
import org.herac.tuxguitar.gui.actions.marker.ListMarkersAction;
 
20
import org.herac.tuxguitar.gui.items.MenuItems;
 
21
 
 
22
/**
 
23
 * @author julian
 
24
 *
 
25
 * TODO To change the template for this generated type comment go to
 
26
 * Window - Preferences - Java - Code Style - Code Templates
 
27
 */
 
28
public class MarkerMenuItem implements MenuItems{
 
29
        private MenuItem markerMenuItem;
 
30
        private Menu menu;
 
31
        private MenuItem add;
 
32
        private MenuItem list;
 
33
        private MenuItem first;
 
34
        private MenuItem last;
 
35
        private MenuItem next;
 
36
        private MenuItem previous;
 
37
        
 
38
        public MarkerMenuItem(Shell shell,Menu parent, int style) {
 
39
                this.markerMenuItem = new MenuItem(parent, style);
 
40
                this.menu = new Menu(shell, SWT.DROP_DOWN);
 
41
        }
 
42
        
 
43
        public void showItems(){
 
44
                //--ADD--
 
45
                this.add = new MenuItem(this.menu, SWT.PUSH);
 
46
                this.add.addSelectionListener(TuxGuitar.instance().getAction(AddMarkerAction.NAME));
 
47
                
 
48
                //--LIST--
 
49
                this.list = new MenuItem(this.menu, SWT.PUSH);
 
50
                this.list.addSelectionListener(TuxGuitar.instance().getAction(ListMarkersAction.NAME));
 
51
                
 
52
                //--SEPARATOR--
 
53
                new MenuItem(this.menu, SWT.SEPARATOR);
 
54
                
 
55
                //--FIRST--
 
56
                this.first = new MenuItem(this.menu, SWT.PUSH);
 
57
                this.first.addSelectionListener(TuxGuitar.instance().getAction(GoFirstMarkerAction.NAME));
 
58
                
 
59
                //--PREVIOUS--
 
60
                this.previous = new MenuItem(this.menu, SWT.PUSH);
 
61
                this.previous.addSelectionListener(TuxGuitar.instance().getAction(GoPreviousMarkerAction.NAME));
 
62
                
 
63
                //--PREVIOUS--
 
64
                this.next = new MenuItem(this.menu, SWT.PUSH);
 
65
                this.next.addSelectionListener(TuxGuitar.instance().getAction(GoNextMarkerAction.NAME));
 
66
                
 
67
                //--LAST--
 
68
                this.last = new MenuItem(this.menu, SWT.PUSH);
 
69
                this.last.addSelectionListener(TuxGuitar.instance().getAction(GoLastMarkerAction.NAME));
 
70
                
 
71
                this.markerMenuItem.setMenu(this.menu);
 
72
                
 
73
                this.loadIcons();
 
74
                this.loadProperties();
 
75
        }
 
76
        
 
77
        public void update(){
 
78
                //Nothing to do
 
79
        }
 
80
        
 
81
        public void loadProperties(){
 
82
                this.markerMenuItem.setText(TuxGuitar.getProperty("marker"));
 
83
                this.add.setText(TuxGuitar.getProperty("marker.add"));
 
84
                this.list.setText(TuxGuitar.getProperty("marker.list"));
 
85
                this.first.setText(TuxGuitar.getProperty("marker.first"));
 
86
                this.last.setText(TuxGuitar.getProperty("marker.last"));
 
87
                this.previous.setText(TuxGuitar.getProperty("marker.previous"));
 
88
                this.next.setText(TuxGuitar.getProperty("marker.next"));
 
89
        }
 
90
        
 
91
        public void loadIcons(){
 
92
                this.add.setImage(TuxGuitar.instance().getIconManager().getMarkerAdd());
 
93
                this.list.setImage(TuxGuitar.instance().getIconManager().getMarkerList());
 
94
                this.first.setImage(TuxGuitar.instance().getIconManager().getMarkerFirst());
 
95
                this.previous.setImage(TuxGuitar.instance().getIconManager().getMarkerPrevious());
 
96
                this.next.setImage(TuxGuitar.instance().getIconManager().getMarkerNext());
 
97
                this.last.setImage(TuxGuitar.instance().getIconManager().getMarkerLast());
 
98
        }
 
99
}