1
package org.herac.tuxguitar.gui.util;
3
import org.eclipse.swt.SWT;
4
import org.eclipse.swt.events.PaintEvent;
5
import org.eclipse.swt.events.PaintListener;
6
import org.eclipse.swt.graphics.Image;
7
import org.eclipse.swt.widgets.Display;
8
import org.eclipse.swt.widgets.Shell;
9
import org.herac.tuxguitar.gui.SystemImages;
10
import org.herac.tuxguitar.gui.TuxGuitar;
11
import org.herac.tuxguitar.gui.system.config.ConfigKeys;
13
public class SplashShell {
16
public SplashShell(Display display){
17
if(TuxGuitar.instance().getConfig().getBooleanConfigValue(ConfigKeys.SHOW_SPLASH)){
22
private void open(Display display) {
23
final Image image = SystemImages.TUXGUITAR_SPLASH;
24
int width = image.getBounds().width;
25
int height = image.getBounds().height;
26
int x = ((display.getBounds().width - display.getBounds().x) / 2) - (width / 2);
27
int y = ((display.getBounds().height - display.getBounds().y) / 2) - (height / 2);
29
this.shell = new Shell(display, SWT.NO_TRIM | SWT.NO_BACKGROUND);
30
this.shell.setBounds(x, y, width, height);
31
this.shell.setImage(SystemImages.TUXGUITAR_ICON);
32
this.shell.setText(TuxGuitar.getProperty("tuxguitar.title"));
33
this.shell.addPaintListener(new PaintListener() {
34
public void paintControl(PaintEvent e) {
35
e.gc.drawImage(image, 0, 0);
42
if(this.shell != null && !this.shell.isDisposed()){