diff dwtx/ui/internal/forms/widgets/FormsResources.d @ 75:5d489b9f966c

Fix continue porting
author Frank Benoit <benoit@tionex.de>
date Sat, 24 May 2008 05:11:16 +0200
parents
children 26c6c9dfd13c
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwtx/ui/internal/forms/widgets/FormsResources.d	Sat May 24 05:11:16 2008 +0200
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2005 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ *******************************************************************************/
+module dwtx.ui.internal.forms.widgets.FormsResources;
+
+import dwt.DWT;
+import dwt.graphics.Cursor;
+import dwt.widgets.Display;
+
+/**
+ * Utility methods to access shared form-specific resources.
+ * <p>
+ * All methods declared on this class are static. This
+ * class cannot be instantiated.
+ * </p>
+ * <p>
+ * </p>
+ */
+public class FormsResources {
+    private static Cursor busyCursor;
+    private static Cursor handCursor;
+    private static Cursor textCursor;
+
+    public static Cursor getBusyCursor() {
+        if (busyCursorisnull)
+            busyCursor = new Cursor(Display.getCurrent(), DWT.CURSOR_WAIT);
+        return busyCursor;
+    }
+    public static Cursor getHandCursor() {
+        if (handCursorisnull)
+            handCursor = new Cursor(Display.getCurrent(), DWT.CURSOR_HAND);
+        return handCursor;
+    }
+    public static Cursor getTextCursor() {
+        if (textCursorisnull)
+            textCursor = new Cursor(Display.getCurrent(), DWT.CURSOR_IBEAM);
+        return textCursor;
+    }
+
+    public static int getProgressDelay(int index) {
+        /*
+        if (progressDelaysisnull)
+            return 0;
+        return progressDelays[index];
+        */
+        return 100;
+    }
+
+    public static void shutdown() {
+        if (busyCursor !is null)
+            busyCursor.dispose();
+        if (handCursor !is null)
+            handCursor.dispose();
+        if (textCursor !is null)
+            textCursor.dispose();
+        busyCursor=null;
+        handCursor=null;
+        textCursor=null;
+    }
+}