Source Code Cross Referenced for NativeEvent.java in  » Apache-Harmony-Java-SE » org-package » org » apache » harmony » awt » wtk » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » org package » org.apache.harmony.awt.wtk 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         */
017:        /**
018:         * @author Mikhail Danilov
019:         * @version $Revision$
020:         */package org.apache.harmony.awt.wtk;
021:
022:        import java.awt.Insets;
023:        import java.awt.Rectangle;
024:        import java.awt.Point;
025:        import java.awt.event.KeyEvent;
026:
027:        import org.apache.harmony.awt.gl.MultiRectArea;
028:
029:        /**
030:         * The interface describing cross-platform translation of system
031:         * messages.
032:         *
033:         * <p/>Some messages can appear only on specific platform,
034:         * but they still can have cross-platform interpretation if the
035:         * application should be aware of them and can react using
036:         * cross-platform API.
037:         *
038:         */
039:        public abstract class NativeEvent {
040:
041:            /**
042:             * Message has no common cross-platform
043:             * interpretation and should be skipped.
044:             */
045:            public static final int ID_PLATFORM = 0;
046:
047:            /**
048:             * Window bounds have changed.
049:             */
050:            public static final int ID_BOUNDS_CHANGED = -1;
051:
052:            /**
053:             * Window decoration size has changed.
054:             */
055:            public static final int ID_INSETS_CHANGED = -2;
056:
057:            /**
058:             * Window was just created (WM_CREATE on Windows)
059:             */
060:            public static final int ID_CREATED = -3;
061:
062:            /**
063:             * Mouse grab was canceled by the native system
064:             */
065:            public static final int ID_MOUSE_GRAB_CANCELED = -4;
066:
067:            /**
068:             * System color scheme or visual theme was changed
069:             */
070:            public static final int ID_THEME_CHANGED = -5;
071:
072:            protected long windowId;
073:            protected int eventId;
074:            protected long otherWindowId;
075:
076:            protected Point screenPos;
077:            protected Point localPos;
078:            protected Rectangle windowRect;
079:
080:            protected int modifiers;
081:            protected int mouseButton;
082:            protected int wheelRotation;
083:
084:            protected KeyInfo keyInfo = new KeyInfo();
085:
086:            protected int windowState = -1;
087:            protected long time;
088:
089:            /**
090:             * Returns the system window id of the event recipient.
091:             * @return HWND on Windows, xwindnow on X
092:             */
093:            public long getWindowId() {
094:                return windowId;
095:            }
096:
097:            /**
098:             * Returns cross-platform event id
099:             * should be one of ID_* constants or
100:             * id constants from java.awt.AWTEvent subclasess
101:             * @return cross-platform event id
102:             */
103:            public int getEventId() {
104:                return eventId;
105:            }
106:
107:            /**
108:             * Returns the position of cursor when event occured relative to
109:             * top-left corner of recipient window
110:             * @return position of cursor in local coordinates
111:             */
112:            public Point getLocalPos() {
113:                return localPos;
114:            }
115:
116:            /**
117:             * Returns the position of cursor when event occured
118:             * in screen coordinates.
119:             * @return position of cursor in screen coordinates
120:             */
121:            public Point getScreenPos() {
122:                return screenPos;
123:            }
124:
125:            /**
126:             * The recipient window bounds when the event occured
127:             * @return window bounds
128:             */
129:            public Rectangle getWindowRect() {
130:                return windowRect;
131:            }
132:
133:            /**
134:             * Returns the state of keyboard and mouse buttons when the event
135:             * occured if event from mouse or keyboard, for other events can
136:             * return junk values. The value is bitwise OR of
137:             * java.awt.event.InputEvent *_DOWN constants.
138:             *
139:             * Method is aware of system mouse button swap for left-hand
140:             * mouse and return swapped values.
141:             * @return bitwise OR of java.awt.event.InputEvent *_DOWN constants
142:             */
143:            public int getInputModifiers() {
144:                return modifiers;
145:            }
146:
147:            /**
148:             * Returns the iconified/maximized state of recipient window if
149:             * event is state related, for other events can junk values.
150:             * The value has the same meaning as Frame.getExtendedState
151:             * It's bitwise OR of ICONIFIED, MAXIMIZED_HORIZ, MAXIMIZED_VERT
152:             * @return bitwise OR of ICONIFIED, MAXIMIZED_HORIZ, MAXIMIZED_VERT
153:             */
154:            public int getWindowState() {
155:                return windowState;
156:            }
157:
158:            /**
159:             * The same meaning as java.awt.event.getKeyCode
160:             * @return java.awt.event VK_* constant
161:             */
162:            public int getVKey() {
163:                return (keyInfo != null) ? keyInfo.vKey : KeyInfo.DEFAULT_VKEY;
164:            }
165:
166:            /**
167:             * The same meaning as java.awt.event.getKeyLocation
168:             * @return java.awt.event KEY_LOCATION_* constant
169:             */
170:            public int getKeyLocation() {
171:                return (keyInfo != null) ? keyInfo.keyLocation
172:                        : KeyInfo.DEFAULT_LOCATION;
173:            }
174:
175:            /**
176:             * Return the string of characters associated with the event
177:             * Has meaning only for KEY_PRESSED as should be translated to
178:             * serie of KEY_TYPED events. For dead keys and input methods
179:             * one key press can generate multiple key chars.
180:             * @return string of characters
181:             */
182:            public StringBuffer getKeyChars() {
183:                if (keyInfo == null) {
184:                    return null;
185:                }
186:                if (keyInfo.vKey == KeyEvent.VK_ENTER) {
187:                    keyInfo.keyChars.setLength(0);
188:                    keyInfo.setKeyChars('\n');
189:                }
190:                return keyInfo.keyChars;
191:            }
192:
193:            public char getLastChar() {
194:                if (keyInfo == null || keyInfo.keyChars.length() == 0) {
195:                    return KeyEvent.CHAR_UNDEFINED;
196:                }
197:                return keyInfo.keyChars.charAt(keyInfo.keyChars.length() - 1);
198:            }
199:
200:            /**
201:             * Returns the number of mouse button which changed it's state,
202:             * otherwise 0.
203:             * Left button is 1, middle button is 2, right button is 3.
204:             *
205:             * Method is aware of system mouse button swap for left-hand
206:             * mouse and return swapped values.
207:             * @return mouse button number
208:             */
209:            public int getMouseButton() {
210:                return mouseButton;
211:            }
212:
213:            /**
214:             * Returns time when the message was received
215:             * @return time in milliseconds
216:             */
217:            public long getTime() {
218:                return time;
219:            }
220:
221:            /**
222:             * For the focus event contains the oposite window.
223:             * This means it lost focus if recipient gains it,
224:             * or will gain focus if recipient looses it.
225:             * @return HWND on Windows, xwindnow on X
226:             */
227:            public long getOtherWindowId() {
228:                return otherWindowId;
229:            }
230:
231:            /**
232:             * Returns the "dirty" area of the window as set of non-intersecting
233:             * rectangles. This area is to be painted.
234:             * @return non-empty array of null if empty
235:             */
236:            public abstract MultiRectArea getClipRects();
237:
238:            /**
239:             * Returns the "dirty" area of the window as one rectangle.
240:             * This area is to be painted.
241:             * @return non-null Rectangle
242:             */
243:            public abstract Rectangle getClipBounds();
244:
245:            /**
246:             * Returns the window insets. Insets is area which belongs to
247:             * window somehow but is outside of it's client area,
248:             * it usually contains system provided border and titlebar.
249:             * @return non-null java.awt.Insets
250:             */
251:            public abstract Insets getInsets();
252:
253:            /**
254:             * Returns true if event is popup menu trigger.
255:             * @return boolean flag
256:             */
257:            public abstract boolean getTrigger();
258:
259:            /**
260:             * Returns the number of "clicks" the mouse wheel was rotated.
261:             * @return negative values if the mouse wheel was rotated up/away from the user,
262:             * and positive values if the mouse wheel was rotated down/ towards the user
263:             */
264:            public int getWheelRotation() {
265:                return wheelRotation;
266:            }
267:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.