Commit 5aac1dac by Tom Tromey Committed by Tom Tromey

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
parent 371ac725
2003-01-31 Tom Tromey <tromey@redhat.com>
* 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.
2003-01-31 Julian Dolby <dolby@us.ibm.com> 2003-01-31 Julian Dolby <dolby@us.ibm.com>
* java/util/Properties.java (load): Ignore backslash before EOF. * java/util/Properties.java (load): Ignore backslash before EOF.
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -I .
if TESTSUBDIR if TESTSUBDIR
SUBDIRS = $(DIRLTDL) testsuite gcj include SUBDIRS = $(DIRLTDL) testsuite gcj include
else else
...@@ -23,7 +25,14 @@ cond_x_ltlibrary = ...@@ -23,7 +25,14 @@ cond_x_ltlibrary =
xlib_includes = xlib_includes =
endif endif
toolexeclib_LTLIBRARIES = libgcj.la lib-org-xml-sax.la lib-org-w3c-dom.la $(cond_x_ltlibrary) if GTK_AWT
cond_gtk_ltlibrary = lib-gnu-java-awt-peer-gtk.la
else
cond_gtk_ltlibrary =
endif
toolexeclib_LTLIBRARIES = libgcj.la lib-org-xml-sax.la lib-org-w3c-dom.la \
$(cond_gtk_ltlibrary) $(cond_x_ltlibrary)
toolexecmainlib_DATA = libgcj.spec toolexecmainlib_DATA = libgcj.spec
jardir = $(datadir)/java jardir = $(datadir)/java
...@@ -115,6 +124,8 @@ nat_files = $(nat_source_files:.cc=.lo) ...@@ -115,6 +124,8 @@ nat_files = $(nat_source_files:.cc=.lo)
x_nat_files = $(x_nat_source_files:.cc=.lo) x_nat_files = $(x_nat_source_files:.cc=.lo)
## Objects from C sources in subdirs. ## Objects from C sources in subdirs.
c_files = $(c_source_files:.c=.lo) c_files = $(c_source_files:.c=.lo)
## Objects from gtk-related C sources in subdirs.
gtk_c_files = $(gtk_c_source_files:.c=.lo)
## Objects from Java sources in subdirs. ## Objects from Java sources in subdirs.
javao_files = $(java_source_files:.java=.lo) \ javao_files = $(java_source_files:.java=.lo) \
$(built_java_source_files:.java=.lo) $(built_java_source_files:.java=.lo)
...@@ -140,6 +151,102 @@ libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(THREADLIBS) \ ...@@ -140,6 +151,102 @@ libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(THREADLIBS) \
-version-info `grep -v '^\#' $(srcdir)/libtool-version` -version-info `grep -v '^\#' $(srcdir)/libtool-version`
libgcj_la_LINK = $(LIBLINK) libgcj_la_LINK = $(LIBLINK)
## Gtk JNI sources.
gtk_c_source_files = \
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/classpath/jcl.c \
jni/classpath/jnilink.c \
jni/classpath/native_state.c \
jni/classpath/primlib.c
## Java sources for Gtk peers.
gtk_awt_peer_sources = \
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/GtkScrollPanePeer.java \
gnu/java/awt/peer/gtk/GtkScrollbarPeer.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
## FIXME: GNU make.
gtk_c_headers = $(patsubst %.java,jniinclude/%.h,$(subst /,_,$(gtk_awt_peer_sources)))
$(gtk_c_headers): $(gtk_awt_peer_sources)
## FIXME: GNU make.
@input=`echo $@ | sed -e 's,jniinclude,,' -e 's,_,.,g' -e 's,.h$$,,'`; \
echo "$(GCJH) -jni -d jniinclude -classpath '' -bootclasspath $(top_builddir) $$input"; \
$(GCJH) -jni -d jniinclude -classpath '' -bootclasspath $(top_builddir) $$input
lib_gnu_java_awt_peer_gtk_la_SOURCES = \
$(gtk_awt_peer_sources) \
$(gtk_c_source_files) \
jni/gtk-peer/gthread-jni.h \
jni/gtk-peer/gtkpeer.h \
jni/classpath/jcl.h \
jni/classpath/jnilink.h \
jni/classpath/native_state.h \
jni/classpath/primlib.h
lib_gnu_java_awt_peer_gtk_la_LIBADD = $(GTK_LIBS) $(GLIB_LIBS) $(LIBART_LIBS)
lib_org_w3c_dom_la_SOURCES = org/w3c/dom/Attr.java \ lib_org_w3c_dom_la_SOURCES = org/w3c/dom/Attr.java \
org/w3c/dom/CDATASection.java \ org/w3c/dom/CDATASection.java \
org/w3c/dom/CharacterData.java \ org/w3c/dom/CharacterData.java \
...@@ -220,6 +327,7 @@ all_java_source_files = \ ...@@ -220,6 +327,7 @@ all_java_source_files = \
$(built_java_source_files) \ $(built_java_source_files) \
$(lib_org_xml_sax_la_SOURCES) \ $(lib_org_xml_sax_la_SOURCES) \
$(lib_org_w3c_dom_la_SOURCES) \ $(lib_org_w3c_dom_la_SOURCES) \
$(gtk_awt_peer_sources) \
$(x_java_source_files) $(x_java_source_files)
all_java_class_files = $(all_java_source_files:.java=.class) all_java_class_files = $(all_java_source_files:.java=.class)
...@@ -270,9 +378,18 @@ $(c_files): %.lo: %.c ...@@ -270,9 +378,18 @@ $(c_files): %.lo: %.c
$(c_files): java/lang/fdlibm.h java/lang/ieeefp.h java/lang/mprec.h $(c_files): java/lang/fdlibm.h java/lang/ieeefp.h java/lang/mprec.h
## FIXME: GNU make. ## FIXME: GNU make.
$(gtk_c_files): %.lo: %.c
$(LTCOMPILE) -c -Ijniinclude -I$(srcdir)/jni/classpath -I$(srcdir)/jni/gtk-peer $(GTK_CFLAGS) $(LIBART_CFLAGS) -o $@ $<
$(gtk_c_files): $(gtk_c_headers)
## FIXME: GNU make.
$(javao_files) $(x_javao_files) $(lib_org_w3c_dom_la_OBJECTS) $(lib_org_xml_sax_la_OBJECTS): %.lo: %.java $(javao_files) $(x_javao_files) $(lib_org_w3c_dom_la_OBJECTS) $(lib_org_xml_sax_la_OBJECTS): %.lo: %.java
$(GCJCOMPILE) -o $@ $< $(GCJCOMPILE) -o $@ $<
$(gtk_awt_peer_sources:.java=.lo): %.lo: %.java
$(GCJCOMPILE) -fjni -o $@ $<
## Pass the list of object files to libtool in a temporary file to ## Pass the list of object files to libtool in a temporary file to
## avoid tripping platform command line length limits. ## avoid tripping platform command line length limits.
libgcj.la: $(libgcj_la_OBJECTS) $(libgcj_la_DEPENDENCIES) libgcj.la: $(libgcj_la_OBJECTS) $(libgcj_la_DEPENDENCIES)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -289,6 +289,59 @@ AC_SUBST(ZLIBSPEC) ...@@ -289,6 +289,59 @@ AC_SUBST(ZLIBSPEC)
ZLIBTESTSPEC= ZLIBTESTSPEC=
AC_SUBST(ZLIBTESTSPEC) AC_SUBST(ZLIBTESTSPEC)
AC_PATH_XTRA
dnl Determine which AWT peer libraries to build
AC_ARG_ENABLE(java-awt,
[ --enable-java-awt list of AWT peer implementations to be built])
peerlibs="`echo ${enable_java_awt} | tr ',' ' '`"
use_xlib_awt=""
use_gtk_awt=""
# The default toolkit to use is the first one specified.
TOOLKIT=
AC_SUBST(TOOLKIT)
for peer in $peerlibs ; do
case $peer in
xlib)
if test "$no_x" = yes; then
echo "*** xlib peers requested but no X library available" 1>&2
exit 1
else
use_xlib_awt="yes"
if test -z "$TOOLKIT"; then
TOOLKIT=gnu.gnu.awt.xlib.XToolkit
fi
fi
;;
gtk)
if test "$no_x" = yes; then
echo "*** xlib peers requested but no X library available" 1>&2
exit 1
else
use_gtk_awt=yes
if test -z "$TOOLKIT"; then
TOOLKIT=gnu.java.awt.peer.gtk.GtkToolkit
fi
test -d jniinclude || mkdir jniinclude
fi
;;
no)
use_xlib_awt=
use_gtk_awt=
break
;;
*)
echo "*** unrecognised argument \"${peer}\" for --enable-java-awt" 1>&2
exit 1
esac
done
AM_CONDITIONAL(XLIB_AWT, test "$use_xlib_awt" = yes)
AM_CONDITIONAL(GTK_AWT, test "$use_gtk_awt" = yes)
dnl FIXME: this should be _libs on some hosts. dnl FIXME: this should be _libs on some hosts.
libsubdir=.libs libsubdir=.libs
...@@ -721,6 +774,15 @@ else ...@@ -721,6 +774,15 @@ else
AC_CHECK_LIB(z, deflate, ZLIBSPEC=-lz, ZLIBSPEC=) AC_CHECK_LIB(z, deflate, ZLIBSPEC=-lz, ZLIBSPEC=)
fi fi
# Test for Gtk stuff, if asked for.
if test "$use_gtk_awt" = yes; then
AM_PATH_GTK(1.2.4,,exit 1)
AM_PATH_GLIB(1.2.4,,exit 1,gthread)
dnl XXX Fix me when libart.m4 has the compile test fixed!
enable_libarttest=no
AM_PATH_LIBART(2.1.0,,exit 1)
fi
# On Solaris, and maybe other architectures, the Boehm collector # On Solaris, and maybe other architectures, the Boehm collector
# requires -ldl. # requires -ldl.
if test "$GC" = boehm; then if test "$GC" = boehm; then
...@@ -757,7 +819,8 @@ CPPFLAGS="$CPPFLAGS -I`${PWDCMD-pwd}` -I`cd $srcdir && ${PWDCMD-pwd}`" ...@@ -757,7 +819,8 @@ CPPFLAGS="$CPPFLAGS -I`${PWDCMD-pwd}` -I`cd $srcdir && ${PWDCMD-pwd}`"
if test ! -f gnu/classpath/Configuration.java; then if test ! -f gnu/classpath/Configuration.java; then
test -d gnu || mkdir gnu test -d gnu || mkdir gnu
test -d gnu/classpath || mkdir gnu/classpath test -d gnu/classpath || mkdir gnu/classpath
sed 's,@LIBGCJDEBUG@,$LIBGCJDEBUG,' \ sed -e 's,@LIBGCJDEBUG@,$LIBGCJDEBUG,' \
-e 's,@TOOLKIT@,$TOOLKIT,' \
< $srcdir/gnu/classpath/Configuration.java.in \ < $srcdir/gnu/classpath/Configuration.java.in \
> gnu/classpath/Configuration.java > gnu/classpath/Configuration.java
# We do not want to redirect the output of the grep below to /dev/null, # We do not want to redirect the output of the grep below to /dev/null,
...@@ -966,42 +1029,6 @@ else ...@@ -966,42 +1029,6 @@ else
multilib_arg= multilib_arg=
fi fi
AC_PATH_XTRA
dnl Determine which AWT peer libraries to build
AC_ARG_ENABLE(java-awt,
[ --enable-java-awt list of AWT peer implementations to be built])
peerlibs="`echo ${enable_java_awt} | tr ',' ' '`"
use_xlib_awt=""
use_gtk_awt=""
for peer in $peerlibs ; do
case $peer in
xlib)
if [test "$no_x" = yes]; then
echo "*** xlib peers requested but no X library available" 1>&2
exit 1
else
use_xlib_awt="yes"
fi
;;
gtk)
# Nothing, yet...
;;
no)
use_xlib_awt=
use_gtk_awt=
break
;;
*)
echo "*** unrecognised argument \"${peer}\" for --enable-java-awt" 1>&2
exit 1
esac
done
AM_CONDITIONAL(XLIB_AWT, test "$use_xlib_awt" = yes)
AM_CONDITIONAL(GTK_AWT, test "$use_gtk_awt" = yes)
here=`${PWDCMD-pwd}` here=`${PWDCMD-pwd}`
...@@ -1023,10 +1050,10 @@ esac ...@@ -1023,10 +1050,10 @@ esac
# builddir for the .java files. # builddir for the .java files.
h=`${PWDCMD-pwd}` h=`${PWDCMD-pwd}`
: > deps.mk : > deps.mk
( (cd $srcdir && find . \( -name '*.java' -o -name '*.cc' \) -print) ; ( (cd $srcdir && find . \( -name '*.java' -o -name '*.cc' -o -name '*.c' \) -print) ;
find . \( -name '*.java' -o -name '*.cc' \) -print) | \ find . \( -name '*.java' -o -name '*.cc' -o -name '*.c' \) -print) | \
fgrep -v testsuite | \ fgrep -v testsuite | \
sed -e 's/\.java/.d/'\;'s/\.cc/.d/' | \ sed -e 's/\.java/.d/'\;'s/\.cc/.d/'\;'s/\.c/.d/' | \
while read f; do while read f; do
echo "include $f" >> deps.mk echo "include $f" >> deps.mk
test -f $f || { test -f $f || {
......
...@@ -85,10 +85,19 @@ GCLIBS = @GCLIBS@ ...@@ -85,10 +85,19 @@ GCLIBS = @GCLIBS@
GCOBJS = @GCOBJS@ GCOBJS = @GCOBJS@
GCSPEC = @GCSPEC@ GCSPEC = @GCSPEC@
GCTESTSPEC = @GCTESTSPEC@ GCTESTSPEC = @GCTESTSPEC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_CONFIG = @GLIB_CONFIG@
GLIB_LIBS = @GLIB_LIBS@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_CONFIG = @GTK_CONFIG@
GTK_LIBS = @GTK_LIBS@
HASH_SYNC_SPEC = @HASH_SYNC_SPEC@ HASH_SYNC_SPEC = @HASH_SYNC_SPEC@
INCLTDL = @INCLTDL@ INCLTDL = @INCLTDL@
INTERPRETER = @INTERPRETER@ INTERPRETER = @INTERPRETER@
JC1GCSPEC = @JC1GCSPEC@ JC1GCSPEC = @JC1GCSPEC@
LIBART_CFLAGS = @LIBART_CFLAGS@
LIBART_CONFIG = @LIBART_CONFIG@
LIBART_LIBS = @LIBART_LIBS@
LIBFFI = @LIBFFI@ LIBFFI = @LIBFFI@
LIBFFIINCS = @LIBFFIINCS@ LIBFFIINCS = @LIBFFIINCS@
LIBGCJDEBUG = @LIBGCJDEBUG@ LIBGCJDEBUG = @LIBGCJDEBUG@
...@@ -118,6 +127,7 @@ THREADLDFLAGS = @THREADLDFLAGS@ ...@@ -118,6 +127,7 @@ THREADLDFLAGS = @THREADLDFLAGS@
THREADLIBS = @THREADLIBS@ THREADLIBS = @THREADLIBS@
THREADOBJS = @THREADOBJS@ THREADOBJS = @THREADOBJS@
THREADSPEC = @THREADSPEC@ THREADSPEC = @THREADSPEC@
TOOLKIT = @TOOLKIT@
VERSION = @VERSION@ VERSION = @VERSION@
ZINCS = @ZINCS@ ZINCS = @ZINCS@
ZLIBS = @ZLIBS@ ZLIBS = @ZLIBS@
...@@ -129,6 +139,9 @@ here = @here@ ...@@ -129,6 +139,9 @@ here = @here@
libgcj_basedir = @libgcj_basedir@ libgcj_basedir = @libgcj_basedir@
mkinstalldirs = @mkinstalldirs@ mkinstalldirs = @mkinstalldirs@
tool_include_dir = @tool_include_dir@ tool_include_dir = @tool_include_dir@
toolexecdir = @toolexecdir@
toolexeclibdir = @toolexeclibdir@
toolexecmainlibdir = @toolexecmainlibdir@
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign
......
# Configure paths for GLIB
# Owen Taylor 97-11-3
dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or
dnl gthread is specified in MODULES, pass to glib-config
dnl
AC_DEFUN(AM_PATH_GLIB,
[dnl
dnl Get the cflags and libraries from the glib-config script
dnl
AC_ARG_WITH(glib-prefix,[ --with-glib-prefix=PFX Prefix where GLIB is installed (optional)],
glib_config_prefix="$withval", glib_config_prefix="")
AC_ARG_WITH(glib-exec-prefix,[ --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)],
glib_config_exec_prefix="$withval", glib_config_exec_prefix="")
AC_ARG_ENABLE(glibtest, [ --disable-glibtest Do not try to compile and run a test GLIB program],
, enable_glibtest=yes)
if test x$glib_config_exec_prefix != x ; then
glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix"
if test x${GLIB_CONFIG+set} != xset ; then
GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config
fi
fi
if test x$glib_config_prefix != x ; then
glib_config_args="$glib_config_args --prefix=$glib_config_prefix"
if test x${GLIB_CONFIG+set} != xset ; then
GLIB_CONFIG=$glib_config_prefix/bin/glib-config
fi
fi
for module in . $4
do
case "$module" in
gmodule)
glib_config_args="$glib_config_args gmodule"
;;
gthread)
glib_config_args="$glib_config_args gthread"
;;
esac
done
AC_PATH_PROG(GLIB_CONFIG, glib-config, no)
min_glib_version=ifelse([$1], ,0.99.7,$1)
AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
no_glib=""
if test "$GLIB_CONFIG" = "no" ; then
no_glib=yes
else
GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags`
GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs`
glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_glibtest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GLIB_CFLAGS"
LIBS="$GLIB_LIBS $LIBS"
dnl
dnl Now check if the installed GLIB is sufficiently new. (Also sanity
dnl checks the results of glib-config to some extent
dnl
rm -f conf.glibtest
AC_TRY_RUN([
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
int major, minor, micro;
char *tmp_version;
system ("touch conf.glibtest");
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = g_strdup("$min_glib_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_glib_version");
exit(1);
}
if ((glib_major_version != $glib_config_major_version) ||
(glib_minor_version != $glib_config_minor_version) ||
(glib_micro_version != $glib_config_micro_version))
{
printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
$glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
glib_major_version, glib_minor_version, glib_micro_version);
printf ("*** was found! If glib-config was correct, then it is best\n");
printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n");
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
printf("*** required on your system.\n");
printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n");
printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n");
printf("*** before re-running configure\n");
}
else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
(glib_minor_version != GLIB_MINOR_VERSION) ||
(glib_micro_version != GLIB_MICRO_VERSION))
{
printf("*** GLIB header files (version %d.%d.%d) do not match\n",
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
printf("*** library (version %d.%d.%d)\n",
glib_major_version, glib_minor_version, glib_micro_version);
}
else
{
if ((glib_major_version > major) ||
((glib_major_version == major) && (glib_minor_version > minor)) ||
((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
glib_major_version, glib_minor_version, glib_micro_version);
printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
major, minor, micro);
printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
printf("***\n");
printf("*** If you have already installed a sufficiently new version, this error\n");
printf("*** probably means that the wrong copy of the glib-config shell script is\n");
printf("*** being found. The easiest way to fix this is to remove the old version\n");
printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n");
printf("*** correct copy of glib-config. (In this case, you will have to\n");
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
printf("*** so that the correct libraries are found at run-time))\n");
}
}
return 1;
}
],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_glib" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$GLIB_CONFIG" = "no" ; then
echo "*** The glib-config script installed by GLIB could not be found"
echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the GLIB_CONFIG environment variable to the"
echo "*** full path to glib-config."
else
if test -f conf.glibtest ; then
:
else
echo "*** Could not run GLIB test program, checking why..."
CFLAGS="$CFLAGS $GLIB_CFLAGS"
LIBS="$LIBS $GLIB_LIBS"
AC_TRY_LINK([
#include <glib.h>
#include <stdio.h>
], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding GLIB or finding the wrong"
echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
echo "***"
echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
echo "*** came with the system with the command"
echo "***"
echo "*** rpm --erase --nodeps gtk gtk-devel" ],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
GLIB_CFLAGS=""
GLIB_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
rm -f conf.glibtest
])
/* gnu.classpath.Configuration /* gnu.classpath.Configuration
Copyright (C) 1998, 2001 Free Software Foundation, Inc. Copyright (C) 1998, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -56,4 +56,7 @@ public interface Configuration ...@@ -56,4 +56,7 @@ public interface Configuration
boolean HAVE_NATIVE_GET_PROXY_DATA = false; boolean HAVE_NATIVE_GET_PROXY_DATA = false;
boolean HAVE_NATIVE_GET_PROXY_CLASS = false; boolean HAVE_NATIVE_GET_PROXY_CLASS = false;
boolean HAVE_NATIVE_GENERATE_PROXY_CLASS = false; boolean HAVE_NATIVE_GENERATE_PROXY_CLASS = false;
// Name of default AWT peer library.
String default_awt_peer_toolkit = "@TOOLKIT@";
} }
/* GdkFontMetrics.java
Copyright (C) 1999, 2002 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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
public class GdkFontMetrics extends FontMetrics
{
private final int native_state = GtkGenericPeer.getUniqueInteger();
private static final int ASCENT = 0, MAX_ASCENT = 1,
DESCENT = 2, MAX_DESCENT = 3,
MAX_ADVANCE = 4;
private int[] metrics;
private native int[] initState (String xlfd, int pts);
public GdkFontMetrics (Font font)
{
super (font);
metrics = initState (((GtkFontPeer)font.getPeer ()).getXLFD (),
font.getSize ());
}
native public int stringWidth (String str);
public int charWidth (char ch)
{
return stringWidth (new String (new char[] { ch }));
}
public int charsWidth (char data[], int off, int len)
{
return stringWidth (new String (data, off, len));
}
/*
Sun's Motif implementation always returns 0 or 1 here (???), but
going by the X11 man pages, it seems as though we should return
font.ascent + font.descent.
*/
public int getLeading ()
{
return 1;
// return metrics[ASCENT] + metrics[DESCENT];
}
public int getAscent ()
{
return metrics[ASCENT];
}
public int getMaxAscent ()
{
return metrics[MAX_ASCENT];
}
public int getDescent ()
{
return metrics[DESCENT];
}
public int getMaxDescent ()
{
return metrics[MAX_DESCENT];
}
public int getMaxAdvance ()
{
return metrics[MAX_ADVANCE];
}
}
/* GdkGraphics.java
Copyright (C) 1998, 1999, 2002 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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.image.*;
public class GdkGraphics extends Graphics
{
private final int native_state = GtkGenericPeer.getUniqueInteger();
Color color, xorColor;
GtkComponentPeer component;
Font font;
Rectangle clip;
int xOffset = 0;
int yOffset = 0;
static final int GDK_COPY = 0, GDK_XOR = 2;
native int[] initState (GtkComponentPeer component);
native void initState (int width, int height);
native void copyState (GdkGraphics g);
GdkGraphics (GdkGraphics g)
{
color = g.color;
xorColor = g.xorColor;
font = g.font;
clip = new Rectangle (g.clip);
component = g.component;
copyState (g);
}
GdkGraphics (int width, int height)
{
initState (width, height);
color = Color.black;
clip = new Rectangle (0, 0, width, height);
font = new Font ("Dialog", Font.PLAIN, 10);
}
GdkGraphics (GtkComponentPeer component)
{
this.component = component;
int rgb[] = initState (component);
color = new Color (rgb[0], rgb[1], rgb[2]);
font = new Font ("Dialog", Font.PLAIN, 10);
Dimension d = component.awtComponent.getSize ();
clip = new Rectangle (0, 0, d.width, d.height);
}
public native void clearRect (int x, int y, int width, int height);
public void clipRect (int x, int y, int width, int height)
{
clip = clip.intersection (new Rectangle (x, y, width, height));
setClipRectangle (clip.x, clip.y, clip.width, clip.height);
}
native public void copyArea (int x, int y, int width, int height,
int dx, int dy);
public Graphics create ()
{
return new GdkGraphics (this);
}
// public Graphics create (int x, int y, int width, int height)
// {
// GdkGraphics g = new GdkGraphics (this);
// System.out.println ("translating by: " + x +" " + y);
// g.translate (x, y);
// g.clipRect (0, 0, width, height);
// return g;
// }
native public void dispose ();
native void copyPixmap (Graphics g, int x, int y, int width, int height);
public boolean drawImage (Image img, int x, int y,
Color bgcolor, ImageObserver observer)
{
if (img instanceof GtkOffScreenImage)
{
copyPixmap (img.getGraphics (),
x, y, img.getWidth (null), img.getHeight (null));
return true;
}
GtkImage image = (GtkImage) img;
new GtkImagePainter (image, this, x, y, -1, -1, bgcolor);
return image.isLoaded ();
}
public boolean drawImage (Image img, int x, int y, ImageObserver observer)
{
if (img instanceof GtkOffScreenImage)
{
copyPixmap (img.getGraphics (),
x, y, img.getWidth (null), img.getHeight (null));
return true;
}
return drawImage (img, x, y, component.getBackground (), observer);
}
public boolean drawImage (Image img, int x, int y, int width, int height,
Color bgcolor, ImageObserver observer)
{
if (img instanceof GtkOffScreenImage)
{
throw new RuntimeException ();
}
GtkImage image = (GtkImage) img;
new GtkImagePainter (image, this, x, y, width, height, bgcolor);
return image.isLoaded ();
}
public boolean drawImage (Image img, int x, int y, int width, int height,
ImageObserver observer)
{
return drawImage (img, x, y, width, height, component.getBackground (),
observer);
}
public boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2,
Color bgcolor, ImageObserver observer)
{
if (img instanceof GtkOffScreenImage)
{
throw new RuntimeException ();
}
GtkImage image = (GtkImage) img;
new GtkImagePainter (image, this, dx1, dy1, dx2, dy2,
sx1, sy1, sx2, sy2, bgcolor);
return image.isLoaded ();
}
public boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2,
ImageObserver observer)
{
return drawImage (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2,
component.getBackground (), observer);
}
native public void drawLine (int x1, int y1, int x2, int y2);
native public void drawArc (int x, int y, int width, int height,
int startAngle, int arcAngle);
native public void fillArc (int x, int y, int width, int height,
int startAngle, int arcAngle);
native public void drawOval(int x, int y, int width, int height);
native public void fillOval(int x, int y, int width, int height);
native public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints);
native public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints);
native public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints);
native public void drawRect(int x, int y, int width, int height);
native public void fillRect (int x, int y, int width, int height);
native void drawString (String str, int x, int y, String fname, int size);
public void drawString (String str, int x, int y)
{
drawString (str, x, y,
((GtkFontPeer)font.getPeer ()).getXLFD (), font.getSize ());
}
public void drawRoundRect(int x, int y, int width, int height,
int arcWidth, int arcHeight)
{
// System.out.println ("drawRoundRect called [UNIMPLEMENTED]");
}
public void fillRoundRect (int x, int y, int width, int height,
int arcWidth, int arcHeight)
{
// System.out.println ("fillRoundRect called [UNIMPLEMENTED]");
}
public Shape getClip ()
{
return getClipBounds ();
}
public Rectangle getClipBounds ()
{
// System.out.println ("returning CLIP: " + clip);
return new Rectangle (clip.x, clip.y, clip.width, clip.height);
}
public Color getColor ()
{
return color;
}
public Font getFont ()
{
return font;
}
public FontMetrics getFontMetrics (Font font)
{
return new GdkFontMetrics (font);
}
native void setClipRectangle (int x, int y, int width, int height);
public void setClip (int x, int y, int width, int height)
{
clip.x = x;
clip.y = y;
clip.width = width;
clip.height = height;
setClipRectangle (x, y, width, height);
}
public void setClip (Rectangle clip)
{
setClip (clip.x, clip.y, clip.width, clip.height);
}
public void setClip (Shape clip)
{
setClip (clip.getBounds ());
}
native private void setFGColor (int red, int green, int blue);
public void setColor (Color c)
{
color = c;
if (xorColor == null) /* paint mode */
setFGColor (color.getRed (), color.getGreen (), color.getBlue ());
else /* xor mode */
setFGColor (color.getRed () ^ xorColor.getRed (),
color.getGreen () ^ xorColor.getGreen (),
color.getBlue () ^ xorColor.getBlue ());
}
public void setFont (Font font)
{
this.font = font;
}
native void setFunction (int gdk_func);
public void setPaintMode ()
{
xorColor = null;
setFunction (GDK_COPY);
setFGColor (color.getRed (), color.getGreen (), color.getBlue ());
}
public void setXORMode (Color c)
{
xorColor = c;
setFunction (GDK_XOR);
setFGColor (color.getRed () ^ xorColor.getRed (),
color.getGreen () ^ xorColor.getGreen (),
color.getBlue () ^ xorColor.getBlue ());
}
native public void translateNative (int x, int y);
public void translate (int x, int y)
{
clip.x -= x;
clip.y -= y;
translateNative (x, y);
}
}
/* GtkArg.java
Copyright (C) 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. */
package gnu.java.awt.peer.gtk;
public class GtkArg
{
String name;
Object value;
public GtkArg (String name, Object value)
{
this.name = name;
this.value = value;
}
public String getName ()
{
return name;
}
public Object getValue ()
{
return value;
}
}
/* GtkArgList.java
Copyright (C) 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. */
package gnu.java.awt.peer.gtk;
import java.util.Vector;
public class GtkArgList extends Vector
{
void add (GtkArg arg)
{
addElement (arg);
}
void add (String name, boolean value)
{
addElement (new GtkArg (name, new Boolean (value)));
}
void add (String name, int value)
{
addElement (new GtkArg (name, new Integer (value)));
}
void add (String name, float value)
{
addElement (new GtkArg (name, new Float (value)));
}
void add (String name, Object value)
{
addElement (new GtkArg (name, value));
}
synchronized void setArgs (GtkComponentPeer cp)
{
for (int i = 0; i < elementCount; i++)
cp.set ((GtkArg)elementData[i]);
}
}
/* GtkButtonPeer.java -- Implements ButtonPeer with GTK
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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.KeyEvent;
import java.awt.peer.*;
public class GtkButtonPeer extends GtkComponentPeer
implements ButtonPeer
{
native void create ();
public GtkButtonPeer (Button b)
{
super (b);
}
public void setLabel (String label)
{
set ("label", label);
}
public void handleEvent (AWTEvent e)
{
if (e.getID () == MouseEvent.MOUSE_CLICKED && isEnabled ()
&& !modalHasGrab ())
{
MouseEvent me = (MouseEvent) e;
if (!me.isConsumed ()
&& (me.getModifiers () & MouseEvent.BUTTON1_MASK) != 0)
postActionEvent (((Button)awtComponent).getActionCommand (),
me.getModifiers ());
}
if (e.getID () == KeyEvent.KEY_PRESSED)
{
KeyEvent ke = (KeyEvent) e;
if (!ke.isConsumed () && ke.getKeyCode () == KeyEvent.VK_SPACE)
postActionEvent (((Button)awtComponent).getActionCommand (),
ke.getModifiers ());
}
super.handleEvent (e);
}
public void getArgs (Component component, GtkArgList args)
{
super.getArgs (component, args);
args.add ("label", ((Button)component).getLabel ());
}
}
/* GtkCanvasPeer.java
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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.event.PaintEvent;
import java.awt.peer.*;
public class GtkCanvasPeer extends GtkComponentPeer implements CanvasPeer
{
native void create ();
public GtkCanvasPeer (Canvas c)
{
super (c);
}
public Graphics getGraphics ()
{
return new GdkGraphics (this);
}
public void handleEvent (AWTEvent event)
{
int id = event.getID();
switch (id)
{
case PaintEvent.PAINT:
case PaintEvent.UPDATE:
{
try
{
Graphics g = getGraphics ();
g.setClip (((PaintEvent)event).getUpdateRect());
if (id == PaintEvent.PAINT)
awtComponent.paint (g);
else
awtComponent.update (g);
g.dispose ();
}
catch (InternalError e)
{
System.err.println (e);
}
}
break;
}
}
/* Preferred size for a drawing widget is always what the user requested */
public Dimension getPreferredSize ()
{
return awtComponent.getSize ();
}
}
/* GtkCheckboxGroupPeer.java - Wrap a CheckboxGroup
Copyright (C) 2002 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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
// Note that there is no peer interface for a CheckboxGroup. We
// introduce our own in order to make it easier to keep a piece of
// native state for each one.
public class GtkCheckboxGroupPeer extends GtkGenericPeer
{
// This maps from a CheckboxGroup to the native peer.
private static WeakHashMap map = new WeakHashMap ();
// Find the native peer corresponding to a CheckboxGroup.
public static synchronized GtkCheckboxGroupPeer
getCheckboxGroupPeer (CheckboxGroup group)
{
if (group == null)
return null;
GtkCheckboxGroupPeer nat = (GtkCheckboxGroupPeer) map.get (group);
if (nat == null)
{
nat = new GtkCheckboxGroupPeer ();
map.put (group, nat);
}
return nat;
}
private GtkCheckboxGroupPeer ()
{
// We don't need any special state here. Note that we can't store
// a reference to the java-side CheckboxGroup. That would mean
// they could never be collected.
super (null);
}
// Dispose of our native resources.
public native void dispose ();
// Remove a given checkbox from this group.
public native void remove (GtkCheckboxPeer box);
// When collected, clean up the native state.
protected void finalize ()
{
dispose ();
}
}
/* GtkCheckboxMenuItemPeer.java -- Implements CheckboxMenuItemPeer with GTK+
Copyright (C) 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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.peer.CheckboxMenuItemPeer;
import java.awt.peer.MenuItemPeer;
public class GtkCheckboxMenuItemPeer extends GtkMenuItemPeer
implements CheckboxMenuItemPeer
{
native void create (String label);
public GtkCheckboxMenuItemPeer (CheckboxMenuItem menu)
{
super (menu);
setState (menu.getState ());
}
native public void setState (boolean t);
}
/* GtkCheckboxPeer.java -- Implements CheckboxPeer with GTK
Copyright (C) 1998, 1999, 2002 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. */
package gnu.java.awt.peer.gtk;
import java.awt.peer.*;
import java.awt.*;
public class GtkCheckboxPeer extends GtkComponentPeer
implements CheckboxPeer
{
// Group from last time it was set.
public GtkCheckboxGroupPeer old_group;
public native void nativeCreate (GtkCheckboxGroupPeer group);
public native void nativeSetCheckboxGroup (GtkCheckboxGroupPeer group);
public native void connectHooks ();
public GtkCheckboxPeer (Checkbox c)
{
super (c);
}
// We can't fully use the ordinary getArgs code here, due to
// oddities of this particular widget. In particular we must be
// able to switch between a checkbutton and a radiobutton
// dynamically.
public void create ()
{
CheckboxGroup g = ((Checkbox) awtComponent).getCheckboxGroup ();
old_group = GtkCheckboxGroupPeer.getCheckboxGroupPeer (g);
nativeCreate (old_group);
}
public void setState (boolean state)
{
set ("active", state);
}
public void setLabel (String label)
{
set ("label", label);
}
public void setCheckboxGroup (CheckboxGroup group)
{
GtkCheckboxGroupPeer gp
= GtkCheckboxGroupPeer.getCheckboxGroupPeer (group);
if (gp != old_group)
{
if (old_group != null)
old_group.remove (this);
nativeSetCheckboxGroup (gp);
old_group = gp;
}
}
public void getArgs (Component component, GtkArgList args)
{
super.getArgs (component, args);
args.add ("active", ((Checkbox) component).getState ());
args.add ("label", ((Checkbox) component).getLabel ());
}
// Override the superclass postItemEvent so that the peer doesn't
// need information that we have.
public void postItemEvent (Object item, int stateChange)
{
super.postItemEvent (awtComponent, stateChange);
}
public void dispose ()
{
// Notify the group so that the native state can be cleaned up
// appropriately.
if (old_group != null)
old_group.remove (this);
super.dispose ();
}
}
/* GtkChoicePeer.java -- Implements ChoicePeer with GTK
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. */
package gnu.java.awt.peer.gtk;
import java.awt.peer.*;
import java.awt.*;
import java.awt.event.*;
public class GtkChoicePeer extends GtkComponentPeer
implements ChoicePeer
{
native void create ();
public GtkChoicePeer (Choice c)
{
super (c);
int count = c.getItemCount ();
if (count > 0)
{
String items[] = new String[count];
for (int i = 0; i < count; i++)
items[i] = c.getItem (i);
append (items);
}
}
native void append (String items[]);
native public void add (String item, int index);
native public void remove (int index);
native public void select (int position);
public void addItem (String item, int position)
{
add (item, position);
}
/*
public void handleEvent (AWTEvent event)
{
if (event instanceof ItemEvent)
((Choice) awtComponent).select ((String) ((ItemEvent)event).getItem ());
super.handleEvent (event);
}
*/
protected void postItemEvent (Object item, int stateChange)
{
if (stateChange == ItemEvent.SELECTED)
((Choice) awtComponent).select ((String) item);
super.postItemEvent (item, stateChange);
}
}
/* GtkClipboard.java
Copyright (C) 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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.io.*;
import java.net.*;
import java.util.*;
import java.awt.datatransfer.*;
import java.awt.image.*;
import java.awt.peer.*;
public class GtkClipboard extends Clipboard
{
/* the number of milliseconds that we'll wait around for the
owner of the GDK_SELECTION_PRIMARY selection to convert
the requested data */
final static int SELECTION_RECEIVED_TIMEOUT = 5000;
/* We currently only support transferring of text between applications */
static String selection;
static Object selectionLock = new Object ();
static boolean hasSelection = false;
protected
GtkClipboard ()
{
super ("System Clipboard");
initNativeState ();
}
public Transferable
getContents (Object requestor)
{
synchronized (this)
{
if (hasSelection)
return contents;
}
/* Java doesn't own the selection, so we need to ask X11 */
synchronized (selectionLock)
{
requestStringConversion ();
try
{
selectionLock.wait (SELECTION_RECEIVED_TIMEOUT);
}
catch (InterruptedException e)
{
return null;
}
return (selection == null) ? null : new StringSelection (selection);
}
}
void
stringSelectionReceived (String newSelection)
{
synchronized (selectionLock)
{
selection = newSelection;
selectionLock.notify ();
}
}
/* convert Java clipboard data into a String suitable for sending
to another application */
synchronized String
stringSelectionHandler () throws IOException
{
String selection = null;
try {
if (contents.isDataFlavorSupported (DataFlavor.stringFlavor))
selection = (String)contents.getTransferData (DataFlavor.stringFlavor);
else if (contents.isDataFlavorSupported (DataFlavor.plainTextFlavor))
{
StringBuffer sbuf = new StringBuffer ();
InputStreamReader reader;
char readBuf[] = new char[512];
int numChars;
reader = new InputStreamReader
((InputStream)
contents.getTransferData (DataFlavor.plainTextFlavor), "UNICODE");
while (true)
{
numChars = reader.read (readBuf);
if (numChars == -1)
break;
sbuf.append (readBuf, 0, numChars);
}
selection = new String (sbuf);
}
} catch (Exception e) { }
return selection;
}
public synchronized void
setContents (Transferable contents, ClipboardOwner owner)
{
selectionGet ();
this.contents = contents;
this.owner = owner;
hasSelection = true;
}
synchronized
void selectionClear ()
{
hasSelection = false;
if (owner != null)
{
owner.lostOwnership (this, contents);
owner = null;
contents = null;
}
}
native void initNativeState ();
native static void requestStringConversion ();
native static void selectionGet ();
}
/* GtkContainerPeer.java -- Implements ContainerPeer with GTK
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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.event.*;
import java.awt.peer.ContainerPeer;
public class GtkContainerPeer extends GtkComponentPeer
implements ContainerPeer
{
Insets insets;
Container c;
public GtkContainerPeer(Container c)
{
super (c);
this.c = c;
insets = new Insets (0, 0, 0, 0);
}
public void beginValidate()
{
}
public void endValidate()
{
// q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
// new Rectangle (x, y, width, height)));
// Graphics gc = getGraphics ();
// if (gc != null)
// {
// awtComponent.update (gc);
// gc.dispose ();
// }
// System.out.println ("got here");
// awtComponent.repaint ();
}
public Insets getInsets()
{
return insets;
}
public Insets insets()
{
return getInsets ();
}
public void setBounds (int x, int y, int width, int height)
{
super.setBounds (x, y, width, height);
awtComponent.validate ();
}
public Graphics getGraphics ()
{
return new GdkGraphics (this);
}
public void handleEvent (AWTEvent event)
{
int id = event.getID();
switch (id)
{
case PaintEvent.PAINT:
case PaintEvent.UPDATE:
{
try
{
Graphics g = getGraphics ();
g.setClip (((PaintEvent)event).getUpdateRect());
if (id == PaintEvent.PAINT)
awtComponent.paint (g);
else
awtComponent.update (g);
g.dispose ();
}
catch (InternalError e)
{
System.err.println (e);
}
}
break;
}
}
}
/* GtkDialogPeer.java -- Implements DialogPeer with GTK
Copyright (C) 1998, 1999, 2002 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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.peer.*;
import java.awt.event.*;
public class GtkDialogPeer extends GtkWindowPeer
implements DialogPeer
{
public GtkDialogPeer (Dialog dialog)
{
super (dialog);
}
void create ()
{
create (GTK_WINDOW_DIALOG);
}
public void getArgs (Component component, GtkArgList args)
{
super.getArgs (component, args);
Dialog dialog = (Dialog) component;
args.add ("modal", dialog.isModal ());
args.add ("allow_shrink", dialog.isResizable ());
args.add ("allow_grow", dialog.isResizable ());
}
public void handleEvent (AWTEvent event)
{
// int id = event.getID();
// if (id == WindowEvent.WINDOW_CLOSING)
// System.out.println ("got a closing event");
}
}
/* GtkFileDialogPeer.java -- Implements FileDialogPeer with GTK
Copyright (C) 1998, 1999, 2002 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. */
package gnu.java.awt.peer.gtk;
import java.io.FilenameFilter;
import java.awt.peer.*;
import java.awt.*;
public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
{
native void create ();
public GtkFileDialogPeer (FileDialog fd)
{
super (fd);
}
public void setDirectory (String directory)
{
setFile (directory);
}
public native void setFile (String file);
public native void connectHooks ();
public void setFilenameFilter (FilenameFilter filter)
{
/* GTK has no filters. */
}
public Graphics getGraphics ()
{
return null;
}
}
/* GtkFontPeer.java -- Implements FontPeer with GTK+
Copyright (C) 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. */
package gnu.java.awt.peer.gtk;
import java.awt.peer.FontPeer;
import java.awt.Font;
import java.util.ResourceBundle;
public class GtkFontPeer implements FontPeer
{
private static ResourceBundle bundle;
static
{
try
{
bundle = ResourceBundle.getBundle ("gnu.java.awt.peer.gtk.font");
}
catch (Throwable ignored)
{
bundle = null;
}
}
final private String Xname;
public GtkFontPeer (String name, int style)
{
if (bundle != null)
Xname = bundle.getString (name.toLowerCase () + "." + style);
else
Xname = "-*-*-medium-r-normal-*-12-*-*-*-c-*-*-*";
}
public String getXLFD ()
{
return Xname;
}
}
/* GtkFramePeer.java -- Implements FramePeer with GTK
Copyright (C) 1999, 2002 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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.peer.*;
import java.awt.event.*;
public class GtkFramePeer extends GtkWindowPeer
implements FramePeer
{
int menuBarHeight = 0;
native int getMenuBarHeight ();
native public void setMenuBarPeer (MenuBarPeer bar);
public void setMenuBar (MenuBar bar)
{
if (bar == null)
setMenuBarPeer (null);
else
setMenuBarPeer ((MenuBarPeer) bar.getPeer ());
}
public GtkFramePeer (Frame frame)
{
super (frame);
}
void create ()
{
create (GTK_WINDOW_TOPLEVEL);
}
public void getArgs (Component component, GtkArgList args)
{
super.getArgs (component, args);
Frame frame = (Frame) component;
args.add ("title", frame.getTitle ());
args.add ("allow_shrink", frame.isResizable ());
args.add ("allow_grow", frame.isResizable ());
}
public void setIconImage (Image image)
{
/* TODO: Waiting on Toolkit Image routines */
}
public Graphics getGraphics ()
{
GdkGraphics g = new GdkGraphics (this);
g.translateNative (-insets.left, -insets.top);
return g;
}
public void setBounds (int x, int y, int width, int height)
{
super.setBounds (0, 0, width - insets.left - insets.right,
height - insets.top - insets.bottom + menuBarHeight);
}
protected void postConfigureEvent (int x, int y, int width, int height,
int top, int left, int bottom, int right)
{
if (((Frame)awtComponent).getMenuBar () != null)
{
menuBarHeight = getMenuBarHeight ();
top += menuBarHeight;
}
super.postConfigureEvent (0, 0,
width + left + right,
height + top + bottom - menuBarHeight,
top, left, bottom, right);
}
protected void postMouseEvent(int id, long when, int mods, int x, int y,
int clickCount, boolean popupTrigger)
{
super.postMouseEvent (id, when, mods,
x + insets.left, y + insets.top,
clickCount, popupTrigger);
}
protected void postExposeEvent (int x, int y, int width, int height)
{
// System.out.println ("x + insets.left:" + (x + insets.left));
// System.out.println ("y + insets.top :" + (y + insets.top));
q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
new Rectangle (x + insets.left,
y + insets.top,
width, height)));
}
}
/* GtkGenericPeer.java - Has a hashcode. Yuck.
Copyright (C) 1998, 1999, 2002 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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.event.*;
public class GtkGenericPeer
{
final int native_state = getUniqueInteger ();
// Next native state value we will assign.
private static int next_native_state = 0;
// The widget or other java-side object we wrap.
protected Object awtWidget;
// Global event queue.
protected static EventQueue q = null;
// Dispose of our native state.
public native void dispose ();
protected GtkGenericPeer (Object awtWidget)
{
this.awtWidget = awtWidget;
}
public static void enableQueue (EventQueue sq)
{
if (q == null)
q = sq;
}
protected void postActionEvent (String command, int mods)
{
q.postEvent (new ActionEvent (awtWidget, ActionEvent.ACTION_PERFORMED,
command, mods));
}
// Return a unique integer for use in the native state mapping
// code. We can't use a hash code since that is not guaranteed to
// be unique.
static synchronized int getUniqueInteger ()
{
// Let's assume this will never wrap.
return next_native_state++;
}
}
/* GtkImage.java
Copyright (C) 1999, 2002 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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.util.*;
import java.awt.image.*;
public class GtkImage extends Image implements ImageConsumer
{
int width = -1, height = -1;
Hashtable props = null;
boolean isLoaded = false;
boolean isCacheable = true;
boolean loading = false;
Vector widthObservers = new Vector ();
Vector heightObservers = new Vector ();
Vector propertyObservers = new Vector ();
ImageProducer source;
Graphics g;
/* Variables in which we stored cached data, if possible.
An image is cached if the following properties are true:
1. The ColorModel passed into setColorModel is the same ColorModel
passed to all invocations of setPixels.
2. The image contains a single frame.
*/
int[] pixelCache;
ColorModel model;
public
GtkImage (ImageProducer producer, Graphics g)
{
source = producer;
this.g = g;
source.addConsumer (this);
}
public synchronized int
getWidth (ImageObserver observer)
{
if (width == -1)
widthObservers.addElement (observer);
return width;
}
public synchronized int
getHeight (ImageObserver observer)
{
if (height == -1)
heightObservers.addElement (observer);
return height;
}
public ImageProducer
getSource ()
{
return source;
}
public Graphics
getGraphics ()
{
return g;
}
public synchronized Object
getProperty (String name, ImageObserver observer)
{
if (props == null)
{
propertyObservers.addElement (observer);
return null;
}
Object value = props.get (name);
return (value == null) ? UndefinedProperty : value;
}
public synchronized void
flush ()
{
isLoaded = false;
isCacheable = true;
width = height = -1;
props = null;
pixelCache = null;
model = null;
source.removeConsumer (this);
source.addConsumer (this);
}
public boolean
isLoaded ()
{
return isLoaded;
}
/* ImageConsumer methods */
public synchronized void
setDimensions (int width, int height)
{
pixelCache = new int[width*height];
this.width = width;
this.height = height;
for (int i = 0; i < widthObservers.size (); i++)
{
ImageObserver io = (ImageObserver) widthObservers.elementAt (i);
io.imageUpdate (this, ImageObserver.WIDTH, -1, -1, width, height);
}
for (int i = 0; i < heightObservers.size (); i++)
{
ImageObserver io = (ImageObserver) heightObservers.elementAt (i);
io.imageUpdate (this, ImageObserver.HEIGHT, -1, -1, width, height);
}
}
public synchronized void
setProperties (Hashtable props)
{
this.props = props;
for (int i = 0; i < propertyObservers.size (); i++)
{
ImageObserver io = (ImageObserver) propertyObservers.elementAt (i);
io.imageUpdate (this, ImageObserver.PROPERTIES, -1, -1, width, height);
}
}
public synchronized void
setColorModel (ColorModel model)
{
if (this.model == null || this.model == model)
this.model = model;
else
isCacheable = false;
}
public synchronized void
setHints (int flags)
{
}
public synchronized void
setPixels (int x, int y, int width, int height, ColorModel cm, byte[] pixels,
int offset, int scansize)
{
setPixels (x, y, width, height, cm, convertPixels (pixels), offset,
scansize);
}
public synchronized void
setPixels (int x, int y, int width, int height, ColorModel cm, int[] pixels,
int offset, int scansize)
{
loading = true;
if (!isCacheable)
return;
if (cm != model || pixelCache == null)
{
isCacheable = false;
return;
}
if (scansize == width)
{
System.arraycopy (pixels, offset,
pixelCache, y * this.width + x,
pixels.length - offset);
}
else // skip over scansize-width for each row
{
for (int i = 0; i < height; i++)
System.arraycopy (pixels, offset + (i * scansize),
pixelCache, (y + i) * this.width + x,
width);
}
}
public synchronized void
imageComplete (int status)
{
if (status == ImageConsumer.STATICIMAGEDONE && isCacheable)
isLoaded = true;
if (status == ImageConsumer.SINGLEFRAMEDONE)
isCacheable = false;
source.removeConsumer (this);
}
public synchronized void
startProduction (GtkImagePainter painter)
{
if (isLoaded)
{
painter.setDimensions (width, height);
painter.setPixels (0, 0, width, height, model, pixelCache, 0, width);
}
else
{
source.startProduction (painter);
source.removeConsumer (painter);
}
}
private int[]
convertPixels (byte[] pixels)
{
int ret[] = new int[pixels.length];
for (int i = 0; i < pixels.length; i++)
ret[i] = pixels[i];
return ret;
}
synchronized int
checkImage ()
{
int bits = 0;
if (width != -1)
bits |= ImageObserver.WIDTH;
if (height != -1)
bits |= ImageObserver.HEIGHT;
if (props != null)
bits |= ImageObserver.PROPERTIES;
if (loading)
bits |= ImageObserver.SOMEBITS;
if (isLoaded)
bits |= ImageObserver.ALLBITS;
return bits;
}
}
/* GtkImagePainter.java
Copyright (C) 1999, 2000 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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.image.*;
import java.util.*;
public class GtkImagePainter implements Runnable, ImageConsumer
{
GtkImage image;
GdkGraphics gc;
int startX, startY;
int redBG;
int greenBG;
int blueBG;
double affine[];
int width, height;
boolean flipX, flipY;
Rectangle clip;
int s_width, s_height;
public
GtkImagePainter (GtkImage image, GdkGraphics gc, int x, int y,
int width, int height, Color bgcolor)
{
this.image = image;
this.gc = (GdkGraphics) gc.create ();
startX = x;
startY = y;
redBG = bgcolor.getRed ();
greenBG = bgcolor.getGreen ();
blueBG = bgcolor.getBlue ();
this.width = width;
this.height = height;
flipX = flipY = false;
s_width = s_height = 0;
clip = null;
new Thread (this).start ();
}
public
GtkImagePainter (GtkImage image, GdkGraphics gc,
int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2,
Color bgcolor)
{
this.image = image;
this.gc = (GdkGraphics) gc.create ();
startX = (dx1 < dx2) ? dx1 : dx2;
startY = dy1;
redBG = bgcolor.getRed ();
greenBG = bgcolor.getGreen ();
blueBG = bgcolor.getBlue ();
this.width = Math.abs (dx2 - dx1);
this.height = Math.abs (dy2 - dy1);
flipX = ((dx1 > dx2 && sx2 > sx1)
|| (dx1 < dx2 && sx2 < sx1));
flipY = ((dy1 > dy2 && sy2 > sy1)
|| (dy1 < dy2 && sy2 < sy1));
s_width = Math.abs (sx2 - sx1);
s_height = Math.abs (sy2 - sy1);
clip = new Rectangle (sx1, sy1, s_width, s_height);
new Thread (this).start ();
}
public void
run ()
{
image.startProduction (this);
gc.dispose ();
}
/* Convert pixel data into a format that gdkrgb can understand */
static int[]
convertPixels (int[] pixels, ColorModel model)
{
if (model.equals (ColorModel.getRGBdefault ()))
return pixels;
int ret[] = new int[pixels.length];
for (int i = 0; i < pixels.length; i++)
ret[i] = model.getRGB (pixels[i]);
return ret;
}
static int[]
convertPixels (byte[] pixels, ColorModel model)
{
int ret[] = new int[pixels.length];
for (int i = 0; i < pixels.length; i++)
ret[i] = model.getRGB (pixels[i]);
return ret;
}
native void
drawPixels (GdkGraphics gc, int bg_red, int bg_green, int bg_blue,
int x, int y, int width, int height, int[] pixels, int offset,
int scansize, double affine[]);
public void
setPixels (int x, int y, int width, int height, ColorModel model,
int[] pixels, int offset, int scansize)
{
if (clip != null)
{
Rectangle r;
r = clip.intersection (new Rectangle (x, y, width, height));
if (r.width == 0 && r.height == 0)
return;
offset += r.y * scansize + r.x;
r.translate (-Math.abs (clip.x - startX), -Math.abs (clip.y - startY));
width = r.width;
height = r.height;
x = r.x;
y = r.y;
}
drawPixels (gc, redBG, greenBG, blueBG,
startX + x, startY + y,
width, height, convertPixels (pixels, model), offset,
scansize, affine);
}
public void
setPixels (int x, int y, int width, int height, ColorModel model,
byte[] pixels, int offset, int scansize)
{
setPixels (x, y, width, height, model, convertPixels (pixels, model),
offset, scansize);
}
public void
setDimensions (int width, int height)
{
if (!flipX && !flipY &&
((this.width == -1 && this.height == -1)
|| (this.width == width && this.height == height)))
return;
affine = new double[6];
affine[1] = affine[2] = affine[4] = affine[5] = 0;
if (clip != null)
{
affine[0] = this.width / (double) s_width;
affine[3] = this.height / (double) s_height;
}
else
{
affine[0] = this.width / (double) width;
affine[3] = this.height / (double) height;
}
if (flipX)
{
affine[0] = -affine[0];
affine[4] = this.width;
}
if (flipY)
{
affine[3] = -affine[3];
affine[5] = this.height;
}
if (affine[0] == 1 && affine[3] == 1)
affine = null;
}
public void
setProperties (Hashtable props)
{
}
public void
setColorModel (ColorModel model)
{
}
public void
setHints (int flags)
{
}
public void
imageComplete (int status)
{
}
}
/* GtkLabelPeer.java -- Implements LabelPeer with GTK
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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.peer.*;
public class GtkLabelPeer extends GtkComponentPeer
implements LabelPeer
{
native void create ();
public GtkLabelPeer (Label l)
{
super (l);
}
public void setText (String text)
{
set ("label", text);
}
public void setAlignment (int alignment)
{
set ("xalign", getGtkAlignment (alignment));
}
float getGtkAlignment (int alignment)
{
switch (alignment)
{
case Label.LEFT:
return 0.0f;
case Label.CENTER:
return 0.5f;
case Label.RIGHT:
return 1.0f;
}
return 0.0f;
}
public void getArgs (Component component, GtkArgList args)
{
super.getArgs (component, args);
Label label = (Label) component;
args.add ("label", label.getText ());
args.add ("xalign", getGtkAlignment (label.getAlignment ()));
args.add ("yalign", 0.5f);
}
}
/* GtkListPeer.java -- Implements ListPeer with GTK
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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.peer.*;
public class GtkListPeer extends GtkComponentPeer
implements ListPeer
{
// native void create (ComponentPeer parent, String [] items, boolean mode);
native void create ();
native void connectHooks ();
native void getSize (int rows, int dims[]);
public GtkListPeer (List list)
{
super (list);
setMultipleMode (list.isMultipleMode ());
if (list.getItemCount () > 0)
append (list.getItems ());
}
native void append (String items[]);
public native void add (String item, int index);
public void addItem (String item, int index)
{
add (item, index);
}
public void clear ()
{
removeAll ();
}
public native void delItems (int start, int end);
public native void deselect (int index);
public Dimension getMinimumSize (int rows)
{
int dims[] = new int[2];
getSize (rows, dims);
return (new Dimension (dims[0], dims[1]));
}
public Dimension getPreferredSize (int rows)
{
int dims[] = new int[2];
getSize (rows, dims);
return (new Dimension (dims[0], dims[1]));
}
public native int[] getSelectedIndexes ();
public native void makeVisible (int index);
public Dimension minimumSize (int rows)
{
return (getMinimumSize (rows));
}
public Dimension preferredSize (int rows)
{
return (getPreferredSize (rows));
}
public void removeAll ()
{
delItems (0, -1);
}
public native void select (int index);
public native void setMultipleMode (boolean b);
public void setMultipleSelections (boolean b)
{
setMultipleMode (b);
}
protected void postItemEvent (int item, int stateChange)
{
postItemEvent (new Integer (item), stateChange);
}
}
/* GtkMainThread.java -- Runs gtk_main()
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. */
package gnu.java.awt.peer.gtk;
public class GtkMainThread extends GtkGenericPeer implements Runnable
{
private static Thread mainThread = null;
private static Object mainThreadLock = new Object();
static native void gtkInit();
native void gtkMain();
public GtkMainThread()
{
super (null);
synchronized (mainThreadLock)
{
if (mainThread != null)
throw new IllegalStateException();
mainThread = new Thread(this, "GtkMain");
}
synchronized (this)
{
mainThread.start();
try {
wait();
} catch (InterruptedException e) { }
}
}
public void run()
{
synchronized (this)
{
gtkInit();
notify();
}
gtkMain();
}
}
/* GtkMenuBarPeer.java -- Implements MenuBarPeer with GTK+
Copyright (C) 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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.peer.MenuBarPeer;
import java.awt.peer.MenuPeer;
public class GtkMenuBarPeer extends GtkMenuComponentPeer
implements MenuBarPeer
{
native void create ();
native void addMenu (MenuPeer menu);
public GtkMenuBarPeer (MenuBar target)
{
super (target);
create ();
}
/* In Gnome, help menus are no longer right flushed. */
public void addHelpMenu (Menu menu)
{
addMenu (menu);
}
public void addMenu (Menu menu)
{
addMenu ((MenuPeer) menu.getPeer ());
}
native public void delMenu (int index);
}
/* GtkMenuComponentPeer.java -- Implements MenuComponentPeer with GTK+
Copyright (C) 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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.peer.MenuComponentPeer;
public class GtkMenuComponentPeer extends GtkGenericPeer
implements MenuComponentPeer
{
public GtkMenuComponentPeer (Object awtWidget)
{
super (awtWidget);
}
public void dispose ()
{
}
}
/* GtkMenuItemPeer.java -- Implements MenuItemPeer with GTK+
Copyright (C) 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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.peer.MenuItemPeer;
import java.awt.peer.MenuComponentPeer;
import java.awt.peer.MenuBarPeer;
import java.awt.peer.MenuPeer;
public class GtkMenuItemPeer extends GtkMenuComponentPeer
implements MenuItemPeer
{
native void create (String label);
public GtkMenuItemPeer (MenuItem item)
{
super (item);
create (item.getLabel ());
setEnabled (item.isEnabled ());
setParent (item);
}
void setParent (MenuItem item)
{
// add ourself differently, based on what type of parent we have
// yes, the typecasting here is nasty.
Object parent = item.getParent ();
if (parent instanceof MenuBar)
{
((GtkMenuBarPeer)((MenuBar)parent).getPeer ()).addMenu ((MenuPeer) this);
}
else // parent instanceof Menu
{
((GtkMenuPeer)((Menu)parent).getPeer ()).addItem (this,
item.getShortcut ());
}
}
public void disable ()
{
setEnabled (false);
}
public void enable ()
{
setEnabled (true);
}
native public void setEnabled (boolean b);
native public void setLabel (String label);
protected void postMenuActionEvent ()
{
postActionEvent (((MenuItem)awtWidget).getActionCommand (), 0);
}
}
/* GtkMenuPeer.java -- Implements MenuPeer with GTK+
Copyright (C) 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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.peer.MenuPeer;
import java.awt.peer.MenuItemPeer;
public class GtkMenuPeer extends GtkMenuItemPeer
implements MenuPeer
{
native void create (String label);
native void addItem (MenuItemPeer item, int key, boolean shiftModifier);
native void setupAccelGroup (GtkGenericPeer container);
public GtkMenuPeer (Menu menu)
{
super (menu);
MenuContainer parent = menu.getParent ();
if (parent instanceof Menu)
setupAccelGroup ((GtkGenericPeer)((Menu)parent).getPeer ());
else if (parent instanceof Component)
setupAccelGroup ((GtkGenericPeer)((Component)parent).getPeer ());
else
setupAccelGroup (null);
}
public void addItem (MenuItem item)
{
int key = 0;
boolean shiftModifier = false;
MenuShortcut ms = item.getShortcut ();
if (ms != null)
{
key = ms.getKey ();
shiftModifier = ms.usesShiftModifier ();
}
addItem ((MenuItemPeer) item.getPeer (), key, shiftModifier);
}
public void addItem (MenuItemPeer item, MenuShortcut ms)
{
int key = 0;
boolean shiftModifier = false;
if (ms != null)
{
key = ms.getKey ();
shiftModifier = ms.usesShiftModifier ();
}
addItem (item, key, shiftModifier);
}
public void addSeparator ()
{
addItem (new MenuItem ("-"));
}
native public void delItem (int index);
}
/* GtkOffScreenImage.java
Copyright (C) 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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.image.*;
public class GtkOffScreenImage extends Image
{
int width, height;
ImageProducer source;
Graphics g;
public GtkOffScreenImage (ImageProducer source, Graphics g,
int width, int height)
{
this.width = width;
this.height = height;
this.source = source;
this.g = g;
}
public int getWidth (ImageObserver observer)
{
return width;
}
public int getHeight (ImageObserver observer)
{
return height;
}
public ImageProducer getSource ()
{
return source;
}
public Graphics getGraphics ()
{
return g;
}
public Object getProperty (String name, ImageObserver observer)
{
return Image.UndefinedProperty;
}
public void flush ()
{
}
}
/* GtkPanelPeer.java -- Implements PanelPeer with GTK
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. */
package gnu.java.awt.peer.gtk;
import java.awt.peer.*;
import java.awt.*;
public class GtkPanelPeer extends GtkContainerPeer
implements PanelPeer
{
native void create ();
native void connectHooks ();
public GtkPanelPeer (Panel p)
{
super (p);
}
}
/* GtkPopupMenuPeer.java -- Implements PopupMenuPeer with GTK+
Copyright (C) 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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.peer.ComponentPeer;
import java.awt.peer.PopupMenuPeer;
public class GtkPopupMenuPeer extends GtkMenuPeer
implements PopupMenuPeer
{
public GtkPopupMenuPeer (PopupMenu menu)
{
super (menu);
}
native void setupAccelGroup (GtkGenericPeer container);
void setParent (MenuItem item)
{
// we don't need to "add" ourselves to our parent
}
native void show (int x, int y, long time);
public void show (Component origin, int x, int y)
{
Point abs = origin.getLocationOnScreen ();
show (abs.x + x, abs.y + y, 0);
}
}
/* GtkScrollPanePeer.java -- Implements ScrollPanePeer with GTK
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. */
package gnu.java.awt.peer.gtk;
import java.awt.peer.*;
import java.awt.*;
public class GtkScrollPanePeer extends GtkContainerPeer
implements ScrollPanePeer
{
native void create ();
native void gtkScrolledWindowNew(ComponentPeer parent,
int policy, int w, int h, int[] dims);
native void gtkScrolledWindowSetScrollPosition(int x, int y);
native void gtkScrolledWindowSetHScrollIncrement (int u);
native void gtkScrolledWindowSetVScrollIncrement (int u);
native void gtkScrolledWindowSetSize(int w, int h);
public GtkScrollPanePeer (ScrollPane sp)
{
super (sp);
setPolicy (sp.getScrollbarDisplayPolicy ());
}
native void setPolicy (int policy);
native public void childResized (int width, int height);
native public int getHScrollbarHeight ();
native public int getVScrollbarWidth ();
native public void setScrollPosition (int x, int y);
// public Dimension getPreferredSize ()
// {
// return new Dimension (60, 60);
// }
public void setUnitIncrement (Adjustable adj, int u)
{
if (adj.getOrientation()==Adjustable.HORIZONTAL)
gtkScrolledWindowSetHScrollIncrement (u);
else
gtkScrolledWindowSetVScrollIncrement (u);
}
public void setValue (Adjustable adj, int v)
{
// System.out.println("SPP: setVal: "+adj+":"+v);
// Point p=myScrollPane.getScrollPosition ();
// if (adj.getOrientation()==Adjustable.HORIZONTAL)
// gtkScrolledWindowSetScrollPosition (v,p.y);
// else
// gtkScrolledWindowSetScrollPosition (p.x,v);
// adj.setValue(v);
}
}
/* GtkScrollbarPeer.java -- Implements ScrollbarPeer with GTK+
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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.peer.*;
import java.awt.event.AdjustmentEvent;
public class GtkScrollbarPeer extends GtkComponentPeer
implements ScrollbarPeer
{
void create ()
{
Scrollbar sb = (Scrollbar) awtComponent;
create (sb.getOrientation (), sb.getValue (),
sb.getMinimum (), sb.getMaximum (),
sb.getUnitIncrement (), sb.getBlockIncrement (),
sb.getVisibleAmount ());
}
native void create (int orientation, int value,
int min, int max, int stepIncr, int pageIncr,
int visibleAmount);
native void connectHooks ();
public GtkScrollbarPeer (Scrollbar s)
{
super (s);
}
native public void setLineIncrement (int amount);
native public void setPageIncrement (int amount);
native public void setValues (int value, int visible, int min, int max);
protected void postAdjustmentEvent (int type, int value)
{
q.postEvent (new AdjustmentEvent ((Adjustable)awtComponent,
AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
type, value));
}
}
/* GtkTextAreaPeer.java -- Implements TextAreaPeer with GTK
Copyright (C) 1998, 1999, 2002 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. */
package gnu.java.awt.peer.gtk;
import java.awt.peer.*;
import java.awt.*;
public class GtkTextAreaPeer extends GtkTextComponentPeer
implements TextAreaPeer
{
native void create (int scrollbarVisibility);
void create ()
{
create (((TextArea)awtComponent).getScrollbarVisibility ());
}
// native void create (Object parent, String text, int scroll);
native void gtkTextGetSize (int rows, int cols, int dims[]);
public GtkTextAreaPeer (TextArea ta)
{
super (ta);
}
public native void insert (String str, int pos);
public native void replaceRange (String str, int start, int end);
public Dimension getMinimumSize (int rows, int cols)
{
int dims[] = new int[2];
gtkTextGetSize (rows, cols, dims);
return (new Dimension (dims[0], dims[1]));
}
public Dimension getPreferredSize (int rows, int cols)
{
int dims[] = new int[2];
gtkTextGetSize (rows, cols, dims);
return (new Dimension (dims[0], dims[1]));
}
/* Deprecated */
public Dimension minimumSize (int rows, int cols)
{
return getMinimumSize (rows, cols);
}
public Dimension preferredSize (int rows, int cols)
{
return getPreferredSize (rows, cols);
}
public void replaceText (String str, int start, int end)
{
replaceRange (str, start, end);
}
public void insertText (String str, int pos)
{
insert (str, pos);
}
}
/* GtkTextComponentPeer.java -- Implements TextComponentPeer with GTK
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. */
package gnu.java.awt.peer.gtk;
import java.awt.peer.*;
import java.awt.*;
public class GtkTextComponentPeer extends GtkComponentPeer
implements TextComponentPeer
{
GtkTextComponentPeer (TextComponent tc)
{
super (tc);
setText (tc.getText ());
}
public native int getCaretPosition ();
public void setCaretPosition (int pos)
{
set ("text_position", pos);
}
public native int getSelectionStart ();
public native int getSelectionEnd ();
public native String getText ();
public native void select (int start, int end);
public void setEditable (boolean state)
{
set ("editable", state);
}
public native void setText (String text);
public void getArgs (Component component, GtkArgList args)
{
super.getArgs (component, args);
TextComponent tc = (TextComponent) component;
args.add ("text_position", tc.getCaretPosition ());
args.add ("editable", tc.isEditable ());
}
}
/* GtkTextFieldPeer.java -- Implements TextFieldPeer with GTK
Copyright (C) 1998, 1999, 2002 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. */
package gnu.java.awt.peer.gtk;
import java.awt.peer.*;
import java.awt.*;
public class GtkTextFieldPeer extends GtkTextComponentPeer
implements TextFieldPeer
{
// native void create (ComponentPeer parent, String text);
native void create ();
native void createHooks ();
native void gtkEntryGetSize (int cols, int dims[]);
public GtkTextFieldPeer (TextField tf)
{
super (tf);
if (tf.echoCharIsSet ())
setEchoChar (tf.getEchoChar ());
}
public Dimension getMinimumSize (int cols)
{
int dims[] = new int[2];
gtkEntryGetSize (cols, dims);
return (new Dimension (dims[0], dims[1]));
}
public Dimension getPreferredSize (int cols)
{
int dims[] = new int[2];
gtkEntryGetSize (cols, dims);
return (new Dimension (dims[0], dims[1]));
}
public native void setEchoChar (char c);
/* Deprecated */
public Dimension minimumSize (int cols)
{
return getMinimumSize (cols);
}
public Dimension preferredSize (int cols)
{
return getPreferredSize (cols);
}
public void setEchoCharacter (char c)
{
setEchoChar (c);
}
}
/* GtkToolkit.java -- Implements an AWT Toolkit using GTK for peers
Copyright (C) 1998, 1999, 2002, 2003 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. */
package gnu.java.awt.peer.gtk;
import java.awt.*;
import java.awt.datatransfer.*;
import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.peer.DragSourceContextPeer;
import java.awt.im.InputMethodHighlight;
import java.awt.image.*;
import java.awt.peer.*;
import java.net.*;
import java.util.Hashtable;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.Properties;
import gnu.java.awt.image.*;
import gnu.classpath.Configuration;
/* This class uses a deprecated method java.awt.peer.ComponentPeer.getPeer().
This merits comment. We are basically calling Sun's bluff on this one.
We think Sun has deprecated it simply to discourage its use as it is
bad programming style. However, we need to get at a component's peer in
this class. If getPeer() ever goes away, we can implement a hash table
that will keep up with every window's peer, but for now this is faster. */
public class GtkToolkit extends java.awt.Toolkit
{
GtkMainThread main;
Hashtable containers = new Hashtable();
static EventQueue q = new EventQueue();
static Clipboard systemClipboard;
static
{
if (Configuration.INIT_LOAD_LIBRARY)
System.loadLibrary("gtkpeer");
}
public GtkToolkit ()
{
main = new GtkMainThread ();
systemClipboard = new GtkClipboard ();
GtkGenericPeer.enableQueue (q);
}
native public void beep ();
native private void getScreenSizeDimensions (int[] xy);
public int checkImage (Image image, int width, int height,
ImageObserver observer)
{
return ImageObserver.ALLBITS;
// GtkImage i = (GtkImage) image;
// return i.checkImage ();
}
public Image createImage (String filename)
{
// FIXME - gcj local: GdkPixbufDecoder doesn't work.
// return new GtkImage (new GdkPixbufDecoder (filename), null);
return null;
}
public Image createImage (URL url)
{
// FIXME - gcj local: GdkPixbufDecoder doesn't work.
// return new GtkImage (new GdkPixbufDecoder (url), null);
return null;
}
public Image createImage (ImageProducer producer)
{
return new GtkImage (producer, null);
}
public Image createImage (byte[] imagedata, int imageoffset,
int imagelength)
{
// System.out.println ("createImage byte[] NOT SUPPORTED");
return null;
}
public ColorModel getColorModel ()
{
return ColorModel.getRGBdefault ();
}
public String[] getFontList ()
{
return (new String[] { "Dialog",
"DialogInput",
"Monospaced",
"Serif",
"SansSerif" });
}
public FontMetrics getFontMetrics (Font font)
{
return new GdkFontMetrics (font);
}
public Image getImage (String filename)
{
// FIXME - gcj local: GdkPixbufDecoder doesn't work.
// return new GtkImage (new GdkPixbufDecoder (filename), null);
return null;
}
public Image getImage (URL url)
{
// FIXME - gcj local: GdkPixbufDecoder doesn't work.
// return new GtkImage (new GdkPixbufDecoder (url), null);
return null;
}
public PrintJob getPrintJob (Frame frame, String jobtitle, Properties props)
{
return null;
}
native public int getScreenResolution();
public Dimension getScreenSize () {
int dim[] = new int[2];
getScreenSizeDimensions(dim);
return new Dimension(dim[0], dim[1]);
}
public Clipboard getSystemClipboard()
{
return systemClipboard;
}
public boolean prepareImage (Image image, int width, int height,
ImageObserver observer)
{
return false;
}
native public void sync ();
protected void setComponentState (Component c, GtkComponentPeer cp)
{
/* Make the Component reflect Peer defaults */
if (c.getForeground () == null)
c.setForeground (cp.getForeground ());
if (c.getBackground () == null)
c.setBackground (cp.getBackground ());
// if (c.getFont () == null)
// c.setFont (cp.getFont ());
/* Make the Peer reflect the state of the Component */
if (! (c instanceof Window))
{
cp.setCursor (c.getCursor ());
Rectangle bounds = c.getBounds ();
cp.setBounds (bounds.x, bounds.y, bounds.width, bounds.height);
cp.setVisible (c.isVisible ());
}
}
protected ButtonPeer createButton (Button b)
{
return new GtkButtonPeer (b);
}
protected CanvasPeer createCanvas (Canvas c)
{
return new GtkCanvasPeer (c);
}
protected CheckboxPeer createCheckbox (Checkbox cb)
{
return new GtkCheckboxPeer (cb);
}
protected CheckboxMenuItemPeer createCheckboxMenuItem (CheckboxMenuItem cmi)
{
return new GtkCheckboxMenuItemPeer (cmi);
}
protected ChoicePeer createChoice (Choice c)
{
return new GtkChoicePeer (c);
}
protected DialogPeer createDialog (Dialog d)
{
return new GtkDialogPeer (d);
}
protected FileDialogPeer createFileDialog (FileDialog fd)
{
return new GtkFileDialogPeer (fd);
}
protected FramePeer createFrame (Frame f)
{
return new GtkFramePeer (f);
}
protected LabelPeer createLabel (Label label)
{
return new GtkLabelPeer (label);
}
protected ListPeer createList (List list)
{
return new GtkListPeer (list);
}
protected MenuPeer createMenu (Menu m)
{
return new GtkMenuPeer (m);
}
protected MenuBarPeer createMenuBar (MenuBar mb)
{
return new GtkMenuBarPeer (mb);
}
protected MenuItemPeer createMenuItem (MenuItem mi)
{
return new GtkMenuItemPeer (mi);
}
protected PanelPeer createPanel (Panel p)
{
return new GtkPanelPeer (p);
}
protected PopupMenuPeer createPopupMenu (PopupMenu target)
{
return new GtkPopupMenuPeer (target);
}
protected ScrollPanePeer createScrollPane (ScrollPane sp)
{
return new GtkScrollPanePeer (sp);
}
protected ScrollbarPeer createScrollbar (Scrollbar sb)
{
return new GtkScrollbarPeer (sb);
}
protected TextAreaPeer createTextArea (TextArea ta)
{
return new GtkTextAreaPeer (ta);
}
protected TextFieldPeer createTextField (TextField tf)
{
return new GtkTextFieldPeer (tf);
}
protected WindowPeer createWindow (Window w)
{
return new GtkWindowPeer (w);
}
protected FontPeer getFontPeer (String name, int style)
{
try {
GtkFontPeer fp = new GtkFontPeer (name, style);
return fp;
} catch (MissingResourceException ex) {
return null;
}
}
protected EventQueue getSystemEventQueueImpl()
{
return q;
}
protected void loadSystemColors (int[] systemColors)
{
}
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent e)
{
throw new Error("not implemented");
}
public Map mapInputMethodHighlight(InputMethodHighlight highlight)
{
throw new Error("not implemented");
}
} // class GtkToolkit
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment