gcc/libjava/jni/gtk-peer/gtkpeer.h
Tom Tromey 5aac1dac62 Window.java (Window(Window,GraphicsConfiguration)): Don't try to find graphics configuration.
* java/awt/Window.java (Window(Window,GraphicsConfiguration)):
	Don't try to find graphics configuration.
	* java/awt/Toolkit.java (default_toolkit_name): Use new
	Configuration entry.
	* gnu/classpath/Configuration.java.in (default_awt_peer_toolkit):
	New global.
	* configure: Rebuilt.
	* configure.in (TOOLKIT): New subst.
	(--enable-java-awt) [xlib, gtk]: Set TOOLKIT if required.
	Do AWT tests much earlier.  Run Gtk tests.  Make jniinclude
	directory.  Make output directories for .c files.
	* Makefile.in: Rebuilt.
	* Makefile.am (lib_gnu_java_awt_peer_gtk_la_SOURCES): New macro.
	(toolexeclib_LTLIBRARIES): Added cond_gtk_ltlibrary.
	(all_java_source_files): Added new sources.
	($(lib_gnu_java_awt_peer_gtk_la_OBJECTS)): New target.
	(gtk_c_files): New macro.
	(gtk_c_source_files): New macro.
	(cond_gtk_ltlibrary): New macro.
	($(gtk_c_files)): New target.
	(lib_gnu_java_awt_peer_gtk_la_LIBADD): New macro.
	(gtk_awt_peer_sources): New macro.
	(gtk_c_headers): New macro.
	($(gtk_c_headers)): New target.
	(ACLOCAL_AMFLAGS): New macro.
	* gtk.m4, glib.m4, libart.m4: New files.
	* gnu/java/awt/peer/gtk/GdkFontMetrics.java,
	gnu/java/awt/peer/gtk/GdkGraphics.java,
	gnu/java/awt/peer/gtk/GtkArg.java,
	gnu/java/awt/peer/gtk/GtkArgList.java,
	gnu/java/awt/peer/gtk/GtkButtonPeer.java,
	gnu/java/awt/peer/gtk/GtkCanvasPeer.java,
	gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java,
	gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java,
	gnu/java/awt/peer/gtk/GtkCheckboxPeer.java,
	gnu/java/awt/peer/gtk/GtkChoicePeer.java,
	gnu/java/awt/peer/gtk/GtkClipboard.java,
	gnu/java/awt/peer/gtk/GtkComponentPeer.java,
	gnu/java/awt/peer/gtk/GtkContainerPeer.java,
	gnu/java/awt/peer/gtk/GtkDialogPeer.java,
	gnu/java/awt/peer/gtk/GtkFileDialogPeer.java,
	gnu/java/awt/peer/gtk/GtkFontPeer.java,
	gnu/java/awt/peer/gtk/GtkFramePeer.java,
	gnu/java/awt/peer/gtk/GtkGenericPeer.java,
	gnu/java/awt/peer/gtk/GtkImage.java,
	gnu/java/awt/peer/gtk/GtkImagePainter.java,
	gnu/java/awt/peer/gtk/GtkLabelPeer.java,
	gnu/java/awt/peer/gtk/GtkListPeer.java,
	gnu/java/awt/peer/gtk/GtkMainThread.java,
	gnu/java/awt/peer/gtk/GtkMenuBarPeer.java,
	gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java,
	gnu/java/awt/peer/gtk/GtkMenuItemPeer.java,
	gnu/java/awt/peer/gtk/GtkMenuPeer.java,
	gnu/java/awt/peer/gtk/GtkOffScreenImage.java,
	gnu/java/awt/peer/gtk/GtkPanelPeer.java,
	gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java,
	gnu/java/awt/peer/gtk/GtkScrollbarPeer.java,
	gnu/java/awt/peer/gtk/GtkScrollPanePeer.java,
	gnu/java/awt/peer/gtk/GtkTextAreaPeer.java,
	gnu/java/awt/peer/gtk/GtkTextComponentPeer.java,
	gnu/java/awt/peer/gtk/GtkTextFieldPeer.java,
	gnu/java/awt/peer/gtk/GtkToolkit.java,
	gnu/java/awt/peer/gtk/GtkWindowPeer.java,
	gnu/java/awt/peer/gtk/TestAWT.java,
	gnu/java/awt/peer/gtk/Test.java: New files from Classpath.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c,
	jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c,
	jni/gtk-peer/gthread-jni.c, jni/gtk-peer/gthread-jni.h,
	jni/gtk-peer/gtkpeer.h, jni/classpath/jcl.c, jni/classpath/jcl.h,
	jni/classpath/jnilink.c, jni/classpath/jnilink.h,
	jni/classpath/native_state.c, jni/classpath/native_state.h,
	jni/classpath/primlib.c, jni/classpath/primlib.h: Likewise.

From-SVN: r62187
2003-01-31 17:54:14 +00:00

300 lines
7.5 KiB
C

/* gtkpeer.h -- Some global variables and #defines
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
#include <gtk/gtk.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <config.h>
#include "native_state.h"
#include <jni.h>
#define RC_FILE ".classpath-gtkrc"
#define JVM_SUN
/*
#define JVM_JAPHAR
*/
#ifndef __GTKPEER_H__
#define __GTKPEER_H__
#ifdef JVM_SUN
extern struct state_table *native_state_table;
#define NSA_INIT(env, clazz) \
native_state_table = init_state_table (env, clazz)
#define NSA_GET_PTR(env, obj) \
get_state (env, obj, native_state_table)
#define NSA_SET_PTR(env, obj, ptr) \
set_state (env, obj, native_state_table, (void *)ptr)
#define NSA_DEL_PTR(env, obj) \
remove_state_slot (env, obj, native_state_table)
#endif /* JVM_SUN */
struct graphics
{
GdkDrawable *drawable;
GdkGC *gc;
GdkColormap *cm;
jint x_offset, y_offset;
};
#define AWT_DEFAULT_CURSOR 0
#define AWT_CROSSHAIR_CURSOR 1
#define AWT_TEXT_CURSOR 2
#define AWT_WAIT_CURSOR 3
#define AWT_SW_RESIZE_CURSOR 4
#define AWT_SE_RESIZE_CURSOR 5
#define AWT_NW_RESIZE_CURSOR 6
#define AWT_NE_RESIZE_CURSOR 7
#define AWT_N_RESIZE_CURSOR 8
#define AWT_S_RESIZE_CURSOR 9
#define AWT_W_RESIZE_CURSOR 10
#define AWT_E_RESIZE_CURSOR 11
#define AWT_HAND_CURSOR 12
#define AWT_MOVE_CURSOR 13
#define SYNTHETIC_EVENT_MASK (1 << 10)
#define AWT_SHIFT_MASK (1 << 0)
#define AWT_CTRL_MASK (1 << 1)
#define AWT_META_MASK (1 << 2)
#define AWT_ALT_MASK (1 << 3)
#define AWT_BUTTON1_MASK (1 << 4)
#define AWT_BUTTON2_MASK AWT_ALT_MASK
#define AWT_BUTTON3_MASK AWT_META_MASK
#define MULTI_CLICK_TIME 250
/* as opposed to a MULTI_PASS_TIME :) */
#define AWT_MOUSE_CLICKED 500
#define AWT_MOUSE_PRESSED 501
#define AWT_MOUSE_RELEASED 502
#define AWT_MOUSE_MOVED 503
#define AWT_MOUSE_ENTERED 504
#define AWT_MOUSE_EXITED 505
#define AWT_MOUSE_DRAGGED 506
#define AWT_ADJUSTMENT_UNIT_INCREMENT 1
#define AWT_ADJUSTMENT_UNIT_DECREMENT 2
#define AWT_ADJUSTMENT_BLOCK_DECREMENT 3
#define AWT_ADJUSTMENT_BLOCK_INCREMENT 4
#define AWT_ADJUSTMENT_TRACK 5
#define AWT_SCROLLPANE_SCROLLBARS_AS_NEEDED 0
#define AWT_SCROLLPANE_SCROLLBARS_ALWAYS 1
#define AWT_SCROLLPANE_SCROLLBARS_NEVER 2
#define AWT_LABEL_LEFT 0
#define AWT_LABEL_CENTER 1
#define AWT_LABEL_RIGHT 2
#define AWT_TEXTAREA_SCROLLBARS_BOTH 0
#define AWT_TEXTAREA_SCROLLBARS_VERTICAL_ONLY 1
#define AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY 2
#define AWT_ITEM_SELECTED 1
#define AWT_ITEM_DESELECTED 2
#define AWT_KEY_TYPED 400
#define AWT_KEY_PRESSED 401
#define AWT_KEY_RELEASED 402
#define VK_UNDEFINED 0
#define AWT_KEY_CHAR_UNDEFINED 0
#define VK_0 48
#define VK_1 49
#define VK_2 50
#define VK_3 51
#define VK_4 52
#define VK_5 53
#define VK_6 54
#define VK_7 55
#define VK_8 56
#define VK_9 57
#define VK_A 65
#define VK_ACCEPT 30
#define VK_ADD 107
#define VK_ALT 18
#define VK_B 66
#define VK_BACK_QUOTE 192
#define VK_BACK_SLASH 92
#define VK_BACK_SPACE 8
#define VK_C 67
#define VK_CANCEL 3
#define VK_CAPS_LOCK 20
#define VK_CLEAR 12
#define VK_CLOSE_BRACKET 93
#define VK_COMMA 44
#define VK_CONTROL 17
#define VK_CONVERT 28
#define VK_D 68
#define VK_DECIMAL 110
#define VK_DELETE 127
#define VK_DIVIDE 111
#define VK_DOWN 40
#define VK_E 69
#define VK_END 35
#define VK_ENTER 10
#define VK_ESCAPE 27
#define VK_F 70
#define VK_F1 112
#define VK_F10 121
#define VK_F11 122
#define VK_F12 123
#define VK_F2 113
#define VK_F3 114
#define VK_F4 115
#define VK_F5 116
#define VK_F6 117
#define VK_F7 118
#define VK_F8 119
#define VK_F9 120
#define VK_FINAL 24
#define VK_G 71
#define VK_H 72
#define VK_HELP 156
#define VK_HOME 36
#define VK_I 73
#define VK_INSERT 155
#define VK_J 74
#define VK_K 75
#define VK_KANA 21
#define VK_KANJI 25
#define VK_L 76
#define VK_LEFT 37
#define VK_M 77
#define VK_META 157
#define VK_MODECHANGE 31
#define VK_MULTIPLY 106
#define VK_N 78
#define VK_NONCONVERT 29
#define VK_NUM_LOCK 144
#define VK_NUMPAD0 96
#define VK_NUMPAD1 97
#define VK_NUMPAD2 98
#define VK_NUMPAD3 99
#define VK_NUMPAD4 100
#define VK_NUMPAD5 101
#define VK_NUMPAD6 102
#define VK_NUMPAD7 103
#define VK_NUMPAD8 104
#define VK_NUMPAD9 105
#define VK_O 79
#define VK_OPEN_BRACKET 91
#define VK_P 80
#define VK_PAGE_DOWN 34
#define VK_PAGE_UP 33
#define VK_PAUSE 19
#define VK_PERIOD 46
#define VK_PRINTSCREEN 154
#define VK_Q 81
#define VK_QUOTE 222
#define VK_R 82
#define VK_RIGHT 39
#define VK_S 83
#define VK_SCROLL_LOCK 145
#define VK_SEMICOLON 59
#define VK_SEPARATOR 108
#define VK_SHIFT 16
#define VK_SLASH 47
#define VK_SPACE 32
#define VK_SUBTRACT 109
#define VK_T 84
#define VK_TAB 9
#define VK_U 85
#define VK_UP 38
#define VK_V 86
#define VK_W 87
#define VK_X 88
#define VK_Y 89
#define VK_Z 90
#define AWT_FOCUS_LOST 1004
#define AWT_FOCUS_GAINED 1005
extern jmethodID postActionEventID;
extern jmethodID postMenuActionEventID;
extern jmethodID postMouseEventID;
extern jmethodID postConfigureEventID;
extern jmethodID postExposeEventID;
extern jmethodID postKeyEventID;
extern jmethodID postFocusEventID;
extern jmethodID postAdjustmentEventID;
extern jmethodID postItemEventID;
extern jmethodID postListItemEventID;
extern jmethodID syncAttrsID;
extern jclass gdkColor;
extern jmethodID gdkColorID;
extern JNIEnv *gdk_env;
void
gdk_window_get_root_geometry (GdkWindow *window,
gint *x,
gint *y,
gint *width,
gint *height,
gint *border,
gint *depth);
void awt_event_handler (GdkEvent *event);
void connect_awt_hook (JNIEnv *env, jobject peer_obj, int nwindows, ...);
void set_visible (GtkWidget *widget, jboolean visible);
void set_parent (GtkWidget *widget, GtkContainer *parent);
GtkLayout *find_gtk_layout (GtkWidget *parent);
void setup_window (JNIEnv *env, jobject obj, GtkWidget *window, jint width,
jint height, jboolean visible);
struct item_event_hook_info
{
jobject peer_obj;
jobject item_obj;
};
#endif /* __GTKPEER_H */