]>
Commit | Line | Data |
---|---|---|
5aac1dac TT |
1 | /* gtkpeer.h -- Some global variables and #defines |
2 | Copyright (C) 1998, 1999 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of GNU Classpath. | |
5 | ||
6 | GNU Classpath is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2, or (at your option) | |
9 | any later version. | |
10 | ||
11 | GNU Classpath is distributed in the hope that it will be useful, but | |
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU Classpath; see the file COPYING. If not, write to the | |
18 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
19 | 02111-1307 USA. | |
20 | ||
21 | Linking this library statically or dynamically with other modules is | |
22 | making a combined work based on this library. Thus, the terms and | |
23 | conditions of the GNU General Public License cover the whole | |
24 | combination. | |
25 | ||
26 | As a special exception, the copyright holders of this library give you | |
27 | permission to link this library with independent modules to produce an | |
28 | executable, regardless of the license terms of these independent | |
29 | modules, and to copy and distribute the resulting executable under | |
30 | terms of your choice, provided that you also meet, for each linked | |
31 | independent module, the terms and conditions of the license of that | |
32 | module. An independent module is a module which is not derived from | |
33 | or based on this library. If you modify this library, you may extend | |
34 | this exception to your version of the library, but you are not | |
35 | obligated to do so. If you do not wish to do so, delete this | |
36 | exception statement from your version. */ | |
37 | ||
38 | ||
39 | #include <gtk/gtk.h> | |
40 | #include <stdio.h> | |
41 | #include <stdlib.h> | |
42 | #include <string.h> | |
43 | #include <config.h> | |
44 | #include "native_state.h" | |
45 | ||
46 | #include <jni.h> | |
47 | ||
48 | #define RC_FILE ".classpath-gtkrc" | |
49 | #define JVM_SUN | |
50 | /* | |
51 | #define JVM_JAPHAR | |
52 | */ | |
53 | ||
54 | #ifndef __GTKPEER_H__ | |
55 | #define __GTKPEER_H__ | |
56 | ||
ce7a72c8 TF |
57 | #ifndef __GNUC__ |
58 | #define __attribute__(x) /* nothing */ | |
59 | #endif | |
60 | ||
5aac1dac TT |
61 | #ifdef JVM_SUN |
62 | ||
63 | extern struct state_table *native_state_table; | |
64 | ||
65 | #define NSA_INIT(env, clazz) \ | |
66 | native_state_table = init_state_table (env, clazz) | |
67 | ||
68 | #define NSA_GET_PTR(env, obj) \ | |
69 | get_state (env, obj, native_state_table) | |
70 | ||
71 | #define NSA_SET_PTR(env, obj, ptr) \ | |
72 | set_state (env, obj, native_state_table, (void *)ptr) | |
73 | ||
74 | #define NSA_DEL_PTR(env, obj) \ | |
75 | remove_state_slot (env, obj, native_state_table) | |
76 | ||
77 | #endif /* JVM_SUN */ | |
78 | ||
79 | struct graphics | |
80 | { | |
81 | GdkDrawable *drawable; | |
82 | GdkGC *gc; | |
83 | GdkColormap *cm; | |
84 | jint x_offset, y_offset; | |
85 | }; | |
86 | ||
87 | #define AWT_DEFAULT_CURSOR 0 | |
88 | #define AWT_CROSSHAIR_CURSOR 1 | |
89 | #define AWT_TEXT_CURSOR 2 | |
90 | #define AWT_WAIT_CURSOR 3 | |
91 | #define AWT_SW_RESIZE_CURSOR 4 | |
92 | #define AWT_SE_RESIZE_CURSOR 5 | |
93 | #define AWT_NW_RESIZE_CURSOR 6 | |
94 | #define AWT_NE_RESIZE_CURSOR 7 | |
95 | #define AWT_N_RESIZE_CURSOR 8 | |
96 | #define AWT_S_RESIZE_CURSOR 9 | |
97 | #define AWT_W_RESIZE_CURSOR 10 | |
98 | #define AWT_E_RESIZE_CURSOR 11 | |
99 | #define AWT_HAND_CURSOR 12 | |
100 | #define AWT_MOVE_CURSOR 13 | |
101 | ||
102 | #define SYNTHETIC_EVENT_MASK (1 << 10) | |
103 | ||
104 | #define AWT_SHIFT_MASK (1 << 0) | |
105 | #define AWT_CTRL_MASK (1 << 1) | |
106 | #define AWT_META_MASK (1 << 2) | |
107 | #define AWT_ALT_MASK (1 << 3) | |
108 | ||
109 | #define AWT_BUTTON1_MASK (1 << 4) | |
110 | #define AWT_BUTTON2_MASK AWT_ALT_MASK | |
111 | #define AWT_BUTTON3_MASK AWT_META_MASK | |
112 | ||
113 | #define MULTI_CLICK_TIME 250 | |
114 | /* as opposed to a MULTI_PASS_TIME :) */ | |
115 | ||
116 | #define AWT_MOUSE_CLICKED 500 | |
117 | #define AWT_MOUSE_PRESSED 501 | |
118 | #define AWT_MOUSE_RELEASED 502 | |
119 | #define AWT_MOUSE_MOVED 503 | |
120 | #define AWT_MOUSE_ENTERED 504 | |
121 | #define AWT_MOUSE_EXITED 505 | |
122 | #define AWT_MOUSE_DRAGGED 506 | |
123 | ||
124 | #define AWT_ADJUSTMENT_UNIT_INCREMENT 1 | |
125 | #define AWT_ADJUSTMENT_UNIT_DECREMENT 2 | |
126 | #define AWT_ADJUSTMENT_BLOCK_DECREMENT 3 | |
127 | #define AWT_ADJUSTMENT_BLOCK_INCREMENT 4 | |
128 | #define AWT_ADJUSTMENT_TRACK 5 | |
129 | ||
130 | #define AWT_SCROLLPANE_SCROLLBARS_AS_NEEDED 0 | |
131 | #define AWT_SCROLLPANE_SCROLLBARS_ALWAYS 1 | |
132 | #define AWT_SCROLLPANE_SCROLLBARS_NEVER 2 | |
133 | ||
134 | #define AWT_LABEL_LEFT 0 | |
135 | #define AWT_LABEL_CENTER 1 | |
136 | #define AWT_LABEL_RIGHT 2 | |
137 | ||
138 | #define AWT_TEXTAREA_SCROLLBARS_BOTH 0 | |
139 | #define AWT_TEXTAREA_SCROLLBARS_VERTICAL_ONLY 1 | |
140 | #define AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY 2 | |
141 | ||
142 | #define AWT_ITEM_SELECTED 1 | |
143 | #define AWT_ITEM_DESELECTED 2 | |
144 | ||
145 | #define AWT_KEY_TYPED 400 | |
146 | #define AWT_KEY_PRESSED 401 | |
147 | #define AWT_KEY_RELEASED 402 | |
148 | ||
5aac1dac TT |
149 | #define AWT_KEY_CHAR_UNDEFINED 0 |
150 | ||
d0b8b6fb TF |
151 | #define AWT_KEY_LOCATION_UNKNOWN 0 |
152 | #define AWT_KEY_LOCATION_STANDARD 1 | |
153 | #define AWT_KEY_LOCATION_LEFT 2 | |
154 | #define AWT_KEY_LOCATION_RIGHT 3 | |
155 | #define AWT_KEY_LOCATION_NUMPAD 4 | |
156 | ||
157 | /* Virtual Keys */ | |
158 | /* This list should be kept in the same order as the VK_ field | |
159 | declarations in KeyEvent.java. */ | |
160 | #define VK_ENTER '\n' | |
161 | #define VK_BACK_SPACE '\b' | |
162 | #define VK_TAB '\t' | |
5aac1dac | 163 | #define VK_CANCEL 3 |
d0b8b6fb TF |
164 | #define VK_CLEAR 12 |
165 | #define VK_SHIFT 16 | |
5aac1dac | 166 | #define VK_CONTROL 17 |
d0b8b6fb TF |
167 | #define VK_ALT 18 |
168 | #define VK_PAUSE 19 | |
169 | #define VK_CAPS_LOCK 20 | |
5aac1dac | 170 | #define VK_ESCAPE 27 |
d0b8b6fb TF |
171 | #define VK_SPACE ' ' |
172 | #define VK_PAGE_UP 33 | |
173 | #define VK_PAGE_DOWN 34 | |
174 | #define VK_END 35 | |
5aac1dac | 175 | #define VK_HOME 36 |
5aac1dac | 176 | #define VK_LEFT 37 |
d0b8b6fb TF |
177 | #define VK_UP 38 |
178 | #define VK_RIGHT 39 | |
179 | #define VK_DOWN 40 | |
180 | #define VK_COMMA ',' | |
181 | #define VK_MINUS '-' | |
182 | #define VK_PERIOD '.' | |
183 | #define VK_SLASH '/' | |
184 | #define VK_0 '0' | |
185 | #define VK_1 '1' | |
186 | #define VK_2 '2' | |
187 | #define VK_3 '3' | |
188 | #define VK_4 '4' | |
189 | #define VK_5 '5' | |
190 | #define VK_6 '6' | |
191 | #define VK_7 '7' | |
192 | #define VK_8 '8' | |
193 | #define VK_9 '9' | |
194 | #define VK_SEMICOLON ';' | |
195 | #define VK_EQUALS '=' | |
196 | #define VK_A 'A' | |
197 | #define VK_B 'B' | |
198 | #define VK_C 'C' | |
199 | #define VK_D 'D' | |
200 | #define VK_E 'E' | |
201 | #define VK_F 'F' | |
202 | #define VK_G 'G' | |
203 | #define VK_H 'H' | |
204 | #define VK_I 'I' | |
205 | #define VK_J 'J' | |
206 | #define VK_K 'K' | |
207 | #define VK_L 'L' | |
208 | #define VK_M 'M' | |
209 | #define VK_N 'N' | |
210 | #define VK_O 'O' | |
211 | #define VK_P 'P' | |
212 | #define VK_Q 'Q' | |
213 | #define VK_R 'R' | |
214 | #define VK_S 'S' | |
215 | #define VK_T 'T' | |
216 | #define VK_U 'U' | |
217 | #define VK_V 'V' | |
218 | #define VK_W 'W' | |
219 | #define VK_X 'X' | |
220 | #define VK_Y 'Y' | |
221 | #define VK_Z 'Z' | |
222 | #define VK_OPEN_BRACKET '[' | |
223 | #define VK_BACK_SLASH '\\' | |
224 | #define VK_CLOSE_BRACKET ']' | |
5aac1dac TT |
225 | #define VK_NUMPAD0 96 |
226 | #define VK_NUMPAD1 97 | |
227 | #define VK_NUMPAD2 98 | |
228 | #define VK_NUMPAD3 99 | |
229 | #define VK_NUMPAD4 100 | |
230 | #define VK_NUMPAD5 101 | |
231 | #define VK_NUMPAD6 102 | |
232 | #define VK_NUMPAD7 103 | |
233 | #define VK_NUMPAD8 104 | |
234 | #define VK_NUMPAD9 105 | |
d0b8b6fb TF |
235 | #define VK_MULTIPLY 106 |
236 | #define VK_ADD 107 | |
237 | #define VK_SEPARATER 108 | |
5aac1dac | 238 | #define VK_SEPARATOR 108 |
5aac1dac | 239 | #define VK_SUBTRACT 109 |
d0b8b6fb TF |
240 | #define VK_DECIMAL 110 |
241 | #define VK_DIVIDE 111 | |
242 | #define VK_DELETE 127 | |
243 | #define VK_NUM_LOCK 144 | |
244 | #define VK_SCROLL_LOCK 145 | |
245 | #define VK_F1 112 | |
246 | #define VK_F2 113 | |
247 | #define VK_F3 114 | |
248 | #define VK_F4 115 | |
249 | #define VK_F5 116 | |
250 | #define VK_F6 117 | |
251 | #define VK_F7 118 | |
252 | #define VK_F8 119 | |
253 | #define VK_F9 120 | |
254 | #define VK_F10 121 | |
255 | #define VK_F11 122 | |
256 | #define VK_F12 123 | |
257 | #define VK_F13 61440 | |
258 | #define VK_F14 61441 | |
259 | #define VK_F15 61442 | |
260 | #define VK_F16 61443 | |
261 | #define VK_F17 61444 | |
262 | #define VK_F18 61445 | |
263 | #define VK_F19 61446 | |
264 | #define VK_F20 61447 | |
265 | #define VK_F21 61448 | |
266 | #define VK_F22 61449 | |
267 | #define VK_F23 61450 | |
268 | #define VK_F24 61451 | |
269 | #define VK_PRINTSCREEN 154 | |
270 | #define VK_INSERT 155 | |
271 | #define VK_HELP 156 | |
272 | #define VK_META 157 | |
273 | #define VK_BACK_QUOTE 192 | |
274 | #define VK_QUOTE 222 | |
275 | #define VK_KP_UP 224 | |
276 | #define VK_KP_DOWN 225 | |
277 | #define VK_KP_LEFT 226 | |
278 | #define VK_KP_RIGHT 227 | |
279 | #define VK_DEAD_GRAVE 128 | |
280 | #define VK_DEAD_ACUTE 129 | |
281 | #define VK_DEAD_CIRCUMFLEX 130 | |
282 | #define VK_DEAD_TILDE 131 | |
283 | #define VK_DEAD_MACRON 132 | |
284 | #define VK_DEAD_BREVE 133 | |
285 | #define VK_DEAD_ABOVEDOT 134 | |
286 | #define VK_DEAD_DIAERESIS 135 | |
287 | #define VK_DEAD_ABOVERING 136 | |
288 | #define VK_DEAD_DOUBLEACUTE 137 | |
289 | #define VK_DEAD_CARON 138 | |
290 | #define VK_DEAD_CEDILLA 139 | |
291 | #define VK_DEAD_OGONEK 140 | |
292 | #define VK_DEAD_IOTA 141 | |
293 | #define VK_DEAD_VOICED_SOUND 142 | |
294 | #define VK_DEAD_SEMIVOICED_SOUND 143 | |
295 | #define VK_AMPERSAND 150 | |
296 | #define VK_ASTERISK 151 | |
297 | #define VK_QUOTEDBL 152 | |
298 | #define VK_LESS 153 | |
299 | #define VK_GREATER 160 | |
300 | #define VK_BRACELEFT 161 | |
301 | #define VK_BRACERIGHT 162 | |
302 | #define VK_AT 512 | |
303 | #define VK_COLON 513 | |
304 | #define VK_CIRCUMFLEX 514 | |
305 | #define VK_DOLLAR 515 | |
306 | #define VK_EURO_SIGN 516 | |
307 | #define VK_EXCLAMATION_MARK 517 | |
308 | #define VK_INVERTED_EXCLAMATION_MARK 518 | |
309 | #define VK_LEFT_PARENTHESIS 519 | |
310 | #define VK_NUMBER_SIGN 520 | |
311 | #define VK_PLUS 521 | |
312 | #define VK_RIGHT_PARENTHESIS 522 | |
313 | #define VK_UNDERSCORE 523 | |
314 | #define VK_FINAL 24 | |
315 | #define VK_CONVERT 28 | |
316 | #define VK_NONCONVERT 29 | |
317 | #define VK_ACCEPT 30 | |
318 | #define VK_MODECHANGE 31 | |
319 | #define VK_KANA 21 | |
320 | #define VK_KANJI 25 | |
321 | #define VK_ALPHANUMERIC 240 | |
322 | #define VK_KATAKANA 241 | |
323 | #define VK_HIRAGANA 242 | |
324 | #define VK_FULL_WIDTH 243 | |
325 | #define VK_HALF_WIDTH 244 | |
326 | #define VK_ROMAN_CHARACTERS 245 | |
327 | #define VK_ALL_CANDIDATES 256 | |
328 | #define VK_PREVIOUS_CANDIDATE 257 | |
329 | #define VK_CODE_INPUT 258 | |
330 | #define VK_JAPANESE_KATAKANA 259 | |
331 | #define VK_JAPANESE_HIRAGANA 260 | |
332 | #define VK_JAPANESE_ROMAN 261 | |
333 | #define VK_KANA_LOCK 262 | |
334 | #define VK_INPUT_METHOD_ON_OFF 263 | |
335 | #define VK_CUT 65489 | |
336 | #define VK_COPY 65485 | |
337 | #define VK_PASTE 65487 | |
338 | #define VK_UNDO 65483 | |
339 | #define VK_AGAIN 65481 | |
340 | #define VK_FIND 65488 | |
341 | #define VK_PROPS 65482 | |
342 | #define VK_STOP 65480 | |
343 | #define VK_COMPOSE 65312 | |
344 | #define VK_ALT_GRAPH 65406 | |
345 | #define VK_UNDEFINED 0 | |
5aac1dac TT |
346 | |
347 | #define AWT_FOCUS_LOST 1004 | |
348 | #define AWT_FOCUS_GAINED 1005 | |
349 | ||
f2d0e05d TF |
350 | #define AWT_WINDOW_OPENED 200 |
351 | #define AWT_WINDOW_CLOSING 201 | |
352 | #define AWT_WINDOW_CLOSED 202 | |
353 | #define AWT_WINDOW_ICONIFIED 203 | |
354 | #define AWT_WINDOW_DEICONIFIED 204 | |
355 | #define AWT_WINDOW_ACTIVATED 205 | |
356 | #define AWT_WINDOW_DEACTIVATED 206 | |
357 | #define AWT_WINDOW_GAINED_FOCUS 207 | |
358 | #define AWT_WINDOW_LOST_FOCUS 208 | |
359 | #define AWT_WINDOW_STATE_CHANGED 209 | |
360 | ||
361 | #define AWT_FRAME_STATE_NORMAL 0 | |
362 | #define AWT_FRAME_STATE_ICONIFIED 1 | |
363 | #define AWT_FRAME_STATE_MAXIMIZED_HORIZ 2 | |
364 | #define AWT_FRAME_STATE_MAXIMIZED_VERT 4 | |
365 | #define AWT_FRAME_STATE_MAXIMIZED_BOTH 6 | |
366 | ||
a5586c38 TF |
367 | #define AWT_STYLE_PLAIN 0 |
368 | #define AWT_STYLE_BOLD 1 | |
369 | #define AWT_STYLE_ITALIC 2 | |
370 | ||
b59b5081 TF |
371 | extern jmethodID setBoundsCallbackID; |
372 | ||
5aac1dac TT |
373 | extern jmethodID postActionEventID; |
374 | extern jmethodID postMenuActionEventID; | |
375 | extern jmethodID postMouseEventID; | |
376 | extern jmethodID postConfigureEventID; | |
377 | extern jmethodID postExposeEventID; | |
378 | extern jmethodID postKeyEventID; | |
379 | extern jmethodID postFocusEventID; | |
380 | extern jmethodID postAdjustmentEventID; | |
381 | extern jmethodID postItemEventID; | |
382 | extern jmethodID postListItemEventID; | |
b6fa901b | 383 | extern jmethodID postTextEventID; |
f2d0e05d TF |
384 | extern jmethodID postWindowEventID; |
385 | ||
5aac1dac TT |
386 | extern jmethodID syncAttrsID; |
387 | extern jclass gdkColor; | |
388 | extern jmethodID gdkColorID; | |
389 | extern JNIEnv *gdk_env; | |
390 | ||
23a555b0 | 391 | extern GtkWindowGroup *global_gtk_window_group; |
5aac1dac TT |
392 | |
393 | void awt_event_handler (GdkEvent *event); | |
394 | ||
395 | void connect_awt_hook (JNIEnv *env, jobject peer_obj, int nwindows, ...); | |
396 | ||
397 | void set_visible (GtkWidget *widget, jboolean visible); | |
398 | void set_parent (GtkWidget *widget, GtkContainer *parent); | |
399 | GtkLayout *find_gtk_layout (GtkWidget *parent); | |
5aac1dac | 400 | |
ff4cc28b TF |
401 | jint keyevent_state_to_awt_mods (GdkEvent *event); |
402 | ||
5aac1dac TT |
403 | struct item_event_hook_info |
404 | { | |
405 | jobject peer_obj; | |
406 | jobject item_obj; | |
407 | }; | |
408 | ||
409 | #endif /* __GTKPEER_H */ |