diff dwtx/jface/fieldassist/ControlDecoration.d @ 70:46a6e0e6ccd4

Merge with d-fied sources of 3.4M7
author Frank Benoit <benoit@tionex.de>
date Thu, 22 May 2008 01:36:46 +0200
parents b3c8e32d406f
children c3583c6ec027
line wrap: on
line diff
--- a/dwtx/jface/fieldassist/ControlDecoration.d	Mon May 19 13:41:06 2008 +0200
+++ b/dwtx/jface/fieldassist/ControlDecoration.d	Thu May 22 01:36:46 2008 +0200
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -121,13 +121,13 @@
     private bool visible = true;
 
     /**
-     * bool indicating whether the decoration should only be shown when the
+     * Boolean indicating whether the decoration should only be shown when the
      * control has focus
      */
     private bool showOnlyOnFocus = false;
 
     /**
-     * bool indicating whether the decoration should show its description
+     * Boolean indicating whether the decoration should show its description
      * text in a hover when the user hovers over the decoration.
      */
     private bool showHover = true;
@@ -249,7 +249,7 @@
         Region region;
 
         /**
-         * bool indicating whether the last computed polygon location had an
+         * Boolean indicating whether the last computed polygon location had an
          * arrow on left. (true if left, false if right).
          */
         bool arrowOnLeft = true;
@@ -260,7 +260,7 @@
         this(Shell parent) {
             Display display = parent.getDisplay();
             hoverShell = new Shell(parent, DWT.NO_TRIM | DWT.ON_TOP
-                    | DWT.NO_FOCUS);
+                    | DWT.NO_FOCUS | DWT.TOOL);
             hoverShell.setBackground(display
                     .getSystemColor(DWT.COLOR_INFO_BACKGROUND));
             hoverShell.setForeground(display
@@ -824,7 +824,8 @@
      * an info hover over the field's control whenever the mouse hovers over the
      * decoration. This method can be used to show a decoration's description
      * text at other times (such as when the control receives focus), or to show
-     * other text associated with the field.
+     * other text associated with the field. The hover will not be shown if the
+     * decoration is hidden.
      *
      * @param text
      *            the text to be shown in the info hover, or <code>null</code>
@@ -870,12 +871,13 @@
     }
 
     /**
-     * Hide the control decoration. This message has no effect if the decoration
-     * is already hidden.
+     * Hide the control decoration and any associated hovers. This message has
+     * no effect if the decoration is already hidden.
      */
     public void hide() {
         if (visible) {
             visible = false;
+            hideHover();
             update();
         }
     }
@@ -919,7 +921,8 @@
      * decoration.
      *
      * @param image
-     *            the image to be shown adjacent to the control
+     *            the image to be shown adjacent to the control. Should never be
+     *            <code>null</code>.
      */
     public void setImage(Image image) {
         this.image = image;
@@ -1045,6 +1048,11 @@
         if (!showHover) {
             return;
         }
+
+        // If we are not visible, don't show the hover.
+        if (!visible) {
+            return;
+        }
         // If there is no text, don't do anything.
         if (text is null) {
             hideHover();