diff dwt/widgets/Decorations.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
line wrap: on
line diff
--- a/dwt/widgets/Decorations.d	Tue Oct 21 15:20:04 2008 +0200
+++ b/dwt/widgets/Decorations.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.Decorations;
 
@@ -103,6 +103,7 @@
  * @see #getMaximized
  * @see Shell
  * @see DWT
+ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
  */
 public class Decorations : Canvas {
     Image image;
@@ -399,17 +400,16 @@
     } 
     Display display = this.display;
     super.releaseChildren (destroy);
-    //TODO
-//  Menu [] menus = display.getMenus (this);
-//  if (menus !is null) {
-//      for (int i=0; i<menus.length; i++) {
-//          Menu menu = menus [i];
-//          if (menu !is null && !menu.isDisposed ()) {
-//              menu.dispose ();
-//          }
-//      }
-//      menus = null;
-//  }
+    Menu [] menus = display.getMenus (this);
+    if (menus !is null) {
+        for (int i=0; i<menus.length; i++) {
+            Menu menu = menus [i];
+            if (menu !is null && !menu.isDisposed ()) {
+                menu.dispose ();
+            }
+        }
+        menus = null;
+    }
 }
 void releaseWidget () {
     super.releaseWidget ();
@@ -497,13 +497,9 @@
     if (image !is null && image.isDisposed()) error(DWT.ERROR_INVALID_ARGUMENT);
     this.image = image;
     if (parent !is null) return;
-//  if (display.dockImage is 0) {
-//      if (image !is null) {
-//          OS.SetApplicationDockTileImage (image.handle);
-//      } else {
-//          OS.RestoreApplicationDockTileImage ();
-//      }
-//  }
+    if (display.dockImage is null) {
+        display.application.setApplicationIconImage (image !is null ? image.handle : null);
+    }
 }
 
 /**
@@ -538,15 +534,19 @@
     }
     this.images = images;
     if (parent !is null) return;
-//  if (display.dockImage is 0) {
-//      if (images !is null && images.length > 1) {
-//          Image [] bestImages = new Image [images.length];
-//          System.arraycopy (images, 0, bestImages, 0, images.length);
-//          sort (bestImages);
-//          images = bestImages;
-//      }
-//      OS.SetApplicationDockTileImage (images [0].handle);
-//  }
+    if (display.dockImage is null) {
+        if (images !is null && images.length > 1) {
+            Image [] bestImages = new Image [images.length];
+            System.arraycopy (images, 0, bestImages, 0, images.length);
+            sort (bestImages);
+            images = bestImages;
+        }
+        if (images !is null && images.length > 0) {
+            display.application.setApplicationIconImage (images [0].handle);
+        } else {
+            display.application.setApplicationIconImage (null);
+        }
+    }
 }
 
 /**