Event.java in  » Script » java2script » org » eclipse » swt » widgets » Java Source Code / Java Documentation 2Java Source Code and Java Documentation

Home
Java Source Code / Java Documentation 2
1.2D
2.3D
3.Ajax
4.Algebra
5.App Engine
6.Aspect
7.Assemble
8.Cache
9.Cassandra
10.Chat
11.Cloud
12.CMS
13.CouchDB
14.Crypt
15.Database
16.Distributed
17.Eclipse
18.Facebook
19.File
20.Forum
21.GAE
22.Game
23.Google tech
24.Graph
25.Graphic
26.GWT
27.Hibernate
28.HTML
29.HTTP
30.Image
31.IntelliJ
32.IRC
33.J2EE
34.J2ME
35.JDBC
36.JPA
37.JSON
38.JSR
39.JUnit
40.JVM
41.Language
42.Linux
43.Math
44.Maven
45.Media
46.Messenger
47.MiddleWare
48.Mobile
49.Mock
50.MongoDB
51.Mp3
52.Music
53.MVC
54.Network
55.OpenID
56.OSGi
57.Parse
58.Persist
59.Petri
60.Phone
61.Physics
62.REST
63.Robot
64.RPC
65.RSS
66.Ruby
67.Script
68.Search
69.Spring
70.SQL
71.SSH
72.Sudoku
73.Swing
74.Tapestry
75.Test
76.Text
77.Torrent
78.Twitter
79.UML
80.UnTagged
81.Utilities
82.Web
83.Wiki
84.XML
Java Source Code / Java Documentation 2 » Script » java2script » org.eclipse.swt.widgets 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


        /*******************************************************************************
         * Copyright (c) 2000, 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
         *******************************************************************************/package org.eclipse.swt.widgets;

        import org.eclipse.swt.graphics.*;

        /**
         * Instances of this class provide a description of a particular
         * event which occurred within SWT. The SWT <em>untyped listener</em>
         * API uses these instances for all event dispatching.
         * <p>
         * Note: For a given event, only the fields which are appropriate
         * will be filled in. The contents of the fields which are not used
         * by the event are unspecified.
         * </p>
         * 
         * @see Listener
         * @see org.eclipse.swt.events.TypedEvent
         */

        public class Event {

            /**
             * the display where the event occurred
             * 
             * @since 2.0 
             */
            public Display display;

            /**
             * the widget that issued the event
             */
            public Widget widget;

            /**
             * the type of event, as defined by the event type constants
             * in class <code>SWT</code>
             *
             * @see org.eclipse.swt.SWT
             */
            public int type;

            /**
             * the event specific detail field, as defined by the detail constants
             * in class <code>SWT</code>
             * 
             * @see org.eclipse.swt.SWT
             */
            public int detail;

            /**
             * the item that the event occurred in (can be null)
             */
            public Widget item;

            /**
             * the graphics context to use when painting
             * that is configured to use the colors, font and
             * damaged region of the control.  It is valid
             * only during the paint and must not be disposed
             */
            public GC gc;

            /**
             * depending on the event type, the x offset of the bounding
             * rectangle of the region that requires painting or the
             * widget-relative, x coordinate of the pointer at the
             * time the mouse button was pressed or released
             */
            public int x;

            /**
             * depending on the event type, the y offset of the bounding
             * rectangle of the  region that requires painting or the
             * widget-relative, y coordinate of the pointer at the
             * time the mouse button was pressed or released
             */
            public int y;

            /**
             * the width of the bounding rectangle of the 
             * region that requires painting
             */
            public int width;

            /**
             * the height of the bounding rectangle of the 
             * region that requires painting
             */
            public int height;

            /**
             * depending on the event type, the number of following
             * paint events which are pending which may always be zero
             * on some platforms or the number of lines or pages to
             * scroll using the mouse wheel
             */
            public int count;

            /**
             * the time that the event occurred.
             * 
             * NOTE: This field is an unsigned integer and should
             * be AND'ed with 0xFFFFFFFFL so that it can be treated
             * as a signed long.
             */
            public int time;

            /**
             * the button that was pressed or released; 1 for the
             * first button, 2 for the second button, and 3 for the
             * third button, etc.
             */
            public int button;

            /**
             * depending on the event, the character represented by the key
             * that was typed.  This is the final character that results
             * after all modifiers have been applied.  For example, when the
             * user types Ctrl+A, the character value is 0x01 (ASCII SOH).
             * It is important that applications do not attempt to modify the
             * character value based on a stateMask (such as SWT.CTRL) or the
             * resulting character will not be correct.
             */
            public char character;

            /**
             * depending on the event, the key code of the key that was typed,
             * as defined by the key code constants in class <code>SWT</code>.
             * When the character field of the event is ambiguous, this field
             * contains the unaffected value of the original character.  For
             * example, typing Ctrl+M or Enter both result in the character '\r'
             * but the keyCode field will also contain '\r' when Enter was typed
             * and 'm' when Ctrl+M was typed.
             * 
             * @see org.eclipse.swt.SWT
             */
            public int keyCode;

            /**
             * depending on the event, the state of the keyboard modifier
             * keys and mouse masks at the time the event was generated.
             * 
             * @see org.eclipse.swt.SWT
             */
            public int stateMask;

            /**
             * depending on the event, the range of text being modified.
             * Setting these fields has no effect.
             */
            public int start, end;

            /**
             * depending on the event, the new text that will be inserted.
             * Setting this field will change the text that is about to
             * be inserted or deleted.
             */
            public String text;

            /**
             * depending on the event, a flag indicating whether the operation
             * should be allowed.  Setting this field to false will cancel the
             * operation.
             */
            public boolean doit = true;

            /**
             * a field for application use
             */
            public Object data;

            /**
             * Gets the bounds.
             * 
             * @return a rectangle that is the bounds.
             */
            public Rectangle getBounds() {
                return new Rectangle(x, y, width, height);
            }

            /**
             * Sets the bounds.
             * 
             * @param rect the new rectangle
             */
            public void setBounds(Rectangle rect) {
                this .x = rect.x;
                this .y = rect.y;
                this .width = rect.width;
                this .height = rect.height;
            }

            /**
             * Returns a string containing a concise, human-readable
             * description of the receiver.
             *
             * @return a string representation of the event
             */
            public String toString() {
                return "Event {type=" + type + ",widget=" + widget + ",x=" + x + ",y=" + y + ",width=" + width + ",height=" + height + "}"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
            }

            /*
             * This release codes is here to make sure that no JavaScript memory leak!
             */
            void releaseResource() {
                gc = null;
                data = null;
                item = null;
                widget = null;
                display = null;
            }
        }
ww__w___._ja_v_a___2__s_.c_o_m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.