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

« back to all changes in this revision

Viewing changes to TuxGuitar/src/org/herac/tuxguitar/gui/items/menu/ToolMenuItem.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 java.util.Iterator;
 
10
 
 
11
import org.eclipse.swt.SWT;
 
12
import org.eclipse.swt.widgets.Menu;
 
13
import org.eclipse.swt.widgets.MenuItem;
 
14
import org.eclipse.swt.widgets.Shell;
 
15
import org.herac.tuxguitar.gui.TuxGuitar;
 
16
import org.herac.tuxguitar.gui.actions.settings.EditConfigAction;
 
17
import org.herac.tuxguitar.gui.actions.settings.EditKeyBindingsAction;
 
18
import org.herac.tuxguitar.gui.actions.settings.EditPluginsAction;
 
19
import org.herac.tuxguitar.gui.actions.tools.ScaleAction;
 
20
import org.herac.tuxguitar.gui.actions.tools.TGBrowserAction;
 
21
import org.herac.tuxguitar.gui.items.MenuItems;
 
22
import org.herac.tuxguitar.gui.tools.custom.TGCustomTool;
 
23
import org.herac.tuxguitar.gui.tools.custom.TGCustomToolManager;
 
24
 
 
25
/**
 
26
 * @author julian
 
27
 * 
 
28
 * TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates
 
29
 */
 
30
public class ToolMenuItem implements MenuItems {
 
31
        private MenuItem settingsMenuItem;
 
32
        private Menu menu;
 
33
        private MenuItem scale;
 
34
        private MenuItem browser;
 
35
        private MenuItem plugins;
 
36
        private MenuItem config;
 
37
        private MenuItem keyBindings;
 
38
        
 
39
        public ToolMenuItem(Shell shell,Menu parent, int style) {
 
40
                this.settingsMenuItem = new MenuItem(parent, style);
 
41
                this.menu = new Menu(shell, SWT.DROP_DOWN);
 
42
        }
 
43
        
 
44
        public void showItems(){
 
45
                this.scale = new MenuItem(this.menu, SWT.PUSH);
 
46
                this.scale.addSelectionListener(TuxGuitar.instance().getAction(ScaleAction.NAME));
 
47
                
 
48
                this.browser = new MenuItem(this.menu, SWT.PUSH);
 
49
                this.browser.addSelectionListener(TuxGuitar.instance().getAction(TGBrowserAction.NAME));
 
50
                
 
51
                Iterator it = TGCustomToolManager.instance().getCustomTools();
 
52
                while(it.hasNext()){
 
53
                        TGCustomTool tool = (TGCustomTool)it.next();
 
54
                        MenuItem menuItem = new MenuItem(this.menu, SWT.PUSH);
 
55
                        menuItem.setText(tool.getName());
 
56
                        menuItem.addSelectionListener(TuxGuitar.instance().getAction(tool.getAction()));
 
57
                }
 
58
                
 
59
                //--SEPARATOR--
 
60
                new MenuItem(this.menu, SWT.SEPARATOR);
 
61
                
 
62
                //--PLUGINS--
 
63
                this.plugins = new MenuItem(this.menu, SWT.PUSH);
 
64
                this.plugins.addSelectionListener(TuxGuitar.instance().getAction(EditPluginsAction.NAME));
 
65
                
 
66
                //--KEY BINDINGS--
 
67
                this.keyBindings = new MenuItem(this.menu, SWT.PUSH);
 
68
                this.keyBindings.addSelectionListener(TuxGuitar.instance().getAction(EditKeyBindingsAction.NAME));
 
69
                
 
70
                //--CONFIG--
 
71
                this.config = new MenuItem(this.menu, SWT.PUSH);
 
72
                this.config.addSelectionListener(TuxGuitar.instance().getAction(EditConfigAction.NAME));
 
73
                
 
74
                this.settingsMenuItem.setMenu(this.menu);
 
75
                
 
76
                this.loadIcons();
 
77
                this.loadProperties();
 
78
        }
 
79
        
 
80
        public void loadProperties(){
 
81
                this.settingsMenuItem.setText(TuxGuitar.getProperty("tools"));
 
82
                this.scale.setText(TuxGuitar.getProperty("tools.scale"));
 
83
                this.browser.setText(TuxGuitar.getProperty("tools.browser"));
 
84
                this.plugins.setText(TuxGuitar.getProperty("tools.plugins"));
 
85
                this.keyBindings.setText(TuxGuitar.getProperty("tools.shortcuts"));
 
86
                this.config.setText(TuxGuitar.getProperty("tools.settings"));
 
87
        }
 
88
        
 
89
        public void loadIcons(){
 
90
                //Nothing to do
 
91
        }
 
92
        
 
93
        public void update(){
 
94
                //Nothing to do
 
95
        }
 
96
}
 
 
b'\\ No newline at end of file'