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

« back to all changes in this revision

Viewing changes to src/org/herac/tuxguitar/gui/items/tool/FileToolItems.java

  • Committer: Bazaar Package Importer
  • Author(s): Philippe Coval
  • Date: 2007-02-04 01:41:23 UTC
  • Revision ID: james.westby@ubuntu.com-20070204014123-9pv7okph0iaiqkvw
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

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.SystemImages;
 
13
import org.herac.tuxguitar.gui.TuxGuitar;
 
14
import org.herac.tuxguitar.gui.actions.file.NewFileAction;
 
15
import org.herac.tuxguitar.gui.actions.file.OpenFileAction;
 
16
import org.herac.tuxguitar.gui.actions.file.PrintAction;
 
17
import org.herac.tuxguitar.gui.actions.file.PrintPreviewAction;
 
18
import org.herac.tuxguitar.gui.actions.file.SaveAsFileAction;
 
19
import org.herac.tuxguitar.gui.actions.file.SaveFileAction;
 
20
import org.herac.tuxguitar.gui.items.ToolItems;
 
21
/**
 
22
 * @author julian
 
23
 *
 
24
 * TODO To change the template for this generated type comment go to
 
25
 * Window - Preferences - Java - Code Style - Code Templates
 
26
 */
 
27
public class FileToolItems extends ToolItems {
 
28
    public static final String NAME = "file.items";
 
29
    private ToolBar toolBar;   
 
30
    private ToolItem newSong;
 
31
    private ToolItem openSong;
 
32
    private ToolItem saveSong;
 
33
    private ToolItem saveAsSong;
 
34
    private ToolItem printSong;
 
35
    private ToolItem printPreviewSong;
 
36
    
 
37
    public FileToolItems(){
 
38
        super(NAME);
 
39
    }
 
40
   
 
41
    public void showItems(ToolBar toolBar){
 
42
        this.toolBar = toolBar;                 
 
43
        newSong = new ToolItem(toolBar, SWT.PUSH);
 
44
        newSong.setImage(SystemImages.NEW_IMAGE);
 
45
        newSong.addSelectionListener(TuxGuitar.instance().getAction(NewFileAction.NAME));
 
46
       
 
47
        openSong = new ToolItem(toolBar, SWT.PUSH);
 
48
        openSong.setImage(SystemImages.OPEN_IMAGE);
 
49
        openSong.addSelectionListener(TuxGuitar.instance().getAction(OpenFileAction.NAME));
 
50
 
 
51
        saveSong = new ToolItem(toolBar, SWT.PUSH);
 
52
        saveSong.setImage(SystemImages.SAVE_IMAGE);
 
53
        saveSong.addSelectionListener(TuxGuitar.instance().getAction(SaveFileAction.NAME));
 
54
    
 
55
        saveAsSong = new ToolItem(toolBar, SWT.PUSH);
 
56
        saveAsSong.setImage(SystemImages.SAVE_AS_IMAGE);
 
57
        saveAsSong.addSelectionListener(TuxGuitar.instance().getAction(SaveAsFileAction.NAME));        
 
58
        
 
59
        printSong = new ToolItem(toolBar, SWT.PUSH);
 
60
        printSong.setImage(SystemImages.PRINT_IMAGE);
 
61
        printSong.addSelectionListener(TuxGuitar.instance().getAction(PrintAction.NAME));        
 
62
        
 
63
        printPreviewSong = new ToolItem(toolBar, SWT.PUSH);
 
64
        printPreviewSong.setImage(SystemImages.PRINT_PREVIEW_IMAGE);
 
65
        printPreviewSong.addSelectionListener(TuxGuitar.instance().getAction(PrintPreviewAction.NAME)); 
 
66
        
 
67
        this.loadProperties();
 
68
    }
 
69
    
 
70
    
 
71
    public void update(){
 
72
        
 
73
    }
 
74
    
 
75
    public void loadProperties(){
 
76
        this.newSong.setToolTipText(TuxGuitar.getProperty("file.new"));  
 
77
        this.openSong.setToolTipText(TuxGuitar.getProperty("file.open"));  
 
78
        this.saveSong.setToolTipText(TuxGuitar.getProperty("file.save"));
 
79
        this.saveAsSong.setToolTipText(TuxGuitar.getProperty("file.save-as"));
 
80
        this.printSong.setToolTipText(TuxGuitar.getProperty("file.print"));
 
81
        this.printPreviewSong.setToolTipText(TuxGuitar.getProperty("file.print-preview"));
 
82
    }        
 
83
}
 
84