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

« back to all changes in this revision

Viewing changes to TuxGuitar/src/org/herac/tuxguitar/gui/items/tool/MarkerToolItems.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.tool;
 
8
 
 
9
import org.eclipse.swt.SWT;
 
10
import org.eclipse.swt.widgets.ToolBar;
 
11
import org.eclipse.swt.widgets.ToolItem;
 
12
import org.herac.tuxguitar.gui.TuxGuitar;
 
13
import org.herac.tuxguitar.gui.actions.marker.AddMarkerAction;
 
14
import org.herac.tuxguitar.gui.actions.marker.GoFirstMarkerAction;
 
15
import org.herac.tuxguitar.gui.actions.marker.GoLastMarkerAction;
 
16
import org.herac.tuxguitar.gui.actions.marker.GoNextMarkerAction;
 
17
import org.herac.tuxguitar.gui.actions.marker.GoPreviousMarkerAction;
 
18
import org.herac.tuxguitar.gui.actions.marker.ListMarkersAction;
 
19
import org.herac.tuxguitar.gui.items.ToolItems;
 
20
/**
 
21
 * @author julian
 
22
 *
 
23
 * TODO To change the template for this generated type comment go to
 
24
 * Window - Preferences - Java - Code Style - Code Templates
 
25
 */
 
26
public class MarkerToolItems  extends ToolItems{
 
27
        public static final String NAME = "marker.items";
 
28
        
 
29
        private ToolItem add;
 
30
        private ToolItem list;
 
31
        private ToolItem first;
 
32
        private ToolItem last;
 
33
        private ToolItem previous;
 
34
        private ToolItem next;
 
35
        
 
36
        public MarkerToolItems(){
 
37
                super(NAME);
 
38
        }
 
39
        
 
40
        public void showItems(ToolBar toolBar){
 
41
                //--ADD--
 
42
                this.add = new ToolItem(toolBar, SWT.PUSH);
 
43
                this.add.addSelectionListener(TuxGuitar.instance().getAction(AddMarkerAction.NAME));
 
44
                
 
45
                //--LIST--
 
46
                this.list = new ToolItem(toolBar, SWT.PUSH);
 
47
                this.list.addSelectionListener(TuxGuitar.instance().getAction(ListMarkersAction.NAME));
 
48
                
 
49
                //--SEPARATOR--
 
50
                new ToolItem(toolBar, SWT.SEPARATOR);
 
51
                
 
52
                //--FIRST--
 
53
                this.first = new ToolItem(toolBar, SWT.PUSH);
 
54
                this.first.addSelectionListener(TuxGuitar.instance().getAction(GoFirstMarkerAction.NAME));
 
55
                
 
56
                //--PREVIOUS--
 
57
                this.previous = new ToolItem(toolBar, SWT.PUSH);
 
58
                this.previous.addSelectionListener(TuxGuitar.instance().getAction(GoPreviousMarkerAction.NAME));
 
59
                
 
60
                //--PREVIOUS--
 
61
                this.next = new ToolItem(toolBar, SWT.PUSH);
 
62
                this.next.addSelectionListener(TuxGuitar.instance().getAction(GoNextMarkerAction.NAME));
 
63
                
 
64
                //--LAST--
 
65
                this.last = new ToolItem(toolBar, SWT.PUSH);
 
66
                this.last.addSelectionListener(TuxGuitar.instance().getAction(GoLastMarkerAction.NAME));
 
67
                
 
68
                this.loadIcons();
 
69
                this.loadProperties();
 
70
        }
 
71
        
 
72
        public void update(){
 
73
                //Nothing to do
 
74
        }
 
75
        
 
76
        public void loadProperties(){
 
77
                this.add.setToolTipText(TuxGuitar.getProperty("marker.add"));
 
78
                this.list.setToolTipText(TuxGuitar.getProperty("marker.list"));
 
79
                this.first.setToolTipText(TuxGuitar.getProperty("marker.first"));
 
80
                this.last.setToolTipText(TuxGuitar.getProperty("marker.last"));
 
81
                this.previous.setToolTipText(TuxGuitar.getProperty("marker.previous"));
 
82
                this.next.setToolTipText(TuxGuitar.getProperty("marker.next"));
 
83
        }
 
84
        
 
85
        public void loadIcons(){
 
86
                this.add.setImage(TuxGuitar.instance().getIconManager().getMarkerAdd());
 
87
                this.list.setImage(TuxGuitar.instance().getIconManager().getMarkerList());
 
88
                this.first.setImage(TuxGuitar.instance().getIconManager().getMarkerFirst());
 
89
                this.previous.setImage(TuxGuitar.instance().getIconManager().getMarkerPrevious());
 
90
                this.next.setImage(TuxGuitar.instance().getIconManager().getMarkerNext());
 
91
                this.last.setImage(TuxGuitar.instance().getIconManager().getMarkerLast());
 
92
        }
 
93
}