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