//
// AWTCursors.java
//

/*
ImageJ software for multidimensional image processing and analysis.

Copyright (c) 2010, ImageJDev.org.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the names of the ImageJDev.org developers nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/

package imagej.awt;

import imagej.display.MouseCursor;

import java.awt.Cursor;

/**
 * Translates ImageJ {@link MouseCursor}s into AWT cursor codes.
 * 
 * @author Grant Harris
 */
public final class AWTCursors {

	private AWTCursors() {
		// prevent instantiation of utility class
	}

	public static int getCursorCode(final MouseCursor cursorCode) {
		switch (cursorCode) {
			default:
				return Cursor.DEFAULT_CURSOR;
			case DEFAULT:
				return Cursor.DEFAULT_CURSOR;
			case OFF:
				return Cursor.CUSTOM_CURSOR;
			case HAND:
				return Cursor.HAND_CURSOR;
			case CROSSHAIR:
				return Cursor.CROSSHAIR_CURSOR;
			case MOVE:
				return Cursor.MOVE_CURSOR;
			case TEXT:
				return Cursor.TEXT_CURSOR;
			case WAIT:
				return Cursor.WAIT_CURSOR;
			case N_RESIZE:
				return Cursor.N_RESIZE_CURSOR;
			case S_RESIZE:
				return Cursor.S_RESIZE_CURSOR;
			case W_RESIZE:
				return Cursor.W_RESIZE_CURSOR;
			case E_RESIZE:
				return Cursor.E_RESIZE_CURSOR;
			case NW_RESIZE:
				return Cursor.NW_RESIZE_CURSOR;
			case NE_RESIZE:
				return Cursor.NE_RESIZE_CURSOR;
			case SW_RESIZE:
				return Cursor.SW_RESIZE_CURSOR;
			case SE_RESIZE:
				return Cursor.SE_RESIZE_CURSOR;
		}
	}

}

@@ -1767,19 +1767,22 @@
 AWT 
-cursor code
+%7B@link Cursor%7D
 s.%0A 
@@ -1808,16 +1808,41 @@
  Harris%0A
+ * @author Curtis Rueden%0A
  */%0Apubl
@@ -1942,16 +1942,347 @@
 ass%0A%09%7D%0A%0A
+%09/**%0A%09 * Gets the AWT %7B@link Cursor%7D corresponding to the given ImageJ%0A%09 * %7B@link MouseCursor%7D.%0A%09 */%0A%09public static Cursor getCursor(final MouseCursor cursorCode) %7B%0A%09%09return Cursor.getPredefinedCursor(getCursorCode(cursorCode));%0A%09%7D%0A%0A%09/**%0A%09 * Gets the AWT cursor code corresponding to the given ImageJ%0A%09 * %7B@link MouseCursor%7D.%0A%09 */%0A
 %09public 
@@ -2366,54 +2366,8 @@
 ) %7B%0A
-%09%09%09default:%0A%09%09%09%09return Cursor.DEFAULT_CURSOR;%0A
 %09%09%09c
@@ -3126,16 +3126,62 @@
 CURSOR;%0A
+%09%09%09default:%0A%09%09%09%09return Cursor.DEFAULT_CURSOR;%0A
 %09%09%7D%0A%09%7D%0A%0A

Add AWTCursors.getCursor(MouseCursor) method.