Mercurial > projects > dwt-addons
diff dwtx/novocode/ishell/internal/TitleBar.d @ 189:71ca5bcf2307
Replaced String alias with import dwt.dwthelper.util
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 26 Oct 2008 14:57:25 +0100 |
parents | e3780acbbf80 |
children | df4e66472aff |
line wrap: on
line diff
--- a/dwtx/novocode/ishell/internal/TitleBar.d Sun Oct 26 14:54:39 2008 +0100 +++ b/dwtx/novocode/ishell/internal/TitleBar.d Sun Oct 26 14:57:25 2008 +0100 @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2005 Stefan Zeiger and others. - * All rights reserved. This program and the accompanying materials + * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.novocode.com/legal/epl-v10.html - * + * * Contributors: * Stefan Zeiger (szeiger@novocode.com) - initial API and implementation *******************************************************************************/ @@ -38,12 +38,12 @@ import dwtx.novocode.ishell.DesktopForm; import dwtx.novocode.ishell.InternalShell; -alias char[] String; +import dwt.dwthelper.utils; /** * A title bar for an InternalShell. - * + * * @author Stefan Zeiger (szeiger@novocode.com) * @since Jan 21, 2005 * @version $Id: TitleBar.java 342 2005-07-09 20:37:13 +0000 (Sat, 09 Jul 2005) szeiger $ @@ -131,7 +131,7 @@ maximizeItem.setText("Ma&ximize"); maximizeItem.setImage(maximizeImage); maximizeItem.addListener(DWT.Selection, dgListener(&maximizeListener)); - + new MenuItem(defaultPopup, DWT.SEPARATOR); closeItem = new MenuItem(defaultPopup, DWT.PUSH); @@ -151,7 +151,7 @@ deactivateListener = dgListener(&onDeactivateListener); shell.addListener(DWT.Activate, activateListener); shell.addListener(DWT.Deactivate, deactivateListener); - + addListener(DWT.Dispose, dgListener(&onDispose)); } @@ -184,14 +184,14 @@ { Rectangle r = getClientArea(); if(r.width is 0 || r.height is 0) return; - + bool active = (shell is display.getActiveShell() && ishell.isActiveShell()); GC gc = event.gc; gc.setForeground(active ? gradStartColor : inactiveGradStartColor); gc.setBackground(active ? gradEndColor : inactiveGradEndColor); gc.fillGradientRectangle(r.x, r.y, r.width, r.height, false); - + int textLeftPadding = LEFT_PADDING; if(image !is null) { @@ -202,7 +202,7 @@ gc.drawImage(image, LEFT_PADDING + (IMAGE_SIZE-imageBounds.width)/2, (r.height-imageBounds.height)/2); textLeftPadding += IMAGE_SIZE + LEFT_PADDING; } - + if(text !is null && text.length() > 0) { gc.setForeground(active ? textColor : inactiveTextColor); @@ -393,8 +393,8 @@ if(newX !is p.x || newY !is p.y) ishell.setLocation(newX, newY); } - - + + public Point getMinGrabSize() { return minGrabSize; @@ -438,19 +438,19 @@ checkWidget(); return false; } - - + + public void setText(String text) { checkWidget(); this.text = text; redraw(); } - - + + public String getText() { return text; } - - + + public void setImage(Image image) { checkWidget(); @@ -460,8 +460,8 @@ if(image !is null) minGrabSize.x += LEFT_PADDING + IMAGE_SIZE; redraw(); } - - + + public Image getImage() { return image; } @@ -475,8 +475,8 @@ } return new Font(getDisplay(), fds); } - - + + private void instrumentDefaultPopup(bool onImage) { restoreItem.setEnabled(styleMax && ishell.getMaximized()); @@ -492,8 +492,8 @@ } defaultPopup.setDefaultItem(def); } - - + + private static const int IMAGE_TYPE_CLOSE = 1; private static const int IMAGE_TYPE_MAXIMIZE = 2; private static const int IMAGE_TYPE_RESTORE = 3; @@ -507,7 +507,7 @@ final Color fg = getForeground(); final Color white = getDisplay().getSystemColor(DWT.COLOR_WHITE); final RGB blackRGB = new RGB(0,0,0); - + ImageData id = new ImageData(imgWidth, size.y, 1, new PaletteData([ blackRGB, fg.getRGB() ])); ImageData maskid = new ImageData(imgWidth, size.y, 1, new PaletteData([ blackRGB, white.getRGB() ])); @@ -516,7 +516,7 @@ gc.setForeground(fg); drawMenuImage(gc, size, type); gc.dispose(); - + Image maskimg = new Image(getDisplay(), maskid); gc = new GC(maskimg); gc.setForeground(white);