]>
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 | ||
57 | #ifdef JVM_SUN | |
58 | ||
59 | extern struct state_table *native_state_table; | |
60 | ||
61 | #define NSA_INIT(env, clazz) \ | |
62 | native_state_table = init_state_table (env, clazz) | |
63 | ||
64 | #define NSA_GET_PTR(env, obj) \ | |
65 | get_state (env, obj, native_state_table) | |
66 | ||
67 | #define NSA_SET_PTR(env, obj, ptr) \ | |
68 | set_state (env, obj, native_state_table, (void *)ptr) | |
69 | ||
70 | #define NSA_DEL_PTR(env, obj) \ | |
71 | remove_state_slot (env, obj, native_state_table) | |
72 | ||
73 | #endif /* JVM_SUN */ | |
74 | ||
75 | struct graphics | |
76 | { | |
77 | GdkDrawable *drawable; | |
78 | GdkGC *gc; | |
79 | GdkColormap *cm; | |
80 | jint x_offset, y_offset; | |
81 | }; | |
82 | ||
83 | #define AWT_DEFAULT_CURSOR 0 | |
84 | #define AWT_CROSSHAIR_CURSOR 1 | |
85 | #define AWT_TEXT_CURSOR 2 | |
86 | #define AWT_WAIT_CURSOR 3 | |
87 | #define AWT_SW_RESIZE_CURSOR 4 | |
88 | #define AWT_SE_RESIZE_CURSOR 5 | |
89 | #define AWT_NW_RESIZE_CURSOR 6 | |
90 | #define AWT_NE_RESIZE_CURSOR 7 | |
91 | #define AWT_N_RESIZE_CURSOR 8 | |
92 | #define AWT_S_RESIZE_CURSOR 9 | |
93 | #define AWT_W_RESIZE_CURSOR 10 | |
94 | #define AWT_E_RESIZE_CURSOR 11 | |
95 | #define AWT_HAND_CURSOR 12 | |
96 | #define AWT_MOVE_CURSOR 13 | |
97 | ||
98 | #define SYNTHETIC_EVENT_MASK (1 << 10) | |
99 | ||
100 | #define AWT_SHIFT_MASK (1 << 0) | |
101 | #define AWT_CTRL_MASK (1 << 1) | |
102 | #define AWT_META_MASK (1 << 2) | |
103 | #define AWT_ALT_MASK (1 << 3) | |
104 | ||
105 | #define AWT_BUTTON1_MASK (1 << 4) | |
106 | #define AWT_BUTTON2_MASK AWT_ALT_MASK | |
107 | #define AWT_BUTTON3_MASK AWT_META_MASK | |
108 | ||
109 | #define MULTI_CLICK_TIME 250 | |
110 | /* as opposed to a MULTI_PASS_TIME :) */ | |
111 | ||
112 | #define AWT_MOUSE_CLICKED 500 | |
113 | #define AWT_MOUSE_PRESSED 501 | |
114 | #define AWT_MOUSE_RELEASED 502 | |
115 | #define AWT_MOUSE_MOVED 503 | |
116 | #define AWT_MOUSE_ENTERED 504 | |
117 | #define AWT_MOUSE_EXITED 505 | |
118 | #define AWT_MOUSE_DRAGGED 506 | |
119 | ||
120 | #define AWT_ADJUSTMENT_UNIT_INCREMENT 1 | |
121 | #define AWT_ADJUSTMENT_UNIT_DECREMENT 2 | |
122 | #define AWT_ADJUSTMENT_BLOCK_DECREMENT 3 | |
123 | #define AWT_ADJUSTMENT_BLOCK_INCREMENT 4 | |
124 | #define AWT_ADJUSTMENT_TRACK 5 | |
125 | ||
126 | #define AWT_SCROLLPANE_SCROLLBARS_AS_NEEDED 0 | |
127 | #define AWT_SCROLLPANE_SCROLLBARS_ALWAYS 1 | |
128 | #define AWT_SCROLLPANE_SCROLLBARS_NEVER 2 | |
129 | ||
130 | #define AWT_LABEL_LEFT 0 | |
131 | #define AWT_LABEL_CENTER 1 | |
132 | #define AWT_LABEL_RIGHT 2 | |
133 | ||
134 | #define AWT_TEXTAREA_SCROLLBARS_BOTH 0 | |
135 | #define AWT_TEXTAREA_SCROLLBARS_VERTICAL_ONLY 1 | |
136 | #define AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY 2 | |
137 | ||
138 | #define AWT_ITEM_SELECTED 1 | |
139 | #define AWT_ITEM_DESELECTED 2 | |
140 | ||
141 | #define AWT_KEY_TYPED 400 | |
142 | #define AWT_KEY_PRESSED 401 | |
143 | #define AWT_KEY_RELEASED 402 | |
144 | ||
145 | #define VK_UNDEFINED 0 | |
146 | #define AWT_KEY_CHAR_UNDEFINED 0 | |
147 | ||
148 | #define VK_0 48 | |
149 | #define VK_1 49 | |
150 | #define VK_2 50 | |
151 | #define VK_3 51 | |
152 | #define VK_4 52 | |
153 | #define VK_5 53 | |
154 | #define VK_6 54 | |
155 | #define VK_7 55 | |
156 | #define VK_8 56 | |
157 | #define VK_9 57 | |
158 | #define VK_A 65 | |
159 | #define VK_ACCEPT 30 | |
160 | #define VK_ADD 107 | |
161 | #define VK_ALT 18 | |
162 | #define VK_B 66 | |
163 | #define VK_BACK_QUOTE 192 | |
164 | #define VK_BACK_SLASH 92 | |
165 | #define VK_BACK_SPACE 8 | |
166 | #define VK_C 67 | |
167 | #define VK_CANCEL 3 | |
168 | #define VK_CAPS_LOCK 20 | |
169 | #define VK_CLEAR 12 | |
170 | #define VK_CLOSE_BRACKET 93 | |
171 | #define VK_COMMA 44 | |
172 | #define VK_CONTROL 17 | |
173 | #define VK_CONVERT 28 | |
174 | #define VK_D 68 | |
175 | #define VK_DECIMAL 110 | |
176 | #define VK_DELETE 127 | |
177 | #define VK_DIVIDE 111 | |
178 | #define VK_DOWN 40 | |
179 | #define VK_E 69 | |
180 | #define VK_END 35 | |
181 | #define VK_ENTER 10 | |
182 | #define VK_ESCAPE 27 | |
183 | #define VK_F 70 | |
184 | #define VK_F1 112 | |
185 | #define VK_F10 121 | |
186 | #define VK_F11 122 | |
187 | #define VK_F12 123 | |
188 | #define VK_F2 113 | |
189 | #define VK_F3 114 | |
190 | #define VK_F4 115 | |
191 | #define VK_F5 116 | |
192 | #define VK_F6 117 | |
193 | #define VK_F7 118 | |
194 | #define VK_F8 119 | |
195 | #define VK_F9 120 | |
196 | #define VK_FINAL 24 | |
197 | #define VK_G 71 | |
198 | #define VK_H 72 | |
199 | #define VK_HELP 156 | |
200 | #define VK_HOME 36 | |
201 | #define VK_I 73 | |
202 | #define VK_INSERT 155 | |
203 | #define VK_J 74 | |
204 | #define VK_K 75 | |
205 | #define VK_KANA 21 | |
206 | #define VK_KANJI 25 | |
207 | #define VK_L 76 | |
208 | #define VK_LEFT 37 | |
209 | #define VK_M 77 | |
210 | #define VK_META 157 | |
211 | #define VK_MODECHANGE 31 | |
212 | #define VK_MULTIPLY 106 | |
213 | #define VK_N 78 | |
214 | #define VK_NONCONVERT 29 | |
215 | #define VK_NUM_LOCK 144 | |
216 | #define VK_NUMPAD0 96 | |
217 | #define VK_NUMPAD1 97 | |
218 | #define VK_NUMPAD2 98 | |
219 | #define VK_NUMPAD3 99 | |
220 | #define VK_NUMPAD4 100 | |
221 | #define VK_NUMPAD5 101 | |
222 | #define VK_NUMPAD6 102 | |
223 | #define VK_NUMPAD7 103 | |
224 | #define VK_NUMPAD8 104 | |
225 | #define VK_NUMPAD9 105 | |
226 | #define VK_O 79 | |
227 | #define VK_OPEN_BRACKET 91 | |
228 | #define VK_P 80 | |
229 | #define VK_PAGE_DOWN 34 | |
230 | #define VK_PAGE_UP 33 | |
231 | #define VK_PAUSE 19 | |
232 | #define VK_PERIOD 46 | |
233 | #define VK_PRINTSCREEN 154 | |
234 | #define VK_Q 81 | |
235 | #define VK_QUOTE 222 | |
236 | #define VK_R 82 | |
237 | #define VK_RIGHT 39 | |
238 | #define VK_S 83 | |
239 | #define VK_SCROLL_LOCK 145 | |
240 | #define VK_SEMICOLON 59 | |
241 | #define VK_SEPARATOR 108 | |
242 | #define VK_SHIFT 16 | |
243 | #define VK_SLASH 47 | |
244 | #define VK_SPACE 32 | |
245 | #define VK_SUBTRACT 109 | |
246 | #define VK_T 84 | |
247 | #define VK_TAB 9 | |
248 | #define VK_U 85 | |
249 | #define VK_UP 38 | |
250 | #define VK_V 86 | |
251 | #define VK_W 87 | |
252 | #define VK_X 88 | |
253 | #define VK_Y 89 | |
254 | #define VK_Z 90 | |
255 | ||
256 | #define AWT_FOCUS_LOST 1004 | |
257 | #define AWT_FOCUS_GAINED 1005 | |
258 | ||
259 | extern jmethodID postActionEventID; | |
260 | extern jmethodID postMenuActionEventID; | |
261 | extern jmethodID postMouseEventID; | |
262 | extern jmethodID postConfigureEventID; | |
263 | extern jmethodID postExposeEventID; | |
264 | extern jmethodID postKeyEventID; | |
265 | extern jmethodID postFocusEventID; | |
266 | extern jmethodID postAdjustmentEventID; | |
267 | extern jmethodID postItemEventID; | |
268 | extern jmethodID postListItemEventID; | |
b6fa901b | 269 | extern jmethodID postTextEventID; |
5aac1dac TT |
270 | extern jmethodID syncAttrsID; |
271 | extern jclass gdkColor; | |
272 | extern jmethodID gdkColorID; | |
273 | extern JNIEnv *gdk_env; | |
274 | ||
275 | void | |
276 | gdk_window_get_root_geometry (GdkWindow *window, | |
277 | gint *x, | |
278 | gint *y, | |
279 | gint *width, | |
280 | gint *height, | |
281 | gint *border, | |
282 | gint *depth); | |
283 | ||
284 | void awt_event_handler (GdkEvent *event); | |
285 | ||
286 | void connect_awt_hook (JNIEnv *env, jobject peer_obj, int nwindows, ...); | |
287 | ||
288 | void set_visible (GtkWidget *widget, jboolean visible); | |
289 | void set_parent (GtkWidget *widget, GtkContainer *parent); | |
290 | GtkLayout *find_gtk_layout (GtkWidget *parent); | |
291 | void setup_window (JNIEnv *env, jobject obj, GtkWidget *window, jint width, | |
292 | jint height, jboolean visible); | |
293 | ||
294 | struct item_event_hook_info | |
295 | { | |
296 | jobject peer_obj; | |
297 | jobject item_obj; | |
298 | }; | |
299 | ||
300 | #endif /* __GTKPEER_H */ |