Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 110937 Details for
Bug 244004
Cursor support missing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Add support for set/get cursor of Control.
Cursor_Infrastructure_Patch.txt (text/plain), 29.78 KB, created by
Ivan Furnadjiev
on 2008-08-26 10:39:01 EDT
(
hide
)
Description:
Add support for set/get cursor of Control.
Filename:
MIME Type:
Creator:
Ivan Furnadjiev
Created:
2008-08-26 10:39:01 EDT
Size:
29.78 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rap.rwt >Index: src/org/eclipse/swt/internal/widgets/Props.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.rap/org.eclipse.rap.rwt/src/org/eclipse/swt/internal/widgets/Props.java,v >retrieving revision 1.4 >diff -u -r1.4 Props.java >--- src/org/eclipse/swt/internal/widgets/Props.java 12 Jun 2008 13:12:12 -0000 1.4 >+++ src/org/eclipse/swt/internal/widgets/Props.java 26 Aug 2008 14:25:00 -0000 >@@ -22,7 +22,8 @@ > public static final String VISIBLE = "visible"; > public static final String ENABLED = "enabled"; > public static final String CONTROL_LISTENERS = "hasControlListeners"; >- >+ public static final String CURSOR = "cursor"; >+ > // Scrollable > public static final String CLIENT_AREA = "clientArea"; > >@@ -30,21 +31,21 @@ > public static final String SELECTION_LISTENERS = "selectionListeners"; > public static final String ACTIVATE_LISTENER = "activateListener"; > public static final String FOCUS_LISTENER = "focusListener"; >- >+ > // Text properties > public static final String TEXT = "text"; >- >+ > public static final String IMAGE = "image"; >- >+ > // Table, TableItem and TableColumn properties > public static final String SELECTION_INDICES = "selection"; >- >+ > // CoolBar/CoolItem properties > public static final String LOCKED = "locked"; > public static final String CONTROL = "control"; >- >+ > public static final String TOOLTIP = "toolTip"; >- >+ > public static final String BACKGROUND = "background"; > public static final String FOREGROUND = "foreground"; > public static final String FONT = "font"; >Index: src/org/eclipse/rwt/graphics/Graphics.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.rap/org.eclipse.rap.rwt/src/org/eclipse/rwt/graphics/Graphics.java,v >retrieving revision 1.14 >diff -u -r1.14 Graphics.java >--- src/org/eclipse/rwt/graphics/Graphics.java 12 Jun 2008 13:56:32 -0000 1.14 >+++ src/org/eclipse/rwt/graphics/Graphics.java 26 Aug 2008 14:24:56 -0000 >@@ -23,7 +23,7 @@ > * As RAP needs to handle with multiple clients simultaneously there are no > * constructors for these objects to share them between different sessions > * in order to have a much smaller memory footprint. >- * >+ * > * @since 1.0 > */ > public final class Graphics { >@@ -31,10 +31,10 @@ > /** > * Returns an instance of {@link Color} given an > * <code>RGB</code> describing the desired red, green and blue values. >- * >+ * > * @param rgb the RGB values of the desired color > * @return the color >- * >+ * > * @see RGB > * @see Device#getSystemColor > */ >@@ -46,7 +46,7 @@ > * Returns a {@link Color} given the > * desired red, green and blue values expressed as ints in the range > * 0 to 255 (where 0 is black and 255 is full brightness). >- * >+ * > * @param red the amount of red in the color > * @param green the amount of green in the color > * @param blue the amount of blue in the color >@@ -60,7 +60,7 @@ > /** > * Returns a new font given a font data > * which describes the desired font's appearance. >- * >+ * > * @param data the {@link FontData} to use > * @return the font > */ >@@ -71,7 +71,7 @@ > /** > * Returns a {@link Font} object given a font name, the height of the desired > * font in points, and a font style. >- * >+ * > * @param name the name of the font (must not be null) > * @param height the font height in points > * @param style a bit or combination of <code>NORMAL</code>, >@@ -88,9 +88,9 @@ > /** > * Returns an instance of {@link Image} based on the specified > * image path. The image has to be on the applications class-path. >- * >+ * > * @param path the path to the image >- * >+ * > * @return the image > */ > public static Image getImage( final String path ) { >@@ -101,10 +101,10 @@ > * Returns an instance of {@link Image} based on the specified > * image path. The image has to be on the applications class-path. > * Uses the specified classloader to load the image. >- * >+ * > * @param path the path to the image > * @param imageLoader the classloader to use >- * >+ * > * @return the image > */ > public static Image getImage( final String path, >@@ -113,14 +113,14 @@ > return ResourceFactory.findImage( path, imageLoader ); > } > >- >+ > /** > * Returns an instance of {@link Image} based on the specified > * image path. The image will be read from the provided InputStream. >- * >+ * > * @param path the path to the image > * @param inputStream the input stream for the image >- * >+ * > * @return the image > */ > public static Image getImage( final String path, >@@ -128,10 +128,22 @@ > { > return ResourceFactory.findImage( path, inputStream ); > } >- >+ >+ /** >+ * Returns an instance of {@link Cursor} based on the specified style. >+ * >+ * @param style the cursor style >+ * @return >+ * >+ * @return the cursor >+ */ >+ public static Cursor getCursor( final int style ) { >+ return ResourceFactory.getCursor( style ); >+ } >+ > ////////////////////////// > // Text-Size-Determination >- >+ > /** > * Returns the extent of the given string. Tab expansion and carriage return > * processing are performed. >@@ -139,7 +151,7 @@ > * The <em>extent</em> of a string is the width and height of the > * rectangular area it would cover if drawn in a particular font. > * </p> >- * >+ * > * @param font the font for which the result is valid > * @param string the string to measure > * @param wrapWidth the maximum width of the text. The text will be wrapped to >@@ -159,7 +171,7 @@ > } > return TextSizeDetermination.textExtent( font, string, wrapWidth ); > } >- >+ > /** > * Returns the extent of the given string. No tab expansion or carriage return > * processing will be performed. >@@ -167,7 +179,7 @@ > * The <em>extent</em> of a string is the width and height of the > * rectangular area it would cover if drawn in a particular font. > * </p> >- * >+ * > * @param font the font for which the result is valid > * @param string the string to measure > * @return a point containing the extent of the string >@@ -182,10 +194,10 @@ > } > return TextSizeDetermination.stringExtent( font, string ); > } >- >+ > /** > * Returns the height of the specified font, measured in pixels. >- * >+ * > * @param font the font for which the result is valid > * @return the height of the font > */ >@@ -195,11 +207,11 @@ > } > return TextSizeDetermination.getCharHeight( font ); > } >- >+ > /** > * Returns the average character width of the specified font, measured in > * pixels. >- * >+ * > * @param font the font for which the result is valid > * @return the average character width of the font > */ >Index: src/org/eclipse/rwt/lifecycle/ControlLCAUtil.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.rap/org.eclipse.rap.rwt/src/org/eclipse/rwt/lifecycle/ControlLCAUtil.java,v >retrieving revision 1.15 >diff -u -r1.15 ControlLCAUtil.java >--- src/org/eclipse/rwt/lifecycle/ControlLCAUtil.java 12 Jun 2008 13:12:18 -0000 1.15 >+++ src/org/eclipse/rwt/lifecycle/ControlLCAUtil.java 26 Aug 2008 14:24:57 -0000 >@@ -51,7 +51,7 @@ > = new JSListenerInfo( "focusout", > "org.eclipse.swt.EventUtil.focusLost", > JSListenerType.ACTION ); >- >+ > private static final JSListenerInfo MOUSE_DOWN_LISTENER_INFO > = new JSListenerInfo( "mousedown", > "org.eclipse.swt.EventUtil.mouseDown", >@@ -124,6 +124,7 @@ > controlAdapter.getBackgroundTransparency() ); > preserveBackgroundImage( control ); > WidgetLCAUtil.preserveFont( control, controlAdapter.getUserFont() ); >+ adapter.preserve( Props.CURSOR, control.getCursor() ); > adapter.preserve( Props.CONTROL_LISTENERS, > Boolean.valueOf( ControlEvent.hasListener( control ) ) ); > adapter.preserve( PROP_ACTIVATE_LISTENER, >@@ -310,6 +311,7 @@ > writeBackground( control ); > writeBackgroundImage( control ); > writeFont( control ); >+ writeCursor( control ); > // TODO [rst] missing: writeControlListener( control ); > writeActivateListener( control ); > writeFocusListener( control ); >@@ -634,6 +636,45 @@ > WidgetLCAUtil.resetFont(); > } > >+ /** >+ * Determines whether the property <code>cursor</code> of the given control >+ * has changed during the processing of the current request and if so, writes >+ * JavaScript code to the response that updates the client-side cursor property. >+ * >+ * @param control the control whose font property to write >+ * @throws IOException >+ */ >+ public static void writeCursor( final Control control ) throws IOException { >+ Cursor newValue = control.getCursor(); >+ if( WidgetLCAUtil.hasChanged( control, Props.CURSOR, newValue, null ) ) { >+ String qxCursor = null; >+ if( newValue != null ) { >+ int hashCode = newValue.hashCode(); >+ if( hashCode >= 0 && hashCode < JSConst.QX_CURSOR_VALUES.length ) { >+ qxCursor = JSConst.QX_CURSOR_VALUES[ hashCode ]; >+ if( "null".equals( qxCursor ) ) { >+ qxCursor = null; >+ } >+ } >+ } >+ JSWriter writer = JSWriter.getWriterFor( control ); >+ writer.set( JSConst.QX_FIELD_CURSOR, qxCursor ); >+ } >+ } >+ >+ /** >+ * Writes JavaScript code to the response that resets the property >+ * <code>cursor</code> of a control. This method is intended to be used by >+ * implementations of the method >+ * {@link AbstractWidgetLCA#createResetHandlerCalls(String)}. >+ * >+ * @throws IOException >+ */ >+ public static void resetCursor() throws IOException { >+ JSWriter writer = JSWriter.getWriterForResetHandler(); >+ writer.reset( JSConst.QX_FIELD_CURSOR ); >+ } >+ > public static void writeActivateListener( final Control control ) > throws IOException > { >@@ -697,9 +738,9 @@ > writer.removeListener( FOCUS_LOST_LISTENER_INFO.getEventType(), > FOCUS_LOST_LISTENER_INFO.getJSListener() ); > } >- >- private static void writeMouseListener( final Control control ) >- throws IOException >+ >+ private static void writeMouseListener( final Control control ) >+ throws IOException > { > boolean hasListener = MouseEvent.hasListener( control ); > JSWriter writer = JSWriter.getWriterFor( control ); >@@ -863,17 +904,17 @@ > true, > SWT.NONE ); > } >- >+ > public static void processMouseEvents( final Control control ) { > if( WidgetLCAUtil.wasEventSent( control, JSConst.EVENT_MOUSE_DOWN ) ) { > MouseEvent event = new MouseEvent( control, MouseEvent.MOUSE_DOWN ); > event.button > = readIntParam( control, JSConst.EVENT_MOUSE_DOWN_BUTTON ); > Point point = readXYParams( control, >- JSConst.EVENT_MOUSE_DOWN_X, >+ JSConst.EVENT_MOUSE_DOWN_X, > JSConst.EVENT_MOUSE_DOWN_Y ); >- event.x = point.x; >- event.y = point.y; >+ event.x = point.x; >+ event.y = point.y; > event.processEvent(); > } > String eventId = JSConst.EVENT_MOUSE_DOUBLE_CLICK; >@@ -882,36 +923,36 @@ > = new MouseEvent( control, MouseEvent.MOUSE_DOUBLE_CLICK ); > event.button > = readIntParam( control, JSConst.EVENT_MOUSE_DOUBLE_CLICK_BUTTON ); >- Point point = readXYParams( control, >- JSConst.EVENT_MOUSE_DOUBLE_CLICK_X, >+ Point point = readXYParams( control, >+ JSConst.EVENT_MOUSE_DOUBLE_CLICK_X, > JSConst.EVENT_MOUSE_DOUBLE_CLICK_Y ); >- event.x = point.x; >- event.y = point.y; >+ event.x = point.x; >+ event.y = point.y; > event.processEvent(); > } > if( WidgetLCAUtil.wasEventSent( control, JSConst.EVENT_MOUSE_UP ) ) { > MouseEvent event = new MouseEvent( control, MouseEvent.MOUSE_UP ); > event.button = readIntParam( control, JSConst.EVENT_MOUSE_UP_BUTTON ); > Point point = readXYParams( control, >- JSConst.EVENT_MOUSE_UP_X, >+ JSConst.EVENT_MOUSE_UP_X, > JSConst.EVENT_MOUSE_UP_Y ); >- event.x = point.x; >- event.y = point.y; >+ event.x = point.x; >+ event.y = point.y; > event.processEvent(); > } > } > >- private static int readIntParam( final Control control, >- final String paramName ) >+ private static int readIntParam( final Control control, >+ final String paramName ) > { > HttpServletRequest request = ContextProvider.getRequest(); > String value = request.getParameter( paramName ); > return Integer.parseInt( value ); > } > >- private static Point readXYParams( final Control control, >+ private static Point readXYParams( final Control control, > final String paramNameX, >- final String paramNameY ) >+ final String paramNameY ) > { > int x = readIntParam( control, paramNameX ); > int y = readIntParam( control, paramNameY ); >Index: src/org/eclipse/swt/internal/graphics/ResourceFactory.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.rap/org.eclipse.rap.rwt/src/org/eclipse/swt/internal/graphics/ResourceFactory.java,v >retrieving revision 1.12 >diff -u -r1.12 ResourceFactory.java >--- src/org/eclipse/swt/internal/graphics/ResourceFactory.java 12 Jun 2008 13:12:19 -0000 1.12 >+++ src/org/eclipse/swt/internal/graphics/ResourceFactory.java 26 Aug 2008 14:24:59 -0000 >@@ -30,6 +30,7 @@ > private final static Map colors = new HashMap(); > private static final Map fonts = new HashMap(); > private static final Map images = new HashMap(); >+ private static final Map cursors = new HashMap(); > private static final ImageDataCache imageDataCache = new ImageDataCache(); > > ///////// >@@ -218,6 +219,22 @@ > return result; > } > >+ //////// >+ // Cursors >+ >+ public static Cursor getCursor( final int style ) { >+ Cursor result; >+ Integer key = new Integer( style ); >+ synchronized( Cursor.class ) { >+ result = ( Cursor )cursors.get( key ); >+ if( result == null ) { >+ result = createCursorInstance( style ); >+ cursors.put( key, result ); >+ } >+ } >+ return result; >+ } >+ > /////////////// > // Test helpers > >@@ -225,6 +242,7 @@ > colors.clear(); > fonts.clear(); > images.clear(); >+ cursors.clear(); > } > > static int colorsCount() { >@@ -239,6 +257,10 @@ > return images.size(); > } > >+ static int cursorsCount() { >+ return cursors.size(); >+ } >+ > > ////////////////// > // Helping methods >@@ -447,7 +469,7 @@ > Class[] paramList = new Class[] { int.class, int.class }; > Constructor constr = fontClass.getDeclaredConstructor( paramList ); > constr.setAccessible( true ); >- result = ( Image )constr.newInstance( new Object[]{ >+ result = ( Image )constr.newInstance( new Object[] { > new Integer( width ), new Integer( height ) > } ); > } catch( final Exception e ) { >@@ -456,6 +478,22 @@ > return result; > } > >+ private static Cursor createCursorInstance( final int style ) { >+ Cursor result = null; >+ try { >+ Class cursorClass = Cursor.class; >+ Class[] paramList = new Class[] { int.class }; >+ Constructor constr = cursorClass.getDeclaredConstructor( paramList ); >+ constr.setAccessible( true ); >+ result = ( Cursor )constr.newInstance( new Object[] { >+ new Integer( style ) >+ } ); >+ } catch( final Exception e ) { >+ throw new RuntimeException( "Failed to instantiate Cursor", e ); >+ } >+ return result; >+ } >+ > private ResourceFactory() { > // prevent instantiation > } >Index: src/org/eclipse/rwt/internal/lifecycle/JSConst.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.rap/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/lifecycle/JSConst.java,v >retrieving revision 1.6 >diff -u -r1.6 JSConst.java >--- src/org/eclipse/rwt/internal/lifecycle/JSConst.java 12 Jun 2008 13:12:18 -0000 1.6 >+++ src/org/eclipse/rwt/internal/lifecycle/JSConst.java 26 Aug 2008 14:24:56 -0000 >@@ -145,6 +145,34 @@ > public static final String QX_FIELD_APPEARANCE = "appearance"; > public static final String QX_FIELD_Z_INDEX = "zIndex"; > public static final String QX_FIELD_TAB_INDEX = "tabIndex"; >+ public static final String QX_FIELD_CURSOR = "cursor"; >+ >+ // cursor values >+ // the order in the array correspond to the SWT#CURSOR_xxxx constants >+ public static final String[] QX_CURSOR_VALUES = { >+ "default", >+ "wait", >+ "crosshair", >+ "null", // SWT#CURSOR_APPSTARTING not exist in qx >+ "help", >+ "move", >+ "ne-resize", >+ "n-resize", >+ "nw-resize", >+ "w-resize", >+ "n-resize", >+ "s-resize", >+ "e-resize", >+ "w-resize", >+ "ne-resize", >+ "se-resize", >+ "sw-resize", >+ "nw-resize", >+ "null", // SWT#CURSOR_UPARROW not exist in qx >+ "text", >+ "null", // SWT#CURSOR_NO not exist in qx >+ "pointer" >+ }; > > // constants > public static final JSVar QX_CONST_VERTICAL_ORIENTATION >Index: src/org/eclipse/swt/widgets/Control.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.rap/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Control.java,v >retrieving revision 1.39 >diff -u -r1.39 Control.java >--- src/org/eclipse/swt/widgets/Control.java 25 Aug 2008 13:49:37 -0000 1.39 >+++ src/org/eclipse/swt/widgets/Control.java 26 Aug 2008 14:25:00 -0000 >@@ -96,6 +96,7 @@ > private Image backgroundImage = null; > private boolean backgroundTransparency; > private Font font; >+ private Cursor cursor; > > Control( final Composite parent ) { > // prevent instantiation from outside this package; only called by Shell >@@ -586,6 +587,56 @@ > return result; > } > >+ ///////// >+ // Cursors >+ >+ /** >+ * Sets the receiver's cursor to the cursor specified by the >+ * argument, or to the default cursor for that kind of control >+ * if the argument is null. >+ * <p> >+ * When the mouse pointer passes over a control its appearance >+ * is changed to match the control's cursor. >+ * </p> >+ * >+ * @param cursor the new cursor (or null) >+ * >+ * @exception IllegalArgumentException <ul> >+ * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li> >+ * </ul> >+ * @exception SWTException <ul> >+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> >+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> >+ * </ul> >+ * >+ * @since 1.1.1 >+ */ >+ public void setCursor (final Cursor cursor) { >+ checkWidget (); >+ this.cursor = cursor; >+ } >+ >+ /** >+ * Returns the receiver's cursor, or null if it has not been set. >+ * <p> >+ * When the mouse pointer passes over a control its appearance >+ * is changed to match the control's cursor. >+ * </p> >+ * >+ * @return the receiver's cursor or <code>null</code> >+ * >+ * @exception SWTException <ul> >+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> >+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> >+ * </ul> >+ * >+ * @since 1.1.1 >+ */ >+ public Cursor getCursor () { >+ checkWidget (); >+ return cursor; >+ } >+ > ////////////////// > // Focus handling > >Index: src/org/eclipse/swt/SWT.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.rap/org.eclipse.rap.rwt/src/org/eclipse/swt/SWT.java,v >retrieving revision 1.31 >diff -u -r1.31 SWT.java >--- src/org/eclipse/swt/SWT.java 22 Aug 2008 13:19:36 -0000 1.31 >+++ src/org/eclipse/swt/SWT.java 26 Aug 2008 14:24:59 -0000 >@@ -971,6 +971,141 @@ > */ > public static final int ITALIC = 1 << 1; > >+ // Cursor style constants >+ >+ /** >+ * System arrow cursor (value is 0). >+ * >+ * @see Graphics#getCursor(int) >+ */ >+ public static final int CURSOR_ARROW = 0; >+ >+ /** >+ * System wait cursor (value is 1). >+ * >+ * @see Graphics#getCursor(int) >+ */ >+ public static final int CURSOR_WAIT = 1; >+ >+ /** >+ * System cross hair cursor (value is 2). >+ * >+ * @see Graphics#getCursor(int) >+ */ >+ public static final int CURSOR_CROSS = 2; >+ >+ /** >+ * System help cursor (value is 4). >+ * >+ * @see Graphics#getCursor(int) >+ */ >+ public static final int CURSOR_HELP = 4; >+ >+ /** >+ * System resize all directions cursor (value is 5). >+ * >+ * @see Graphics#getCursor(int) >+ */ >+ public static final int CURSOR_SIZEALL = 5; >+ >+ /** >+ * System resize north-east-south-west cursor (value is 6). >+ * >+ * @see Graphics#getCursor(int) >+ */ >+ public static final int CURSOR_SIZENESW = 6; >+ >+ /** >+ * System resize north-south cursor (value is 7). >+ * >+ * @see Graphics#getCursor(int) >+ */ >+ public static final int CURSOR_SIZENS = 7; >+ >+ /** >+ * System resize north-west-south-east cursor (value is 8). >+ * >+ * @see Graphics#getCursor(int) >+ */ >+ public static final int CURSOR_SIZENWSE = 8; >+ >+ /** >+ * System resize west-east cursor (value is 9). >+ * >+ * @see Graphics#getCursor(int) >+ */ >+ public static final int CURSOR_SIZEWE = 9; >+ >+ /** >+ * System resize north cursor (value is 10). >+ * >+ * @see Graphics#getCursor(int) >+ */ >+ public static final int CURSOR_SIZEN = 10; >+ >+ /** >+ * System resize south cursor (value is 11). >+ * >+ * @see Graphics#getCursor(int) >+ */ >+ public static final int CURSOR_SIZES = 11; >+ >+ /** >+ * System resize east cursor (value is 12). >+ * >+ * @see Graphics#getCursor(int) >+ */ >+ public static final int CURSOR_SIZEE = 12; >+ >+ /** >+ * System resize west cursor (value is 13). >+ * >+ * @see Graphics#getCursor(int) >+ */ >+ public static final int CURSOR_SIZEW = 13; >+ >+ /** >+ * System resize north-east cursor (value is 14). >+ * >+ * @see Graphics#getCursor(int) >+ */ >+ public static final int CURSOR_SIZENE = 14; >+ >+ /** >+ * System resize south-east cursor (value is 15). >+ * >+ * @see Graphics#getCursor(int) >+ */ >+ public static final int CURSOR_SIZESE = 15; >+ >+ /** >+ * System resize south-west cursor (value is 16). >+ * >+ * @see Graphics#getCursor(int) >+ */ >+ public static final int CURSOR_SIZESW = 16; >+ >+ /** >+ * System resize north-west cursor (value is 17). >+ * >+ * @see Graphics#getCursor(int) >+ */ >+ public static final int CURSOR_SIZENW = 17; >+ >+ /** >+ * System i-beam cursor (value is 19). >+ * >+ * @see Graphics#getCursor(int) >+ */ >+ public static final int CURSOR_IBEAM = 19; >+ >+ /** >+ * System hand cursor (value is 21). >+ * >+ * @see Graphics#getCursor(int) >+ */ >+ public static final int CURSOR_HAND = 21; >+ > // Predefined images > > /** >Index: src/org/eclipse/swt/graphics/Cursor.java >=================================================================== >RCS file: src/org/eclipse/swt/graphics/Cursor.java >diff -N src/org/eclipse/swt/graphics/Cursor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/swt/graphics/Cursor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,211 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Innoopract Informationssysteme GmbH. >+ * 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: >+ * Innoopract Informationssysteme GmbH - initial API and implementation >+ ******************************************************************************/ >+package org.eclipse.swt.graphics; >+ >+import org.eclipse.rwt.graphics.Graphics; >+import org.eclipse.swt.SWT; >+ >+/** >+ * Instances of this class manage operating system resources that >+ * specify the appearance of the on-screen pointer. >+ * >+ * <p>Cursors may be constructed using one of the <code>getCursor</code> methods >+ * in class <code>Graphics</code> by providing a style information. >+ * </p> >+ * <dl> >+ * <dt><b>Styles:</b></dt> >+ * <dd> >+ * CURSOR_ARROW, CURSOR_WAIT, CURSOR_CROSS, CURSOR_HELP, >+ * CURSOR_SIZEALL, CURSOR_SIZENESW, CURSOR_SIZENS, CURSOR_SIZENWSE, CURSOR_SIZEWE, >+ * CURSOR_SIZEN, CURSOR_SIZES, CURSOR_SIZEE, CURSOR_SIZEW, CURSOR_SIZENE, CURSOR_SIZESE, >+ * CURSOR_SIZESW, CURSOR_SIZENW, CURSOR_IBEAM, CURSOR_HAND >+ * </dd> >+ * </dl> >+ * <p> >+ * Note: Only one of the above styles may be specified. >+ * </p> >+ * >+ * @see Graphics >+ * >+ * @since 1.1.1 >+ */ >+ >+public final class Cursor extends Resource { >+ >+ /** >+ * the handle to the cursor resource >+ */ >+ int handle; >+ >+ //prevent instance creation >+ private Cursor( final int style ) { >+ switch( style ) { >+ case SWT.CURSOR_HAND: >+ handle = SWT.CURSOR_HAND; >+ break; >+ case SWT.CURSOR_ARROW: >+ handle = SWT.CURSOR_ARROW; >+ break; >+ case SWT.CURSOR_WAIT: >+ handle = SWT.CURSOR_WAIT; >+ break; >+ case SWT.CURSOR_CROSS: >+ handle = SWT.CURSOR_CROSS; >+ break; >+// case SWT.CURSOR_APPSTARTING: >+// handle = SWT.CURSOR_APPSTARTING; >+// break; >+ case SWT.CURSOR_HELP: >+ handle = SWT.CURSOR_HELP; >+ break; >+ case SWT.CURSOR_SIZEALL: >+ handle = SWT.CURSOR_SIZEALL; >+ break; >+ case SWT.CURSOR_SIZENESW: >+ handle = SWT.CURSOR_SIZENESW; >+ break; >+ case SWT.CURSOR_SIZENS: >+ handle = SWT.CURSOR_SIZENS; >+ break; >+ case SWT.CURSOR_SIZENWSE: >+ handle = SWT.CURSOR_SIZENWSE; >+ break; >+ case SWT.CURSOR_SIZEWE: >+ handle = SWT.CURSOR_SIZEWE; >+ break; >+ case SWT.CURSOR_SIZEN: >+ handle = SWT.CURSOR_SIZEN; >+ break; >+ case SWT.CURSOR_SIZES: >+ handle = SWT.CURSOR_SIZES; >+ break; >+ case SWT.CURSOR_SIZEE: >+ handle = SWT.CURSOR_SIZEE; >+ break; >+ case SWT.CURSOR_SIZEW: >+ handle = SWT.CURSOR_SIZEW; >+ break; >+ case SWT.CURSOR_SIZENE: >+ handle = SWT.CURSOR_SIZENE; >+ break; >+ case SWT.CURSOR_SIZESE: >+ handle = SWT.CURSOR_SIZESE; >+ break; >+ case SWT.CURSOR_SIZESW: >+ handle = SWT.CURSOR_SIZESW; >+ break; >+ case SWT.CURSOR_SIZENW: >+ handle = SWT.CURSOR_SIZENW; >+ break; >+// case SWT.CURSOR_UPARROW: >+// handle = SWT.CURSOR_UPARROW; >+// break; >+ case SWT.CURSOR_IBEAM: >+ handle = SWT.CURSOR_IBEAM; >+ break; >+// case SWT.CURSOR_NO: >+// handle = SWT.CURSOR_NO; >+// break; >+ default: >+ SWT.error(SWT.ERROR_INVALID_ARGUMENT); >+ } >+ } >+ >+ /** >+ * Returns an integer hash code for the receiver. >+ * >+ * @return the receiver's hash >+ */ >+ public int hashCode () { >+ return handle; >+ } >+ >+ /** >+ * Returns a string containing a concise, human-readable >+ * description of the receiver. >+ * >+ * @return a string representation of the receiver >+ */ >+ public String toString () { >+ String type; >+ switch( handle ) { >+ case SWT.CURSOR_HAND: >+ type = "SWT.CURSOR_HAND"; >+ break; >+ case SWT.CURSOR_ARROW: >+ type = "SWT.CURSOR_ARROW"; >+ break; >+ case SWT.CURSOR_WAIT: >+ type = "SWT.CURSOR_WAIT"; >+ break; >+ case SWT.CURSOR_CROSS: >+ type = "SWT.CURSOR_CROSS"; >+ break; >+// case SWT.CURSOR_APPSTARTING: >+// type = "SWT.CURSOR_APPSTARTING"; >+// break; >+ case SWT.CURSOR_HELP: >+ type = "SWT.CURSOR_HELP"; >+ break; >+ case SWT.CURSOR_SIZEALL: >+ type = "SWT.CURSOR_SIZEALL"; >+ break; >+ case SWT.CURSOR_SIZENESW: >+ type = "SWT.CURSOR_SIZENESW"; >+ break; >+ case SWT.CURSOR_SIZENS: >+ type = "SWT.CURSOR_SIZENS"; >+ break; >+ case SWT.CURSOR_SIZENWSE: >+ type = "SWT.CURSOR_SIZENWSE"; >+ break; >+ case SWT.CURSOR_SIZEWE: >+ type = "SWT.CURSOR_SIZEWE"; >+ break; >+ case SWT.CURSOR_SIZEN: >+ type = "SWT.CURSOR_SIZEN"; >+ break; >+ case SWT.CURSOR_SIZES: >+ type = "SWT.CURSOR_SIZES"; >+ break; >+ case SWT.CURSOR_SIZEE: >+ type = "SWT.CURSOR_SIZEE"; >+ break; >+ case SWT.CURSOR_SIZEW: >+ type = "SWT.CURSOR_SIZEW"; >+ break; >+ case SWT.CURSOR_SIZENE: >+ type = "SWT.CURSOR_SIZENE"; >+ break; >+ case SWT.CURSOR_SIZESE: >+ type = "SWT.CURSOR_SIZESE"; >+ break; >+ case SWT.CURSOR_SIZESW: >+ type = "SWT.CURSOR_SIZESW"; >+ break; >+ case SWT.CURSOR_SIZENW: >+ type = "SWT.CURSOR_SIZENW"; >+ break; >+// case SWT.CURSOR_UPARROW: >+// type = "SWT.CURSOR_UPARROW"; >+// break; >+ case SWT.CURSOR_IBEAM: >+ type = "SWT.CURSOR_IBEAM"; >+ break; >+// case SWT.CURSOR_NO: >+// type = "SWT.CURSOR_NO"; >+// break; >+ default: >+ type = "" + handle; >+ } >+ return "Cursor {" + type + "}"; >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 244004
:
110937
|
110938
|
110939
|
110940
|
111283
|
111284
|
111285