Mercurial > projects > dwt-mac
diff dwt/widgets/ToolTip.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | 642f460a0908 |
children | 6d9ec9ccdcdd |
line wrap: on
line diff
--- a/dwt/widgets/ToolTip.d Tue Oct 21 15:20:04 2008 +0200 +++ b/dwt/widgets/ToolTip.d Mon Dec 01 17:07:00 2008 +0100 @@ -1,5 +1,5 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. +/******************************************************************************* + * Copyright (c) 2000, 2008 IBM Corporation and others. * 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 @@ -9,7 +9,7 @@ * IBM Corporation - initial API and implementation * * Port to the D programming language: - * Jacob Carlborg <jacob.carlborg@gmail.com> + * Jacob Carlborg <doob@me.com> *******************************************************************************/ module dwt.widgets.ToolTip; @@ -56,6 +56,10 @@ * IMPORTANT: This class is intended to be subclassed <em>only</em> * within the DWT implementation. * </p> + * + * @see <a href="http://www.eclipse.org/swt/snippets/#tooltips">Tool Tips snippets</a> + * @see <a href="http://www.eclipse.org/swt/examples.php">DWT Example: ControlExample</a> + * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> * * @since 3.2 */ @@ -174,7 +178,12 @@ int x = this.x; int y = this.y; if (x is -1 || y is -1) { - Point point = display.getCursorLocation (); + Point point; + if (item !is null) { + point = item.getLocation (); + } else { + point = display.getCursorLocation (); + } x = point.x; y = point.y; } @@ -293,7 +302,7 @@ messageWidth = layoutMessage.getBounds ().width; } int messageTrim = 2 * INSET + 2 * BORDER + 2 * PADDING; - bool hasImage = layoutText !is null && (style & DWT.BALLOON) !is 0 && (style & (DWT.ICON_ERROR | DWT.ICON_INFORMATION | DWT.ICON_WARNING)) !is 0; + bool hasImage = layoutText !is null && (style & DWT.BALLOON) !is 0 && (style & (DWT.ICON_ERROR | DWT.ICON_INFORMATION | DWT.ICON_WARNING)) !is 0; int textTrim = messageTrim + (hasImage ? IMAGE_SIZE : 0); int width = Math.min (maxWidth, Math.max (textWidth + textTrim, messageWidth + messageTrim)); int textHeight = 0, messageHeight = 0;