GTK
diff --git a/bundles/org.eclipse.swt/.classpath_gtk b/bundles/org.eclipse.swt/.classpath_gtk
new file mode 100644
index 0000000..b70d21a
--- /dev/null
+++ b/bundles/org.eclipse.swt/.classpath_gtk
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="var" path="JRE_LIB"/>
+ <classpathentry kind="src" path="Eclipse SWT/gtk"/>
+ <classpathentry kind="src" path="Eclipse SWT/emulated"/>
+ <classpathentry kind="src" path="Eclipse SWT/common"/>
+ <classpathentry kind="src" path="Eclipse SWT/common_j2se"/>
+ <classpathentry kind="src" path="Eclipse SWT Printing/gtk"/>
+ <classpathentry kind="src" path="Eclipse SWT Printing/common"/>
+ <classpathentry kind="src" path="Eclipse SWT Program/gtk"/>
+ <classpathentry kind="src" path="Eclipse SWT Program/common"/>
+ <classpathentry kind="src" path="Eclipse SWT Drag and Drop/gtk"/>
+ <classpathentry kind="src" path="Eclipse SWT Drag and Drop/common"/>
+ <classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/>
+ <classpathentry kind="src" path="Eclipse SWT PI/gtk"/>
+ <classpathentry kind="src" path="Eclipse SWT PI/common_j2se"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.swt/.classpath_gtk_j2me b/bundles/org.eclipse.swt/.classpath_gtk_j2me
new file mode 100644
index 0000000..48fef2d
--- /dev/null
+++ b/bundles/org.eclipse.swt/.classpath_gtk_j2me
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="var" path="JRE_LIB"/>
+ <classpathentry kind="src" path="Eclipse SWT/gtk"/>
+ <classpathentry kind="src" path="Eclipse SWT/emulated"/>
+ <classpathentry kind="src" path="Eclipse SWT/common"/>
+ <classpathentry kind="src" path="Eclipse SWT/common_j2me"/>
+ <classpathentry kind="src" path="Eclipse SWT Printing/gtk"/>
+ <classpathentry kind="src" path="Eclipse SWT Printing/common"/>
+ <classpathentry kind="src" path="Eclipse SWT Program/gtk"/>
+ <classpathentry kind="src" path="Eclipse SWT Program/common"/>
+ <classpathentry kind="src" path="Eclipse SWT Drag and Drop/gtk"/>
+ <classpathentry kind="src" path="Eclipse SWT Drag and Drop/common"/>
+ <classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/>
+ <classpathentry kind="src" path="Eclipse SWT PI/gtk"/>
+ <classpathentry kind="src" path="Eclipse SWT PI/common_j2me"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ByteArrayTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ByteArrayTransfer.java
new file mode 100644
index 0000000..c8c5e4a
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ByteArrayTransfer.java
@@ -0,0 +1,28 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ * The class <code>ByteArrayTransfer</code> provides a platform specific mechanism for transforming
+ * a Java array of bytes into a format that can be passed around in a Drag and Drop operation and vice
+ * versa.
+ *
+ * <p>This abstract class can be subclassed to provided utilities for transforming Java data types
+ * into the byte array based platform specific drag and drop data types. See TextTransfer and
+ * FileTransfer for examples. If the data you are transferring <b>does not</b> map to a byte array,
+ * you should sub-class Transfer directly and do your own mapping to the platform data types.</p>
+ */
+public abstract class ByteArrayTransfer extends Transfer {
+public TransferData[] getSupportedTypes(){
+ return null;
+}
+public boolean isSupportedType(TransferData transferData){
+ return false;
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java
new file mode 100644
index 0000000..b368acb
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java
@@ -0,0 +1,73 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ */
+public class Clipboard {
+
+ private Display display;
+
+public Clipboard(Display display) {
+ checkSubclass ();
+ if (display == null) {
+ display = Display.getCurrent();
+ if (display == null) {
+ display = Display.getDefault();
+ }
+ }
+ if (display.getThread() != Thread.currentThread()) {
+ SWT.error(SWT.ERROR_THREAD_INVALID_ACCESS);
+ }
+ this.display = display;
+}
+protected void checkSubclass () {
+ String name = getClass().getName ();
+ String validName = Clipboard.class.getName();
+ if (!validName.equals(name)) {
+ DND.error (SWT.ERROR_INVALID_SUBCLASS);
+ }
+}
+public void dispose () {
+ display = null;
+}
+public Object getContents(Transfer transfer) {
+ if (display.isDisposed() || !(transfer instanceof TextTransfer)) return null;
+ return display.getData("TextTransfer");
+}
+public void setContents(Object[] data, Transfer[] transferAgents){
+
+ if (data == null) {
+ DND.error(SWT.ERROR_NOT_IMPLEMENTED);
+ }
+ if (transferAgents == null || data.length != transferAgents.length) {
+ DND.error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+
+ if (display.isDisposed() )
+ DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
+
+ for (int i = 0; i < transferAgents.length; i++) {
+ if (transferAgents[i] instanceof TextTransfer && data[i] instanceof String){
+ display.setData("TextTransfer", data[i]);
+ return;
+ }
+ }
+}
+/*
+ * Note: getAvailableTypeNames is a tool for writing a Transfer sub-class only. It should
+ * NOT be used within an application because it provides platform specfic
+ * information.
+ */
+public String[] getAvailableTypeNames() {
+ return null;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
new file mode 100644
index 0000000..1c41d9e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
@@ -0,0 +1,142 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ *
+ * Class <code>DragSource</code> defines the source object for a drag and drop transfer.
+ *
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ *
+ * <p>This class defines the following items:<ul>
+ * <li>the <code>Control</code> that the user clicks on to intiate a drag;
+ * <li>the data that will be transferred on a successful drop;
+ * <li>and the modes (move, copy, link) of transfer that are allowed.
+ * </ul></p>
+ *
+ * <p>You may have several DragSources in an application but you can only have one DragSource
+ * per Control. Data dragged from this DragSource can be dropped on a site within this application
+ * but it can also be dropped on another application such as an external Text editor.</p>
+ *
+ * <p>The application supplies the content of the data being transferred by implementing the interface
+ * <code>DragSourceListener</code> which uses the class <code>DragSourceEvent</code>.
+ * The application is required to take the appropriate action to remove the data from the drag source
+ * when a successful move operation occurs.</p>
+ *
+ * <code><pre>
+ * // Enable a label as a Drag Source
+ * Label label = new Label(shell, SWT.NONE);
+ * // This example will allow text to be dragged
+ * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
+ * // This example will allow the text to be copied or moved to the drop target
+ * int operations = DND.DROP_MOVE | DND.DROP_COPY;
+ *
+ * DragSource source = new DragSource (label, operations);
+ * source.setTransfer(types);
+ * source.addDragListener (new DragSourceListener() {
+ * public void dragStart(DragSourceEvent e) {
+ * // Only start the drag if there is actually text in the
+ * // label - this text will be what is dropped on the target.
+ * if (label.getText().length() == 0) {
+ * event.doit = false;
+ * }
+ * };
+ * public void dragSetData (DragSourceEvent event) {
+ * // A drop has been performed, so provide the data of the
+ * // requested type.
+ * // (Checking the type of the requested data is only
+ * // necessary if the drag source supports more than
+ * // one data type but is shown here as an example).
+ * if (TextTransfer.getInstance().isSupportedType(event.dataType)){
+ * event.data = label.getText();
+ * }
+ * }
+ * public void dragFinished(DragSourceEvent event) {
+ * // A Move operation has been performed so remove the data
+ * // from the source
+ * if (event.detail == DND.DROP_MOVE)
+ * label.setText("");
+ * }
+ * });
+ * </pre></code>
+ *
+ *
+ * <dl>
+ * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
+ * <dt><b>Events</b> <dd>DND.DragEnd, DND.DragSetData
+ * </dl>
+ */
+public final class DragSource extends Widget {
+
+/**
+ * Creates a new <code>DragSource</code> to handle dragging from the specified <code>Control</code>.
+ *
+ * @param control the <code>Control</code> that the user clicks on to initiate the drag
+ *
+ * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
+ * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
+ *
+ */
+public DragSource(Control control, int style) {
+ super (control, style);
+}
+/**
+ * Adds the listener to receive events.
+ *
+ * @param listener the listener
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
+ * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
+ * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
+ */
+public void addDragListener(DragSourceListener listener) {
+
+}
+
+public Display getDisplay () {
+ return null;
+}
+/**
+ * Returns the list of data types that can be transferred by this DragSource.
+ *
+ * @return the list of data types that can be transferred by this DragSource
+ */
+public Transfer[] getTransfer(){
+ return null;
+}
+
+/**
+ * Removes the listener.
+ *
+ * @param listener the listener
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
+ * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
+ * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
+ */
+public void removeDragListener(DragSourceListener listener) {
+}
+/**
+ * Specifies the list of data types that can be transferred by this DragSource.
+ * The application must be able to provide data to match each of these types when
+ * a successful drop has occurred.
+ */
+public void setTransfer(Transfer[] transferAgents){
+}
+/**
+ * @deprecated - use DragSourceListener.dragStart
+ */
+public void startDrag() {
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
new file mode 100644
index 0000000..1be0fe0
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
@@ -0,0 +1,133 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ *
+ * Class <code>DropTarget</code> defines the target object for a drag and drop transfer.
+ *
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ *
+ * <p>This class identifies the <code>Control</code> over which the user must position the cursor
+ * in order to drop the data being transferred. It also specifies what data types can be dropped on
+ * this control and what operations can be performed. You may have several DropTragets in an
+ * application but there can only be a one to one mapping between a <code>Control</code> and a <code>DropTarget</code>.
+ * The DropTarget can receive data from within the same application or from other applications
+ * (such as text dragged from a text editor like Word).</p>
+ *
+ * <code><pre>
+ * int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
+ * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
+ * DropTarget target = new DropTarget(label, operations);
+ * target.setTransfer(types);
+ * </code></pre>
+ *
+ * <p>The application is notified of data being dragged over this control and of when a drop occurs by
+ * implementing the interface <code>DropTargetListener</code> which uses the class
+ * <code>DropTargetEvent</code>. The application can modify the type of drag being performed
+ * on this Control at any stage of the drag by modifying the <code>event.detail</code> field or the
+ * <code>event.currentDataType</code> field. When the data is dropped, it is the responsibility of
+ * the application to copy this data for its own purposes.
+ *
+ * <code><pre>
+ * target.addDropListener (new DropTargetListener() {
+ * public void dragEnter(DropTargetEvent event) {};
+ * public void dragOver(DropTargetEvent event) {};
+ * public void dragLeave(DropTargetEvent event) {};
+ * public void dragOperationChanged(DropTargetEvent event) {};
+ * public void dropAccept(DropTargetEvent event) {}
+ * public void drop(DropTargetEvent event) {
+ * // A drop has occurred, copy over the data
+ * if (event.data == null) { // no data to copy, indicate failure in event.detail
+ * event.detail = DND.DROP_NONE;
+ * return;
+ * }
+ * label.setText ((String) event.data); // data copied to label text
+ * }
+ * });
+ * </pre></code>
+ *
+ * <dl>
+ * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
+ * <dt><b>Events</b> <dd>DND.DragEnter, DND.DragLeave, DND.DragOver, DND.DragOperationChanged,
+ * DND.Drop, DND.DropAccept
+ * </dl>
+ */
+public final class DropTarget extends Widget {
+
+/**
+ * Creates a new <code>DropTarget</code> to handle dropping on the specified <code>Control</code>.
+ *
+ * @param control the <code>Control</code> over which the user positions the cursor to drop data
+ *
+ * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
+ * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
+ *
+ */
+public DropTarget(Control control, int style) {
+ super(control, style);
+}
+
+/**
+ * Adds the listener to receive events.
+ *
+ * @param listener the listener
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
+ * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
+ * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
+ */
+public void addDropListener(DropTargetListener listener) {
+}
+
+/**
+ * Returns the Control which is registered for this DropTarget. This is the control over which the
+ * user positions the cursor to drop the data.
+ *
+ * @return the Control which is registered for this DropTarget
+ *
+ */
+public Control getControl () {
+ return null;
+}
+public Display getDisplay () {
+ return null;
+}
+/**
+ * Returns the list of data types that can be transferred to this DropTarget.
+ *
+ * @return the list of data types that can be transferred to this DropTarget
+ *
+ */
+public Transfer[] getTransfer() { return null; }
+public void notifyListener (int eventType, Event event) {}
+/**
+ * Removes the listener.
+ *
+ * @param listener the listener
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
+ * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
+ * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
+ */
+public void removeDropListener(DropTargetListener listener) {}
+/**
+ * Specifies the list of data types that can be transferred to this DropTarget.
+ *
+ * @param transferAgents a list of Transfer objects which define the types of data that can be
+ * dropped on this target
+ */
+public void setTransfer(Transfer[] transferAgents){}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/FileTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/FileTransfer.java
new file mode 100644
index 0000000..a3f240b
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/FileTransfer.java
@@ -0,0 +1,59 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+/**
+ * The <code>FileTransfer</code> class is used to transfer files in a drag and drop operation.
+ */
+public class FileTransfer extends ByteArrayTransfer {
+
+private FileTransfer() {}
+/**
+ * Returns the singleton instance of the FileTransfer class.
+ *
+ * @return the singleton instance of the FileTransfer class
+ */
+public static FileTransfer getInstance () {
+ return null;
+}
+/**
+ * Converts a list of filenames to a platform specific representation.
+ * <p>
+ * On a successful conversion, the transferData.result field will be set as follows:
+ * <ul>
+ * <li>Windows: OLE.S_OK
+ * <li>Motif: 0
+ * </ul>
+ * If this transfer agent is unable to perform the conversion,
+ * the transferData.result field will be set to a failure value as follows:
+ * <ul>
+ * <li>Windows: OLE.DV_E_TYMED
+ * <li>Motif: 1
+ * </ul></p>
+ *
+ * @param object a list of file names
+ * @param transferData an empty TransferData object; this object will be filled in on return
+ * with the platform specific format of the data
+ */
+public void javaToNative(Object object, TransferData transferData) {
+}
+/**
+ * Converts a platform specific representation of a list of file names to a Java array of String.
+ *
+ * @param transferData the platform specific representation of the data that has been transferred
+ * @return a Java array of String containing a list of file names if the conversion was successful;
+ * otherwise null
+ */
+public Object nativeToJava(TransferData transferData) {
+ return null;
+}
+protected String[] getTypeNames(){
+ return null;
+}
+protected int[] getTypeIds(){
+ return null;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/RTFTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/RTFTransfer.java
new file mode 100644
index 0000000..490afae
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/RTFTransfer.java
@@ -0,0 +1,69 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+/**
+ * The <code>RTFTransfer</code> class is used to transfer text with the RTF format
+ * in a drag and drop operation.
+ */
+public class RTFTransfer extends ByteArrayTransfer {
+
+ private static RTFTransfer _instance = new RTFTransfer();
+ private static final String TYPENAME1 = "text/rtf\0";
+ private static final int TYPEID1 = registerType(TYPENAME1);
+ private static final String TYPENAME2 = "TEXT/RTF\0";
+ private static final int TYPEID2 = registerType(TYPENAME2);
+ private static final String TYPENAME3 = "application/rtf\0";
+ private static final int TYPEID3 = registerType(TYPENAME3);
+
+private RTFTransfer() {
+}
+/**
+ * Returns the singleton instance of the RTFTransfer class.
+ *
+ * @return the singleton instance of the RTFTransfer class
+ */
+public static RTFTransfer getInstance () {
+ return _instance;
+}
+/**
+ * Converts a RTF-formatted Java String to a platform specific representation.
+ * <p>
+ * On a successful conversion, the transferData.result field will be set as follows:
+ * <ul>
+ * <li>Windows: OLE.S_OK
+ * <li>Motif: 0
+ * </ul>
+ * If this transfer agent is unable to perform the conversion,
+ * the transferData.result field will be set to a failure value as follows:
+ * <ul>
+ * <li>Windows: OLE.DV_E_TYMED
+ * <li>Motif: 1
+ * </ul></p>
+ *
+ * @param object a Java String containing the data to be transferred
+ * @param transferData an empty TransferData object; this object will be filled in on return
+ * with the platform specific format of the data
+ */
+public void javaToNative (Object object, TransferData transferData){
+}
+/**
+ * Converts a platform specific representation of a string to a Java String.
+ *
+ * @param transferData the platform specific representation of the data that has been transferred
+ * @return a Java String containing the transferred data if the conversion was successful;
+ * otherwise null
+ */
+public Object nativeToJava(TransferData transferData){
+ return null;
+}
+protected String[] getTypeNames(){
+ return new String[]{TYPENAME1, TYPENAME2, TYPENAME3};
+}
+protected int[] getTypeIds(){
+ return new int[]{TYPEID1, TYPEID2, TYPEID3};
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDragUnderEffect.java
new file mode 100644
index 0000000..6862a2e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDragUnderEffect.java
@@ -0,0 +1,52 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+
+class TableDragUnderEffect extends DragUnderEffect {
+ private Table table;
+ private TableItem currentItem;
+ private TableItem[] selection = new TableItem[0];
+ private int currentEffect = DND.FEEDBACK_NONE;
+
+TableDragUnderEffect(Table table) {
+ this.table = table;
+}
+void show(int effect, int x, int y) {
+ TableItem item = null;
+ if (effect != DND.FEEDBACK_NONE) item = findItem(x, y);
+ if (item == null) effect = DND.FEEDBACK_NONE;
+ if (currentEffect != effect && currentEffect == DND.FEEDBACK_NONE) {
+ selection = table.getSelection();
+ table.setSelection(new TableItem[0]);
+ }
+ boolean restoreSelection = currentEffect != effect && effect == DND.FEEDBACK_NONE;
+ setDragUnderEffect(effect, item);
+ if (restoreSelection) {
+ table.setSelection(selection);
+ selection = new TableItem[0];
+ }
+}
+private TableItem findItem(int x, int y){
+ if (table == null) return null;
+ Point coordinates = new Point(x, y);
+ coordinates = table.toControl(coordinates);
+ return table.getItem(coordinates);
+}
+private void setDragUnderEffect(int effect, TableItem item) {
+ if (currentItem != item) {
+ if (item == null) {
+ table.setSelection(new TableItem[0]);
+ } else {
+ table.setSelection(new TableItem[] {item});
+ }
+ currentItem = item;
+ }
+ currentEffect = effect;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java
new file mode 100644
index 0000000..d84cbfe
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java
@@ -0,0 +1,68 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+/**
+ * The <code>TextTransfer</code> class is used to transfer text in a drag and drop operation.
+ */
+public class TextTransfer extends ByteArrayTransfer {
+
+ private static TextTransfer _instance = new TextTransfer();
+ private static final String TYPENAME1 = "STRING\0";
+ private static final int TYPEID1 = registerType(TYPENAME1);
+ private static final String TYPENAME2 = "text/plain\0";
+ private static final int TYPEID2 = registerType(TYPENAME2);
+ private static final String TYPENAME3 = "text/text\0";
+ private static final int TYPEID3 = registerType(TYPENAME3);
+
+private TextTransfer() {
+}
+/**
+ * Returns the singleton instance of the TextTransfer class.
+ *
+ * @return the singleton instance of the TextTransfer class
+ */
+public static TextTransfer getInstance () {
+ return _instance;
+}
+/**
+ * Converts a plain text Java String to a platform specific representation.
+ * <p>
+ * On a successful conversion, the transferData.result field will be set as follows:
+ * <ul>
+ * <li>Windows: OLE.S_OK
+ * <li>Motif: 0
+ * </ul>
+ * If this transfer agent is unable to perform the conversion,
+ * the transferData.result field will be set to a failure value as follows:
+ * <ul>
+ * <li>Windows: OLE.DV_E_TYMED
+ * <li>Motif: 1
+ * </ul></p>
+ *
+ * @param object a Java String containing the data to be transferred
+ * @param transferData an empty TransferData object; this object will be filled in on return
+ * with the platform specific format of the data
+ */
+public void javaToNative (Object object, TransferData transferData){
+}
+/**
+ * Converts a platform specific representation of a string to a Java String.
+ *
+ * @param transferData the platform specific representation of the data that has been transferred
+ * @return a Java String containing the transferred data if the conversion was successful;
+ * otherwise null
+ */
+public Object nativeToJava(TransferData transferData){
+ return null;
+}
+protected String[] getTypeNames(){
+ return new String[]{TYPENAME1, TYPENAME2, TYPENAME3};
+}
+protected int[] getTypeIds(){
+ return new int[]{TYPEID1, TYPEID2, TYPEID3};
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Transfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Transfer.java
new file mode 100644
index 0000000..9dcf84f
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Transfer.java
@@ -0,0 +1,57 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.Converter;
+import org.eclipse.swt.internal.gtk.OS;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * The class <code>Transfer</code> provides a mechanism for converting a Java object to a
+ * platform specific format that can be passed around in a Drag and Drop operation and vice versa.
+ *
+ * <p>You should only need to become familiar with this class if you are implementing
+ * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
+ */
+public abstract class Transfer {
+/**
+ * Returns a list of the data types that can be transferred using this Transfer agent.
+ *
+ * <p>Only the data type fields of the TransferData Object are filled in.</p>
+ *
+ * @return a list of the data types that can be transferred using this Transfer agent
+ */
+abstract public TransferData[] getSupportedTypes();
+/**
+ * Returns true if the transferData data type can be transferred using this Transfer agent.
+ *
+ * @param transferData a platform specific description of a data type; only the data type fields
+ * of the TransferData Object need to be filled in
+ *
+ * @return true if the transferData data type can be transferred using this Transfer agent
+ */
+abstract public boolean isSupportedType(TransferData transferData);
+abstract protected String[] getTypeNames();
+abstract protected int[] getTypeIds();
+abstract protected void javaToNative (Object object, TransferData transferData);
+abstract protected Object nativeToJava(TransferData transferData);
+/**
+ * Registers a name for a data type and returns the associated unique identifier.
+ *
+ * <p>You may register the same type more than once, the same unique identifier will be returned if the
+ * type has been previously registered.</p>
+ *
+ * <p>Note: Do <b>not</b> call this method with pre-defined Clipboard Format types such as CF_TEXT
+ * or CF_BITMAP because the pre-defined value will not be returned</p>
+ *
+ * @param formatName the name of a data type
+ *
+ * @return the unique identifier associated with htis data type
+ */
+public static int registerType(String formatName){
+ return 0;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TransferData.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TransferData.java
new file mode 100644
index 0000000..bade8ba
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TransferData.java
@@ -0,0 +1,35 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+/**
+ * The <code>TransferData</code> class is a platform specific data structure for describing the type and the
+ * contents of data being transferred in a Drag and Drop operation.
+ *
+ * <p>As an application writer, you do not need to know anything about the specifics of TransferData. You
+ * should just pass the TransferData instances to subclass of Transfer and let the Transfer objects deal
+ * with the platform specific issues. You can ask a Transfer subclass if it can handle this data by calling
+ * TextTransfer.isSupportedType(transferData). You can get a list of the types of TransferData supported by a
+ * Transfer object by calling TextTransfer.getSupportedTypes().</p>
+ *
+ * <p>You should only need to become familiar with the fields in this class if you are implementing
+ * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
+ */
+public class TransferData {
+ /**
+ * Data Type - a pre-defined clipboard format <b>or</b> the unique identifier of a user defined format
+ * (Warning: This field is platform dependent)
+ */
+ public int type;
+
+ // attributes specific to set/get
+ int length;
+ int format;
+ int pValue;
+
+ int result;
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragUnderEffect.java
new file mode 100644
index 0000000..54ff723
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragUnderEffect.java
@@ -0,0 +1,92 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+
+class TreeDragUnderEffect extends DragUnderEffect {
+
+ private Tree tree;
+ private TreeItem currentItem = null;
+ private int currentEffect = DND.FEEDBACK_NONE;
+ private TreeItem[] selection = new TreeItem[0];
+
+TreeDragUnderEffect(Tree tree) {
+ this.tree = tree;
+}
+void show(int effect, int x, int y) {
+ TreeItem item = null;
+ if (effect != DND.FEEDBACK_NONE) item = findItem(x, y);
+ if (item == null) effect = DND.FEEDBACK_NONE;
+ if (currentEffect != effect && currentEffect == DND.FEEDBACK_NONE) {
+ selection = tree.getSelection();
+ tree.setSelection(new TreeItem[0]);
+ }
+ boolean restoreSelection = currentEffect != effect && effect == DND.FEEDBACK_NONE;
+ setDragUnderEffect(effect, item);
+ if (restoreSelection) {
+ tree.setSelection(selection);
+ selection = new TreeItem[0];
+ }
+}
+private TreeItem findItem(int x , int y){
+ Point coordinates = new Point(x, y);
+ coordinates = tree.toControl(coordinates);
+ return tree.getItem(coordinates);
+}
+private void setDragUnderEffect(int effect, TreeItem item) {
+ switch (effect) {
+ case DND.FEEDBACK_SELECT:
+ if (currentEffect == DND.FEEDBACK_INSERT_AFTER ||
+ currentEffect == DND.FEEDBACK_INSERT_BEFORE) {
+ setInsertMark(null, false);
+ currentEffect = DND.FEEDBACK_NONE;
+ currentItem = null;
+ }
+ if (currentEffect != effect || currentItem != item) {
+ setDropSelection(item);
+ currentEffect = DND.FEEDBACK_SELECT;
+ currentItem = item;
+ }
+ break;
+ case DND.FEEDBACK_INSERT_AFTER:
+ case DND.FEEDBACK_INSERT_BEFORE:
+ if (currentEffect == DND.FEEDBACK_SELECT) {
+ setDropSelection(null);
+ currentEffect = DND.FEEDBACK_NONE;
+ currentItem = null;
+ }
+ if (currentEffect != effect || currentItem != item) {
+ setInsertMark(item, effect == DND.FEEDBACK_INSERT_AFTER);
+ currentEffect = effect;
+ currentItem = item;
+ }
+ break;
+ default :
+ if (currentEffect == DND.FEEDBACK_INSERT_AFTER ||
+ currentEffect == DND.FEEDBACK_INSERT_BEFORE) {
+ setInsertMark(null, false);
+ }
+ if (currentEffect == DND.FEEDBACK_SELECT) {
+ setDropSelection(null);
+ }
+ currentEffect = DND.FEEDBACK_NONE;
+ currentItem = null;
+ break;
+ }
+}
+private void setDropSelection (TreeItem item) {
+ if (item == null) {
+ tree.setSelection(new TreeItem[0]);
+ } else {
+ tree.setSelection(new TreeItem[]{item});
+ }
+}
+private void setInsertMark (TreeItem item, boolean after) {
+ // not currently implemented
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/ByteArrayTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/ByteArrayTransfer.java
new file mode 100644
index 0000000..c8c5e4a
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/ByteArrayTransfer.java
@@ -0,0 +1,28 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ * The class <code>ByteArrayTransfer</code> provides a platform specific mechanism for transforming
+ * a Java array of bytes into a format that can be passed around in a Drag and Drop operation and vice
+ * versa.
+ *
+ * <p>This abstract class can be subclassed to provided utilities for transforming Java data types
+ * into the byte array based platform specific drag and drop data types. See TextTransfer and
+ * FileTransfer for examples. If the data you are transferring <b>does not</b> map to a byte array,
+ * you should sub-class Transfer directly and do your own mapping to the platform data types.</p>
+ */
+public abstract class ByteArrayTransfer extends Transfer {
+public TransferData[] getSupportedTypes(){
+ return null;
+}
+public boolean isSupportedType(TransferData transferData){
+ return false;
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Clipboard.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Clipboard.java
new file mode 100644
index 0000000..b368acb
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Clipboard.java
@@ -0,0 +1,73 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ */
+public class Clipboard {
+
+ private Display display;
+
+public Clipboard(Display display) {
+ checkSubclass ();
+ if (display == null) {
+ display = Display.getCurrent();
+ if (display == null) {
+ display = Display.getDefault();
+ }
+ }
+ if (display.getThread() != Thread.currentThread()) {
+ SWT.error(SWT.ERROR_THREAD_INVALID_ACCESS);
+ }
+ this.display = display;
+}
+protected void checkSubclass () {
+ String name = getClass().getName ();
+ String validName = Clipboard.class.getName();
+ if (!validName.equals(name)) {
+ DND.error (SWT.ERROR_INVALID_SUBCLASS);
+ }
+}
+public void dispose () {
+ display = null;
+}
+public Object getContents(Transfer transfer) {
+ if (display.isDisposed() || !(transfer instanceof TextTransfer)) return null;
+ return display.getData("TextTransfer");
+}
+public void setContents(Object[] data, Transfer[] transferAgents){
+
+ if (data == null) {
+ DND.error(SWT.ERROR_NOT_IMPLEMENTED);
+ }
+ if (transferAgents == null || data.length != transferAgents.length) {
+ DND.error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+
+ if (display.isDisposed() )
+ DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
+
+ for (int i = 0; i < transferAgents.length; i++) {
+ if (transferAgents[i] instanceof TextTransfer && data[i] instanceof String){
+ display.setData("TextTransfer", data[i]);
+ return;
+ }
+ }
+}
+/*
+ * Note: getAvailableTypeNames is a tool for writing a Transfer sub-class only. It should
+ * NOT be used within an application because it provides platform specfic
+ * information.
+ */
+public String[] getAvailableTypeNames() {
+ return null;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DragSource.java
new file mode 100644
index 0000000..1c41d9e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DragSource.java
@@ -0,0 +1,142 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ *
+ * Class <code>DragSource</code> defines the source object for a drag and drop transfer.
+ *
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ *
+ * <p>This class defines the following items:<ul>
+ * <li>the <code>Control</code> that the user clicks on to intiate a drag;
+ * <li>the data that will be transferred on a successful drop;
+ * <li>and the modes (move, copy, link) of transfer that are allowed.
+ * </ul></p>
+ *
+ * <p>You may have several DragSources in an application but you can only have one DragSource
+ * per Control. Data dragged from this DragSource can be dropped on a site within this application
+ * but it can also be dropped on another application such as an external Text editor.</p>
+ *
+ * <p>The application supplies the content of the data being transferred by implementing the interface
+ * <code>DragSourceListener</code> which uses the class <code>DragSourceEvent</code>.
+ * The application is required to take the appropriate action to remove the data from the drag source
+ * when a successful move operation occurs.</p>
+ *
+ * <code><pre>
+ * // Enable a label as a Drag Source
+ * Label label = new Label(shell, SWT.NONE);
+ * // This example will allow text to be dragged
+ * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
+ * // This example will allow the text to be copied or moved to the drop target
+ * int operations = DND.DROP_MOVE | DND.DROP_COPY;
+ *
+ * DragSource source = new DragSource (label, operations);
+ * source.setTransfer(types);
+ * source.addDragListener (new DragSourceListener() {
+ * public void dragStart(DragSourceEvent e) {
+ * // Only start the drag if there is actually text in the
+ * // label - this text will be what is dropped on the target.
+ * if (label.getText().length() == 0) {
+ * event.doit = false;
+ * }
+ * };
+ * public void dragSetData (DragSourceEvent event) {
+ * // A drop has been performed, so provide the data of the
+ * // requested type.
+ * // (Checking the type of the requested data is only
+ * // necessary if the drag source supports more than
+ * // one data type but is shown here as an example).
+ * if (TextTransfer.getInstance().isSupportedType(event.dataType)){
+ * event.data = label.getText();
+ * }
+ * }
+ * public void dragFinished(DragSourceEvent event) {
+ * // A Move operation has been performed so remove the data
+ * // from the source
+ * if (event.detail == DND.DROP_MOVE)
+ * label.setText("");
+ * }
+ * });
+ * </pre></code>
+ *
+ *
+ * <dl>
+ * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
+ * <dt><b>Events</b> <dd>DND.DragEnd, DND.DragSetData
+ * </dl>
+ */
+public final class DragSource extends Widget {
+
+/**
+ * Creates a new <code>DragSource</code> to handle dragging from the specified <code>Control</code>.
+ *
+ * @param control the <code>Control</code> that the user clicks on to initiate the drag
+ *
+ * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
+ * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
+ *
+ */
+public DragSource(Control control, int style) {
+ super (control, style);
+}
+/**
+ * Adds the listener to receive events.
+ *
+ * @param listener the listener
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
+ * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
+ * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
+ */
+public void addDragListener(DragSourceListener listener) {
+
+}
+
+public Display getDisplay () {
+ return null;
+}
+/**
+ * Returns the list of data types that can be transferred by this DragSource.
+ *
+ * @return the list of data types that can be transferred by this DragSource
+ */
+public Transfer[] getTransfer(){
+ return null;
+}
+
+/**
+ * Removes the listener.
+ *
+ * @param listener the listener
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
+ * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
+ * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
+ */
+public void removeDragListener(DragSourceListener listener) {
+}
+/**
+ * Specifies the list of data types that can be transferred by this DragSource.
+ * The application must be able to provide data to match each of these types when
+ * a successful drop has occurred.
+ */
+public void setTransfer(Transfer[] transferAgents){
+}
+/**
+ * @deprecated - use DragSourceListener.dragStart
+ */
+public void startDrag() {
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DropTarget.java
new file mode 100644
index 0000000..1be0fe0
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DropTarget.java
@@ -0,0 +1,133 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ *
+ * Class <code>DropTarget</code> defines the target object for a drag and drop transfer.
+ *
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ *
+ * <p>This class identifies the <code>Control</code> over which the user must position the cursor
+ * in order to drop the data being transferred. It also specifies what data types can be dropped on
+ * this control and what operations can be performed. You may have several DropTragets in an
+ * application but there can only be a one to one mapping between a <code>Control</code> and a <code>DropTarget</code>.
+ * The DropTarget can receive data from within the same application or from other applications
+ * (such as text dragged from a text editor like Word).</p>
+ *
+ * <code><pre>
+ * int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
+ * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
+ * DropTarget target = new DropTarget(label, operations);
+ * target.setTransfer(types);
+ * </code></pre>
+ *
+ * <p>The application is notified of data being dragged over this control and of when a drop occurs by
+ * implementing the interface <code>DropTargetListener</code> which uses the class
+ * <code>DropTargetEvent</code>. The application can modify the type of drag being performed
+ * on this Control at any stage of the drag by modifying the <code>event.detail</code> field or the
+ * <code>event.currentDataType</code> field. When the data is dropped, it is the responsibility of
+ * the application to copy this data for its own purposes.
+ *
+ * <code><pre>
+ * target.addDropListener (new DropTargetListener() {
+ * public void dragEnter(DropTargetEvent event) {};
+ * public void dragOver(DropTargetEvent event) {};
+ * public void dragLeave(DropTargetEvent event) {};
+ * public void dragOperationChanged(DropTargetEvent event) {};
+ * public void dropAccept(DropTargetEvent event) {}
+ * public void drop(DropTargetEvent event) {
+ * // A drop has occurred, copy over the data
+ * if (event.data == null) { // no data to copy, indicate failure in event.detail
+ * event.detail = DND.DROP_NONE;
+ * return;
+ * }
+ * label.setText ((String) event.data); // data copied to label text
+ * }
+ * });
+ * </pre></code>
+ *
+ * <dl>
+ * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
+ * <dt><b>Events</b> <dd>DND.DragEnter, DND.DragLeave, DND.DragOver, DND.DragOperationChanged,
+ * DND.Drop, DND.DropAccept
+ * </dl>
+ */
+public final class DropTarget extends Widget {
+
+/**
+ * Creates a new <code>DropTarget</code> to handle dropping on the specified <code>Control</code>.
+ *
+ * @param control the <code>Control</code> over which the user positions the cursor to drop data
+ *
+ * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
+ * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
+ *
+ */
+public DropTarget(Control control, int style) {
+ super(control, style);
+}
+
+/**
+ * Adds the listener to receive events.
+ *
+ * @param listener the listener
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
+ * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
+ * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
+ */
+public void addDropListener(DropTargetListener listener) {
+}
+
+/**
+ * Returns the Control which is registered for this DropTarget. This is the control over which the
+ * user positions the cursor to drop the data.
+ *
+ * @return the Control which is registered for this DropTarget
+ *
+ */
+public Control getControl () {
+ return null;
+}
+public Display getDisplay () {
+ return null;
+}
+/**
+ * Returns the list of data types that can be transferred to this DropTarget.
+ *
+ * @return the list of data types that can be transferred to this DropTarget
+ *
+ */
+public Transfer[] getTransfer() { return null; }
+public void notifyListener (int eventType, Event event) {}
+/**
+ * Removes the listener.
+ *
+ * @param listener the listener
+ *
+ * @exception SWTError
+ * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
+ * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
+ * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
+ */
+public void removeDropListener(DropTargetListener listener) {}
+/**
+ * Specifies the list of data types that can be transferred to this DropTarget.
+ *
+ * @param transferAgents a list of Transfer objects which define the types of data that can be
+ * dropped on this target
+ */
+public void setTransfer(Transfer[] transferAgents){}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/FileTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/FileTransfer.java
new file mode 100644
index 0000000..a3f240b
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/FileTransfer.java
@@ -0,0 +1,59 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+/**
+ * The <code>FileTransfer</code> class is used to transfer files in a drag and drop operation.
+ */
+public class FileTransfer extends ByteArrayTransfer {
+
+private FileTransfer() {}
+/**
+ * Returns the singleton instance of the FileTransfer class.
+ *
+ * @return the singleton instance of the FileTransfer class
+ */
+public static FileTransfer getInstance () {
+ return null;
+}
+/**
+ * Converts a list of filenames to a platform specific representation.
+ * <p>
+ * On a successful conversion, the transferData.result field will be set as follows:
+ * <ul>
+ * <li>Windows: OLE.S_OK
+ * <li>Motif: 0
+ * </ul>
+ * If this transfer agent is unable to perform the conversion,
+ * the transferData.result field will be set to a failure value as follows:
+ * <ul>
+ * <li>Windows: OLE.DV_E_TYMED
+ * <li>Motif: 1
+ * </ul></p>
+ *
+ * @param object a list of file names
+ * @param transferData an empty TransferData object; this object will be filled in on return
+ * with the platform specific format of the data
+ */
+public void javaToNative(Object object, TransferData transferData) {
+}
+/**
+ * Converts a platform specific representation of a list of file names to a Java array of String.
+ *
+ * @param transferData the platform specific representation of the data that has been transferred
+ * @return a Java array of String containing a list of file names if the conversion was successful;
+ * otherwise null
+ */
+public Object nativeToJava(TransferData transferData) {
+ return null;
+}
+protected String[] getTypeNames(){
+ return null;
+}
+protected int[] getTypeIds(){
+ return null;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/RTFTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/RTFTransfer.java
new file mode 100644
index 0000000..490afae
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/RTFTransfer.java
@@ -0,0 +1,69 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+/**
+ * The <code>RTFTransfer</code> class is used to transfer text with the RTF format
+ * in a drag and drop operation.
+ */
+public class RTFTransfer extends ByteArrayTransfer {
+
+ private static RTFTransfer _instance = new RTFTransfer();
+ private static final String TYPENAME1 = "text/rtf\0";
+ private static final int TYPEID1 = registerType(TYPENAME1);
+ private static final String TYPENAME2 = "TEXT/RTF\0";
+ private static final int TYPEID2 = registerType(TYPENAME2);
+ private static final String TYPENAME3 = "application/rtf\0";
+ private static final int TYPEID3 = registerType(TYPENAME3);
+
+private RTFTransfer() {
+}
+/**
+ * Returns the singleton instance of the RTFTransfer class.
+ *
+ * @return the singleton instance of the RTFTransfer class
+ */
+public static RTFTransfer getInstance () {
+ return _instance;
+}
+/**
+ * Converts a RTF-formatted Java String to a platform specific representation.
+ * <p>
+ * On a successful conversion, the transferData.result field will be set as follows:
+ * <ul>
+ * <li>Windows: OLE.S_OK
+ * <li>Motif: 0
+ * </ul>
+ * If this transfer agent is unable to perform the conversion,
+ * the transferData.result field will be set to a failure value as follows:
+ * <ul>
+ * <li>Windows: OLE.DV_E_TYMED
+ * <li>Motif: 1
+ * </ul></p>
+ *
+ * @param object a Java String containing the data to be transferred
+ * @param transferData an empty TransferData object; this object will be filled in on return
+ * with the platform specific format of the data
+ */
+public void javaToNative (Object object, TransferData transferData){
+}
+/**
+ * Converts a platform specific representation of a string to a Java String.
+ *
+ * @param transferData the platform specific representation of the data that has been transferred
+ * @return a Java String containing the transferred data if the conversion was successful;
+ * otherwise null
+ */
+public Object nativeToJava(TransferData transferData){
+ return null;
+}
+protected String[] getTypeNames(){
+ return new String[]{TYPENAME1, TYPENAME2, TYPENAME3};
+}
+protected int[] getTypeIds(){
+ return new int[]{TYPEID1, TYPEID2, TYPEID3};
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TableDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TableDragUnderEffect.java
new file mode 100644
index 0000000..6862a2e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TableDragUnderEffect.java
@@ -0,0 +1,52 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+
+class TableDragUnderEffect extends DragUnderEffect {
+ private Table table;
+ private TableItem currentItem;
+ private TableItem[] selection = new TableItem[0];
+ private int currentEffect = DND.FEEDBACK_NONE;
+
+TableDragUnderEffect(Table table) {
+ this.table = table;
+}
+void show(int effect, int x, int y) {
+ TableItem item = null;
+ if (effect != DND.FEEDBACK_NONE) item = findItem(x, y);
+ if (item == null) effect = DND.FEEDBACK_NONE;
+ if (currentEffect != effect && currentEffect == DND.FEEDBACK_NONE) {
+ selection = table.getSelection();
+ table.setSelection(new TableItem[0]);
+ }
+ boolean restoreSelection = currentEffect != effect && effect == DND.FEEDBACK_NONE;
+ setDragUnderEffect(effect, item);
+ if (restoreSelection) {
+ table.setSelection(selection);
+ selection = new TableItem[0];
+ }
+}
+private TableItem findItem(int x, int y){
+ if (table == null) return null;
+ Point coordinates = new Point(x, y);
+ coordinates = table.toControl(coordinates);
+ return table.getItem(coordinates);
+}
+private void setDragUnderEffect(int effect, TableItem item) {
+ if (currentItem != item) {
+ if (item == null) {
+ table.setSelection(new TableItem[0]);
+ } else {
+ table.setSelection(new TableItem[] {item});
+ }
+ currentItem = item;
+ }
+ currentEffect = effect;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TextTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TextTransfer.java
new file mode 100644
index 0000000..d84cbfe
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TextTransfer.java
@@ -0,0 +1,68 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+/**
+ * The <code>TextTransfer</code> class is used to transfer text in a drag and drop operation.
+ */
+public class TextTransfer extends ByteArrayTransfer {
+
+ private static TextTransfer _instance = new TextTransfer();
+ private static final String TYPENAME1 = "STRING\0";
+ private static final int TYPEID1 = registerType(TYPENAME1);
+ private static final String TYPENAME2 = "text/plain\0";
+ private static final int TYPEID2 = registerType(TYPENAME2);
+ private static final String TYPENAME3 = "text/text\0";
+ private static final int TYPEID3 = registerType(TYPENAME3);
+
+private TextTransfer() {
+}
+/**
+ * Returns the singleton instance of the TextTransfer class.
+ *
+ * @return the singleton instance of the TextTransfer class
+ */
+public static TextTransfer getInstance () {
+ return _instance;
+}
+/**
+ * Converts a plain text Java String to a platform specific representation.
+ * <p>
+ * On a successful conversion, the transferData.result field will be set as follows:
+ * <ul>
+ * <li>Windows: OLE.S_OK
+ * <li>Motif: 0
+ * </ul>
+ * If this transfer agent is unable to perform the conversion,
+ * the transferData.result field will be set to a failure value as follows:
+ * <ul>
+ * <li>Windows: OLE.DV_E_TYMED
+ * <li>Motif: 1
+ * </ul></p>
+ *
+ * @param object a Java String containing the data to be transferred
+ * @param transferData an empty TransferData object; this object will be filled in on return
+ * with the platform specific format of the data
+ */
+public void javaToNative (Object object, TransferData transferData){
+}
+/**
+ * Converts a platform specific representation of a string to a Java String.
+ *
+ * @param transferData the platform specific representation of the data that has been transferred
+ * @return a Java String containing the transferred data if the conversion was successful;
+ * otherwise null
+ */
+public Object nativeToJava(TransferData transferData){
+ return null;
+}
+protected String[] getTypeNames(){
+ return new String[]{TYPENAME1, TYPENAME2, TYPENAME3};
+}
+protected int[] getTypeIds(){
+ return new int[]{TYPEID1, TYPEID2, TYPEID3};
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Transfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Transfer.java
new file mode 100644
index 0000000..9dcf84f
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Transfer.java
@@ -0,0 +1,57 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.Converter;
+import org.eclipse.swt.internal.gtk.OS;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * The class <code>Transfer</code> provides a mechanism for converting a Java object to a
+ * platform specific format that can be passed around in a Drag and Drop operation and vice versa.
+ *
+ * <p>You should only need to become familiar with this class if you are implementing
+ * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
+ */
+public abstract class Transfer {
+/**
+ * Returns a list of the data types that can be transferred using this Transfer agent.
+ *
+ * <p>Only the data type fields of the TransferData Object are filled in.</p>
+ *
+ * @return a list of the data types that can be transferred using this Transfer agent
+ */
+abstract public TransferData[] getSupportedTypes();
+/**
+ * Returns true if the transferData data type can be transferred using this Transfer agent.
+ *
+ * @param transferData a platform specific description of a data type; only the data type fields
+ * of the TransferData Object need to be filled in
+ *
+ * @return true if the transferData data type can be transferred using this Transfer agent
+ */
+abstract public boolean isSupportedType(TransferData transferData);
+abstract protected String[] getTypeNames();
+abstract protected int[] getTypeIds();
+abstract protected void javaToNative (Object object, TransferData transferData);
+abstract protected Object nativeToJava(TransferData transferData);
+/**
+ * Registers a name for a data type and returns the associated unique identifier.
+ *
+ * <p>You may register the same type more than once, the same unique identifier will be returned if the
+ * type has been previously registered.</p>
+ *
+ * <p>Note: Do <b>not</b> call this method with pre-defined Clipboard Format types such as CF_TEXT
+ * or CF_BITMAP because the pre-defined value will not be returned</p>
+ *
+ * @param formatName the name of a data type
+ *
+ * @return the unique identifier associated with htis data type
+ */
+public static int registerType(String formatName){
+ return 0;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TransferData.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TransferData.java
new file mode 100644
index 0000000..bade8ba
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TransferData.java
@@ -0,0 +1,35 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+/**
+ * The <code>TransferData</code> class is a platform specific data structure for describing the type and the
+ * contents of data being transferred in a Drag and Drop operation.
+ *
+ * <p>As an application writer, you do not need to know anything about the specifics of TransferData. You
+ * should just pass the TransferData instances to subclass of Transfer and let the Transfer objects deal
+ * with the platform specific issues. You can ask a Transfer subclass if it can handle this data by calling
+ * TextTransfer.isSupportedType(transferData). You can get a list of the types of TransferData supported by a
+ * Transfer object by calling TextTransfer.getSupportedTypes().</p>
+ *
+ * <p>You should only need to become familiar with the fields in this class if you are implementing
+ * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
+ */
+public class TransferData {
+ /**
+ * Data Type - a pre-defined clipboard format <b>or</b> the unique identifier of a user defined format
+ * (Warning: This field is platform dependent)
+ */
+ public int type;
+
+ // attributes specific to set/get
+ int length;
+ int format;
+ int pValue;
+
+ int result;
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TreeDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TreeDragUnderEffect.java
new file mode 100644
index 0000000..54ff723
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TreeDragUnderEffect.java
@@ -0,0 +1,92 @@
+package org.eclipse.swt.dnd;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+
+class TreeDragUnderEffect extends DragUnderEffect {
+
+ private Tree tree;
+ private TreeItem currentItem = null;
+ private int currentEffect = DND.FEEDBACK_NONE;
+ private TreeItem[] selection = new TreeItem[0];
+
+TreeDragUnderEffect(Tree tree) {
+ this.tree = tree;
+}
+void show(int effect, int x, int y) {
+ TreeItem item = null;
+ if (effect != DND.FEEDBACK_NONE) item = findItem(x, y);
+ if (item == null) effect = DND.FEEDBACK_NONE;
+ if (currentEffect != effect && currentEffect == DND.FEEDBACK_NONE) {
+ selection = tree.getSelection();
+ tree.setSelection(new TreeItem[0]);
+ }
+ boolean restoreSelection = currentEffect != effect && effect == DND.FEEDBACK_NONE;
+ setDragUnderEffect(effect, item);
+ if (restoreSelection) {
+ tree.setSelection(selection);
+ selection = new TreeItem[0];
+ }
+}
+private TreeItem findItem(int x , int y){
+ Point coordinates = new Point(x, y);
+ coordinates = tree.toControl(coordinates);
+ return tree.getItem(coordinates);
+}
+private void setDragUnderEffect(int effect, TreeItem item) {
+ switch (effect) {
+ case DND.FEEDBACK_SELECT:
+ if (currentEffect == DND.FEEDBACK_INSERT_AFTER ||
+ currentEffect == DND.FEEDBACK_INSERT_BEFORE) {
+ setInsertMark(null, false);
+ currentEffect = DND.FEEDBACK_NONE;
+ currentItem = null;
+ }
+ if (currentEffect != effect || currentItem != item) {
+ setDropSelection(item);
+ currentEffect = DND.FEEDBACK_SELECT;
+ currentItem = item;
+ }
+ break;
+ case DND.FEEDBACK_INSERT_AFTER:
+ case DND.FEEDBACK_INSERT_BEFORE:
+ if (currentEffect == DND.FEEDBACK_SELECT) {
+ setDropSelection(null);
+ currentEffect = DND.FEEDBACK_NONE;
+ currentItem = null;
+ }
+ if (currentEffect != effect || currentItem != item) {
+ setInsertMark(item, effect == DND.FEEDBACK_INSERT_AFTER);
+ currentEffect = effect;
+ currentItem = item;
+ }
+ break;
+ default :
+ if (currentEffect == DND.FEEDBACK_INSERT_AFTER ||
+ currentEffect == DND.FEEDBACK_INSERT_BEFORE) {
+ setInsertMark(null, false);
+ }
+ if (currentEffect == DND.FEEDBACK_SELECT) {
+ setDropSelection(null);
+ }
+ currentEffect = DND.FEEDBACK_NONE;
+ currentItem = null;
+ break;
+ }
+}
+private void setDropSelection (TreeItem item) {
+ if (item == null) {
+ tree.setSelection(new TreeItem[0]);
+ } else {
+ tree.setSelection(new TreeItem[]{item});
+ }
+}
+private void setInsertMark (TreeItem item, boolean after) {
+ // not currently implemented
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/about.html b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/about.html
new file mode 100644
index 0000000..ee4dc99
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/about.html
@@ -0,0 +1,59 @@
+<html>
+<head>
+<title>About</title>
+<style type="text/css">
+p, table, td, th { font-family: arial, helvetica, geneva; font-size: 10pt}
+pre { font-family: "Courier New", Courier, mono; font-size: 10pt}
+h2 { font-family: arial, helvetica, geneva; font-size: 18pt; font-weight: bold ; line-height: 14px}
+code { font-family: "Courier New", Courier, mono; font-size: 10pt}
+sup { font-family: arial,helvetica,geneva; font-size: 10px}
+h3 { font-family: arial, helvetica, geneva; font-size: 14pt; font-weight: bold}
+li { font-family: arial, helvetica, geneva; font-size: 10pt}
+h1 { font-family: arial, helvetica, geneva; font-size: 28px; font-weight: bold}
+body { font-family: arial, helvetica, geneva; font-size: 10pt; clip: rect( ); margin-top: 5mm; margin-left: 3mm}
+</style>
+</head>
+<body>
+<body lang=EN-US link=blue vlink=purple>
+<table border=0 cellspacing=5 cellpadding=2 width="100%" >
+ <tr>
+ <td align=LEFT valign=TOP colspan="2" bgcolor="#0080C0"><b><font color="#FFFFFF" face="Arial,Helvetica">About This Plug-in Sub-directory</font></b></td>
+ </tr>
+ <tr>
+ <td>
+<p>4th December, 2001</p>
+<h3>License</h3>
+<p>All content in this plug-in sub-directory ("Content") is made available by Eclipse.org under the following terms and conditions:</p>
+
+<p>The following two files shall be defined as the SWT:</p>
+<ul>
+ <li>libswt-linux-2018.so</li>
+ <li>swt.jar</li>
+</ul>
+
+<p>A. The SWT is licensed to you under the terms and conditions of the <a href="http://www.eclipse.org/legal/cpl-v05.html">Common Public License Version 0.5</a> ("CPL").
+For the purposes of the CPL the term "Program" shall mean the SWT.</p>
+
+<p>B. All other files contained in this sub-directory shall be defined as the GTK+ Binding. The GTK+ Binding contains portions of GTK+ ("Library"). GTK+ is made available
+by The Free Software Foundation. Use of the Library is governed by the terms and conditions of the
+<a href="http://www.gnu.org/licenses/lgpl.html">GNU Lesser General Public License Version 2.1</a> ("LGPL"). Use of the GTK+ Binding on a standalone basis, is also governed
+by the terms and conditions of the LGPL. A copy of the LGPL is provided with the Content.</p>
+
+<p>C. In accordance with Section 6 of the LGPL, you may combine or link a "work that uses the Library" (e.g. the SWT) with the Library to produce a work
+containing portions of the Library (e.g. the GTK+ Binding) and distribute that work under the terms of your choice (e.g. the CPL) provided you comply with all
+other terms and conditions of Section 6 as well as other Sections of the LGPL. Please note, if you modify the GTK+ Binding such modifications shall be
+governed by the terms and conditions of the LGPL. Also note, the terms of the CPL permit you to modify the combined work and the source code of the combined
+work is provided for debugging purposes so there is no need to reverse engineer the combined work.</p>
+
+<p>If you wish to provide Contributions related to the SWT, such Contributions shall be made under the terms of the CPL. If you wish to make
+Contributions related to the GTK+ Binding such Contributions shall be made under the terms of the LGPL and the CPL (with respect to portions
+of the contribution for which you are the copyright holder).</p>
+</td></tr></table>
+</body>
+</html>
+
+
+
+
+
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/cpl-v05.html b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/cpl-v05.html
new file mode 100644
index 0000000..800c779
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/cpl-v05.html
@@ -0,0 +1,239 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<!-- saved from url=(0041)http://www.eclipse.org/legal/cpl-v05.html -->
+<HTML><HEAD><TITLE>Common Public License Version 0.5</TITLE>
+<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
+<META content="MSHTML 5.00.3315.2870" name=GENERATOR></HEAD>
+<BODY bgColor=#ffffff>
+<DIV align=center>
+<P>
+<TABLE border=0 cellPadding=10 cellSpacing=10 width="90%">
+ <TBODY>
+ <TR>
+ <TD vAlign=top width="75%"><FONT face="Arial, Helvetica, sans serif"
+ size=3>
+ <H1>Common Public License Version 0.5</H1><TT>
+ <P><FONT face="Courier New, Courier, mono">THE ACCOMPANYING PROGRAM IS
+ PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY
+ USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S
+ ACCEPTANCE OF THIS AGREEMENT. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><B>1. DEFINITIONS
+ </B></FONT></P>
+ <P><FONT face="Courier New, Courier, mono">"Contribution"
+means:</FONT></P>
+ <BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">a) in the case of the initial
+ Contributor, the initial code and documentation distributed under this
+ Agreement, and </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">b) in the case of each
+ subsequent Contributor:</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">i) changes to the Program,
+ and</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">ii) additions to the
+ Program;</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">where such changes and/or
+ additions to the Program originate from and are distributed by that
+ particular Contributor. A Contribution 'originates' from a Contributor
+ if it was added to the Program by such Contributor itself or anyone
+ acting on such Contributor's behalf. Contributions do not include
+ additions to the Program which: (i) are separate modules of software
+ distributed in conjunction with the Program under their own license
+ agreement, and (ii) are not derivative works of the
+ Program.</FONT></P></BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">"Contributor" means any person
+ or entity that distributes the Program. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">"Licensed Patents " mean patent
+ claims licensable by a Contributor which are necessarily infringed by the
+ use or sale of its Contribution alone or when combined with the
+ Program.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">"Program" means the
+ Contributions distributed in accordance with this Agreement. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">"Recipient" means anyone who
+ receives the Program under this Agreement, including all Contributors.
+ </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><B>2. GRANT OF
+ RIGHTS</B></FONT></P>
+ <BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">a) Subject to the terms of
+ this Agreement, each Contributor hereby grants Recipient a
+ non-exclusive, worldwide, royalty-free copyright license to reproduce,
+ prepare derivative works of, publicly display, publicly perform,
+ distribute and sublicense the Contribution of such Contributor, if any,
+ and such derivative works, in source code and object code
+ form.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">b) Subject to the terms of
+ this Agreement, each Contributor hereby grants Recipient a
+ non-exclusive, worldwide, royalty-free patent license under Licensed
+ Patents to make, use, sell, offer to sell, import and otherwise transfer
+ the Contribution of such Contributor, if any, in source code and object
+ code form. This patent license shall apply to the combination of the
+ Contribution and the Program if, at the time the Contribution is added
+ by the Contributor, such addition of the Contribution causes such
+ combination to be covered by the Licensed Patents. The patent license
+ shall not apply to any other combinations which include the
+ Contribution. No hardware per se is licensed hereunder.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">c) Recipient understands that
+ although each Contributor grants the licenses to its Contributions set
+ forth herein, no assurances are provided by any Contributor that the
+ Program does not infringe the patent or other intellectual property
+ rights of any other entity. Each Contributor disclaims any liability to
+ Recipient for claims brought by any other entity based on infringement
+ of intellectual property rights or otherwise. As a condition to
+ exercising the rights and licenses granted hereunder, each Recipient
+ hereby assumes sole responsibility to secure any other intellectual
+ property rights needed, if any. For example, if a third party patent
+ license is required to allow Recipient to distribute the Program, it is
+ Recipient's responsibility to acquire that license before distributing
+ the Program.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">d) Each Contributor
+ represents that to its knowledge it has sufficient copyright rights in
+ its Contribution, if any, to grant the copyright license set forth in
+ this Agreement.</FONT></P></BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>3.
+ REQUIREMENTS</STRONG> </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">A Contributor may choose to
+ distribute the Program in object code form under its own license
+ agreement, provided that: </FONT></P>
+ <BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">a) it complies with the terms
+ and conditions of this Agreement; and</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">b) its license
+ agreement:</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">i) effectively disclaims on
+ behalf of all Contributors all warranties and conditions, express and
+ implied, including warranties or conditions of title and
+ non-infringement, and implied warranties or conditions of
+ merchantability and fitness for a particular purpose; </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">ii) effectively excludes on
+ behalf of all Contributors all liability for damages, including direct,
+ indirect, special, incidental and consequential damages, such as lost
+ profits; </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">iii) states that any
+ provisions which differ from this Agreement are offered by that
+ Contributor alone and not by any other party; and </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">iv) states that source code
+ for the Program is available from such Contributor, and informs
+ licensees how to obtain it in a reasonable manner on or through a medium
+ customarily used for software exchange. </FONT></P></BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">When the Program is made
+ available in source code form:</FONT></P>
+ <BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">a) it must be made available
+ under this Agreement; and</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">b) a copy of this Agreement
+ must be included with each copy of the Program. </FONT></P></BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">Contributors may not remove or
+ alter any copyright notices contained within the Program.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">Each Contributor must identify
+ itself as the originator of its Contribution, if any, in a manner that
+ reasonably allows subsequent Recipients to identify the originator of the
+ Contribution. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>4. COMMERCIAL
+ DISTRIBUTION</STRONG> </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">Commercial distributors of
+ software may accept certain responsibilities with respect to end users,
+ business partners and the like. While this license is intended to
+ facilitate the commercial use of the Program, the Contributor who includes
+ the Program in a commercial product offering should do so in a manner
+ which does not create potential liability for other Contributors.
+ Therefore, if a Contributor includes the Program in a commercial product
+ offering, such Contributor ("Commercial Contributor") hereby agrees to
+ defend and indemnify every other Contributor ("Indemnified Contributor")
+ against any losses, damages and costs (collectively "Losses") arising from
+ claims, lawsuits and other legal actions brought by a third party against
+ the Indemnified Contributor to the extent caused by the acts or omissions
+ of such Commercial Contributor in connection with its distribution of the
+ Program in a commercial product offering. The obligations in this section
+ do not apply to any claims or Losses relating to any actual or alleged
+ intellectual property infringement. In order to qualify, an Indemnified
+ Contributor must: a) promptly notify the Commercial Contributor in writing
+ of such claim, and b) allow the Commercial Contributor to control, and
+ cooperate with the Commercial Contributor in, the defense and any related
+ settlement negotiations. The Indemnified Contributor may participate in
+ any such claim at its own expense. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">For example, a Contributor
+ might include the Program in a commercial product offering, Product X.
+ That Contributor is then a Commercial Contributor. If that Commercial
+ Contributor then makes performance claims, or offers warranties related to
+ Product X, those performance claims and warranties are such Commercial
+ Contributor's responsibility alone. Under this section, the Commercial
+ Contributor would have to defend claims against the other Contributors
+ related to those performance claims and warranties, and if a court
+ requires any other Contributor to pay any damages as a result, the
+ Commercial Contributor must pay those damages. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>5. NO
+ WARRANTY</STRONG></FONT></P>
+ <P><FONT face="Courier New, Courier, mono">EXCEPT AS EXPRESSLY SET FORTH
+ IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+ WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+ WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+ NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ Each Recipient is solely responsible for determining the appropriateness
+ of using and distributing the Program and assumes all risks associated
+ with its exercise of rights under this Agreement, including but not
+ limited to the risks and costs of program errors, compliance with
+ applicable laws, damage to or loss of data, programs or equipment, and
+ unavailability or interruption of operations. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>6. DISCLAIMER OF
+ LIABILITY </STRONG></FONT></P>
+ <P><FONT face="Courier New, Courier, mono">EXCEPT AS EXPRESSLY SET FORTH
+ IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY
+ LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY
+ RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>7.
+ GENERAL</STRONG></FONT></P>
+ <P><FONT face="Courier New, Courier, mono">If any provision of this
+ Agreement is invalid or unenforceable under applicable law, it shall not
+ affect the validity or enforceability of the remainder of the terms of
+ this Agreement, and without further action by the parties hereto, such
+ provision shall be reformed to the minimum extent necessary to make such
+ provision valid and enforceable. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">If Recipient institutes patent
+ litigation against a Contributor with respect to a patent applicable to
+ software (including a cross-claim or counterclaim in a lawsuit), then any
+ patent licenses granted by that Contributor to such Recipient under this
+ Agreement shall terminate as of the date such litigation is filed. In
+ addition, If Recipient institutes patent litigation against any entity
+ (including a cross-claim or counterclaim in a lawsuit) alleging that the
+ Program itself (excluding combinations of the Program with other software
+ or hardware) infringes such Recipient's patent(s), then such Recipient's
+ rights granted under Section 2(b) shall terminate as of the date such
+ litigation is filed.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">All Recipient's rights under
+ this Agreement shall terminate if it fails to comply with any of the
+ material terms or conditions of this Agreement and does not cure such
+ failure in a reasonable period of time after becoming aware of such
+ noncompliance. If all Recipient's rights under this Agreement terminate,
+ Recipient agrees to cease use and distribution of the Program as soon as
+ reasonably practicable. However, Recipient's obligations under this
+ Agreement and any licenses granted by Recipient relating to the Program
+ shall continue and survive. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">Everyone is permitted to copy
+ and distribute copies of this Agreement, but in order to avoid
+ inconsistency the Agreement is copyrighted and may only be modified in the
+ following manner. The Agreement Steward reserves the right to publish new
+ versions (including revisions) of this Agreement from time to time. No one
+ other than the Agreement Steward has the right to modify this Agreement.
+ IBM is the initial Agreement Steward. IBM may assign the responsibility to
+ serve as the Agreement Steward to a suitable separate entity. Each new
+ version of the Agreement will be given a distinguishing version number.
+ The Program (including Contributions) may always be distributed subject to
+ the version of the Agreement under which it was received. In addition,
+ after a new version of the Agreement is published, Contributor may elect
+ to distribute the Program (including its Contributions) under the new
+ version. Except as expressly stated in Sections 2(a) and 2(b) above,
+ Recipient receives no rights or licenses to the intellectual property of
+ any Contributor under this Agreement, whether expressly, by implication,
+ estoppel or otherwise. All rights in the Program not expressly granted
+ under this Agreement are reserved. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">This Agreement is governed by
+ the laws of the State of New York and the intellectual property laws of
+ the United States of America. No party to this Agreement will bring a
+ legal action under this Agreement more than one year after the cause of
+ action arose. Each party waives its rights to a jury trial in any
+ resulting litigation.</FONT></P></TT></FONT></TD></TR></TBODY></TABLE>
+<P></P></DIV></BODY></HTML>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/lgpl-v21.txt b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/lgpl-v21.txt
new file mode 100644
index 0000000..3f50d04
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/lgpl-v21.txt
@@ -0,0 +1,506 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
+
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/build.csh b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/build.csh
new file mode 100644
index 0000000..05e11d1
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/build.csh
Binary files differ
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_gtk.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_gtk.mak
new file mode 100644
index 0000000..b2f9488
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_gtk.mak
@@ -0,0 +1,132 @@
+# Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+#
+# The contents of this file are made available under the terms
+# of the GNU Lesser General Public License (LGPL) Version 2.1 that
+# accompanies this distribution (lgpl-v21.txt). The LGPL is also
+# available at http://www.gnu.org/licenses/lgpl.html. If the version
+# of the LGPL at http://www.gnu.org is different to the version of
+# the LGPL accompanying this distribution and there is any conflict
+# between the two license versions, the terms of the LGPL accompanying
+# this distribution shall govern.
+#
+# Makefile for creating SWT libraries on Linux
+
+include make_common.mak
+
+SWT_VERSION=$(maj_ver)$(min_ver)
+
+
+# Define the installation directories for various products.
+# Your system may have these in a different place.
+# IVE_HOME - IBM's version of Java (J9)
+IVE_HOME = /bluebird/teamswt/swt-builddir/ive
+#IVE_HOME = /opt/IBMvame1.4/ive
+
+JAVA_JNI=$(IVE_HOME)/bin/include
+JAVAH=$(IVE_HOME)/bin/javah
+LD_LIBRARY_PATH=$(IVE_HOME)/bin
+
+# Define the various DLL (shared) libraries to be made.
+
+SWT_PREFIX = swt
+OS_PREFIX = linux
+SWT_DLL = lib$(SWT_PREFIX)-$(OS_PREFIX)-$(SWT_VERSION).so
+SWTPI_DLL = lib$(SWT_PREFIX)-pi-$(OS_PREFIX)-$(SWT_VERSION).so
+
+GNOME_PREFIX = swt-gnome
+GNOME_DLL = lib$(GNOME_PREFIX)-$(OS_PREFIX)-$(SWT_VERSION).so
+GNOME_LIB = -x -shared \
+ -L/usr/lib \
+ -lgnome -lglib \
+ -lm -ldl
+
+PIXBUF_PREFIX = swt-pixbuf
+PIXBUF_DLL = lib$(PIXBUF_PREFIX)-$(OS_PREFIX)-$(SWT_VERSION).so
+
+
+#
+# Target Rules
+#
+
+all: make_swt make_pixbuf # make_gnome
+
+make_swt: $(SWT_DLL) $(SWTPI_DLL)
+
+#make_gnome: $(GNOME_DLL)
+
+make_pixbuf: $(PIXBUF_DLL)
+
+
+# All about Linking
+
+$(SWT_DLL): callback.o
+ ld -x -shared \
+ -o $(SWT_DLL) callback.o
+
+# Note: your setup may be different. Consult `gtk-config --libs`
+$(SWTPI_DLL): swt.o structs.o
+ ld -x -shared \
+ -L/usr/lib -L/usr/X11R6/lib \
+ -lgtk -lgdk -lgmodule -lglib \
+ -ldl -lXi -lXext -lX11 -lm -lc \
+ -o $(SWTPI_DLL) swt.o structs.o
+
+#$(GNOME_DLL): gnome.o
+# ld -o $@ gnome.o $(GNOME_LIB)
+
+$(PIXBUF_DLL): pixbuf.o
+ ld -x -shared \
+ -L/usr/lib -L/usr/X11R6/lib \
+ -lgdk_pixbuf \
+ -lgtk -lgdk -lgmodule -lglib \
+ -ldl -lXi -lXext -lX11 -lm -lc \
+ -o $(PIXBUF_DLL) pixbuf.o
+
+
+# All about Compiling
+
+SWT_C_FLAGS = -c -O -s \
+ -DSWT_VERSION=$(SWT_VERSION) \
+ -DLINUX -DGTK \
+ -fpic \
+ -I$(JAVA_JNI) \
+ `gtk-config --cflags`
+
+SWT_PIXBUF_FLAGS = -c -O -s \
+ -DSWT_VERSION=$(SWT_VERSION) \
+ -DLINUX -DGTK \
+ -fpic \
+ -I$(JAVA_JNI) \
+ -I/usr/include/gdk-pixbuf \
+ `gtk-config --cflags`
+
+SWT_GNOME_FLAGS = -c -O -s \
+ -DSWT_VERSION=$(SWT_VERSION) \
+ -DLINUX -DGTK \
+ -fpic \
+ -I$(JAVA_JNI) \
+ `gnome-config --cflags gnome`
+
+swt.o: swt.c swt.h
+ gcc $(SWT_C_FLAGS) swt.c
+
+structs.o: structs.c
+ gcc $(SWT_C_FLAGS) structs.c
+
+callback.o: callback.c
+ gcc $(SWT_C_FLAGS) callback.c
+
+globals.o: globals.c
+ gcc $(SWT_C_FLAGS) globals.c
+
+library.o: library.c
+ gcc $(SWT_C_FLAGS) library.c
+
+pixbuf.o: pixbuf.c
+ gcc $(SWT_PIXBUF_FLAGS) pixbuf.c
+
+#gnome.o: gnome.c
+# gcc $(SWT_GNOME_FLAGS) gnome.c
+
+clean:
+ rm -f *.o *.so
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/pixbuf.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/pixbuf.c
new file mode 100644
index 0000000..f624fe3
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/pixbuf.c
@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+#include "swt.h"
+#include <gtk/gtk.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_get_colorspace
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1colorspace
+ (JNIEnv *env, jclass cl, jint pixbuf)
+{
+ return (jint) gdk_pixbuf_get_colorspace((GdkPixbuf*)pixbuf);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_get_n_channels
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1n_1channels
+ (JNIEnv *env, jclass cl, jint pixbuf)
+{
+ return (jint) gdk_pixbuf_get_n_channels((GdkPixbuf*)pixbuf);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_get_has_alpha
+ * Signature: (I)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1has_1alpha
+ (JNIEnv *env, jclass cl, jint pixbuf)
+{
+ return (jboolean) gdk_pixbuf_get_has_alpha((GdkPixbuf*)pixbuf);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_get_bits_per_sample
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1bits_1per_1sample
+ (JNIEnv *env, jclass cl, jint pixbuf)
+{
+ return (jint) gdk_pixbuf_get_bits_per_sample((GdkPixbuf*)pixbuf);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_get_pixels
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1pixels
+ (JNIEnv *env, jclass cl, jint pixbuf)
+{
+ return (jint) gdk_pixbuf_get_pixels((GdkPixbuf*)pixbuf);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_get_width
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1width
+ (JNIEnv *env, jclass cl, jint pixbuf)
+{
+ return (jint) gdk_pixbuf_get_width((GdkPixbuf*)pixbuf);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_get_height
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1height
+ (JNIEnv *env, jclass cl, jint pixbuf)
+{
+ return (jint) gdk_pixbuf_get_height((GdkPixbuf*)pixbuf);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_get_rowstride
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1rowstride
+ (JNIEnv *env, jclass cl, jint pixbuf)
+{
+ return (jint) gdk_pixbuf_get_rowstride((GdkPixbuf*)pixbuf);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_new
+ * Signature: (IZIII)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1new
+ (JNIEnv *env, jclass cl,
+ jint colorspace,
+ jboolean hasAlpha,
+ jint bpc,
+ jint width, jint height)
+{
+ return (jint) gdk_pixbuf_new (
+ colorspace,
+ (gboolean) hasAlpha,
+ bpc,
+ width, height
+ );
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_copy
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1copy
+ (JNIEnv *env, jclass cl, jint source) {
+ return (jint)gdk_pixbuf_copy ((GdkPixbuf*) source);
+}
+
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_render_to_drawable
+ * Signature: (IIIIIIIIIIII)V
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1render_1to_1drawable
+ (JNIEnv *env, jclass cl,
+ jint pixbuf,
+ jint drawable,
+ jint gc,
+ jint src_x, jint src_y,
+ jint dest_x, jint dest_y,
+ jint width, jint height,
+ jint dithering,
+ jint x_dither, jint y_dither) {
+ gdk_pixbuf_render_to_drawable (
+ (GdkPixbuf*) pixbuf,
+ (GdkDrawable*) drawable,
+ (GdkGC*) gc,
+ src_x, src_y,
+ dest_x, dest_y,
+ width, height,
+ dithering,
+ x_dither, y_dither
+ );
+}
+
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_render_to_drawable_alpha
+ * Signature: (IIIIIIIIIIIII)V
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1render_1to_1drawable_1alpha
+ (JNIEnv *env, jclass cl,
+ jint pixbuf,
+ jint drawable,
+ jint src_x, jint src_y, jint dest_x, jint dest_y,
+ jint width, jint height,
+ jint alphaMode,
+ jint alphaThreshold,
+ jint dithering,
+ jint x_dither, jint y_dither)
+{
+ gdk_pixbuf_render_to_drawable_alpha (
+ (GdkPixbuf*) pixbuf,
+ (GdkDrawable*) drawable,
+ src_x, src_y,
+ dest_x, dest_y,
+ width, height,
+ alphaMode,
+ alphaThreshold,
+ dithering,
+ x_dither, y_dither
+ );
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_scale
+ * Signature: (IIIIIIDDDDI)V
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1scale
+ (JNIEnv *env, jclass cl,
+ jint source, jint dest,
+ jint dest_x, jint dest_y,
+ jint dest_width, jint dest_height,
+ jdouble offset_x, jdouble offset_y,
+ jdouble scale_x, jdouble scale_y,
+ jint interp_type) {
+ gdk_pixbuf_scale ((GdkPixbuf*)source, (GdkPixbuf*)dest,
+ dest_x, dest_y,
+ dest_width, dest_height,
+ offset_x, offset_y,
+ scale_x, scale_y,
+ interp_type
+ );
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_get_from_drawable
+ * Signature: (IIIIIIIII)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1from_1drawable
+ (JNIEnv *env, jclass cl,
+ jint dest, jint src, jint cmap,
+ jint src_x, jint src_y,
+ jint dest_x, jint dest_y,
+ jint width, jint height)
+{
+ gdk_pixbuf_get_from_drawable (
+ (GdkPixbuf*) dest,
+ (GdkDrawable*) src,
+ (GdkColormap*) cmap,
+ src_x, src_y,
+ dest_x, dest_y,
+ width, height);
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.c
new file mode 100644
index 0000000..db094ff
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.c
@@ -0,0 +1,2663 @@
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+/**
+ * JNI SWT object field getters and setters declarations for Windows structs
+ */
+
+#include "swt.h"
+#include "structs.h"
+
+/* Globals */
+GdkColor_FID_CACHE GdkColorFc;
+GdkEventKey_FID_CACHE GdkEventKeyFc;
+GdkEventButton_FID_CACHE GdkEventButtonFc;
+GdkEventMotion_FID_CACHE GdkEventMotionFc;
+GdkEventExpose_FID_CACHE GdkEventExposeFc;
+GdkFont_FID_CACHE GdkFontFc;
+GdkGCValues_FID_CACHE GdkGCValuesFc;
+GdkImage_FID_CACHE GdkImageFc;
+GdkPoint_FID_CACHE GdkPointFc;
+GdkRectangle_FID_CACHE GdkRectangleFc;
+GdkVisual_FID_CACHE GdkVisualFc;
+GtkObject_FID_CACHE GtkObjectFc;
+GtkData_FID_CACHE GtkDataFc;
+GtkAdjustment_FID_CACHE GtkAdjustmentFc;
+GtkAllocation_FID_CACHE GtkAllocationFc;
+GtkWidget_FID_CACHE GtkWidgetFc;
+GtkContainer_FID_CACHE GtkContainerFc;
+GtkBin_FID_CACHE GtkBinFc;
+GtkMenu_FID_CACHE GtkMenuFc;
+GtkItem_FID_CACHE GtkItemFc;
+GtkMenuShell_FID_CACHE GtkMenuShellFc;
+GtkMenuItem_FID_CACHE GtkMenuItemFc;
+GtkCheckMenuItem_FID_CACHE GtkCheckMenuItemFc;
+GtkWindow_FID_CACHE GtkWindowFc;
+GtkColorSelectionDialog_FID_CACHE GtkColorSelectionDialogFc;\
+GtkBox_FID_CACHE GtkBoxFc;
+GtkHBox_FID_CACHE GtkHBoxFc;
+GtkCombo_FID_CACHE GtkComboFc;
+GtkFileSelection_FID_CACHE GtkFileSelectionFc;
+GtkFrame_FID_CACHE GtkFrameFc;
+GtkFontSelectionDialog_FID_CACHE GtkFontSelectionDialogFc;
+GtkCList_FID_CACHE GtkCListFc;
+GtkEditable_FID_CACHE GtkEditableFc;
+GtkText_FID_CACHE GtkTextFc;
+GtkProgress_FID_CACHE GtkProgressFc;
+GtkProgressBar_FID_CACHE GtkProgressBarFc;
+GtkArg_FID_CACHE GtkArgFc;
+GtkRequisition_FID_CACHE GtkRequisitionFc;
+GtkStyle_FID_CACHE GtkStyleFc;
+GtkStyleClass_FID_CACHE GtkStyleClassFc;
+GtkCListRow_FID_CACHE GtkCListRowFc;
+GtkCListColumn_FID_CACHE GtkCListColumnFc;
+GtkCTreeRow_FID_CACHE GtkCTreeRowFc;
+GtkCTree_FID_CACHE GtkCTreeFc;
+
+/* ----------- fid and class caches ----------- */
+/*
+ * Used for Java objects passed into JNI that are
+ * declared like:
+ *
+ * nativeFunction (Rectangle p1, Rectangle p2, Rectangle p3)
+ *
+ * and not like this
+ *
+ * nativeFunction (Object p1, Object p2, Object p3)
+ *
+ *
+ */
+void cacheGdkColorFids(JNIEnv *env, jobject lpGdkColor, PGdkColor_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkColorClass = (*env)->GetObjectClass(env, lpGdkColor);
+
+ lpCache->pixel = (*env)->GetFieldID(env, lpCache->GdkColorClass, "pixel", "I");
+ lpCache->red = (*env)->GetFieldID(env, lpCache->GdkColorClass, "red", "S");
+ lpCache->green = (*env)->GetFieldID(env, lpCache->GdkColorClass, "green", "S");
+ lpCache->blue = (*env)->GetFieldID(env, lpCache->GdkColorClass, "blue", "S");
+ lpCache->cached = 1;
+};
+
+void cacheGdkEventKeyFids(JNIEnv *env, jobject lpGdkEventKey, PGdkEventKey_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkEventKeyClass = (*env)->GetObjectClass(env, lpGdkEventKey);
+
+ lpCache->type = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "type", "I");
+ lpCache->window = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "window", "I");
+ lpCache->send_event = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "send_event", "B");
+ lpCache->time = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "time", "I");
+ lpCache->state = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "state", "I");
+ lpCache->keyval = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "keyval", "I");
+ lpCache->length = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "length", "I");
+ lpCache->string = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "string", "I");
+ lpCache->cached = 1;
+};
+
+void cacheGdkEventButtonFids(JNIEnv *env, jobject lpGdkEventButton, PGdkEventButton_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkEventButtonClass = (*env)->GetObjectClass(env, lpGdkEventButton);
+ lpCache->type = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "type", "I");
+ lpCache->window = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "window", "I");
+ lpCache->send_event = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "send_event", "B");
+ lpCache->time = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "time", "I");
+ lpCache->x = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "x", "J");
+ lpCache->y = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "y", "J");
+ lpCache->pressure = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "pressure", "J");
+ lpCache->xtilt = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "xtilt", "J");
+ lpCache->ytilt = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "ytilt", "J");
+ lpCache->state = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "state", "I");
+ lpCache->button = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "button", "I");
+ lpCache->source = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "source", "I");
+ lpCache->deviceid = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "deviceid", "I");
+ lpCache->x_root = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "x_root", "J");
+ lpCache->y_root = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "y_root", "J");
+
+ lpCache->cached = 1;
+};
+
+void cacheGdkEventMotionFids(JNIEnv *env, jobject lpGdkEventMotion, PGdkEventMotion_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkEventMotionClass = (*env)->GetObjectClass(env, lpGdkEventMotion);
+ lpCache->type = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "type", "I");
+ lpCache->window = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "window", "I");
+ lpCache->send_event = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "send_event", "B");
+ lpCache->time = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "time", "I");
+ lpCache->x = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "x", "J");
+ lpCache->y = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "y", "J");
+ lpCache->pressure = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "pressure", "J");
+ lpCache->xtilt = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "xtilt", "J");
+ lpCache->ytilt = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "ytilt", "J");
+ lpCache->state = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "state", "I");
+ lpCache->is_hint = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "is_hint", "I");
+ lpCache->source = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "source", "I");
+ lpCache->deviceid = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "deviceid", "I");
+ lpCache->x_root = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "x_root", "J");
+ lpCache->y_root = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "y_root", "J");
+
+ lpCache->cached = 1;
+};
+
+void cacheGdkEventExposeFids(JNIEnv *env, jobject lpGdkEventExpose, PGdkEventExpose_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkEventExposeClass = (*env)->GetObjectClass(env, lpGdkEventExpose);
+ lpCache->type = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "type", "I");
+ lpCache->window = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "window", "I");
+ lpCache->send_event = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "send_event", "B");
+ lpCache->x = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "x", "S");
+ lpCache->y = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "y", "S");
+ lpCache->width = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "width", "S");
+ lpCache->height = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "height", "S");
+ lpCache->count = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "count", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGdkFontFids(JNIEnv *env, jobject lpGdkFont, PGdkFont_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkFontClass = (*env)->GetObjectClass(env, lpGdkFont);
+ lpCache->type = (*env)->GetFieldID(env, lpCache->GdkFontClass, "type", "I");
+ lpCache->ascent = (*env)->GetFieldID(env, lpCache->GdkFontClass, "ascent", "I");
+ lpCache->descent = (*env)->GetFieldID(env, lpCache->GdkFontClass, "descent", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGdkGCValuesFids(JNIEnv *env, jobject lpGdkGCValues, PGdkGCValues_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkGCValuesClass = (*env)->GetObjectClass(env, lpGdkGCValues);
+
+ lpCache->foreground_pixel = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "foreground_pixel", "I");
+ lpCache->foreground_red = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "foreground_red", "S");
+ lpCache->foreground_green = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "foreground_green", "S");
+ lpCache->foreground_blue = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "foreground_blue", "S");
+ lpCache->background_pixel = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "background_pixel", "I");
+ lpCache->background_red = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "background_red", "S");
+ lpCache->background_green = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "background_green", "S");
+ lpCache->background_blue = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "background_blue", "S");
+ lpCache->font = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "font", "I");
+ lpCache->function = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "function", "I");
+ lpCache->fill = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "fill", "I");
+ lpCache->tile = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "tile", "I");
+ lpCache->stipple = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "stipple", "I");
+ lpCache->clip_mask = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "clip_mask", "I");
+ lpCache->subwindow_mode = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "subwindow_mode", "I");
+ lpCache->ts_x_origin = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "ts_x_origin", "I");
+ lpCache->ts_y_origin = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "ts_y_origin", "I");
+ lpCache->clip_x_origin = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "clip_x_origin", "I");
+ lpCache->clip_y_origin = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "clip_y_origin", "I");
+ lpCache->graphics_exposures = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "graphics_exposures", "I");
+ lpCache->line_width = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "line_width", "I");
+ lpCache->line_style = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "line_style", "I");
+ lpCache->cap_style = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "cap_style", "I");
+ lpCache->join_style = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "join_style", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGdkImageFids(JNIEnv *env, jobject lpGdkImage, PGdkImage_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkImageClass = (*env)->GetObjectClass(env, lpGdkImage);
+ lpCache->type = (*env)->GetFieldID(env, lpCache->GdkImageClass, "type", "I");
+ lpCache->visual = (*env)->GetFieldID(env, lpCache->GdkImageClass, "visual", "I");
+ lpCache->byte_order = (*env)->GetFieldID(env, lpCache->GdkImageClass, "byte_order", "I");
+ lpCache->width = (*env)->GetFieldID(env, lpCache->GdkImageClass, "width", "S");
+ lpCache->height = (*env)->GetFieldID(env, lpCache->GdkImageClass, "height", "S");
+ lpCache->depth = (*env)->GetFieldID(env, lpCache->GdkImageClass, "depth", "S");
+ lpCache->bpp = (*env)->GetFieldID(env, lpCache->GdkImageClass, "bpp", "S");
+ lpCache->bpl = (*env)->GetFieldID(env, lpCache->GdkImageClass, "bpl", "S");
+ lpCache->mem = (*env)->GetFieldID(env, lpCache->GdkImageClass, "mem", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGdkPointFids(JNIEnv *env, jobject lpGdkPoint, PGdkPoint_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkPointClass = (*env)->GetObjectClass(env, lpGdkPoint);
+ lpCache->x = (*env)->GetFieldID(env, lpCache->GdkPointClass, "x", "S");
+ lpCache->y = (*env)->GetFieldID(env, lpCache->GdkPointClass, "y", "S");
+
+ lpCache->cached = 1;
+};
+
+void cacheGdkRectangleFids(JNIEnv *env, jobject lpGdkRectangle, PGdkRectangle_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkRectangleClass = (*env)->GetObjectClass(env, lpGdkRectangle);
+ lpCache->x = (*env)->GetFieldID(env, lpCache->GdkRectangleClass, "x", "S");
+ lpCache->y = (*env)->GetFieldID(env, lpCache->GdkRectangleClass, "y", "S");
+ lpCache->width = (*env)->GetFieldID(env, lpCache->GdkRectangleClass, "width", "S");
+ lpCache->height = (*env)->GetFieldID(env, lpCache->GdkRectangleClass, "height", "S");
+
+ lpCache->cached = 1;
+};
+
+void cacheGdkVisualFids(JNIEnv *env, jobject lpGdkVisual, PGdkVisual_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkVisualClass = (*env)->GetObjectClass(env, lpGdkVisual);
+ lpCache->type = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "type", "I");
+ lpCache->depth = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "depth", "I");
+ lpCache->byte_order = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "byte_order", "I");
+ lpCache->colormap_size = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "colormap_size", "I");
+ lpCache->bits_per_rgb = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "bits_per_rgb", "I");
+ lpCache->red_mask = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "red_mask", "I");
+ lpCache->red_shift = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "red_shift", "I");
+ lpCache->red_prec = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "red_prec", "I");
+ lpCache->green_mask = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "green_mask", "I");
+ lpCache->green_shift = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "green_shift", "I");
+ lpCache->green_prec = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "green_prec", "I");
+ lpCache->blue_mask = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "blue_mask", "I");
+ lpCache->blue_shift = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "blue_shift", "I");
+ lpCache->blue_prec = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "blue_prec", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkAllocationFids(JNIEnv *env, jobject lpGtkAllocation, PGtkAllocation_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GtkAllocationClass = (*env)->GetObjectClass(env, lpGtkAllocation);
+ lpCache->x = (*env)->GetFieldID(env, lpCache->GtkAllocationClass, "x", "S");
+ lpCache->y = (*env)->GetFieldID(env, lpCache->GtkAllocationClass, "y", "S");
+ lpCache->width = (*env)->GetFieldID(env, lpCache->GtkAllocationClass, "width", "S");
+ lpCache->height = (*env)->GetFieldID(env, lpCache->GtkAllocationClass, "height", "S");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkArgFids(JNIEnv *env, jobject lpGtkArg, PGtkArg_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GtkArgClass = (*env)->GetObjectClass(env, lpGtkArg);
+
+ fprintf(stderr, "WARNING: Unimplemented method cacheGtkArgFids.\n");
+ lpCache->cached = 1;
+};
+
+void cacheGtkBinFids(JNIEnv *env, jobject lpGtkBin, PGtkBin_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkBinClass = (*env)->GetObjectClass(env, lpGtkBin);
+ cacheGtkContainerFids(env, lpGtkBin, &PGLOB(GtkContainerFc));
+ lpCache->child = (*env)->GetFieldID(env, lpCache->GtkBinClass, "child", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkCListFids(JNIEnv *env, jobject lpGtkCList, PGtkCList_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkCListClass = (*env)->GetObjectClass(env, lpGtkCList);
+ cacheGtkContainerFids(env, lpGtkCList, &PGLOB(GtkContainerFc));
+ lpCache->clist_flags = (*env)->GetFieldID(env, lpCache->GtkCListClass, "clist_flags", "S");
+ lpCache->row_mem_chunk = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_mem_chunk", "I");
+ lpCache->cell_mem_chunk = (*env)->GetFieldID(env, lpCache->GtkCListClass, "cell_mem_chunk", "I");
+ lpCache->freeze_count = (*env)->GetFieldID(env, lpCache->GtkCListClass, "freeze_count", "I");
+ lpCache->internal_allocation_x = (*env)->GetFieldID(env, lpCache->GtkCListClass, "internal_allocation_x", "S");
+ lpCache->internal_allocation_y = (*env)->GetFieldID(env, lpCache->GtkCListClass, "internal_allocation_y", "S");
+ lpCache->internal_allocation_width = (*env)->GetFieldID(env, lpCache->GtkCListClass, "internal_allocation_width", "S");
+ lpCache->internal_allocation_height = (*env)->GetFieldID(env, lpCache->GtkCListClass, "internal_allocation_height", "S");
+ lpCache->rows = (*env)->GetFieldID(env, lpCache->GtkCListClass, "rows", "I");
+ lpCache->row_center_offset = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_center_offset", "I");
+ lpCache->row_height = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_height", "I");
+ lpCache->row_list = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_list", "I");
+ lpCache->row_list_end = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_list_end", "I");
+ lpCache->columns = (*env)->GetFieldID(env, lpCache->GtkCListClass, "columns", "I");
+ lpCache->column_title_area_x = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column_title_area_x", "S");
+ lpCache->column_title_area_y = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column_title_area_y", "S");
+ lpCache->column_title_area_width = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column_title_area_width", "S");
+ lpCache->column_title_area_height = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column_title_area_height", "S");
+ lpCache->title_window = (*env)->GetFieldID(env, lpCache->GtkCListClass, "title_window", "I");
+ lpCache->column = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column", "I");
+ lpCache->clist_window = (*env)->GetFieldID(env, lpCache->GtkCListClass, "clist_window", "I");
+ lpCache->clist_window_width = (*env)->GetFieldID(env, lpCache->GtkCListClass, "clist_window_width", "I");
+ lpCache->clist_window_height = (*env)->GetFieldID(env, lpCache->GtkCListClass, "clist_window_height", "I");
+ lpCache->hoffset = (*env)->GetFieldID(env, lpCache->GtkCListClass, "hoffset", "I");
+ lpCache->voffset = (*env)->GetFieldID(env, lpCache->GtkCListClass, "voffset", "I");
+ lpCache->shadow_type = (*env)->GetFieldID(env, lpCache->GtkCListClass, "shadow_type", "I");
+ lpCache->selection_mode = (*env)->GetFieldID(env, lpCache->GtkCListClass, "selection_mode", "I");
+ lpCache->selection = (*env)->GetFieldID(env, lpCache->GtkCListClass, "selection", "I");
+ lpCache->selection_end = (*env)->GetFieldID(env, lpCache->GtkCListClass, "selection_end", "I");
+ lpCache->undo_selection = (*env)->GetFieldID(env, lpCache->GtkCListClass, "undo_selection", "I");
+ lpCache->undo_unselection = (*env)->GetFieldID(env, lpCache->GtkCListClass, "undo_unselection", "I");
+ lpCache->undo_anchor = (*env)->GetFieldID(env, lpCache->GtkCListClass, "undo_anchor", "I");
+ lpCache->button_actions0 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions0", "B");
+ lpCache->button_actions1 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions1", "B");
+ lpCache->button_actions2 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions2", "B");
+ lpCache->button_actions3 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions3", "B");
+ lpCache->button_actions4 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions4", "B");
+ lpCache->drag_button = (*env)->GetFieldID(env, lpCache->GtkCListClass, "drag_button", "B");
+ lpCache->click_cell_row = (*env)->GetFieldID(env, lpCache->GtkCListClass, "click_cell_row", "I");
+ lpCache->click_cell_column = (*env)->GetFieldID(env, lpCache->GtkCListClass, "click_cell_column", "I");
+ lpCache->hadjustment = (*env)->GetFieldID(env, lpCache->GtkCListClass, "hadjustment", "I");
+ lpCache->vadjustment = (*env)->GetFieldID(env, lpCache->GtkCListClass, "vadjustment", "I");
+ lpCache->xor_gc = (*env)->GetFieldID(env, lpCache->GtkCListClass, "xor_gc", "I");
+ lpCache->fg_gc = (*env)->GetFieldID(env, lpCache->GtkCListClass, "fg_gc", "I");
+ lpCache->bg_gc = (*env)->GetFieldID(env, lpCache->GtkCListClass, "bg_gc", "I");
+ lpCache->cursor_drag = (*env)->GetFieldID(env, lpCache->GtkCListClass, "cursor_drag", "I");
+ lpCache->x_drag = (*env)->GetFieldID(env, lpCache->GtkCListClass, "x_drag", "I");
+ lpCache->focus_row = (*env)->GetFieldID(env, lpCache->GtkCListClass, "focus_row", "I");
+ lpCache->anchor = (*env)->GetFieldID(env, lpCache->GtkCListClass, "anchor", "I");
+ lpCache->anchor_state = (*env)->GetFieldID(env, lpCache->GtkCListClass, "anchor_state", "I");
+ lpCache->drag_pos = (*env)->GetFieldID(env, lpCache->GtkCListClass, "drag_pos", "I");
+ lpCache->htimer = (*env)->GetFieldID(env, lpCache->GtkCListClass, "htimer", "I");
+ lpCache->vtimer = (*env)->GetFieldID(env, lpCache->GtkCListClass, "vtimer", "I");
+ lpCache->sort_type = (*env)->GetFieldID(env, lpCache->GtkCListClass, "sort_type", "I");
+ lpCache->compare = (*env)->GetFieldID(env, lpCache->GtkCListClass, "compare", "I");
+ lpCache->sort_column = (*env)->GetFieldID(env, lpCache->GtkCListClass, "sort_column", "I");
+
+ lpCache->cached = 1;
+};
+
+
+void cacheGtkColorSelectionDialogFids(JNIEnv *env, jobject lpGtkColorSelectionDialog, PGtkColorSelectionDialog_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkColorSelectionDialogClass = (*env)->GetObjectClass(env, lpGtkColorSelectionDialog);
+ cacheGtkWindowFids(env, lpGtkColorSelectionDialog, &PGLOB(GtkWindowFc));
+ lpCache->colorsel = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "colorsel", "I");
+ lpCache->main_vbox = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "main_vbox", "I");
+ lpCache->ok_button = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "ok_button", "I");
+ lpCache->reset_button = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "reset_button", "I");
+ lpCache->cancel_button = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "cancel_button", "I");
+ lpCache->help_button = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "help_button", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkComboFids(JNIEnv *env, jobject lpGtkCombo, PGtkCombo_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkComboClass = (*env)->GetObjectClass(env, lpGtkCombo);
+ cacheGtkHBoxFids(env, lpGtkCombo, &PGLOB(GtkHBoxFc));
+ lpCache->entry = (*env)->GetFieldID(env, lpCache->GtkComboClass, "entry", "I");
+ lpCache->button = (*env)->GetFieldID(env, lpCache->GtkComboClass, "button", "I");
+ lpCache->popup = (*env)->GetFieldID(env, lpCache->GtkComboClass, "popup", "I");
+ lpCache->popwin = (*env)->GetFieldID(env, lpCache->GtkComboClass, "popwin", "I");
+ lpCache->list = (*env)->GetFieldID(env, lpCache->GtkComboClass, "list", "I");
+ lpCache->entry_change_id = (*env)->GetFieldID(env, lpCache->GtkComboClass, "entry_change_id", "I");
+ lpCache->list_change_id = (*env)->GetFieldID(env, lpCache->GtkComboClass, "list_change_id", "I");
+ lpCache->value_in_list = (*env)->GetFieldID(env, lpCache->GtkComboClass, "value_in_list", "I");
+ lpCache->ok_if_empty = (*env)->GetFieldID(env, lpCache->GtkComboClass, "ok_if_empty", "I");
+ lpCache->case_sensitive = (*env)->GetFieldID(env, lpCache->GtkComboClass, "case_sensitive", "I");
+ lpCache->use_arrows = (*env)->GetFieldID(env, lpCache->GtkComboClass, "use_arrows", "I");
+ lpCache->use_arrows_always = (*env)->GetFieldID(env, lpCache->GtkComboClass, "use_arrows_always", "I");
+ lpCache->current_button = (*env)->GetFieldID(env, lpCache->GtkComboClass, "current_button", "S");
+ lpCache->activate_id = (*env)->GetFieldID(env, lpCache->GtkComboClass, "activate_id", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkContainerFids(JNIEnv *env, jobject lpGtkContainer, PGtkContainer_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkContainerClass = (*env)->GetObjectClass(env, lpGtkContainer);
+ cacheGtkWidgetFids(env, lpGtkContainer, &PGLOB(GtkWidgetFc));
+ lpCache->focus_child = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "focus_child", "I");
+ lpCache->border_width = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "border_width", "I");
+ lpCache->need_resize = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "need_resize", "I");
+ lpCache->resize_mode = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "resize_mode", "I");
+ lpCache->resize_widgets = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "resize_widgets", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkDataFids(JNIEnv *env, jobject lpGtkData, PGtkData_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkDataClass = (*env)->GetObjectClass(env, lpGtkData);
+ cacheGtkObjectFids(env, lpGtkData, &PGLOB(GtkObjectFc));
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkEditableFids(JNIEnv *env, jobject lpGtkEditable, PGtkEditable_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkEditableClass = (*env)->GetObjectClass(env, lpGtkEditable);
+ cacheGtkWidgetFids(env, lpGtkEditable, &PGLOB(GtkWidgetFc));
+ lpCache->current_pos = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "current_pos", "I");
+ lpCache->selection_start_pos = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "selection_start_pos", "I");
+ lpCache->selection_end_pos = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "selection_end_pos", "I");
+ lpCache->has_selection = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "has_selection", "I");
+ lpCache->editable = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "editable", "I");
+ lpCache->visible = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "visible", "I");
+ lpCache->ic = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "ic", "I");
+ lpCache->ic_attr = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "ic_attr", "I");
+ lpCache->clipboard_text = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "clipboard_text", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkTextFids(JNIEnv *env, jobject lpGtkText, PGtkText_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkTextClass = (*env)->GetObjectClass(env, lpGtkText);
+ cacheGtkEditableFids(env, lpGtkText, &PGLOB(GtkEditableFc));
+
+ lpCache->first_line_start_index = (*env)->GetFieldID(env, lpCache->GtkTextClass, "first_line_start_index", "I");
+ lpCache->first_onscreen_hor_pixel = (*env)->GetFieldID(env, lpCache->GtkTextClass, "first_onscreen_hor_pixel", "I");
+ lpCache->first_onscreen_ver_pixel = (*env)->GetFieldID(env, lpCache->GtkTextClass, "first_onscreen_ver_pixel", "I");
+ lpCache->default_tab_width = (*env)->GetFieldID(env, lpCache->GtkTextClass, "default_tab_width", "I");
+ lpCache->cursor_pos_x = (*env)->GetFieldID(env, lpCache->GtkTextClass, "cursor_pos_x", "I");
+ lpCache->cursor_pos_y = (*env)->GetFieldID(env, lpCache->GtkTextClass, "cursor_pos_y", "I");
+ lpCache->cursor_virtual_x = (*env)->GetFieldID(env, lpCache->GtkTextClass, "cursor_virtual_x", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkFileSelectionFids(JNIEnv *env, jobject lpGtkFileSelection, PGtkFileSelection_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkFileSelectionClass = (*env)->GetObjectClass(env, lpGtkFileSelection);
+ cacheGtkWindowFids(env, lpGtkFileSelection, &PGLOB(GtkWindowFc));
+ lpCache->dir_list = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "dir_list", "I");
+ lpCache->file_list = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "file_list", "I");
+ lpCache->selection_entry = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "selection_entry", "I");
+ lpCache->selection_text = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "selection_text", "I");
+ lpCache->main_vbox = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "main_vbox", "I");
+ lpCache->ok_button = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "ok_button", "I");
+ lpCache->cancel_button = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "cancel_button", "I");
+ lpCache->help_button = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "help_button", "I");
+ lpCache->history_pulldown = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "history_pulldown", "I");
+ lpCache->history_menu = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "history_menu", "I");
+ lpCache->history_list = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "history_list", "I");
+ lpCache->fileop_dialog = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_dialog", "I");
+ lpCache->fileop_entry = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_entry", "I");
+ lpCache->fileop_file = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_file", "I");
+ lpCache->cmpl_state = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "cmpl_state", "I");
+ lpCache->fileop_c_dir = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_c_dir", "I");
+ lpCache->fileop_del_file = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_del_file", "I");
+ lpCache->fileop_ren_file = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_ren_file", "I");
+ lpCache->button_area = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "button_area", "I");
+ lpCache->action_area = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "action_area", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkFontSelectionDialogFids(JNIEnv *env, jobject lpGtkFontSelectionDialog, PGtkFontSelectionDialog_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkFontSelectionDialogClass = (*env)->GetObjectClass(env, lpGtkFontSelectionDialog);
+ cacheGtkWindowFids(env, lpGtkFontSelectionDialog, &PGLOB(GtkWindowFc));
+ lpCache->fontsel = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "fontsel", "I");
+ lpCache->main_vbox = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "main_vbox", "I");
+ lpCache->action_area = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "action_area", "I");
+ lpCache->ok_button = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "ok_button", "I");
+ lpCache->apply_button = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "apply_button", "I");
+ lpCache->cancel_button = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "cancel_button", "I");
+ lpCache->dialog_width = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "dialog_width", "I");
+ lpCache->auto_resize = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "auto_resize", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkObjectFids(JNIEnv *env, jobject lpGtkObject, PGtkObject_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GtkObjectClass = (*env)->GetObjectClass(env, lpGtkObject);
+ lpCache->klass = (*env)->GetFieldID(env, lpCache->GtkObjectClass, "klass", "I");
+ lpCache->flags = (*env)->GetFieldID(env, lpCache->GtkObjectClass, "flags", "I");
+ lpCache->ref_count = (*env)->GetFieldID(env, lpCache->GtkObjectClass, "ref_count", "I");
+ lpCache->object_data = (*env)->GetFieldID(env, lpCache->GtkObjectClass, "object_data", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkProgressFids(JNIEnv *env, jobject lpGtkProgress, PGtkProgress_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GtkProgressClass = (*env)->GetObjectClass(env, lpGtkProgress);
+
+ fprintf(stderr, "WARNING: Unimplemented method cacheGtkProgressFids.\n");
+ lpCache->cached = 1;
+};
+
+void cacheGtkProgressBarFids(JNIEnv *env, jobject lpGtkProgressBar, PGtkProgressBar_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkProgressBarClass = (*env)->GetObjectClass(env, lpGtkProgressBar);
+ cacheGtkProgressFids(env, lpGtkProgressBar, &PGLOB(GtkProgressFc));
+ lpCache->bar_style = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "bar_style", "I");
+ lpCache->orientation = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "orientation", "I");
+ lpCache->blocks = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "blocks", "I");
+ lpCache->in_block = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "in_block", "I");
+ lpCache->activity_pos = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "activity_pos", "I");
+ lpCache->activity_step = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "activity_step", "I");
+ lpCache->activity_blocks = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "activity_blocks", "I");
+ lpCache->activity_dir = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "activity_dir", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkRequisitionFids(JNIEnv *env, jobject lpGtkRequisition, PGtkRequisition_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GtkRequisitionClass = (*env)->GetObjectClass(env, lpGtkRequisition);
+ lpCache->width = (*env)->GetFieldID(env, lpCache->GtkRequisitionClass, "width", "S");
+ lpCache->height = (*env)->GetFieldID(env, lpCache->GtkRequisitionClass, "height", "S");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkStyleFids(JNIEnv *env, jobject lpGtkStyle, PGtkStyle_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GtkStyleClazz = (*env)->GetObjectClass(env, lpGtkStyle);
+ lpCache->klass = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "klass", "I");
+ lpCache->fg0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg0_pixel", "I");
+ lpCache->fg0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg0_red", "S");
+ lpCache->fg0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg0_green", "S");
+ lpCache->fg0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg0_blue", "S");
+ lpCache->fg1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg1_pixel", "I");
+ lpCache->fg1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg1_red", "S");
+ lpCache->fg1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg1_green", "S");
+ lpCache->fg1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg1_blue", "S");
+ lpCache->fg2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg2_pixel", "I");
+ lpCache->fg2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg2_red", "S");
+ lpCache->fg2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg2_green", "S");
+ lpCache->fg2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg2_blue", "S");
+ lpCache->fg3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg3_pixel", "I");
+ lpCache->fg3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg3_red", "S");
+ lpCache->fg3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg3_green", "S");
+ lpCache->fg3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg3_blue", "S");
+ lpCache->fg4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg4_pixel", "I");
+ lpCache->fg4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg4_red", "S");
+ lpCache->fg4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg4_green", "S");
+ lpCache->fg4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg4_blue", "S");
+ lpCache->bg0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg0_pixel", "I");
+ lpCache->bg0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg0_red", "S");
+ lpCache->bg0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg0_green", "S");
+ lpCache->bg0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg0_blue", "S");
+ lpCache->bg1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg1_pixel", "I");
+ lpCache->bg1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg1_red", "S");
+ lpCache->bg1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg1_green", "S");
+ lpCache->bg1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg1_blue", "S");
+ lpCache->bg2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg2_pixel", "I");
+ lpCache->bg2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg2_red", "S");
+ lpCache->bg2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg2_green", "S");
+ lpCache->bg2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg2_blue", "S");
+ lpCache->bg3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg3_pixel", "I");
+ lpCache->bg3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg3_red", "S");
+ lpCache->bg3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg3_green", "S");
+ lpCache->bg3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg3_blue", "S");
+ lpCache->bg4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg4_pixel", "I");
+ lpCache->bg4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg4_red", "S");
+ lpCache->bg4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg4_green", "S");
+ lpCache->bg4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg4_blue", "S");
+ lpCache->light0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light0_pixel", "I");
+ lpCache->light0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light0_red", "S");
+ lpCache->light0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light0_green", "S");
+ lpCache->light0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light0_blue", "S");
+ lpCache->light1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light1_pixel", "I");
+ lpCache->light1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light1_red", "S");
+ lpCache->light1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light1_green", "S");
+ lpCache->light1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light1_blue", "S");
+ lpCache->light2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light2_pixel", "I");
+ lpCache->light2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light2_red", "S");
+ lpCache->light2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light2_green", "S");
+ lpCache->light2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light2_blue", "S");
+ lpCache->light3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light3_pixel", "I");
+ lpCache->light3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light3_red", "S");
+ lpCache->light3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light3_green", "S");
+ lpCache->light3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light3_blue", "S");
+ lpCache->light4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light4_pixel", "I");
+ lpCache->light4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light4_red", "S");
+ lpCache->light4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light4_green", "S");
+ lpCache->light4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light4_blue", "S");
+ lpCache->dark0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark0_pixel", "I");
+ lpCache->dark0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark0_red", "S");
+ lpCache->dark0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark0_green", "S");
+ lpCache->dark0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark0_blue", "S");
+ lpCache->dark1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark1_pixel", "I");
+ lpCache->dark1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark1_red", "S");
+ lpCache->dark1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark1_green", "S");
+ lpCache->dark1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark1_blue", "S");
+ lpCache->dark2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark2_pixel", "I");
+ lpCache->dark2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark2_red", "S");
+ lpCache->dark2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark2_green", "S");
+ lpCache->dark2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark2_blue", "S");
+ lpCache->dark3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark3_pixel", "I");
+ lpCache->dark3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark3_red", "S");
+ lpCache->dark3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark3_green", "S");
+ lpCache->dark3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark3_blue", "S");
+ lpCache->dark4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark4_pixel", "I");
+ lpCache->dark4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark4_red", "S");
+ lpCache->dark4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark4_green", "S");
+ lpCache->dark4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark4_blue", "S");
+ lpCache->mid0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid0_pixel", "I");
+ lpCache->mid0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid0_red", "S");
+ lpCache->mid0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid0_green", "S");
+ lpCache->mid0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid0_blue", "S");
+ lpCache->mid1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid1_pixel", "I");
+ lpCache->mid1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid1_red", "S");
+ lpCache->mid1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid1_green", "S");
+ lpCache->mid1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid1_blue", "S");
+ lpCache->mid2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid2_pixel", "I");
+ lpCache->mid2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid2_red", "S");
+ lpCache->mid2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid2_green", "S");
+ lpCache->mid2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid2_blue", "S");
+ lpCache->mid3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid3_pixel", "I");
+ lpCache->mid3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid3_red", "S");
+ lpCache->mid3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid3_green", "S");
+ lpCache->mid3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid3_blue", "S");
+ lpCache->mid4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid4_pixel", "I");
+ lpCache->mid4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid4_red", "S");
+ lpCache->mid4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid4_green", "S");
+ lpCache->mid4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid4_blue", "S");
+ lpCache->text0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text0_pixel", "I");
+ lpCache->text0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text0_red", "S");
+ lpCache->text0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text0_green", "S");
+ lpCache->text0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text0_blue", "S");
+ lpCache->text1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text1_pixel", "I");
+ lpCache->text1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text1_red", "S");
+ lpCache->text1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text1_green", "S");
+ lpCache->text1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text1_blue", "S");
+ lpCache->text2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text2_pixel", "I");
+ lpCache->text2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text2_red", "S");
+ lpCache->text2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text2_green", "S");
+ lpCache->text2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text2_blue", "S");
+ lpCache->text3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text3_pixel", "I");
+ lpCache->text3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text3_red", "S");
+ lpCache->text3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text3_green", "S");
+ lpCache->text3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text3_blue", "S");
+ lpCache->text4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text4_pixel", "I");
+ lpCache->text4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text4_red", "S");
+ lpCache->text4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text4_green", "S");
+ lpCache->text4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text4_blue", "S");
+ lpCache->base0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base0_pixel", "I");
+ lpCache->base0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base0_red", "S");
+ lpCache->base0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base0_green", "S");
+ lpCache->base0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base0_blue", "S");
+ lpCache->base1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base1_pixel", "I");
+ lpCache->base1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base1_red", "S");
+ lpCache->base1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base1_green", "S");
+ lpCache->base1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base1_blue", "S");
+ lpCache->base2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base2_pixel", "I");
+ lpCache->base2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base2_red", "S");
+ lpCache->base2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base2_green", "S");
+ lpCache->base2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base2_blue", "S");
+ lpCache->base3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base3_pixel", "I");
+ lpCache->base3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base3_red", "S");
+ lpCache->base3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base3_green", "S");
+ lpCache->base3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base3_blue", "S");
+ lpCache->base4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base4_pixel", "I");
+ lpCache->base4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base4_red", "S");
+ lpCache->base4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base4_green", "S");
+ lpCache->base4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base4_blue", "S");
+ lpCache->black_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_pixel", "I");
+ lpCache->black_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_red", "S");
+ lpCache->black_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_green", "S");
+ lpCache->black_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_blue", "S");
+ lpCache->white_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_pixel", "I");
+ lpCache->white_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_red", "S");
+ lpCache->white_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_green", "S");
+ lpCache->white_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_blue", "S");
+ lpCache->font = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "font", "I");
+ lpCache->fg_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc0", "I");
+ lpCache->fg_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc1", "I");
+ lpCache->fg_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc2", "I");
+ lpCache->fg_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc3", "I");
+ lpCache->fg_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc4", "I");
+ lpCache->bg_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc0", "I");
+ lpCache->bg_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc1", "I");
+ lpCache->bg_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc2", "I");
+ lpCache->bg_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc3", "I");
+ lpCache->bg_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc4", "I");
+ lpCache->light_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc0", "I");
+ lpCache->light_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc1", "I");
+ lpCache->light_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc2", "I");
+ lpCache->light_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc3", "I");
+ lpCache->light_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc4", "I");
+ lpCache->dark_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc0", "I");
+ lpCache->dark_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc1", "I");
+ lpCache->dark_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc2", "I");
+ lpCache->dark_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc3", "I");
+ lpCache->dark_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc4", "I");
+ lpCache->mid_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc0", "I");
+ lpCache->mid_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc1", "I");
+ lpCache->mid_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc2", "I");
+ lpCache->mid_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc3", "I");
+ lpCache->mid_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc4", "I");
+ lpCache->text_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc0", "I");
+ lpCache->text_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc1", "I");
+ lpCache->text_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc2", "I");
+ lpCache->text_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc3", "I");
+ lpCache->text_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc4", "I");
+ lpCache->base_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc0", "I");
+ lpCache->base_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc1", "I");
+ lpCache->base_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc2", "I");
+ lpCache->base_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc3", "I");
+ lpCache->base_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc4", "I");
+ lpCache->black_gc = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_gc", "I");
+ lpCache->white_gc = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_gc", "I");
+ lpCache->bg_pixmap0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap0", "I");
+ lpCache->bg_pixmap1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap1", "I");
+ lpCache->bg_pixmap2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap2", "I");
+ lpCache->bg_pixmap3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap3", "I");
+ lpCache->bg_pixmap4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap4", "I");
+ lpCache->ref_count = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "ref_count", "I");
+ lpCache->attach_count = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "attach_count", "I");
+ lpCache->depth = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "depth", "I");
+ lpCache->colormap = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "colormap", "I");
+ lpCache->engine = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "engine", "I");
+ lpCache->engine_data = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "engine_data", "I");
+ lpCache->rc_style = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "rc_style", "I");
+ lpCache->styles = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "styles", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkStyleClassFids(JNIEnv *env, jobject lpGtkStyleClass, PGtkStyleClass_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GtkStyleClassClazz = (*env)->GetObjectClass(env, lpGtkStyleClass);
+ lpCache->xthickness = (*env)->GetFieldID(env, lpCache->GtkStyleClassClazz, "xthickness", "I");
+ lpCache->ythickness = (*env)->GetFieldID(env, lpCache->GtkStyleClassClazz, "ythickness", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkWidgetFids(JNIEnv *env, jobject lpGtkWidget, PGtkWidget_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkWidgetClass = (*env)->GetObjectClass(env, lpGtkWidget);
+ cacheGtkObjectFids(env, lpGtkWidget, &PGLOB(GtkObjectFc));
+ lpCache->private_flags = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "private_flags", "S");
+ lpCache->state = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "state", "B");
+ lpCache->saved_state = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "saved_state", "B");
+ lpCache->name = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "name", "I");
+ lpCache->style = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "style", "I");
+ lpCache->req_width = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "req_width", "S");
+ lpCache->req_height = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "req_height", "S");
+ lpCache->alloc_x = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "alloc_x", "S");
+ lpCache->alloc_y = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "alloc_y", "S");
+ lpCache->alloc_width = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "alloc_width", "S");
+ lpCache->alloc_height = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "alloc_height", "S");
+ lpCache->window = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "window", "I");
+ lpCache->parent = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "parent", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkFrameFids(JNIEnv *env, jobject lpGtkFrame, PGtkFrame_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkFrameClass = (*env)->GetObjectClass(env, lpGtkFrame);
+ cacheGtkBinFids(env, lpGtkFrame, &PGLOB(GtkBinFc));
+ lpCache->label = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label", "I");
+ lpCache->shadow_type = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "shadow_type", "S");
+ lpCache->label_width = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label_width", "S");
+ lpCache->label_height = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label_height", "S");
+ lpCache->label_xalign = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label_xalign", "F");
+ lpCache->label_yalign = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label_yalign", "F");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkWindowFids(JNIEnv *env, jobject lpGtkWindow, PGtkWindow_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkWindowClass = (*env)->GetObjectClass(env, lpGtkWindow);
+ cacheGtkBinFids(env, lpGtkWindow, &PGLOB(GtkBinFc));
+ lpCache->title = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "title", "I");
+ lpCache->wmclass_name = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "wmclass_name", "I");
+ lpCache->wmclass_class = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "wmclass_class", "I");
+ lpCache->type = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "type", "I");
+ lpCache->focus_widget = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "focus_widget", "I");
+ lpCache->default_widget = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "default_widget", "I");
+ lpCache->transient_parent = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "transient_parent", "I");
+ lpCache->resize_count = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "resize_count", "S");
+ lpCache->allow_shrink = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "allow_shrink", "I");
+ lpCache->allow_grow = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "allow_grow", "I");
+ lpCache->auto_shrink = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "auto_shrink", "I");
+ lpCache->handling_resize = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "handling_resize", "I");
+ lpCache->position = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "position", "I");
+ lpCache->use_uposition = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "use_uposition", "I");
+ lpCache->modal = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "modal", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkCheckMenuItemFids(JNIEnv *env, jobject lpGtkCheckMenuItem, PGtkCheckMenuItem_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkCheckMenuItemClass = (*env)->GetObjectClass(env, lpGtkCheckMenuItem);
+ cacheGtkMenuItemFids(env, lpGtkCheckMenuItem, &PGLOB(GtkMenuItemFc));
+ lpCache->active = (*env)->GetFieldID(env, lpCache->GtkCheckMenuItemClass, "active", "I");
+ lpCache->always_show_toggle = (*env)->GetFieldID(env, lpCache->GtkCheckMenuItemClass, "always_show_toggle", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkAdjustmentFids(JNIEnv *env, jobject lpGtkAdjustment, PGtkAdjustment_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkAdjustmentClass = (*env)->GetObjectClass(env, lpGtkAdjustment);
+ cacheGtkDataFids(env, lpGtkAdjustment, &PGLOB(GtkDataFc));
+ lpCache->lower = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "lower", "F");
+ lpCache->upper = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "upper", "F");
+ lpCache->value = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "value", "F");
+ lpCache->step_increment = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "step_increment", "F");
+ lpCache->page_increment = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "page_increment", "F");
+ lpCache->page_size = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "page_size", "F");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkBoxFids(JNIEnv *env, jobject lpGtkBox, PGtkBox_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkBoxClass = (*env)->GetObjectClass(env, lpGtkBox);
+ cacheGtkContainerFids(env, lpGtkBox, &PGLOB(GtkContainerFc));
+ lpCache->children = (*env)->GetFieldID(env, lpCache->GtkBoxClass, "children", "I");
+ lpCache->spacing = (*env)->GetFieldID(env, lpCache->GtkBoxClass, "spacing", "S");
+ lpCache->homogeneous = (*env)->GetFieldID(env, lpCache->GtkBoxClass, "homogeneous", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkHBoxFids(JNIEnv *env, jobject lpGtkHBox, PGtkHBox_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkHBoxClass = (*env)->GetObjectClass(env, lpGtkHBox);
+ cacheGtkBoxFids(env, lpGtkHBox, &PGLOB(GtkBoxFc));
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkMenuFids(JNIEnv *env, jobject lpGtkMenu, PGtkMenu_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkMenuClass = (*env)->GetObjectClass(env, lpGtkMenu);
+ cacheGtkMenuShellFids(env, lpGtkMenu, &PGLOB(GtkMenuShellFc));
+ lpCache->parent_menu_item = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "parent_menu_item", "I");
+ lpCache->old_active_menu_item = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "old_active_menu_item", "I");
+ lpCache->accel_group = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "accel_group", "I");
+ lpCache->position_func = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "position_func", "I");
+ lpCache->position_func_data = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "position_func_data", "I");
+ lpCache->toplevel = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "toplevel", "I");
+ lpCache->tearoff_window = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "tearoff_window", "I");
+ lpCache->torn_off = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "torn_off", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkMenuShellFids(JNIEnv *env, jobject lpGtkMenuShell, PGtkMenuShell_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkMenuShellClass = (*env)->GetObjectClass(env, lpGtkMenuShell);
+ cacheGtkContainerFids(env, lpGtkMenuShell, &PGLOB(GtkContainerFc));
+ lpCache->active = (*env)->GetFieldID(env, lpCache->GtkMenuShellClass, "active", "I");
+ lpCache->cached = 1;
+
+};
+
+void cacheGtkItemFids(JNIEnv *env, jobject lpGtkItem, PGtkItem_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkItemClass = (*env)->GetObjectClass(env, lpGtkItem);
+ cacheGtkBinFids(env, lpGtkItem, &PGLOB(GtkBinFc));
+
+ lpCache->cached = 1;
+}
+
+void cacheGtkMenuItemFids(JNIEnv *env, jobject lpGtkMenuItem, PGtkMenuItem_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkMenuItemClass = (*env)->GetObjectClass(env, lpGtkMenuItem);
+ cacheGtkItemFids(env, lpGtkMenuItem, &PGLOB(GtkItemFc));
+ lpCache->submenu = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "submenu", "I");
+ lpCache->accelerator_signal = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "accelerator_signal", "I");
+ lpCache->toggle_size = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "toggle_size", "I");
+ lpCache->accelerator_width = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "accelerator_width", "I");
+ lpCache->show_toggle_indicator = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "show_toggle_indicator", "I");
+ lpCache->show_submenu_indicator = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "show_submenu_indicator", "I");
+ lpCache->submenu_placement = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "submenu_placement", "I");
+ lpCache->submenu_direction = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "submenu_direction", "I");
+ lpCache->right_justify = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "right_justify", "I");
+ lpCache->timer = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "timer", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkCListRowFids(JNIEnv *env, jobject lpGtkCListRow, PGtkCListRow_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GtkCListRowClass = (*env)->GetObjectClass(env, lpGtkCListRow);
+ lpCache->cell = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "cell", "I");
+ lpCache->state = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "state", "I");
+ lpCache->foreground_red = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "foreground_red", "S");
+ lpCache->foreground_green = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "foreground_green", "S");
+ lpCache->foreground_blue = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "foreground_blue", "S");
+ lpCache->foreground_pixel = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "foreground_pixel", "I");
+ lpCache->background_red = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "background_red", "S");
+ lpCache->background_green = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "background_green", "S");
+ lpCache->background_blue = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "background_blue", "S");
+ lpCache->background_pixel = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "background_pixel", "I");
+ lpCache->style = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "style", "I");
+ lpCache->data = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "data", "I");
+ lpCache->destroy = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "destroy", "I");
+ lpCache->fg_set = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "fg_set", "I");
+ lpCache->bg_set = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "bg_set", "I");
+ lpCache->selectable = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "selectable", "I");
+
+ lpCache->cached = 1;
+}
+
+void cacheGtkCListColumnFids(JNIEnv *env, jobject lpGtkCListColumn, PGtkCListColumn_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GtkCListColumnClass = (*env)->GetObjectClass(env, lpGtkCListColumn);
+ lpCache->title = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "title", "I");
+ lpCache->area_x = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "area_x", "S");
+ lpCache->area_y = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "area_y", "S");
+ lpCache->area_width = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "area_width", "S");
+ lpCache->area_height = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "area_height", "S");
+ lpCache->button = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "button", "I");
+ lpCache->window = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "window", "I");
+ lpCache->width = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "width", "I");
+ lpCache->min_width = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "min_width", "I");
+ lpCache->max_width = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "max_width", "I");
+ lpCache->justification = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "justification", "I");
+ lpCache->visible = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "visible", "I");
+ lpCache->width_set = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "width_set", "I");
+ lpCache->resizeable = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "resizeable", "I");
+ lpCache->auto_resize = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "auto_resize", "I");
+ lpCache->button_passive = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "button_passive", "I");
+
+ lpCache->cached = 1;
+}
+
+void cacheGtkCTreeFids(JNIEnv *env, jobject lpGtkCTree, PGtkCTree_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkCTreeClass = (*env)->GetObjectClass(env, lpGtkCTree);
+ cacheGtkCListFids(env, lpGtkCTree, &PGLOB(GtkCListFc));
+ lpCache->tree_indent = (*env)->GetFieldID(env, lpCache->GtkCTreeClass, "tree_indent", "I");
+ lpCache->tree_column = (*env)->GetFieldID(env, lpCache->GtkCTreeClass, "tree_column", "I");
+
+ lpCache->cached = 1;
+}
+
+void cacheGtkCTreeRowFids(JNIEnv *env, jobject lpGtkCTreeRow, PGtkCTreeRow_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkCTreeRowClass = (*env)->GetObjectClass(env, lpGtkCTreeRow);
+ cacheGtkCListRowFids(env, lpGtkCTreeRow, &PGLOB(GtkCListRowFc));
+ lpCache->parent = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "parent", "I");
+ lpCache->sibling = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "sibling", "I");
+ lpCache->children = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "children", "I");
+ lpCache->pixmap_closed = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "pixmap_closed", "I");
+ lpCache->mask_closed = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "mask_closed", "I");
+ lpCache->pixmap_opened = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "pixmap_opened", "I");
+ lpCache->mask_opened = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "mask_opened", "I");
+ lpCache->level = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "level", "S");
+ lpCache->is_leaf = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "is_leaf", "I");
+ lpCache->expanded = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "expanded", "I");
+
+ lpCache->cached = 1;
+}
+
+/* ----------- swt getters and setters ----------- */
+/**
+ * These functions get or set object field ids assuming that the
+ * fids for these objects have already been cached.
+ *
+ */
+void getGdkColorFields(JNIEnv *env, jobject lpObject, GdkColor *lpGdkColor, GdkColor_FID_CACHE *lpGdkColorFc)
+{
+ lpGdkColor->pixel = (*env)->GetIntField(env, lpObject, lpGdkColorFc->pixel);
+ lpGdkColor->red = (*env)->GetShortField(env, lpObject, lpGdkColorFc->red);
+ lpGdkColor->green = (*env)->GetShortField(env, lpObject, lpGdkColorFc->green);
+ lpGdkColor->blue = (*env)->GetShortField(env, lpObject, lpGdkColorFc->blue);
+}
+
+void setGdkColorFields(JNIEnv *env, jobject lpObject, GdkColor *lpGdkColor, GdkColor_FID_CACHE *lpGdkColorFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGdkColorFc->pixel, (jint)lpGdkColor->pixel);
+ (*env)->SetShortField(env, lpObject, lpGdkColorFc->red, (jshort)lpGdkColor->red);
+ (*env)->SetShortField(env, lpObject, lpGdkColorFc->green, (jshort)lpGdkColor->green);
+ (*env)->SetShortField(env, lpObject, lpGdkColorFc->blue, (jshort)lpGdkColor->blue);
+}
+
+void getGdkEventKeyFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventKey_FID_CACHE *lpGdkEventKeyFc)
+{
+ GdkEventKey *lpGdkEventKey = (GdkEventKey*)lpGdkEvent;
+ lpGdkEventKey->type = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->type);
+ lpGdkEventKey->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->window);
+ lpGdkEventKey->send_event = (*env)->GetByteField(env, lpObject, lpGdkEventKeyFc->send_event);
+ lpGdkEventKey->time = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->time);
+ lpGdkEventKey->state = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->state);
+ lpGdkEventKey->keyval = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->keyval);
+ lpGdkEventKey->length = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->length);
+ lpGdkEventKey->string = (char*)(*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->string);
+}
+
+void setGdkEventKeyFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventKey_FID_CACHE *lpGdkEventKeyFc)
+{
+ GdkEventKey *lpGdkEventKey = (GdkEventKey*)lpGdkEvent;
+ (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->type, (jint)lpGdkEventKey->type);
+ (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->window, (jint)lpGdkEventKey->window);
+ (*env)->SetByteField(env, lpObject, lpGdkEventKeyFc->send_event, (jbyte)lpGdkEventKey->send_event);
+ (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->time, (jint)lpGdkEventKey->time);
+ (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->state, (jint)lpGdkEventKey->state);
+ (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->keyval, (jint)lpGdkEventKey->keyval);
+ (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->length, (jint)lpGdkEventKey->length);
+ (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->string, (jint)lpGdkEventKey->string);
+}
+
+void getGdkEventButtonFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventButton_FID_CACHE *lpGdkEventButtonFc)
+{
+ GdkEventButton *lpGdkEventButton = (GdkEventButton*)lpGdkEvent;
+ lpGdkEventButton->type = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->type);
+ lpGdkEventButton->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->window);
+ lpGdkEventButton->send_event = (*env)->GetByteField(env, lpObject, lpGdkEventButtonFc->send_event);
+ lpGdkEventButton->time = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->time);
+ lpGdkEventButton->x = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->x);
+ lpGdkEventButton->y = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->y);
+ lpGdkEventButton->pressure = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->pressure);
+ lpGdkEventButton->xtilt = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->xtilt);
+ lpGdkEventButton->ytilt = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->ytilt);
+ lpGdkEventButton->state = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->state);
+ lpGdkEventButton->button = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->button);
+ lpGdkEventButton->source = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->source);
+ lpGdkEventButton->deviceid = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->deviceid);
+ lpGdkEventButton->x_root = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->x_root);
+ lpGdkEventButton->y_root = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->y_root);
+}
+
+void setGdkEventButtonFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventButton_FID_CACHE *lpGdkEventButtonFc)
+{
+ GdkEventButton *lpGdkEventButton = (GdkEventButton*)lpGdkEvent;
+ (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->type, (jint)lpGdkEventButton->type);
+ (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->window, (jint)lpGdkEventButton->window);
+ (*env)->SetByteField(env, lpObject, lpGdkEventButtonFc->send_event, (jbyte)lpGdkEventButton->send_event);
+ (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->time, (jint)lpGdkEventButton->time);
+ (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->x, (jlong)lpGdkEventButton->x);
+ (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->y, (jlong)lpGdkEventButton->y);
+ (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->pressure, (jlong)lpGdkEventButton->pressure);
+ (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->xtilt, (jlong)lpGdkEventButton->xtilt);
+ (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->ytilt, (jlong)lpGdkEventButton->ytilt);
+ (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->state, (jint)lpGdkEventButton->state);
+ (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->button, (jint)lpGdkEventButton->button);
+ (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->source, (jint)lpGdkEventButton->source);
+ (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->deviceid, (jint)lpGdkEventButton->deviceid);
+ (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->x_root, (jlong)lpGdkEventButton->x_root);
+ (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->y_root, (jlong)lpGdkEventButton->y_root);
+}
+
+void getGdkEventMotionFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventMotion_FID_CACHE *lpGdkEventMotionFc)
+{
+ GdkEventMotion *lpGdkEventMotion = (GdkEventMotion*)lpGdkEvent;
+ lpGdkEventMotion->type = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->type);
+ lpGdkEventMotion->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->window);
+ lpGdkEventMotion->send_event = (*env)->GetByteField(env, lpObject, lpGdkEventMotionFc->send_event);
+ lpGdkEventMotion->time = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->time);
+ lpGdkEventMotion->x = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->x);
+ lpGdkEventMotion->y = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->y);
+ lpGdkEventMotion->pressure = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->pressure);
+ lpGdkEventMotion->xtilt = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->xtilt);
+ lpGdkEventMotion->ytilt = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->ytilt);
+ lpGdkEventMotion->state = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->state);
+ lpGdkEventMotion->is_hint = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->is_hint);
+ lpGdkEventMotion->source = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->source);
+ lpGdkEventMotion->deviceid = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->deviceid);
+ lpGdkEventMotion->x_root = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->x_root);
+ lpGdkEventMotion->y_root = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->y_root);
+}
+
+void setGdkEventMotionFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventMotion_FID_CACHE *lpGdkEventMotionFc)
+{
+ GdkEventMotion *lpGdkEventMotion = (GdkEventMotion*)lpGdkEvent;
+ (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->type, lpGdkEventMotion->type);
+ (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->window, (jint)lpGdkEventMotion->window);
+ (*env)->SetByteField(env, lpObject, lpGdkEventMotionFc->send_event, lpGdkEventMotion->send_event);
+ (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->time, (jint)lpGdkEventMotion->time);
+ (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->x, (jlong)lpGdkEventMotion->x);
+ (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->y, (jlong)lpGdkEventMotion->y);
+ (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->pressure, (jlong)lpGdkEventMotion->pressure);
+ (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->xtilt, (jlong)lpGdkEventMotion->xtilt);
+ (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->ytilt, (jlong)lpGdkEventMotion->ytilt);
+ (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->state, (jint)lpGdkEventMotion->state);
+ (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->is_hint, (jint)lpGdkEventMotion->is_hint);
+ (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->source, (jint)lpGdkEventMotion->source);
+ (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->deviceid, (jint)lpGdkEventMotion->deviceid);
+ (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->x_root, (jlong)lpGdkEventMotion->x_root);
+ (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->y_root, (jlong)lpGdkEventMotion->y_root);
+}
+
+void getGdkEventExposeFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventExpose_FID_CACHE *lpGdkEventExposeFc)
+{
+ GdkEventExpose *lpGdkEventExpose = (GdkEventExpose*)lpGdkEvent;
+ lpGdkEventExpose->area.x = (*env)->GetShortField(env, lpObject, lpGdkEventExposeFc->x);
+ lpGdkEventExpose->area.y = (*env)->GetShortField(env, lpObject, lpGdkEventExposeFc->y);
+ lpGdkEventExpose->area.width = (*env)->GetShortField(env, lpObject, lpGdkEventExposeFc->width);
+ lpGdkEventExpose->area.height = (*env)->GetShortField(env, lpObject, lpGdkEventExposeFc->height);
+ lpGdkEventExpose->count = (*env)->GetIntField(env, lpObject, lpGdkEventExposeFc->count);
+}
+
+void setGdkEventExposeFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventExpose_FID_CACHE *lpGdkEventExposeFc)
+{
+ GdkEventExpose *lpGdkEventExpose = (GdkEventExpose*)lpGdkEvent;
+ (*env)->SetShortField(env, lpObject, lpGdkEventExposeFc->x, (jshort)lpGdkEventExpose->area.x);
+ (*env)->SetShortField(env, lpObject, lpGdkEventExposeFc->y, (jshort)lpGdkEventExpose->area.y);
+ (*env)->SetShortField(env, lpObject, lpGdkEventExposeFc->width, (jshort)lpGdkEventExpose->area.width);
+ (*env)->SetShortField(env, lpObject, lpGdkEventExposeFc->height, (jshort)lpGdkEventExpose->area.height);
+ (*env)->SetIntField(env, lpObject, lpGdkEventExposeFc->count, (jint)lpGdkEventExpose->count);
+}
+
+void getGdkFontFields(JNIEnv *env, jobject lpObject, GdkFont *lpGdkFont, GdkFont_FID_CACHE *lpGdkFontFc)
+{
+ lpGdkFont->type = (*env)->GetIntField(env, lpObject, lpGdkFontFc->type);
+ lpGdkFont->ascent = (*env)->GetIntField(env, lpObject, lpGdkFontFc->ascent);
+ lpGdkFont->descent = (*env)->GetIntField(env, lpObject, lpGdkFontFc->descent);
+}
+
+void setGdkFontFields(JNIEnv *env, jobject lpObject, GdkFont *lpGdkFont, GdkFont_FID_CACHE *lpGdkFontFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGdkFontFc->type, (jint)lpGdkFont->type);
+ (*env)->SetIntField(env, lpObject, lpGdkFontFc->ascent, (jint)lpGdkFont->ascent);
+ (*env)->SetIntField(env, lpObject, lpGdkFontFc->descent, (jint)lpGdkFont->descent);
+}
+
+void getGdkGCValuesFields(JNIEnv *env, jobject lpObject, GdkGCValues *lpGdkGCValues, GdkGCValues_FID_CACHE *lpGdkGCValuesFc)
+{
+ lpGdkGCValues->foreground.pixel = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->foreground_pixel);
+ lpGdkGCValues->foreground.red = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->foreground_red);
+ lpGdkGCValues->foreground.green = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->foreground_green);
+ lpGdkGCValues->foreground.blue = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->foreground_blue);
+ lpGdkGCValues->background.pixel = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->background_pixel);
+ lpGdkGCValues->background.red = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->background_red);
+ lpGdkGCValues->background.green = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->background_green);
+ lpGdkGCValues->background.blue = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->background_blue);
+ lpGdkGCValues->font = (GdkFont*)(*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->font);
+ lpGdkGCValues->function = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->function);
+ lpGdkGCValues->fill = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->fill);
+ lpGdkGCValues->tile = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->tile);
+ lpGdkGCValues->stipple = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->stipple);
+ lpGdkGCValues->clip_mask = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->clip_mask);
+ lpGdkGCValues->subwindow_mode = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->subwindow_mode);
+ lpGdkGCValues->ts_x_origin = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->ts_x_origin);
+ lpGdkGCValues->ts_y_origin = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->ts_y_origin);
+ lpGdkGCValues->clip_x_origin = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->clip_x_origin);
+ lpGdkGCValues->clip_y_origin = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->clip_y_origin);
+ lpGdkGCValues->graphics_exposures = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->graphics_exposures);
+ lpGdkGCValues->line_width = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->line_width);
+ lpGdkGCValues->line_style = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->line_style);
+ lpGdkGCValues->cap_style = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->cap_style);
+ lpGdkGCValues->join_style = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->join_style);
+}
+
+void setGdkGCValuesFields(JNIEnv *env, jobject lpObject, GdkGCValues *lpGdkGCValues, GdkGCValues_FID_CACHE *lpGdkGCValuesFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->foreground_pixel, (jint)lpGdkGCValues->foreground.pixel);
+ (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->foreground_red, (jshort)lpGdkGCValues->foreground.red);
+ (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->foreground_green, (jshort)lpGdkGCValues->foreground.green);
+ (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->foreground_blue, (jshort)lpGdkGCValues->foreground.blue);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->background_pixel, (jint)lpGdkGCValues->background.pixel);
+ (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->background_red, (jshort)lpGdkGCValues->background.red);
+ (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->background_green, (jshort)lpGdkGCValues->background.green);
+ (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->background_blue, (jshort)lpGdkGCValues->background.blue);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->font, (jint)lpGdkGCValues->font);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->function, (jint)lpGdkGCValues->function);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->fill, (jint)lpGdkGCValues->fill);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->tile, (jint)lpGdkGCValues->tile);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->stipple, (jint)lpGdkGCValues->stipple);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->clip_mask, (jint)lpGdkGCValues->clip_mask);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->subwindow_mode, (jint)lpGdkGCValues->subwindow_mode);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->ts_x_origin, (jint)lpGdkGCValues->ts_x_origin);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->ts_y_origin, (jint)lpGdkGCValues->ts_y_origin);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->clip_x_origin, (jint)lpGdkGCValues->clip_x_origin);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->clip_y_origin, (jint)lpGdkGCValues->clip_y_origin);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->graphics_exposures, (jint)lpGdkGCValues->graphics_exposures);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->line_width, (jint)lpGdkGCValues->line_width);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->line_style, (jint)lpGdkGCValues->line_style);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->cap_style, (jint)lpGdkGCValues->cap_style);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->join_style, (jint)lpGdkGCValues->join_style);
+}
+
+void getGdkImageFields(JNIEnv *env, jobject lpObject, GdkImage *lpGdkImage, GdkImage_FID_CACHE *lpGdkImageFc)
+{
+ lpGdkImage->type = (*env)->GetIntField(env, lpObject, lpGdkImageFc->type);
+ lpGdkImage->visual = (GdkVisual*)(*env)->GetIntField(env, lpObject, lpGdkImageFc->visual);
+ lpGdkImage->byte_order = (*env)->GetIntField(env, lpObject, lpGdkImageFc->byte_order);
+ lpGdkImage->width = (*env)->GetShortField(env, lpObject, lpGdkImageFc->width);
+ lpGdkImage->height = (*env)->GetShortField(env, lpObject, lpGdkImageFc->height);
+ lpGdkImage->depth = (*env)->GetShortField(env, lpObject, lpGdkImageFc->depth);
+ lpGdkImage->bpp = (*env)->GetShortField(env, lpObject, lpGdkImageFc->bpp);
+ lpGdkImage->bpl = (*env)->GetShortField(env, lpObject, lpGdkImageFc->bpl);
+ lpGdkImage->mem = (gpointer)(*env)->GetIntField(env, lpObject, lpGdkImageFc->mem);
+}
+
+void setGdkImageFields(JNIEnv *env, jobject lpObject, GdkImage *lpGdkImage, GdkImage_FID_CACHE *lpGdkImageFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGdkImageFc->type, (jint)lpGdkImage->type);
+ (*env)->SetIntField(env, lpObject, lpGdkImageFc->visual, (jint)lpGdkImage->visual);
+ (*env)->SetIntField(env, lpObject, lpGdkImageFc->byte_order, (jint)lpGdkImage->byte_order);
+ (*env)->SetShortField(env, lpObject, lpGdkImageFc->width, (jshort)lpGdkImage->width);
+ (*env)->SetShortField(env, lpObject, lpGdkImageFc->height, (jshort)lpGdkImage->height);
+ (*env)->SetShortField(env, lpObject, lpGdkImageFc->depth, (jshort)lpGdkImage->depth);
+ (*env)->SetShortField(env, lpObject, lpGdkImageFc->bpp, (jshort)lpGdkImage->bpp);
+ (*env)->SetShortField(env, lpObject, lpGdkImageFc->bpl, (jshort)lpGdkImage->bpl);
+ (*env)->SetIntField(env, lpObject, lpGdkImageFc->mem, (jint)lpGdkImage->mem);
+}
+
+void getGdkPointFields(JNIEnv *env, jobject lpObject, GdkPoint *lpGdkPoint, GdkPoint_FID_CACHE *lpGdkPointFc)
+{
+ lpGdkPoint->x = (*env)->GetShortField(env, lpObject, lpGdkPointFc->x);
+ lpGdkPoint->y = (*env)->GetShortField(env, lpObject, lpGdkPointFc->y);
+}
+
+void setGdkPointFields(JNIEnv *env, jobject lpObject, GdkPoint *lpGdkPoint, GdkPoint_FID_CACHE *lpGdkPointFc)
+{
+ (*env)->SetShortField(env, lpObject, lpGdkPointFc->x, (jshort)lpGdkPoint->x);
+ (*env)->SetShortField(env, lpObject, lpGdkPointFc->y, (jshort)lpGdkPoint->y);
+}
+
+void getGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpGdkRectangle, GdkRectangle_FID_CACHE *lpGdkRectangleFc)
+{
+ lpGdkRectangle->x = (*env)->GetShortField(env, lpObject, lpGdkRectangleFc->x);
+ lpGdkRectangle->y = (*env)->GetShortField(env, lpObject, lpGdkRectangleFc->y);
+ lpGdkRectangle->width = (*env)->GetShortField(env, lpObject, lpGdkRectangleFc->width);
+ lpGdkRectangle->height = (*env)->GetShortField(env, lpObject, lpGdkRectangleFc->height);
+}
+
+void setGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpGdkRectangle, GdkRectangle_FID_CACHE *lpGdkRectangleFc)
+{
+ (*env)->SetShortField(env, lpObject, lpGdkRectangleFc->x, (jshort)lpGdkRectangle->x);
+ (*env)->SetShortField(env, lpObject, lpGdkRectangleFc->y, (jshort)lpGdkRectangle->y);
+ (*env)->SetShortField(env, lpObject, lpGdkRectangleFc->width, (jshort)lpGdkRectangle->width);
+ (*env)->SetShortField(env, lpObject, lpGdkRectangleFc->height, (jshort)lpGdkRectangle->height);
+}
+
+void getGdkVisualFields(JNIEnv *env, jobject lpObject, GdkVisual *lpGdkVisual, GdkVisual_FID_CACHE *lpGdkVisualFc)
+{
+ lpGdkVisual->type = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->type);
+ lpGdkVisual->depth = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->depth);
+ lpGdkVisual->byte_order = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->byte_order);
+ lpGdkVisual->colormap_size = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->colormap_size);
+ lpGdkVisual->bits_per_rgb = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->bits_per_rgb);
+ lpGdkVisual->red_mask = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->red_mask);
+ lpGdkVisual->red_shift = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->red_shift);
+ lpGdkVisual->red_prec = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->red_prec);
+ lpGdkVisual->green_mask = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->green_mask);
+ lpGdkVisual->green_shift = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->green_shift);
+ lpGdkVisual->green_prec = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->green_prec);
+ lpGdkVisual->blue_mask = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->blue_mask);
+ lpGdkVisual->blue_shift = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->blue_shift);
+ lpGdkVisual->blue_prec = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->blue_prec);
+}
+
+void setGdkVisualFields(JNIEnv *env, jobject lpObject, GdkVisual *lpGdkVisual, GdkVisual_FID_CACHE *lpGdkVisualFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->type, (jint)lpGdkVisual->type);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->depth, (jint)lpGdkVisual->depth);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->byte_order, (jint)lpGdkVisual->byte_order);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->colormap_size, (jint)lpGdkVisual->colormap_size);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->bits_per_rgb, (jint)lpGdkVisual->bits_per_rgb);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->red_mask, (jint)lpGdkVisual->red_mask);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->red_shift, (jint)lpGdkVisual->red_shift);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->red_prec, (jint)lpGdkVisual->red_prec);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->green_mask, (jint)lpGdkVisual->green_mask);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->green_shift, (jint)lpGdkVisual->green_shift);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->green_prec, (jint)lpGdkVisual->green_prec);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->blue_mask, (jint)lpGdkVisual->blue_mask);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->blue_shift, (jint)lpGdkVisual->blue_shift);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->blue_prec, (jint)lpGdkVisual->blue_prec);
+}
+
+void getGtkAllocationFields(JNIEnv *env, jobject lpObject, GtkAllocation *lpGtkAllocation, GtkAllocation_FID_CACHE *lpGtkAllocationFc)
+{
+ lpGtkAllocation->x = (*env)->GetShortField(env, lpObject, lpGtkAllocationFc->x);
+ lpGtkAllocation->y = (*env)->GetShortField(env, lpObject, lpGtkAllocationFc->y);
+ lpGtkAllocation->width = (*env)->GetShortField(env, lpObject, lpGtkAllocationFc->width);
+ lpGtkAllocation->height = (*env)->GetShortField(env, lpObject, lpGtkAllocationFc->height);
+}
+
+void setGtkAllocationFields(JNIEnv *env, jobject lpObject, GtkAllocation *lpGtkAllocation, GtkAllocation_FID_CACHE *lpGtkAllocationFc)
+{
+ (*env)->SetShortField(env, lpObject, lpGtkAllocationFc->x, lpGtkAllocation->x);
+ (*env)->SetShortField(env, lpObject, lpGtkAllocationFc->y, lpGtkAllocation->y);
+ (*env)->SetShortField(env, lpObject, lpGtkAllocationFc->width, lpGtkAllocation->width);
+ (*env)->SetShortField(env, lpObject, lpGtkAllocationFc->height, lpGtkAllocation->height);
+}
+
+void getGtkArgFields(JNIEnv *env, jobject lpObject, GtkArg *lpGtkArg, GtkArg_FID_CACHE *lpGtkArgFc)
+{
+ fprintf(stderr, "WARNING: Unimplemented method getGtkArgFields.\n");
+}
+
+void setGtkArgFields(JNIEnv *env, jobject lpObject, GtkArg *lpGtkArg, GtkArg_FID_CACHE *lpGtkArgFc)
+{
+ fprintf(stderr, "WARNING: Unimplemented method setGtkArgFields.\n");
+}
+
+void getGtkBinFields(JNIEnv *env, jobject lpObject, GtkBin *lpGtkBin, GtkBin_FID_CACHE *lpGtkBinFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkContainerFields(env, lpObject, &lpGtkBin->container, &PGLOB(GtkContainerFc));
+ lpGtkBin->child = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkBinFc->child);
+}
+
+void setGtkBinFields(JNIEnv *env, jobject lpObject, GtkBin *lpGtkBin, GtkBin_FID_CACHE *lpGtkBinFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkContainerFields(env, lpObject, &lpGtkBin->container, &PGLOB(GtkContainerFc));
+ (*env)->SetIntField(env, lpObject, lpGtkBinFc->child, (jint)lpGtkBin->child);
+}
+
+void getGtkBoxFields(JNIEnv *env, jobject lpObject, GtkBox *lpGtkBox, GtkBox_FID_CACHE *lpGtkBoxFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkContainerFields(env, lpObject, &lpGtkBox->container, &PGLOB(GtkContainerFc));
+ lpGtkBox->children = (GList*)(*env)->GetIntField(env, lpObject, lpGtkBoxFc->children);
+ lpGtkBox->spacing = (*env)->GetShortField(env, lpObject, lpGtkBoxFc->spacing);
+ lpGtkBox->homogeneous = (*env)->GetIntField(env, lpObject, lpGtkBoxFc->homogeneous);
+}
+
+void setGtkBoxFields(JNIEnv *env, jobject lpObject, GtkBox *lpGtkBox, GtkBox_FID_CACHE *lpGtkBoxFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkContainerFields(env, lpObject, &lpGtkBox->container, &PGLOB(GtkContainerFc));
+ (*env)->SetIntField(env, lpObject, lpGtkBoxFc->children, (jint)lpGtkBox->children);
+ (*env)->SetShortField(env, lpObject, lpGtkBoxFc->spacing, (jshort)lpGtkBox->spacing);
+ (*env)->SetIntField(env, lpObject, lpGtkBoxFc->homogeneous, (jint)lpGtkBox->homogeneous);
+}
+
+void getGtkCListFields(JNIEnv *env, jobject lpObject, GtkCList *lpGtkCList, GtkCList_FID_CACHE *lpGtkCListFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkContainerFields(env, lpObject, &lpGtkCList->container, &PGLOB(GtkContainerFc));
+ lpGtkCList->flags = (*env)->GetShortField(env, lpObject, lpGtkCListFc->clist_flags);
+ lpGtkCList->row_mem_chunk = (GMemChunk*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->row_mem_chunk);
+ lpGtkCList->cell_mem_chunk = (GMemChunk*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->cell_mem_chunk);
+ lpGtkCList->freeze_count = (*env)->GetIntField(env, lpObject, lpGtkCListFc->freeze_count);
+ lpGtkCList->internal_allocation.x = (*env)->GetShortField(env, lpObject, lpGtkCListFc->internal_allocation_x);
+ lpGtkCList->internal_allocation.y = (*env)->GetShortField(env, lpObject, lpGtkCListFc->internal_allocation_y);
+ lpGtkCList->internal_allocation.width = (*env)->GetShortField(env, lpObject, lpGtkCListFc->internal_allocation_width);
+ lpGtkCList->internal_allocation.height = (*env)->GetShortField(env, lpObject, lpGtkCListFc->internal_allocation_height);
+ lpGtkCList->rows = (*env)->GetIntField(env, lpObject, lpGtkCListFc->rows);
+ lpGtkCList->row_center_offset = (*env)->GetIntField(env, lpObject, lpGtkCListFc->row_center_offset);
+ lpGtkCList->row_height = (*env)->GetIntField(env, lpObject, lpGtkCListFc->row_height);
+ lpGtkCList->row_list = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->row_list);
+ lpGtkCList->row_list_end = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->row_list_end);
+ lpGtkCList->columns = (*env)->GetIntField(env, lpObject, lpGtkCListFc->columns);
+ lpGtkCList->column_title_area.x = (*env)->GetShortField(env, lpObject, lpGtkCListFc->column_title_area_x);
+ lpGtkCList->column_title_area.y = (*env)->GetShortField(env, lpObject, lpGtkCListFc->column_title_area_y);
+ lpGtkCList->column_title_area.width = (*env)->GetShortField(env, lpObject, lpGtkCListFc->column_title_area_width);
+ lpGtkCList->column_title_area.height = (*env)->GetShortField(env, lpObject, lpGtkCListFc->column_title_area_height);
+ lpGtkCList->title_window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->title_window);
+ lpGtkCList->column = (GtkCListColumn*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->column);
+ lpGtkCList->clist_window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->clist_window);
+ lpGtkCList->clist_window_width = (*env)->GetIntField(env, lpObject, lpGtkCListFc->clist_window_width);
+ lpGtkCList->clist_window_height = (*env)->GetIntField(env, lpObject, lpGtkCListFc->clist_window_height);
+ lpGtkCList->hoffset = (*env)->GetIntField(env, lpObject, lpGtkCListFc->hoffset);
+ lpGtkCList->voffset = (*env)->GetIntField(env, lpObject, lpGtkCListFc->voffset);
+ lpGtkCList->shadow_type = (*env)->GetIntField(env, lpObject, lpGtkCListFc->shadow_type);
+ lpGtkCList->selection_mode = (*env)->GetIntField(env, lpObject, lpGtkCListFc->selection_mode);
+ lpGtkCList->selection = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->selection);
+ lpGtkCList->selection_end = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->selection_end);
+ lpGtkCList->undo_selection = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->undo_selection);
+ lpGtkCList->undo_unselection = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->undo_unselection);
+ lpGtkCList->undo_anchor = (*env)->GetIntField(env, lpObject, lpGtkCListFc->undo_anchor);
+ lpGtkCList->button_actions[0] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions0);
+ lpGtkCList->button_actions[1] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions1);
+ lpGtkCList->button_actions[2] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions2);
+ lpGtkCList->button_actions[3] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions3);
+ lpGtkCList->button_actions[4] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions4);
+ lpGtkCList->drag_button = (*env)->GetByteField(env, lpObject, lpGtkCListFc->drag_button);
+ lpGtkCList->click_cell.row = (*env)->GetIntField(env, lpObject, lpGtkCListFc->click_cell_row);
+ lpGtkCList->click_cell.column = (*env)->GetIntField(env, lpObject, lpGtkCListFc->click_cell_column);
+ lpGtkCList->hadjustment = (GtkAdjustment*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->hadjustment);
+ lpGtkCList->vadjustment = (GtkAdjustment*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->vadjustment);
+ lpGtkCList->xor_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->xor_gc);
+ lpGtkCList->bg_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->bg_gc);
+ lpGtkCList->bg_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->bg_gc);
+ lpGtkCList->cursor_drag = (GdkCursor*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->cursor_drag);
+ lpGtkCList->x_drag = (*env)->GetIntField(env, lpObject, lpGtkCListFc->x_drag);
+ lpGtkCList->focus_row = (*env)->GetIntField(env, lpObject, lpGtkCListFc->focus_row);
+ lpGtkCList->anchor = (*env)->GetIntField(env, lpObject, lpGtkCListFc->anchor);
+ lpGtkCList->anchor_state = (*env)->GetIntField(env, lpObject, lpGtkCListFc->anchor_state);
+ lpGtkCList->drag_pos = (*env)->GetIntField(env, lpObject, lpGtkCListFc->drag_pos);
+ lpGtkCList->htimer = (*env)->GetIntField(env, lpObject, lpGtkCListFc->htimer);
+ lpGtkCList->vtimer = (*env)->GetIntField(env, lpObject, lpGtkCListFc->vtimer);
+ lpGtkCList->sort_type = (*env)->GetIntField(env, lpObject, lpGtkCListFc->sort_type);
+ lpGtkCList->compare = (GtkCListCompareFunc)(*env)->GetIntField(env, lpObject, lpGtkCListFc->compare);
+ lpGtkCList->sort_column = (*env)->GetIntField(env, lpObject, lpGtkCListFc->sort_column);
+}
+
+void setGtkCListFields(JNIEnv *env, jobject lpObject, GtkCList *lpGtkCList, GtkCList_FID_CACHE *lpGtkCListFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkContainerFields(env, lpObject, &lpGtkCList->container, &PGLOB(GtkContainerFc));
+ (*env)->SetShortField(env, lpObject, lpGtkCListFc->clist_flags, (jshort)lpGtkCList->flags);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_mem_chunk, (jint)lpGtkCList->row_mem_chunk);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->cell_mem_chunk, (jint)lpGtkCList->cell_mem_chunk);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->freeze_count, (jint)lpGtkCList->freeze_count);
+ (*env)->SetShortField(env, lpObject, lpGtkCListFc->internal_allocation_x, (jshort)lpGtkCList->internal_allocation.x);
+ (*env)->SetShortField(env, lpObject, lpGtkCListFc->internal_allocation_y, (jshort)lpGtkCList->internal_allocation.y);
+ (*env)->SetShortField(env, lpObject, lpGtkCListFc->internal_allocation_width, (jshort)lpGtkCList->internal_allocation.width);
+ (*env)->SetShortField(env, lpObject, lpGtkCListFc->internal_allocation_height, (jshort)lpGtkCList->internal_allocation.height);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->rows, (jint)lpGtkCList->rows);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_center_offset, (jint)lpGtkCList->row_center_offset);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_height, (jint)lpGtkCList->row_height);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_list, (jint)lpGtkCList->row_list);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_list_end, (jint)lpGtkCList->row_list_end);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->columns, (jint)lpGtkCList->columns);
+ (*env)->SetShortField(env, lpObject, lpGtkCListFc->column_title_area_x, (jshort)lpGtkCList->column_title_area.x);
+ (*env)->SetShortField(env, lpObject, lpGtkCListFc->column_title_area_y, (jshort)lpGtkCList->column_title_area.y);
+ (*env)->SetShortField(env, lpObject, lpGtkCListFc->column_title_area_width, (jshort)lpGtkCList->column_title_area.width);
+ (*env)->SetShortField(env, lpObject, lpGtkCListFc->column_title_area_height, (jshort)lpGtkCList->column_title_area.height);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->title_window, (jint)lpGtkCList->title_window);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->column, (jint)lpGtkCList->column);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->clist_window, (jint)lpGtkCList->clist_window);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->clist_window_width, (jint)lpGtkCList->clist_window_width);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->clist_window_height, (jint)lpGtkCList->clist_window_height);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->hoffset, (jint)lpGtkCList->hoffset);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->voffset, (jint)lpGtkCList->voffset);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->shadow_type, (jint)lpGtkCList->shadow_type);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->selection_mode, (jint)lpGtkCList->selection_mode);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->selection, (jint)lpGtkCList->selection);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->selection_end, (jint)lpGtkCList->selection_end);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->undo_selection, (jint)lpGtkCList->undo_selection);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->undo_unselection, (jint)lpGtkCList->undo_unselection);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->undo_anchor, (jint)lpGtkCList->undo_anchor);
+ (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions0, (jbyte)lpGtkCList->button_actions[0]);
+ (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions1, (jbyte)lpGtkCList->button_actions[1]);
+ (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions2, (jbyte)lpGtkCList->button_actions[2]);
+ (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions3, (jbyte)lpGtkCList->button_actions[3]);
+ (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions4, (jbyte)lpGtkCList->button_actions[4]);
+ (*env)->SetByteField(env, lpObject, lpGtkCListFc->drag_button, (jbyte)lpGtkCList->drag_button);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->click_cell_row, (jint)lpGtkCList->click_cell.row);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->click_cell_column, (jint)lpGtkCList->click_cell.column);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->hadjustment, (jint)lpGtkCList->hadjustment);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->vadjustment, (jint)lpGtkCList->vadjustment);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->xor_gc, (jint)lpGtkCList->xor_gc);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->bg_gc, (jint)lpGtkCList->bg_gc);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->bg_gc, (jint)lpGtkCList->bg_gc);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->cursor_drag, (jint)lpGtkCList->cursor_drag);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->x_drag, (jint)lpGtkCList->x_drag);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->focus_row, (jint)lpGtkCList->focus_row);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->anchor, (jint)lpGtkCList->anchor);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->anchor_state, (jint)lpGtkCList->anchor_state);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->drag_pos, (jint)lpGtkCList->drag_pos);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->htimer, (jint)lpGtkCList->htimer);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->vtimer, (jint)lpGtkCList->vtimer);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->sort_type, (jint)lpGtkCList->sort_type);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->compare, (jint)lpGtkCList->compare);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->sort_column, (jint)lpGtkCList->sort_column);
+}
+
+void getGtkColorSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkColorSelectionDialog *lpGtkColorSelectionDialog, GtkColorSelectionDialog_FID_CACHE *lpGtkColorSelectionDialogFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkWindowFields(env, lpObject, &lpGtkColorSelectionDialog->window, &PGLOB(GtkWindowFc));
+ lpGtkColorSelectionDialog->colorsel = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->colorsel);
+ lpGtkColorSelectionDialog->main_vbox = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->main_vbox);
+ lpGtkColorSelectionDialog->ok_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->ok_button);
+ lpGtkColorSelectionDialog->reset_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->reset_button);
+ lpGtkColorSelectionDialog->cancel_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->cancel_button);
+ lpGtkColorSelectionDialog->help_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->help_button);
+}
+
+void setGtkColorSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkColorSelectionDialog *lpGtkColorSelectionDialog, GtkColorSelectionDialog_FID_CACHE *lpGtkColorSelectionDialogFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkWindowFields(env, lpObject, &lpGtkColorSelectionDialog->window, &PGLOB(GtkWindowFc));
+ (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->colorsel, (jint)lpGtkColorSelectionDialog->colorsel);
+ (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->main_vbox, (jint)lpGtkColorSelectionDialog->main_vbox);
+ (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->ok_button, (jint)lpGtkColorSelectionDialog->ok_button);
+ (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->reset_button, (jint)lpGtkColorSelectionDialog->reset_button);
+ (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->cancel_button, (jint)lpGtkColorSelectionDialog->cancel_button);
+ (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->help_button, (jint)lpGtkColorSelectionDialog->help_button);
+}
+
+void getGtkComboFields(JNIEnv *env, jobject lpObject, GtkCombo *lpGtkCombo, GtkCombo_FID_CACHE *lpGtkComboFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkHBoxFields(env, lpObject, &lpGtkCombo->hbox, &PGLOB(GtkHBoxFc));
+ lpGtkCombo->entry = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->entry);
+ lpGtkCombo->button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->button);
+ lpGtkCombo->popup = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->popup);
+ lpGtkCombo->popwin = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->popwin);
+ lpGtkCombo->list = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->list);
+ lpGtkCombo->entry_change_id = (*env)->GetIntField(env, lpObject, lpGtkComboFc->entry_change_id);
+ lpGtkCombo->list_change_id = (*env)->GetIntField(env, lpObject, lpGtkComboFc->list_change_id);
+ lpGtkCombo->value_in_list = (*env)->GetIntField(env, lpObject, lpGtkComboFc->value_in_list);
+ lpGtkCombo->ok_if_empty = (*env)->GetIntField(env, lpObject, lpGtkComboFc->ok_if_empty);
+ lpGtkCombo->case_sensitive = (*env)->GetIntField(env, lpObject, lpGtkComboFc->case_sensitive);
+ lpGtkCombo->use_arrows = (*env)->GetIntField(env, lpObject, lpGtkComboFc->use_arrows);
+ lpGtkCombo->use_arrows_always = (*env)->GetIntField(env, lpObject, lpGtkComboFc->use_arrows_always);
+ lpGtkCombo->current_button = (*env)->GetShortField(env, lpObject, lpGtkComboFc->current_button);
+ lpGtkCombo->activate_id = (*env)->GetIntField(env, lpObject, lpGtkComboFc->activate_id);
+}
+
+void setGtkComboFields(JNIEnv *env, jobject lpObject, GtkCombo *lpGtkCombo, GtkCombo_FID_CACHE *lpGtkComboFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkHBoxFields(env, lpObject, &lpGtkCombo->hbox, &PGLOB(GtkHBoxFc));
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->entry, (jint)lpGtkCombo->entry);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->button, (jint)lpGtkCombo->button);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->popup, (jint)lpGtkCombo->popup);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->popwin, (jint)lpGtkCombo->popwin);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->list, (jint)lpGtkCombo->list);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->entry_change_id, (jint)lpGtkCombo->entry_change_id);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->list_change_id, (jint)lpGtkCombo->list_change_id);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->value_in_list, (jint)lpGtkCombo->value_in_list);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->ok_if_empty, (jint)lpGtkCombo->ok_if_empty);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->case_sensitive, (jint)lpGtkCombo->case_sensitive);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->use_arrows, (jint)lpGtkCombo->use_arrows);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->use_arrows_always, (jint)lpGtkCombo->use_arrows_always);
+ (*env)->SetShortField(env, lpObject, lpGtkComboFc->current_button, (jshort)lpGtkCombo->current_button);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->activate_id, (jint)lpGtkCombo->activate_id);
+}
+
+void getGtkContainerFields(JNIEnv *env, jobject lpObject, GtkContainer *lpGtkContainer, GtkContainer_FID_CACHE *lpGtkContainerFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkWidgetFields(env, lpObject, &lpGtkContainer->widget, &PGLOB(GtkWidgetFc));
+ lpGtkContainer->focus_child = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkContainerFc->focus_child);
+ lpGtkContainer->border_width = (*env)->GetIntField(env, lpObject, lpGtkContainerFc->border_width);
+ lpGtkContainer->need_resize = (*env)->GetIntField(env, lpObject, lpGtkContainerFc->need_resize);
+ lpGtkContainer->resize_mode = (*env)->GetIntField(env, lpObject, lpGtkContainerFc->resize_mode);
+ lpGtkContainer->resize_widgets = (GSList*)(*env)->GetIntField(env, lpObject, lpGtkContainerFc->resize_widgets);
+}
+
+void setGtkContainerFields(JNIEnv *env, jobject lpObject, GtkContainer *lpGtkContainer, GtkContainer_FID_CACHE *lpGtkContainerFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkWidgetFields(env, lpObject, &lpGtkContainer->widget, &PGLOB(GtkWidgetFc));
+ (*env)->SetIntField(env, lpObject, lpGtkContainerFc->focus_child, (jint)lpGtkContainer->focus_child);
+ (*env)->SetIntField(env, lpObject, lpGtkContainerFc->border_width, (jint)lpGtkContainer->border_width);
+ (*env)->SetIntField(env, lpObject, lpGtkContainerFc->need_resize, (jint)lpGtkContainer->need_resize);
+ (*env)->SetIntField(env, lpObject, lpGtkContainerFc->resize_mode, (jint)lpGtkContainer->resize_mode);
+ (*env)->SetIntField(env, lpObject, lpGtkContainerFc->resize_widgets, (jint)lpGtkContainer->resize_widgets);
+}
+
+void getGtkEditableFields(JNIEnv *env, jobject lpObject, GtkEditable *lpGtkEditable, GtkEditable_FID_CACHE *lpGtkEditableFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkWidgetFields(env, lpObject, &lpGtkEditable->widget, &PGLOB(GtkWidgetFc));
+ lpGtkEditable->current_pos = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->current_pos);
+ lpGtkEditable->selection_start_pos = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->selection_start_pos);
+ lpGtkEditable->selection_end_pos = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->selection_end_pos);
+ lpGtkEditable->has_selection = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->has_selection);
+ lpGtkEditable->editable = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->editable);
+ lpGtkEditable->visible = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->visible);
+ lpGtkEditable->ic = (GdkIC*)(*env)->GetIntField(env, lpObject, lpGtkEditableFc->ic);
+ lpGtkEditable->ic_attr = (GdkICAttr*)(*env)->GetIntField(env, lpObject, lpGtkEditableFc->ic_attr);
+ lpGtkEditable->clipboard_text = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkEditableFc->clipboard_text);
+}
+
+void setGtkEditableFields(JNIEnv *env, jobject lpObject, GtkEditable *lpGtkEditable, GtkEditable_FID_CACHE *lpGtkEditableFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkWidgetFields(env, lpObject, &lpGtkEditable->widget, &PGLOB(GtkWidgetFc));
+ (*env)->SetIntField(env, lpObject, lpGtkEditableFc->current_pos, (jint)lpGtkEditable->current_pos);
+ (*env)->SetIntField(env, lpObject, lpGtkEditableFc->selection_start_pos, (jint)lpGtkEditable->selection_start_pos);
+ (*env)->SetIntField(env, lpObject, lpGtkEditableFc->selection_end_pos, (jint)lpGtkEditable->selection_end_pos);
+ (*env)->SetIntField(env, lpObject, lpGtkEditableFc->has_selection, (jint)lpGtkEditable->has_selection);
+ (*env)->SetIntField(env, lpObject, lpGtkEditableFc->editable, (jint)lpGtkEditable->editable);
+ (*env)->SetIntField(env, lpObject, lpGtkEditableFc->visible, (jint)lpGtkEditable->visible);
+ (*env)->SetIntField(env, lpObject, lpGtkEditableFc->ic, (jint)lpGtkEditable->ic);
+ (*env)->SetIntField(env, lpObject, lpGtkEditableFc->ic_attr, (jint)lpGtkEditable->ic_attr);
+ (*env)->SetIntField(env, lpObject, lpGtkEditableFc->clipboard_text, (jint)lpGtkEditable->clipboard_text);
+}
+
+void getGtkTextFields(JNIEnv *env, jobject lpObject, GtkText *lpGtkText, GtkText_FID_CACHE *lpGtkTextFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkEditableFields(env, lpObject, &lpGtkText->editable, &PGLOB(GtkEditableFc));
+
+ lpGtkText->first_line_start_index = (*env)->GetIntField(env, lpObject, lpGtkTextFc->first_line_start_index);
+ lpGtkText->first_onscreen_hor_pixel = (*env)->GetIntField(env, lpObject, lpGtkTextFc->first_onscreen_hor_pixel);
+ lpGtkText->first_onscreen_ver_pixel = (*env)->GetIntField(env, lpObject, lpGtkTextFc->first_onscreen_ver_pixel);
+ lpGtkText->default_tab_width = (*env)->GetIntField(env, lpObject, lpGtkTextFc->default_tab_width);
+ lpGtkText->cursor_pos_x = (*env)->GetIntField(env, lpObject, lpGtkTextFc->cursor_pos_x);
+ lpGtkText->cursor_pos_y = (*env)->GetIntField(env, lpObject, lpGtkTextFc->cursor_pos_y);
+ lpGtkText->cursor_virtual_x = (*env)->GetIntField(env, lpObject, lpGtkTextFc->cursor_virtual_x);
+}
+
+void setGtkTextFields(JNIEnv *env, jobject lpObject, GtkText *lpGtkText, GtkText_FID_CACHE *lpGtkTextFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkEditableFields(env, lpObject, &lpGtkText->editable, &PGLOB(GtkEditableFc));
+ (*env)->SetIntField(env, lpObject, lpGtkTextFc->first_line_start_index, (jint)lpGtkText->first_line_start_index);
+ (*env)->SetIntField(env, lpObject, lpGtkTextFc->first_onscreen_hor_pixel, (jint)lpGtkText->first_onscreen_hor_pixel);
+ (*env)->SetIntField(env, lpObject, lpGtkTextFc->first_onscreen_ver_pixel, (jint)lpGtkText->first_onscreen_ver_pixel);
+ (*env)->SetIntField(env, lpObject, lpGtkTextFc->default_tab_width, (jint)lpGtkText->default_tab_width);
+ (*env)->SetIntField(env, lpObject, lpGtkTextFc->cursor_pos_x, (jint)lpGtkText->cursor_pos_x);
+ (*env)->SetIntField(env, lpObject, lpGtkTextFc->cursor_pos_y, (jint)lpGtkText->cursor_pos_y);
+ (*env)->SetIntField(env, lpObject, lpGtkTextFc->cursor_virtual_x, (jint)lpGtkText->cursor_virtual_x);
+}
+
+void getGtkFileSelectionFields(JNIEnv *env, jobject lpObject, GtkFileSelection *lpGtkFileSelection, GtkFileSelection_FID_CACHE *lpGtkFileSelectionFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkWindowFields(env, lpObject, &lpGtkFileSelection->window, &PGLOB(GtkWindowFc));
+ lpGtkFileSelection->dir_list = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->dir_list);
+ lpGtkFileSelection->file_list = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->file_list);
+ lpGtkFileSelection->selection_entry = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->selection_entry);
+ lpGtkFileSelection->selection_text = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->selection_text);
+ lpGtkFileSelection->main_vbox = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->main_vbox);
+ lpGtkFileSelection->ok_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->ok_button);
+ lpGtkFileSelection->cancel_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->cancel_button);
+ lpGtkFileSelection->help_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->help_button);
+ lpGtkFileSelection->history_pulldown = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->history_pulldown);
+ lpGtkFileSelection->history_menu = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->history_menu);
+ lpGtkFileSelection->history_list = (GList*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->history_list);
+ lpGtkFileSelection->fileop_dialog = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_dialog);
+ lpGtkFileSelection->fileop_entry = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_entry);
+ lpGtkFileSelection->fileop_file = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_file);
+ lpGtkFileSelection->cmpl_state = (gpointer)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->cmpl_state);
+ lpGtkFileSelection->fileop_c_dir = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_c_dir);
+ lpGtkFileSelection->fileop_del_file = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_del_file);
+ lpGtkFileSelection->fileop_ren_file = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_ren_file);
+ lpGtkFileSelection->button_area = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->button_area);
+ lpGtkFileSelection->action_area = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->action_area);
+}
+
+void setGtkFileSelectionFields(JNIEnv *env, jobject lpObject, GtkFileSelection *lpGtkFileSelection, GtkFileSelection_FID_CACHE *lpGtkFileSelectionFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkWindowFields(env, lpObject, &lpGtkFileSelection->window, &PGLOB(GtkWindowFc));
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->dir_list, (jint)lpGtkFileSelection->dir_list);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->file_list, (jint)lpGtkFileSelection->file_list);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->selection_entry, (jint)lpGtkFileSelection->selection_entry);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->selection_text, (jint)lpGtkFileSelection->selection_text);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->main_vbox, (jint)lpGtkFileSelection->main_vbox);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->ok_button, (jint)lpGtkFileSelection->ok_button);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->cancel_button, (jint)lpGtkFileSelection->cancel_button);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->help_button, (jint)lpGtkFileSelection->help_button);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->history_pulldown, (jint)lpGtkFileSelection->history_pulldown);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->history_menu, (jint)lpGtkFileSelection->history_menu);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->history_list, (jint)lpGtkFileSelection->history_list);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_dialog, (jint)lpGtkFileSelection->fileop_dialog);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_entry, (jint)lpGtkFileSelection->fileop_entry);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_file, (jint)lpGtkFileSelection->fileop_file);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->cmpl_state, (jint)lpGtkFileSelection->cmpl_state);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_c_dir, (jint)lpGtkFileSelection->fileop_c_dir);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_del_file, (jint)lpGtkFileSelection->fileop_del_file);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_ren_file, (jint)lpGtkFileSelection->fileop_ren_file);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->button_area, (jint)lpGtkFileSelection->button_area);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->action_area, (jint)lpGtkFileSelection->action_area);
+}
+
+void getGtkFontSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkFontSelectionDialog *lpGtkFontSelectionDialog, GtkFontSelectionDialog_FID_CACHE *lpGtkFontSelectionDialogFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkWindowFields(env, lpObject, &lpGtkFontSelectionDialog->window, &PGLOB(GtkWindowFc));
+ lpGtkFontSelectionDialog->fontsel = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->fontsel);
+ lpGtkFontSelectionDialog->main_vbox = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->main_vbox);
+ lpGtkFontSelectionDialog->action_area = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->action_area);
+ lpGtkFontSelectionDialog->ok_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->ok_button);
+ lpGtkFontSelectionDialog->apply_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->apply_button);
+ lpGtkFontSelectionDialog->cancel_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->cancel_button);
+ lpGtkFontSelectionDialog->dialog_width = (*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->dialog_width);
+ lpGtkFontSelectionDialog->auto_resize = (*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->auto_resize);
+}
+
+void setGtkFontSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkFontSelectionDialog *lpGtkFontSelectionDialog, GtkFontSelectionDialog_FID_CACHE *lpGtkFontSelectionDialogFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkWindowFields(env, lpObject, &lpGtkFontSelectionDialog->window, &PGLOB(GtkWindowFc));
+ (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->fontsel, (jint)lpGtkFontSelectionDialog->fontsel);
+ (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->main_vbox, (jint)lpGtkFontSelectionDialog->main_vbox);
+ (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->action_area, (jint)lpGtkFontSelectionDialog->action_area);
+ (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->ok_button, (jint)lpGtkFontSelectionDialog->ok_button);
+ (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->apply_button, (jint)lpGtkFontSelectionDialog->apply_button);
+ (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->cancel_button, (jint)lpGtkFontSelectionDialog->cancel_button);
+ (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->dialog_width, (jint)lpGtkFontSelectionDialog->dialog_width);
+ (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->auto_resize, (jint)lpGtkFontSelectionDialog->auto_resize);
+}
+
+void getGtkHBoxFields(JNIEnv *env, jobject lpObject, GtkHBox *lpGtkHBox, GtkHBox_FID_CACHE *lpGtkHBoxFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkBoxFields(env, lpObject, &lpGtkHBox->box, &PGLOB(GtkBoxFc));
+}
+
+void setGtkHBoxFields(JNIEnv *env, jobject lpObject, GtkHBox *lpGtkHBox, GtkHBox_FID_CACHE *lpGtkHBoxFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkBoxFields(env, lpObject, &lpGtkHBox->box, &PGLOB(GtkBoxFc));
+}
+
+void getGtkObjectFields(JNIEnv *env, jobject lpObject, GtkObject *lpGtkObject, GtkObject_FID_CACHE *lpGtkObjectFc)
+{
+ lpGtkObject->klass = (GtkObjectClass*)(*env)->GetIntField(env, lpObject, lpGtkObjectFc->klass);
+ lpGtkObject->flags = (*env)->GetIntField(env, lpObject, lpGtkObjectFc->flags);
+ lpGtkObject->ref_count = (*env)->GetIntField(env, lpObject, lpGtkObjectFc->ref_count);
+ lpGtkObject->object_data = (GData*)(*env)->GetIntField(env, lpObject, lpGtkObjectFc->object_data);
+}
+
+void setGtkObjectFields(JNIEnv *env, jobject lpObject, GtkObject *lpGtkObject, GtkObject_FID_CACHE *lpGtkObjectFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGtkObjectFc->klass, (jint)lpGtkObject->klass);
+ (*env)->SetIntField(env, lpObject, lpGtkObjectFc->flags, (jint)lpGtkObject->flags);
+ (*env)->SetIntField(env, lpObject, lpGtkObjectFc->ref_count, (jint)lpGtkObject->ref_count);
+ (*env)->SetIntField(env, lpObject, lpGtkObjectFc->object_data, (jint)lpGtkObject->object_data);
+}
+
+void getGtkProgressFields(JNIEnv *env, jobject lpObject, GtkProgress *lpGtkProgress, GtkProgress_FID_CACHE *lpGtkProgressFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkWidgetFields(env, lpObject, &lpGtkProgress->widget, &PGLOB(GtkWidgetFc));
+ lpGtkProgress->adjustment = (GtkAdjustment*)(*env)->GetIntField(env, lpObject, lpGtkProgressFc->adjustment);
+ lpGtkProgress->offscreen_pixmap = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkProgressFc->offscreen_pixmap);
+ lpGtkProgress->format = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkProgressFc->format);
+ lpGtkProgress->x_align = (*env)->GetFloatField(env, lpObject, lpGtkProgressFc->x_align);
+ lpGtkProgress->y_align = (*env)->GetFloatField(env, lpObject, lpGtkProgressFc->y_align);
+ lpGtkProgress->show_text = (*env)->GetIntField(env, lpObject, lpGtkProgressFc->show_text);
+ lpGtkProgress->activity_mode = (*env)->GetIntField(env, lpObject, lpGtkProgressFc->activity_mode);
+}
+
+void setGtkProgressFields(JNIEnv *env, jobject lpObject, GtkProgress *lpGtkProgress, GtkProgress_FID_CACHE *lpGtkProgressFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkWidgetFields(env, lpObject, &lpGtkProgress->widget, &PGLOB(GtkWidgetFc));
+ (*env)->SetIntField(env, lpObject, lpGtkProgressFc->adjustment, (jint)lpGtkProgress->adjustment);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressFc->offscreen_pixmap, (jint)lpGtkProgress->offscreen_pixmap);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressFc->format, (jint)lpGtkProgress->format);
+ (*env)->SetFloatField(env, lpObject, lpGtkProgressFc->x_align, (jfloat)lpGtkProgress->x_align);
+ (*env)->SetFloatField(env, lpObject, lpGtkProgressFc->y_align, (jfloat)lpGtkProgress->y_align);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressFc->show_text, (jint)lpGtkProgress->show_text);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressFc->activity_mode, (jint)lpGtkProgress->activity_mode);
+}
+
+void getGtkProgressBarFields(JNIEnv *env, jobject lpObject, GtkProgressBar *lpGtkProgressBar, GtkProgressBar_FID_CACHE *lpGtkProgressBarFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkProgressFields(env, lpObject, &lpGtkProgressBar->progress, &PGLOB(GtkProgressFc));
+ lpGtkProgressBar->bar_style = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->bar_style);
+ lpGtkProgressBar->orientation = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->orientation);
+ lpGtkProgressBar->blocks = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->blocks);
+ lpGtkProgressBar->in_block = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->in_block);
+ lpGtkProgressBar->activity_pos = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->activity_pos);
+ lpGtkProgressBar->activity_step = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->activity_step);
+ lpGtkProgressBar->activity_blocks = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->activity_blocks);
+ lpGtkProgressBar->activity_dir = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->activity_dir);
+}
+
+void setGtkProgressBarFields(JNIEnv *env, jobject lpObject, GtkProgressBar *lpGtkProgressBar, GtkProgressBar_FID_CACHE *lpGtkProgressBarFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkProgressFields(env, lpObject, &lpGtkProgressBar->progress, &PGLOB(GtkProgressFc));
+ (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->bar_style, (jint)lpGtkProgressBar->bar_style);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->orientation, (jint)lpGtkProgressBar->orientation);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->blocks, (jint)lpGtkProgressBar->blocks);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->in_block, (jint)lpGtkProgressBar->in_block);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->activity_pos, (jint)lpGtkProgressBar->activity_pos);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->activity_step, (jint)lpGtkProgressBar->activity_step);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->activity_blocks, (jint)lpGtkProgressBar->activity_blocks);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->activity_dir, (jint)lpGtkProgressBar->activity_dir);
+}
+
+void getGtkRequisitionFields(JNIEnv *env, jobject lpObject, GtkRequisition *lpGtkRequisition, GtkRequisition_FID_CACHE *lpGtkRequisitionFc)
+{
+ lpGtkRequisition->width = (*env)->GetShortField(env, lpObject, lpGtkRequisitionFc->width);
+ lpGtkRequisition->height = (*env)->GetShortField(env, lpObject, lpGtkRequisitionFc->height);
+}
+
+void setGtkRequisitionFields(JNIEnv *env, jobject lpObject, GtkRequisition *lpGtkRequisition, GtkRequisition_FID_CACHE *lpGtkRequisitionFc)
+{
+ (*env)->SetShortField(env, lpObject, lpGtkRequisitionFc->width, lpGtkRequisition->width);
+ (*env)->SetShortField(env, lpObject, lpGtkRequisitionFc->height, lpGtkRequisition->height);
+}
+
+void getGtkStyleFields(JNIEnv *env, jobject lpObject, GtkStyle *lpGtkStyle, GtkStyle_FID_CACHE *lpGtkStyleFc)
+{
+ lpGtkStyle->klass = (GtkStyleClass*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->klass);
+ lpGtkStyle->fg[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg0_pixel);
+ lpGtkStyle->fg[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg0_red);
+ lpGtkStyle->fg[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg0_green);
+ lpGtkStyle->fg[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg0_blue);
+ lpGtkStyle->fg[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg1_pixel);
+ lpGtkStyle->fg[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg1_red);
+ lpGtkStyle->fg[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg1_green);
+ lpGtkStyle->fg[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg1_blue);
+ lpGtkStyle->fg[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg2_pixel);
+ lpGtkStyle->fg[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg2_red);
+ lpGtkStyle->fg[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg2_green);
+ lpGtkStyle->fg[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg2_blue);
+ lpGtkStyle->fg[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg3_pixel);
+ lpGtkStyle->fg[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg3_red);
+ lpGtkStyle->fg[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg3_green);
+ lpGtkStyle->fg[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg3_blue);
+ lpGtkStyle->fg[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg4_pixel);
+ lpGtkStyle->fg[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg4_red);
+ lpGtkStyle->fg[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg4_green);
+ lpGtkStyle->fg[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg4_blue);
+ lpGtkStyle->bg[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg0_pixel);
+ lpGtkStyle->bg[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg0_red);
+ lpGtkStyle->bg[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg0_green);
+ lpGtkStyle->bg[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg0_blue);
+ lpGtkStyle->bg[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg1_pixel);
+ lpGtkStyle->bg[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg1_red);
+ lpGtkStyle->bg[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg1_green);
+ lpGtkStyle->bg[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg1_blue);
+ lpGtkStyle->bg[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg2_pixel);
+ lpGtkStyle->bg[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg2_red);
+ lpGtkStyle->bg[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg2_green);
+ lpGtkStyle->bg[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg2_blue);
+ lpGtkStyle->bg[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg3_pixel);
+ lpGtkStyle->bg[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg3_red);
+ lpGtkStyle->bg[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg3_green);
+ lpGtkStyle->bg[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg3_blue);
+ lpGtkStyle->bg[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg4_pixel);
+ lpGtkStyle->bg[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg4_red);
+ lpGtkStyle->bg[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg4_green);
+ lpGtkStyle->bg[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg4_blue);
+ lpGtkStyle->light[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light0_pixel);
+ lpGtkStyle->light[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light0_red);
+ lpGtkStyle->light[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light0_green);
+ lpGtkStyle->light[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light0_blue);
+ lpGtkStyle->light[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light1_pixel);
+ lpGtkStyle->light[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light1_red);
+ lpGtkStyle->light[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light1_green);
+ lpGtkStyle->light[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light1_blue);
+ lpGtkStyle->light[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light2_pixel);
+ lpGtkStyle->light[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light2_red);
+ lpGtkStyle->light[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light2_green);
+ lpGtkStyle->light[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light2_blue);
+ lpGtkStyle->light[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light3_pixel);
+ lpGtkStyle->light[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light3_red);
+ lpGtkStyle->light[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light3_green);
+ lpGtkStyle->light[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light3_blue);
+ lpGtkStyle->light[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light4_pixel);
+ lpGtkStyle->light[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light4_red);
+ lpGtkStyle->light[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light4_green);
+ lpGtkStyle->light[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light4_blue);
+ lpGtkStyle->dark[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark0_pixel);
+ lpGtkStyle->dark[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark0_red);
+ lpGtkStyle->dark[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark0_green);
+ lpGtkStyle->dark[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark0_blue);
+ lpGtkStyle->dark[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark1_pixel);
+ lpGtkStyle->dark[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark1_red);
+ lpGtkStyle->dark[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark1_green);
+ lpGtkStyle->dark[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark1_blue);
+ lpGtkStyle->dark[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark2_pixel);
+ lpGtkStyle->dark[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark2_red);
+ lpGtkStyle->dark[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark2_green);
+ lpGtkStyle->dark[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark2_blue);
+ lpGtkStyle->dark[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark3_pixel);
+ lpGtkStyle->dark[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark3_red);
+ lpGtkStyle->dark[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark3_green);
+ lpGtkStyle->dark[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark3_blue);
+ lpGtkStyle->dark[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark4_pixel);
+ lpGtkStyle->dark[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark4_red);
+ lpGtkStyle->dark[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark4_green);
+ lpGtkStyle->dark[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark4_blue);
+ lpGtkStyle->mid[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid0_pixel);
+ lpGtkStyle->mid[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid0_red);
+ lpGtkStyle->mid[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid0_green);
+ lpGtkStyle->mid[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid0_blue);
+ lpGtkStyle->mid[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid1_pixel);
+ lpGtkStyle->mid[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid1_red);
+ lpGtkStyle->mid[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid1_green);
+ lpGtkStyle->mid[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid1_blue);
+ lpGtkStyle->mid[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid2_pixel);
+ lpGtkStyle->mid[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid2_red);
+ lpGtkStyle->mid[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid2_green);
+ lpGtkStyle->mid[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid2_blue);
+ lpGtkStyle->mid[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid3_pixel);
+ lpGtkStyle->mid[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid3_red);
+ lpGtkStyle->mid[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid3_green);
+ lpGtkStyle->mid[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid3_blue);
+ lpGtkStyle->mid[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid4_pixel);
+ lpGtkStyle->mid[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid4_red);
+ lpGtkStyle->mid[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid4_green);
+ lpGtkStyle->mid[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid4_blue);
+ lpGtkStyle->text[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text0_pixel);
+ lpGtkStyle->text[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text0_red);
+ lpGtkStyle->text[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text0_green);
+ lpGtkStyle->text[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text0_blue);
+ lpGtkStyle->text[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text1_pixel);
+ lpGtkStyle->text[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text1_red);
+ lpGtkStyle->text[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text1_green);
+ lpGtkStyle->text[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text1_blue);
+ lpGtkStyle->text[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text2_pixel);
+ lpGtkStyle->text[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text2_red);
+ lpGtkStyle->text[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text2_green);
+ lpGtkStyle->text[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text2_blue);
+ lpGtkStyle->text[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text3_pixel);
+ lpGtkStyle->text[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text3_red);
+ lpGtkStyle->text[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text3_green);
+ lpGtkStyle->text[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text3_blue);
+ lpGtkStyle->text[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text4_pixel);
+ lpGtkStyle->text[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text4_red);
+ lpGtkStyle->text[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text4_green);
+ lpGtkStyle->text[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text4_blue);
+ lpGtkStyle->base[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base0_pixel);
+ lpGtkStyle->base[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base0_red);
+ lpGtkStyle->base[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base0_green);
+ lpGtkStyle->base[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base0_blue);
+ lpGtkStyle->base[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base1_pixel);
+ lpGtkStyle->base[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base1_red);
+ lpGtkStyle->base[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base1_green);
+ lpGtkStyle->base[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base1_blue);
+ lpGtkStyle->base[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base2_pixel);
+ lpGtkStyle->base[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base2_red);
+ lpGtkStyle->base[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base2_green);
+ lpGtkStyle->base[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base2_blue);
+ lpGtkStyle->base[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base3_pixel);
+ lpGtkStyle->base[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base3_red);
+ lpGtkStyle->base[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base3_green);
+ lpGtkStyle->base[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base3_blue);
+ lpGtkStyle->base[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base4_pixel);
+ lpGtkStyle->base[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base4_red);
+ lpGtkStyle->base[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base4_green);
+ lpGtkStyle->base[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base4_blue);
+ lpGtkStyle->black.pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->black_pixel);
+ lpGtkStyle->black.red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->black_red);
+ lpGtkStyle->black.green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->black_green);
+ lpGtkStyle->black.blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->black_blue);
+ lpGtkStyle->white.pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->white_pixel);
+ lpGtkStyle->white.red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->white_red);
+ lpGtkStyle->white.green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->white_green);
+ lpGtkStyle->white.blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->white_blue);
+ lpGtkStyle->font = (GdkFont*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->font);
+ lpGtkStyle->fg_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc0);
+ lpGtkStyle->fg_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc1);
+ lpGtkStyle->fg_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc2);
+ lpGtkStyle->fg_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc3);
+ lpGtkStyle->fg_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc4);
+ lpGtkStyle->bg_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc0);
+ lpGtkStyle->bg_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc1);
+ lpGtkStyle->bg_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc2);
+ lpGtkStyle->bg_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc3);
+ lpGtkStyle->bg_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc4);
+ lpGtkStyle->light_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc0);
+ lpGtkStyle->light_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc1);
+ lpGtkStyle->light_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc2);
+ lpGtkStyle->light_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc3);
+ lpGtkStyle->light_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc4);
+ lpGtkStyle->dark_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc0);
+ lpGtkStyle->dark_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc1);
+ lpGtkStyle->dark_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc2);
+ lpGtkStyle->dark_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc3);
+ lpGtkStyle->dark_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc4);
+ lpGtkStyle->mid_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc0);
+ lpGtkStyle->mid_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc1);
+ lpGtkStyle->mid_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc2);
+ lpGtkStyle->mid_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc3);
+ lpGtkStyle->mid_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc4);
+ lpGtkStyle->text_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc0);
+ lpGtkStyle->text_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc1);
+ lpGtkStyle->text_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc2);
+ lpGtkStyle->text_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc3);
+ lpGtkStyle->text_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc4);
+ lpGtkStyle->base_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc0);
+ lpGtkStyle->base_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc1);
+ lpGtkStyle->base_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc2);
+ lpGtkStyle->base_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc3);
+ lpGtkStyle->base_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc4);
+ lpGtkStyle->black_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->black_gc);
+ lpGtkStyle->white_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->white_gc);
+ lpGtkStyle->bg_pixmap[0] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap0);
+ lpGtkStyle->bg_pixmap[1] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap1);
+ lpGtkStyle->bg_pixmap[2] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap2);
+ lpGtkStyle->bg_pixmap[3] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap3);
+ lpGtkStyle->bg_pixmap[4] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap4);
+ lpGtkStyle->ref_count = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->ref_count);
+ lpGtkStyle->attach_count = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->attach_count);
+ lpGtkStyle->depth = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->depth);
+ lpGtkStyle->colormap = (GdkColormap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->colormap);
+ lpGtkStyle->engine = (GtkThemeEngine*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->engine);
+ lpGtkStyle->engine_data = (gpointer)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->engine_data);
+ lpGtkStyle->rc_style = (GtkRcStyle*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->rc_style);
+ lpGtkStyle->styles = (GSList*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->styles);
+}
+
+void setGtkStyleFields(JNIEnv *env, jobject lpObject, GtkStyle *lpGtkStyle, GtkStyle_FID_CACHE *lpGtkStyleFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->klass, (jint)lpGtkStyle->klass);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg0_pixel, (jint)lpGtkStyle->fg[0].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg0_red, (jshort)lpGtkStyle->fg[0].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg0_green, (jshort)lpGtkStyle->fg[0].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg0_blue, (jshort)lpGtkStyle->fg[0].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg1_pixel, (jint)lpGtkStyle->fg[1].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg1_red, (jshort)lpGtkStyle->fg[1].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg1_green, (jshort)lpGtkStyle->fg[1].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg1_blue, (jshort)lpGtkStyle->fg[1].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg2_pixel, (jint)lpGtkStyle->fg[2].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg2_red, (jshort)lpGtkStyle->fg[2].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg2_green, (jshort)lpGtkStyle->fg[2].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg2_blue, (jshort)lpGtkStyle->fg[2].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg3_pixel, (jint)lpGtkStyle->fg[3].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg3_red, (jshort)lpGtkStyle->fg[3].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg3_green, (jshort)lpGtkStyle->fg[3].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg3_blue, (jshort)lpGtkStyle->fg[3].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg4_pixel, (jint)lpGtkStyle->fg[4].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg4_red, (jshort)lpGtkStyle->fg[4].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg4_green, (jshort)lpGtkStyle->fg[4].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg4_blue, (jshort)lpGtkStyle->fg[4].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg0_pixel, (jint)lpGtkStyle->bg[0].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg0_red, (jshort)lpGtkStyle->bg[0].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg0_green, (jshort)lpGtkStyle->bg[0].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg0_blue, (jshort)lpGtkStyle->bg[0].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg1_pixel, (jint)lpGtkStyle->bg[1].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg1_red, (jshort)lpGtkStyle->bg[1].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg1_green, (jshort)lpGtkStyle->bg[1].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg1_blue, (jshort)lpGtkStyle->bg[1].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg2_pixel, (jint)lpGtkStyle->bg[2].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg2_red, (jshort)lpGtkStyle->bg[2].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg2_green, (jshort)lpGtkStyle->bg[2].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg2_blue, (jshort)lpGtkStyle->bg[2].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg3_pixel, (jint)lpGtkStyle->bg[3].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg3_red, (jshort)lpGtkStyle->bg[3].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg3_green, (jshort)lpGtkStyle->bg[3].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg3_blue, (jshort)lpGtkStyle->bg[3].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg4_pixel, (jint)lpGtkStyle->bg[4].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg4_red, (jshort)lpGtkStyle->bg[4].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg4_green, (jshort)lpGtkStyle->bg[4].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg4_blue, (jshort)lpGtkStyle->bg[4].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light0_pixel, (jint)lpGtkStyle->light[0].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light0_red, (jshort)lpGtkStyle->light[0].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light0_green, (jshort)lpGtkStyle->light[0].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light0_blue, (jshort)lpGtkStyle->light[0].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light1_pixel, (jint)lpGtkStyle->light[1].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light1_red, (jshort)lpGtkStyle->light[1].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light1_green, (jshort)lpGtkStyle->light[1].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light1_blue, (jshort)lpGtkStyle->light[1].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light2_pixel, (jint)lpGtkStyle->light[2].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light2_red, (jshort)lpGtkStyle->light[2].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light2_green, (jshort)lpGtkStyle->light[2].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light2_blue, (jshort)lpGtkStyle->light[2].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light3_pixel, (jint)lpGtkStyle->light[3].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light3_red, (jshort)lpGtkStyle->light[3].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light3_green, (jshort)lpGtkStyle->light[3].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light3_blue, (jshort)lpGtkStyle->light[3].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light4_pixel, (jint)lpGtkStyle->light[4].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light4_red, (jshort)lpGtkStyle->light[4].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light4_green, (jshort)lpGtkStyle->light[4].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light4_blue, (jshort)lpGtkStyle->light[4].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark0_pixel, (jint)lpGtkStyle->dark[0].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark0_red, (jshort)lpGtkStyle->dark[0].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark0_green, (jshort)lpGtkStyle->dark[0].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark0_blue, (jshort)lpGtkStyle->dark[0].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark1_pixel, (jint)lpGtkStyle->dark[1].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark1_red, (jshort)lpGtkStyle->dark[1].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark1_green, (jshort)lpGtkStyle->dark[1].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark1_blue, (jshort)lpGtkStyle->dark[1].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark2_pixel, (jint)lpGtkStyle->dark[2].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark2_red, (jshort)lpGtkStyle->dark[2].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark2_green, (jshort)lpGtkStyle->dark[2].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark2_blue, (jshort)lpGtkStyle->dark[2].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark3_pixel, (jint)lpGtkStyle->dark[3].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark3_red, (jshort)lpGtkStyle->dark[3].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark3_green, (jshort)lpGtkStyle->dark[3].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark3_blue, (jshort)lpGtkStyle->dark[3].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark4_pixel, (jint)lpGtkStyle->dark[4].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark4_red, (jshort)lpGtkStyle->dark[4].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark4_green, (jshort)lpGtkStyle->dark[4].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark4_blue, (jshort)lpGtkStyle->dark[4].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid0_pixel, (jint)lpGtkStyle->mid[0].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid0_red, (jshort)lpGtkStyle->mid[0].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid0_green, (jshort)lpGtkStyle->mid[0].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid0_blue, (jshort)lpGtkStyle->mid[0].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid1_pixel, (jint)lpGtkStyle->mid[1].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid1_red, (jshort)lpGtkStyle->mid[1].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid1_green, (jshort)lpGtkStyle->mid[1].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid1_blue, (jshort)lpGtkStyle->mid[1].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid2_pixel, (jint)lpGtkStyle->mid[2].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid2_red, (jshort)lpGtkStyle->mid[2].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid2_green, (jshort)lpGtkStyle->mid[2].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid2_blue, (jshort)lpGtkStyle->mid[2].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid3_pixel, (jint)lpGtkStyle->mid[3].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid3_red, (jshort)lpGtkStyle->mid[3].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid3_green, (jshort)lpGtkStyle->mid[3].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid3_blue, (jshort)lpGtkStyle->mid[3].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid4_pixel, (jint)lpGtkStyle->mid[4].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid4_red, (jshort)lpGtkStyle->mid[4].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid4_green, (jshort)lpGtkStyle->mid[4].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid4_blue, (jshort)lpGtkStyle->mid[4].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text0_pixel, (jint)lpGtkStyle->text[0].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text0_red, (jshort)lpGtkStyle->text[0].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text0_green, (jshort)lpGtkStyle->text[0].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text0_blue, (jshort)lpGtkStyle->text[0].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text1_pixel, (jint)lpGtkStyle->text[1].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text1_red, (jshort)lpGtkStyle->text[1].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text1_green, (jshort)lpGtkStyle->text[1].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text1_blue, (jshort)lpGtkStyle->text[1].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text2_pixel, (jint)lpGtkStyle->text[2].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text2_red, (jshort)lpGtkStyle->text[2].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text2_green, (jshort)lpGtkStyle->text[2].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text2_blue, (jshort)lpGtkStyle->text[2].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text3_pixel, (jint)lpGtkStyle->text[3].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text3_red, (jshort)lpGtkStyle->text[3].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text3_green, (jshort)lpGtkStyle->text[3].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text3_blue, (jshort)lpGtkStyle->text[3].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text4_pixel, (jint)lpGtkStyle->text[4].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text4_red, (jshort)lpGtkStyle->text[4].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text4_green, (jshort)lpGtkStyle->text[4].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text4_blue, (jshort)lpGtkStyle->text[4].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base0_pixel, (jint)lpGtkStyle->base[0].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base0_red, (jshort)lpGtkStyle->base[0].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base0_green, (jshort)lpGtkStyle->base[0].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base0_blue, (jshort)lpGtkStyle->base[0].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base1_pixel, (jint)lpGtkStyle->base[1].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base1_red, (jshort)lpGtkStyle->base[1].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base1_green, (jshort)lpGtkStyle->base[1].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base1_blue, (jshort)lpGtkStyle->base[1].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base2_pixel, (jint)lpGtkStyle->base[2].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base2_red, (jshort)lpGtkStyle->base[2].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base2_green, (jshort)lpGtkStyle->base[2].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base2_blue, (jshort)lpGtkStyle->base[2].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base3_pixel, (jint)lpGtkStyle->base[3].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base3_red, (jshort)lpGtkStyle->base[3].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base3_green, (jshort)lpGtkStyle->base[3].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base3_blue, (jshort)lpGtkStyle->base[3].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base4_pixel, (jint)lpGtkStyle->base[4].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base4_red, (jshort)lpGtkStyle->base[4].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base4_green, (jshort)lpGtkStyle->base[4].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base4_blue, (jshort)lpGtkStyle->base[4].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->black_pixel, (jint)lpGtkStyle->black.pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->black_red, (jshort)lpGtkStyle->black.red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->black_green, (jshort)lpGtkStyle->black.green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->black_blue, (jshort)lpGtkStyle->black.blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->white_pixel, (jint)lpGtkStyle->white.pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->white_red, (jshort)lpGtkStyle->white.red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->white_green, (jshort)lpGtkStyle->white.green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->white_blue, (jshort)lpGtkStyle->white.blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->font, (jint)lpGtkStyle->font);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc0, (jint)lpGtkStyle->fg_gc[0]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc1, (jint)lpGtkStyle->fg_gc[1]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc2, (jint)lpGtkStyle->fg_gc[2]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc3, (jint)lpGtkStyle->fg_gc[3]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc4, (jint)lpGtkStyle->fg_gc[4]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc0, (jint)lpGtkStyle->bg_gc[0]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc1, (jint)lpGtkStyle->bg_gc[1]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc2, (jint)lpGtkStyle->bg_gc[2]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc3, (jint)lpGtkStyle->bg_gc[3]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc4, (jint)lpGtkStyle->bg_gc[4]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc0, (jint)lpGtkStyle->light_gc[0]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc1, (jint)lpGtkStyle->light_gc[1]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc2, (jint)lpGtkStyle->light_gc[2]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc3, (jint)lpGtkStyle->light_gc[3]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc4, (jint)lpGtkStyle->light_gc[4]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc0, (jint)lpGtkStyle->dark_gc[0]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc1, (jint)lpGtkStyle->dark_gc[1]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc2, (jint)lpGtkStyle->dark_gc[2]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc3, (jint)lpGtkStyle->dark_gc[3]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc4, (jint)lpGtkStyle->dark_gc[4]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc0, (jint)lpGtkStyle->mid_gc[0]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc1, (jint)lpGtkStyle->mid_gc[1]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc2, (jint)lpGtkStyle->mid_gc[2]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc3, (jint)lpGtkStyle->mid_gc[3]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc4, (jint)lpGtkStyle->mid_gc[4]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc0, (jint)lpGtkStyle->text_gc[0]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc1, (jint)lpGtkStyle->text_gc[1]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc2, (jint)lpGtkStyle->text_gc[2]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc3, (jint)lpGtkStyle->text_gc[3]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc4, (jint)lpGtkStyle->text_gc[4]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc0, (jint)lpGtkStyle->base_gc[0]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc1, (jint)lpGtkStyle->base_gc[1]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc2, (jint)lpGtkStyle->base_gc[2]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc3, (jint)lpGtkStyle->base_gc[3]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc4, (jint)lpGtkStyle->base_gc[4]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->black_gc, (jint)lpGtkStyle->black_gc);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->white_gc, (jint)lpGtkStyle->white_gc);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap0, (jint)lpGtkStyle->bg_pixmap[0]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap1, (jint)lpGtkStyle->bg_pixmap[1]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap2, (jint)lpGtkStyle->bg_pixmap[2]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap3, (jint)lpGtkStyle->bg_pixmap[3]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap4, (jint)lpGtkStyle->bg_pixmap[4]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->ref_count, (jint)lpGtkStyle->ref_count);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->attach_count, (jint)lpGtkStyle->attach_count);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->depth, (jint)lpGtkStyle->depth);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->colormap, (jint)lpGtkStyle->colormap);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->engine, (jint)lpGtkStyle->engine);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->engine_data, (jint)lpGtkStyle->engine_data);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->rc_style, (jint)lpGtkStyle->rc_style);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->styles, (jint)lpGtkStyle->styles);
+}
+
+void getGtkStyleClassFields(JNIEnv *env, jobject lpObject, GtkStyleClass *lpGtkStyleClass, GtkStyleClass_FID_CACHE *lpGtkStyleClassFc)
+{
+ lpGtkStyleClass->xthickness = (*env)->GetIntField(env, lpObject, lpGtkStyleClassFc->xthickness);
+ lpGtkStyleClass->ythickness = (*env)->GetIntField(env, lpObject, lpGtkStyleClassFc->ythickness);
+}
+
+void setGtkStyleClassFields(JNIEnv *env, jobject lpObject, GtkStyleClass *lpGtkStyleClass, GtkStyleClass_FID_CACHE *lpGtkStyleClassFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGtkStyleClassFc->xthickness, (jint)lpGtkStyleClass->xthickness);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleClassFc->ythickness, (jint)lpGtkStyleClass->ythickness);
+}
+
+void getGtkWidgetFields(JNIEnv *env, jobject lpObject, GtkWidget *lpGtkWidget, GtkWidget_FID_CACHE *lpGtkWidgetFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkObjectFields(env, lpObject, &lpGtkWidget->object, &PGLOB(GtkObjectFc));
+ lpGtkWidget->private_flags = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->private_flags);
+ lpGtkWidget->state = (*env)->GetByteField(env, lpObject, lpGtkWidgetFc->state);
+ lpGtkWidget->saved_state = (*env)->GetByteField(env, lpObject, lpGtkWidgetFc->saved_state);
+ lpGtkWidget->name = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkWidgetFc->name);
+ lpGtkWidget->style = (GtkStyle*)(*env)->GetIntField(env, lpObject, lpGtkWidgetFc->style);
+ lpGtkWidget->requisition.width = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->req_width);
+ lpGtkWidget->requisition.height = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->req_height);
+ lpGtkWidget->allocation.x = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->alloc_x);
+ lpGtkWidget->allocation.y = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->alloc_y);
+ lpGtkWidget->allocation.width = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->alloc_width);
+ lpGtkWidget->allocation.height = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->alloc_height);
+ lpGtkWidget->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGtkWidgetFc->window);
+ lpGtkWidget->parent = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkWidgetFc->parent);
+}
+
+void getGtkFrameFields(JNIEnv *env, jobject lpObject, GtkFrame *lpGtkFrame, GtkFrame_FID_CACHE *lpGtkFrameFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkBinFields(env, lpObject, &lpGtkFrame->bin, &PGLOB(GtkBinFc));
+ lpGtkFrame->label = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkFrameFc->label);
+ lpGtkFrame->shadow_type = (*env)->GetShortField(env, lpObject, lpGtkFrameFc->shadow_type);
+ lpGtkFrame->label_width = (*env)->GetShortField(env, lpObject, lpGtkFrameFc->label_width);
+ lpGtkFrame->label_height = (*env)->GetShortField(env, lpObject, lpGtkFrameFc->label_height);
+ lpGtkFrame->label_xalign = (*env)->GetFloatField(env, lpObject, lpGtkFrameFc->label_xalign);
+ lpGtkFrame->label_yalign = (*env)->GetFloatField(env, lpObject, lpGtkFrameFc->label_yalign);
+}
+
+void setGtkWidgetFields(JNIEnv *env, jobject lpObject, GtkWidget *lpGtkWidget, GtkWidget_FID_CACHE *lpGtkWidgetFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkObjectFields(env, lpObject, &lpGtkWidget->object, &PGLOB(GtkObjectFc));
+ (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->private_flags, (jshort)lpGtkWidget->private_flags);
+ (*env)->SetByteField(env, lpObject, lpGtkWidgetFc->state, (jbyte)lpGtkWidget->state);
+ (*env)->SetByteField(env, lpObject, lpGtkWidgetFc->saved_state, (jbyte)lpGtkWidget->saved_state);
+ (*env)->SetIntField(env, lpObject, lpGtkWidgetFc->name, (jint)lpGtkWidget->name);
+ (*env)->SetIntField(env, lpObject, lpGtkWidgetFc->style, (jint)lpGtkWidget->style);
+ (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->req_width, (jshort)lpGtkWidget->requisition.width);
+ (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->req_height, (jshort)lpGtkWidget->requisition.height);
+ (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->alloc_x, (jshort)lpGtkWidget->allocation.x);
+ (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->alloc_y, (jshort)lpGtkWidget->allocation.y);
+ (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->alloc_width, (jshort)lpGtkWidget->allocation.width);
+ (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->alloc_height, (jshort)lpGtkWidget->allocation.height);
+ (*env)->SetIntField(env, lpObject, lpGtkWidgetFc->window, (jint)lpGtkWidget->window);
+ (*env)->SetIntField(env, lpObject, lpGtkWidgetFc->parent, (jint)lpGtkWidget->parent);
+}
+
+void setGtkFrameFields(JNIEnv *env, jobject lpObject, GtkFrame *lpGtkFrame, GtkFrame_FID_CACHE *lpGtkFrameFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkBinFields(env, lpObject, &lpGtkFrame->bin, &PGLOB(GtkBinFc));
+ (*env)->SetIntField (env, lpObject, lpGtkFrameFc->label, (jint)lpGtkFrame->label);
+ (*env)->SetShortField(env, lpObject, lpGtkFrameFc->label_width, (jshort)lpGtkFrame->label_width);
+ (*env)->SetShortField(env, lpObject, lpGtkFrameFc->label_height, (jshort)lpGtkFrame->label_height);
+ (*env)->SetFloatField(env, lpObject, lpGtkFrameFc->label_xalign, (jfloat)lpGtkFrame->label_xalign);
+ (*env)->SetFloatField(env, lpObject, lpGtkFrameFc->label_yalign, (jfloat)lpGtkFrame->label_yalign);
+}
+
+void getGtkWindowFields(JNIEnv *env, jobject lpObject, GtkWindow *lpGtkWindow, GtkWindow_FID_CACHE *lpGtkWindowFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkBinFields(env, lpObject, &lpGtkWindow->bin, &PGLOB(GtkBinFc));
+ lpGtkWindow->title = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->title);
+ lpGtkWindow->wmclass_name = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->wmclass_name);
+ lpGtkWindow->wmclass_class = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->wmclass_class);
+ lpGtkWindow->type = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->type);
+ lpGtkWindow->focus_widget = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->focus_widget);
+ lpGtkWindow->default_widget = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->default_widget);
+ lpGtkWindow->transient_parent = (GtkWindow*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->transient_parent);
+ lpGtkWindow->resize_count = (*env)->GetShortField(env, lpObject, lpGtkWindowFc->resize_count);
+ lpGtkWindow->allow_shrink = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->allow_shrink);
+ lpGtkWindow->allow_grow = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->allow_grow);
+ lpGtkWindow->auto_shrink = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->auto_shrink);
+ lpGtkWindow->handling_resize = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->handling_resize);
+ lpGtkWindow->position = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->position);
+ lpGtkWindow->use_uposition = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->use_uposition);
+ lpGtkWindow->modal = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->title);
+}
+
+void setGtkWindowFields(JNIEnv *env, jobject lpObject, GtkWindow *lpGtkWindow, GtkWindow_FID_CACHE *lpGtkWindowFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkBinFields(env, lpObject, &lpGtkWindow->bin, &PGLOB(GtkBinFc));
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->title, (jint)lpGtkWindow->title);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->wmclass_name, (jint)lpGtkWindow->wmclass_name);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->wmclass_class, (jint)lpGtkWindow->wmclass_class);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->type, (jint)lpGtkWindow->type);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->focus_widget, (jint)lpGtkWindow->focus_widget);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->default_widget, (jint)lpGtkWindow->default_widget);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->transient_parent, (jint)lpGtkWindow->title);
+ (*env)->SetShortField(env, lpObject, lpGtkWindowFc->resize_count, (jshort)lpGtkWindow->resize_count);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->allow_shrink, (jint)lpGtkWindow->allow_shrink);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->allow_grow, (jint)lpGtkWindow->allow_grow);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->auto_shrink, (jint)lpGtkWindow->auto_shrink);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->handling_resize, (jint)lpGtkWindow->handling_resize);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->position, (jint)lpGtkWindow->position);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->use_uposition, (jint)lpGtkWindow->use_uposition);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->modal, (jint)lpGtkWindow->modal);
+}
+
+void getGtkMenuFields(JNIEnv *env, jobject lpObject, GtkMenu *lpGtkMenu, GtkMenu_FID_CACHE *lpGtkMenuFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkMenuShellFields(env, lpObject, &lpGtkMenu->menu_shell, &PGLOB(GtkMenuShellFc));
+ lpGtkMenu->parent_menu_item = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->parent_menu_item);
+ lpGtkMenu->old_active_menu_item = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->old_active_menu_item);
+ lpGtkMenu->accel_group = (GtkAccelGroup*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->accel_group);
+ lpGtkMenu->position_func = (GtkMenuPositionFunc)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->position_func);
+ lpGtkMenu->position_func_data = (gpointer)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->position_func_data);
+ lpGtkMenu->toplevel = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->toplevel);
+ lpGtkMenu->tearoff_window = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->tearoff_window);
+ lpGtkMenu->torn_off = (*env)->GetIntField(env, lpObject, lpGtkMenuFc->torn_off);
+}
+
+void setGtkMenuFields(JNIEnv *env, jobject lpObject, GtkMenu *lpGtkMenu, GtkMenu_FID_CACHE *lpGtkMenuFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkMenuShellFields(env, lpObject, &lpGtkMenu->menu_shell, &PGLOB(GtkMenuShellFc));
+ (*env)->SetIntField(env, lpObject, lpGtkMenuFc->parent_menu_item, (jint)lpGtkMenu->parent_menu_item);
+ (*env)->SetIntField(env, lpObject, lpGtkMenuFc->old_active_menu_item, (jint)lpGtkMenu->old_active_menu_item);
+ (*env)->SetIntField(env, lpObject, lpGtkMenuFc->accel_group, (jint)lpGtkMenu->accel_group);
+ (*env)->SetIntField(env, lpObject, lpGtkMenuFc->position_func, (jint)lpGtkMenu->position_func);
+ (*env)->SetIntField(env, lpObject, lpGtkMenuFc->position_func_data, (jint)lpGtkMenu->position_func_data);
+ (*env)->SetIntField(env, lpObject, lpGtkMenuFc->toplevel, (jint)lpGtkMenu->toplevel);
+ (*env)->SetIntField(env, lpObject, lpGtkMenuFc->tearoff_window, (jint)lpGtkMenu->tearoff_window);
+ (*env)->SetIntField(env, lpObject, lpGtkMenuFc->torn_off, (jint)lpGtkMenu->torn_off);
+}
+
+void getGtkMenuShellFields(JNIEnv *env, jobject lpObject, GtkMenuShell *lpGtkMenuShell, GtkMenuShell_FID_CACHE *lpGtkMenuShellFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkContainerFields(env, lpObject, &lpGtkMenuShell->container, &PGLOB(GtkContainerFc));
+ lpGtkMenuShell->active = (*env)->GetIntField(env, lpObject, lpGtkMenuShellFc->active);
+}
+
+void setGtkMenuShellFields(JNIEnv *env, jobject lpObject, GtkMenuShell *lpGtkMenuShell, GtkMenuShell_FID_CACHE *lpGtkMenuShellFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkContainerFields(env, lpObject, &lpGtkMenuShell->container, &PGLOB(GtkContainerFc));
+ (*env)->SetIntField(env, lpObject, lpGtkMenuShellFc->active, (jint)lpGtkMenuShell->active);
+}
+
+void getGtkItemFields(JNIEnv *env, jobject lpObject, GtkItem *lpGtkItem, GtkItem_FID_CACHE *lpGtkItemFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkBinFields(env, lpObject, &lpGtkItem->bin, &PGLOB(GtkBinFc));
+}
+
+void setGtkItemFields(JNIEnv *env, jobject lpObject, GtkItem *lpGtkItem, GtkItem_FID_CACHE *lpGtkItemFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkBinFields(env, lpObject, &lpGtkItem->bin, &PGLOB(GtkBinFc));
+}
+
+void getGtkMenuItemFields(JNIEnv *env, jobject lpObject, GtkMenuItem *lpGtkMenuItem, GtkMenuItem_FID_CACHE *lpGtkMenuItemFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkItemFields(env, lpObject, &lpGtkMenuItem->item, &PGLOB(GtkItemFc));
+}
+
+void setGtkMenuItemFields(JNIEnv *env, jobject lpObject, GtkMenuItem *lpGtkMenuItem, GtkMenuItem_FID_CACHE *lpGtkMenuItemFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkItemFields(env, lpObject, &lpGtkMenuItem->item, &PGLOB(GtkItemFc));
+}
+
+void getGtkCheckMenuItemFields(JNIEnv *env, jobject lpObject, GtkCheckMenuItem *lpGtkCheckMenuItem, GtkCheckMenuItem_FID_CACHE *lpGtkCheckMenuItemFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkMenuItemFields(env, lpObject, &lpGtkCheckMenuItem->menu_item, &PGLOB(GtkMenuItemFc));
+ lpGtkCheckMenuItem->active = (*env)->GetIntField(env, lpObject, lpGtkCheckMenuItemFc->active);
+ lpGtkCheckMenuItem->always_show_toggle = (*env)->GetIntField(env, lpObject, lpGtkCheckMenuItemFc->always_show_toggle);
+}
+
+void setGtkCheckMenuItemFields(JNIEnv *env, jobject lpObject, GtkCheckMenuItem *lpGtkCheckMenuItem, GtkCheckMenuItem_FID_CACHE *lpGtkCheckMenuItemFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkMenuItemFields(env, lpObject, &lpGtkCheckMenuItem->menu_item, &PGLOB(GtkMenuItemFc));
+ (*env)->SetIntField(env, lpObject, lpGtkCheckMenuItemFc->active, (jint)lpGtkCheckMenuItem->active);
+ (*env)->SetIntField(env, lpObject, lpGtkCheckMenuItemFc->always_show_toggle, (jint)lpGtkCheckMenuItem->always_show_toggle);
+}
+
+void getGtkDataFields(JNIEnv *env, jobject lpObject, GtkData *lpGtkData, GtkData_FID_CACHE *lpGtkDataFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkObjectFields(env, lpObject, &lpGtkData->object, &PGLOB(GtkObjectFc));
+}
+
+void setGtkDataFields(JNIEnv *env, jobject lpObject, GtkData *lpGtkData, GtkData_FID_CACHE *lpGtkDataFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkObjectFields(env, lpObject, &lpGtkData->object, &PGLOB(GtkObjectFc));
+}
+
+void getGtkAdjustmentFields(JNIEnv *env, jobject lpObject, GtkAdjustment *lpGtkAdjustment, GtkAdjustment_FID_CACHE *lpGtkAdjustmentFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkDataFields(env, lpObject, &lpGtkAdjustment->data, &PGLOB(GtkDataFc));
+ lpGtkAdjustment->lower = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->lower);
+ lpGtkAdjustment->upper = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->upper);
+ lpGtkAdjustment->value = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->value);
+ lpGtkAdjustment->step_increment = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->step_increment);
+ lpGtkAdjustment->page_increment = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->page_increment);
+ lpGtkAdjustment->page_size = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->page_size);
+}
+
+void setGtkAdjustmentFields(JNIEnv *env, jobject lpObject, GtkAdjustment *lpGtkAdjustment, GtkAdjustment_FID_CACHE *lpGtkAdjustmentFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkDataFields(env, lpObject, &lpGtkAdjustment->data, &PGLOB(GtkDataFc));
+ (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->lower, (jfloat)lpGtkAdjustment->lower);
+ (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->upper, (jfloat)lpGtkAdjustment->upper);
+ (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->value, (jfloat)lpGtkAdjustment->value);
+ (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->step_increment, (jfloat)lpGtkAdjustment->step_increment);
+ (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->page_increment, (jfloat)lpGtkAdjustment->page_increment);
+ (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->page_size, (jfloat)lpGtkAdjustment->page_size);
+}
+
+void getGtkCListRowFields(JNIEnv *env, jobject lpObject, GtkCListRow *lpGtkCListRow, GtkCListRow_FID_CACHE *lpGtkCListRowFc)
+{
+ lpGtkCListRow->cell = (GtkCell*)(*env)->GetIntField(env, lpObject, lpGtkCListRowFc->cell);
+ lpGtkCListRow->state = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->state);
+ lpGtkCListRow->foreground.red = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->foreground_red);
+ lpGtkCListRow->foreground.green = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->foreground_green);
+ lpGtkCListRow->foreground.blue = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->foreground_blue);
+ lpGtkCListRow->foreground.pixel = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->foreground_pixel);
+ lpGtkCListRow->background.red = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->background_red);
+ lpGtkCListRow->background.green = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->background_green);
+ lpGtkCListRow->background.blue = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->background_blue);
+ lpGtkCListRow->background.pixel = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->background_pixel);
+ lpGtkCListRow->style = (GtkStyle*)(*env)->GetIntField(env, lpObject, lpGtkCListRowFc->style);
+ lpGtkCListRow->data = (gpointer)(*env)->GetIntField(env, lpObject, lpGtkCListRowFc->data);
+ lpGtkCListRow->destroy = (GtkDestroyNotify)(*env)->GetIntField(env, lpObject, lpGtkCListRowFc->destroy);
+ lpGtkCListRow->fg_set = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->fg_set);
+ lpGtkCListRow->bg_set = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->bg_set);
+ lpGtkCListRow->selectable = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->selectable);
+}
+
+void getGtkCListColumnFields(JNIEnv *env, jobject lpObject, GtkCListColumn *lpGtkCListColumn, GtkCListColumn_FID_CACHE *lpGtkCListColumnFc)
+{
+ lpGtkCListColumn->title = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->title);
+ lpGtkCListColumn->area.x = (*env)->GetShortField(env, lpObject, lpGtkCListColumnFc->area_x);
+ lpGtkCListColumn->area.y = (*env)->GetShortField(env, lpObject, lpGtkCListColumnFc->area_y);
+ lpGtkCListColumn->area.width = (*env)->GetShortField(env, lpObject, lpGtkCListColumnFc->area_width);
+ lpGtkCListColumn->area.height = (*env)->GetShortField(env, lpObject, lpGtkCListColumnFc->area_height);
+ lpGtkCListColumn->button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->button);
+ lpGtkCListColumn->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->window);
+ lpGtkCListColumn->width = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->width);
+ lpGtkCListColumn->min_width = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->min_width);
+ lpGtkCListColumn->max_width = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->max_width);
+ lpGtkCListColumn->justification = (GtkJustification)(*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->justification);
+ lpGtkCListColumn->visible = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->visible);
+ lpGtkCListColumn->width_set = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->width_set);
+ lpGtkCListColumn->resizeable = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->resizeable);
+ lpGtkCListColumn->auto_resize = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->auto_resize);
+ lpGtkCListColumn->button_passive = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->button_passive);
+}
+
+void setGtkCListRowFields(JNIEnv *env, jobject lpObject, GtkCListRow *lpGtkCListRow, GtkCListRow_FID_CACHE *lpGtkCListRowFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->cell, (jint)lpGtkCListRow->cell);
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->state, (jint)lpGtkCListRow->state);
+ (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->foreground_red, (jshort)lpGtkCListRow->foreground.red);
+ (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->foreground_green, (jshort)lpGtkCListRow->foreground.green);
+ (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->foreground_blue, (jshort)lpGtkCListRow->foreground.blue);
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->foreground_pixel, (jint)lpGtkCListRow->foreground.pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->background_red, (jshort)lpGtkCListRow->background.red);
+ (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->background_green, (jshort)lpGtkCListRow->background.green);
+ (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->background_blue, (jshort)lpGtkCListRow->background.blue);
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->background_pixel, (jint)lpGtkCListRow->background.pixel);
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->style, (jint)lpGtkCListRow->style);
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->data, (jint)lpGtkCListRow->data);
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->destroy, (jint)lpGtkCListRow->destroy);
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->fg_set, (jint)lpGtkCListRow->fg_set);
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->bg_set, (jint)lpGtkCListRow->bg_set);
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->selectable, (jint)lpGtkCListRow->selectable);
+}
+
+void setGtkCListColumnFields(JNIEnv *env, jobject lpObject, GtkCListColumn *lpGtkCListColumn, GtkCListColumn_FID_CACHE *lpGtkCListColumnFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->title, (jint)lpGtkCListColumn->title);
+ (*env)->SetShortField(env, lpObject, lpGtkCListColumnFc->area_x, (jshort)lpGtkCListColumn->area.x);
+ (*env)->SetShortField(env, lpObject, lpGtkCListColumnFc->area_y, (jshort)lpGtkCListColumn->area.y);
+ (*env)->SetShortField(env, lpObject, lpGtkCListColumnFc->area_width, (jshort)lpGtkCListColumn->area.width);
+ (*env)->SetShortField(env, lpObject, lpGtkCListColumnFc->area_height, (jshort)lpGtkCListColumn->area.height);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->button, (jint)lpGtkCListColumn->button);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->window, (jint)lpGtkCListColumn->window);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->width, (jshort)lpGtkCListColumn->width);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->min_width, (jint)lpGtkCListColumn->min_width);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->max_width, (jint)lpGtkCListColumn->max_width);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->justification, (jint)lpGtkCListColumn->justification);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->visible, (jint)lpGtkCListColumn->visible);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->width_set, (jint)lpGtkCListColumn->width_set);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->resizeable, (jint)lpGtkCListColumn->resizeable);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->auto_resize, (jint)lpGtkCListColumn->auto_resize);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->button_passive, (jint)lpGtkCListColumn->button_passive);
+}
+
+void getGtkCTreeFields(JNIEnv *env, jobject lpObject, GtkCTree *lpGtkCTree, GtkCTree_FID_CACHE *lpGtkCTreeFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkCListFields(env, lpObject, &lpGtkCTree->clist, &PGLOB(GtkCListFc));
+ lpGtkCTree->tree_indent = (*env)->GetIntField(env, lpObject, lpGtkCTreeFc->tree_indent);
+ lpGtkCTree->tree_column = (*env)->GetIntField(env, lpObject, lpGtkCTreeFc->tree_column);
+}
+
+void setGtkCTreeFields(JNIEnv *env, jobject lpObject, GtkCTree *lpGtkCTree, GtkCTree_FID_CACHE *lpGtkCTreeFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkCListFields(env, lpObject, &lpGtkCTree->clist, &PGLOB(GtkCListFc));
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeFc->tree_indent, (jint)lpGtkCTree->tree_indent);
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeFc->tree_column, (jint)lpGtkCTree->tree_column);
+}
+
+void getGtkCTreeRowFields(JNIEnv *env, jobject lpObject, GtkCTreeRow *lpGtkCTreeRow, GtkCTreeRow_FID_CACHE *lpGtkCTreeRowFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkCListRowFields(env, lpObject, &lpGtkCTreeRow->row, &PGLOB(GtkCListRowFc));
+ lpGtkCTreeRow->parent = (GtkCTreeNode*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->parent);
+ lpGtkCTreeRow->sibling = (GtkCTreeNode*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->sibling);
+ lpGtkCTreeRow->children = (GtkCTreeNode*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->children);
+ lpGtkCTreeRow->pixmap_closed = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->pixmap_closed);
+ lpGtkCTreeRow->mask_closed = (GdkBitmap*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->mask_closed);
+ lpGtkCTreeRow->pixmap_opened = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->pixmap_opened);
+ lpGtkCTreeRow->mask_opened = (GdkBitmap*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->mask_opened);
+ lpGtkCTreeRow->level = (*env)->GetShortField(env, lpObject, lpGtkCTreeRowFc->level);
+ lpGtkCTreeRow->is_leaf = (*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->is_leaf);
+ lpGtkCTreeRow->expanded = (*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->expanded);
+}
+
+void setGtkCTreeRowFields(JNIEnv *env, jobject lpObject, GtkCTreeRow *lpGtkCTreeRow, GtkCTreeRow_FID_CACHE *lpGtkCTreeRowFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkCListRowFields(env, lpObject, &lpGtkCTreeRow->row, &PGLOB(GtkCListRowFc));
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->parent, (jint)lpGtkCTreeRow->parent);
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->sibling, (jint)lpGtkCTreeRow->sibling);
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->children, (jint)lpGtkCTreeRow->children);
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->pixmap_closed, (jint)lpGtkCTreeRow->pixmap_closed);
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->mask_closed, (jint)lpGtkCTreeRow->mask_closed);
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->pixmap_opened, (jint)lpGtkCTreeRow->pixmap_opened);
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->mask_opened, (jint)lpGtkCTreeRow->mask_opened);
+ (*env)->SetShortField(env, lpObject, lpGtkCTreeRowFc->level, (jshort)lpGtkCTreeRow->level);
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->is_leaf, (jint)lpGtkCTreeRow->is_leaf);
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->expanded, (jint)lpGtkCTreeRow->expanded);
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.h
new file mode 100644
index 0000000..605c117
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/structs.h
@@ -0,0 +1,580 @@
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+/**
+ * JNI SWT object field getters and setters declarations for GTK structs.
+ */
+
+#ifndef INC_structs_H
+#define INC_structs_H
+
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+
+/* ----------- fid and class caches ----------- */
+/**
+ * Used for Java objects passed into JNI that are
+ * declared like:
+ *
+ * nativeFunction (Rectangle p1, Rectangle p2, Rectangle p3)
+ *
+ * and not like this
+ *
+ * nativeFunction (Object p1, Object p2, Object p3)
+ *
+ *
+ */
+
+/* ----------- fid cache structures ----------- */
+
+typedef struct GdkColor_FID_CACHE {
+ int cached;
+ jclass GdkColorClass;
+ jfieldID pixel, red, green, blue;
+} GdkColor_FID_CACHE;
+
+typedef GdkColor_FID_CACHE *PGdkColor_FID_CACHE;
+
+typedef struct GdkEventKey_FID_CACHE {
+ int cached;
+ jclass GdkEventKeyClass;
+ jfieldID type, window, send_event, time, state, keyval, length, string;
+} GdkEventKey_FID_CACHE;
+
+typedef GdkEventKey_FID_CACHE *PGdkEventKey_FID_CACHE;
+
+typedef struct GdkEventButton_FID_CACHE {
+ int cached;
+ jclass GdkEventButtonClass;
+ jfieldID type, window, send_event, time, x, y, pressure, xtilt, ytilt, state, button, source, deviceid, x_root, y_root;
+} GdkEventButton_FID_CACHE;
+
+typedef GdkEventButton_FID_CACHE *PGdkEventButton_FID_CACHE;
+
+typedef struct GdkEventMotion_FID_CACHE {
+ int cached;
+ jclass GdkEventMotionClass;
+ jfieldID type, window, send_event, time, x, y, pressure, xtilt, ytilt, state, is_hint, source, deviceid, x_root, y_root;
+} GdkEventMotion_FID_CACHE;
+
+typedef GdkEventMotion_FID_CACHE *PGdkEventMotion_FID_CACHE;
+
+typedef struct GdkEventExpose_FID_CACHE {
+ int cached;
+ jclass GdkEventExposeClass;
+ jfieldID type, window, send_event, x, y, width, height, count;
+} GdkEventExpose_FID_CACHE;
+
+typedef GdkEventExpose_FID_CACHE *PGdkEventExpose_FID_CACHE;
+
+typedef struct GdkFont_FID_CACHE {
+ int cached;
+ jclass GdkFontClass;
+ jfieldID type, ascent, descent;
+} GdkFont_FID_CACHE;
+
+typedef GdkFont_FID_CACHE *PGdkFont_FID_CACHE;
+
+typedef struct GdkGCValues_FID_CACHE {
+ int cached;
+ jclass GdkGCValuesClass;
+ jfieldID foreground_pixel, foreground_red, foreground_green, foreground_blue, background_pixel, background_red, background_green, background_blue, font, function, fill, tile, stipple, clip_mask, subwindow_mode, ts_x_origin, ts_y_origin, clip_x_origin, clip_y_origin, graphics_exposures, line_width, line_style, cap_style, join_style;
+} GdkGCValues_FID_CACHE;
+
+typedef GdkGCValues_FID_CACHE *PGdkGCValues_FID_CACHE;
+
+typedef struct GdkImage_FID_CACHE {
+ int cached;
+ jclass GdkImageClass;
+ jfieldID type, visual, byte_order, width, height, depth, bpp, bpl, mem;
+} GdkImage_FID_CACHE;
+
+typedef GdkImage_FID_CACHE *PGdkImage_FID_CACHE;
+
+typedef struct GdkPoint_FID_CACHE {
+ int cached;
+ jclass GdkPointClass;
+ jfieldID x, y;
+} GdkPoint_FID_CACHE;
+
+typedef GdkPoint_FID_CACHE *PGdkPoint_FID_CACHE;
+
+typedef struct GdkRectangle_FID_CACHE {
+ int cached;
+ jclass GdkRectangleClass;
+ jfieldID x, y, width, height;
+} GdkRectangle_FID_CACHE;
+
+typedef GdkRectangle_FID_CACHE *PGdkRectangle_FID_CACHE;
+
+typedef struct GdkVisual_FID_CACHE {
+ int cached;
+ jclass GdkVisualClass;
+ jfieldID type, depth, byte_order, colormap_size, bits_per_rgb, red_mask, red_shift, red_prec, green_mask, green_shift, green_prec, blue_mask, blue_shift, blue_prec;
+} GdkVisual_FID_CACHE;
+
+typedef GdkVisual_FID_CACHE *PGdkVisual_FID_CACHE;
+
+typedef struct GtkObject_FID_CACHE {
+ int cached;
+ jclass GtkObjectClass;
+ jfieldID klass, flags, ref_count, object_data;
+} GtkObject_FID_CACHE;
+
+typedef GtkObject_FID_CACHE *PGtkObject_FID_CACHE;
+
+typedef struct GtkData_FID_CACHE {
+ int cached;
+ jclass GtkDataClass;
+} GtkData_FID_CACHE;
+
+typedef GtkData_FID_CACHE *PGtkData_FID_CACHE;
+
+typedef struct GtkAdjustment_FID_CACHE {
+ int cached;
+ jclass GtkAdjustmentClass;
+ jfieldID lower, upper, value, step_increment, page_increment, page_size;
+} GtkAdjustment_FID_CACHE;
+
+typedef GtkAdjustment_FID_CACHE *PGtkAdjustment_FID_CACHE;
+
+typedef struct GtkAllocation_FID_CACHE {
+ int cached;
+ jclass GtkAllocationClass;
+ jfieldID x, y, width, height;
+} GtkAllocation_FID_CACHE;
+
+typedef GtkAllocation_FID_CACHE *PGtkAllocation_FID_CACHE;
+
+typedef struct GtkWidget_FID_CACHE {
+ int cached;
+ jclass GtkWidgetClass;
+ jfieldID private_flags, state, saved_state, name, style, req_width, req_height, alloc_x, alloc_y, alloc_width, alloc_height, window, parent;
+} GtkWidget_FID_CACHE;
+
+typedef GtkWidget_FID_CACHE *PGtkWidget_FID_CACHE;
+
+typedef struct GtkContainer_FID_CACHE {
+ int cached;
+ jclass GtkContainerClass;
+ jfieldID focus_child, border_width, need_resize, resize_mode, resize_widgets;
+} GtkContainer_FID_CACHE;
+
+typedef GtkContainer_FID_CACHE *PGtkContainer_FID_CACHE;
+
+typedef struct GtkBin_FID_CACHE {
+ int cached;
+ jclass GtkBinClass;
+ jfieldID child;
+} GtkBin_FID_CACHE;
+
+typedef GtkBin_FID_CACHE *PGtkBin_FID_CACHE;
+
+typedef struct GtkFrame_FID_CACHE {
+ int cached;
+ jclass GtkFrameClass;
+ jfieldID label, shadow_type,
+ label_width, label_height,
+ label_xalign, label_yalign;
+} GtkFrame_FID_CACHE;
+
+typedef GtkFrame_FID_CACHE *PGtkFrame_FID_CACHE;
+
+typedef struct GtkMenu_FID_CACHE {
+ int cached;
+ jclass GtkMenuClass;
+ jfieldID parent_menu_item, old_active_menu_item, accel_group, position_func, position_func_data, toplevel, tearoff_window, torn_off;
+} GtkMenu_FID_CACHE;
+
+typedef GtkMenu_FID_CACHE *PGtkMenu_FID_CACHE;
+
+typedef struct GtkMenuShell_FID_CACHE {
+ int cached;
+ jclass GtkMenuShellClass;
+ jfieldID active;
+} GtkMenuShell_FID_CACHE;
+
+typedef GtkMenuShell_FID_CACHE *PGtkMenuShell_FID_CACHE;
+
+typedef struct GtkItem_FID_CACHE {
+ int cached;
+ jclass GtkItemClass;
+} GtkItem_FID_CACHE;
+
+typedef GtkItem_FID_CACHE *PGtkItem_FID_CACHE;
+
+typedef struct GtkMenuItem_FID_CACHE {
+ int cached;
+ jclass GtkMenuItemClass;
+ jfieldID submenu, accelerator_signal, toggle_size, accelerator_width, show_toggle_indicator, show_submenu_indicator, submenu_placement, submenu_direction, right_justify, timer;
+} GtkMenuItem_FID_CACHE;
+
+typedef GtkMenuItem_FID_CACHE *PGtkMenuItem_FID_CACHE;
+
+typedef struct GtkCheckMenuItem_FID_CACHE {
+ int cached;
+ jclass GtkCheckMenuItemClass;
+ jfieldID active, always_show_toggle;
+} GtkCheckMenuItem_FID_CACHE;
+
+typedef GtkCheckMenuItem_FID_CACHE *PGtkCheckMenuItem_FID_CACHE;
+
+typedef struct GtkWindow_FID_CACHE {
+ int cached;
+ jclass GtkWindowClass;
+ jfieldID title, wmclass_name, wmclass_class, type, focus_widget, default_widget, transient_parent, resize_count, allow_shrink, allow_grow, auto_shrink, handling_resize, position, use_uposition, modal;
+} GtkWindow_FID_CACHE;
+
+typedef GtkWindow_FID_CACHE *PGtkWindow_FID_CACHE;
+
+typedef struct GtkColorSelectionDialog_FID_CACHE {
+ int cached;
+ jclass GtkColorSelectionDialogClass;
+ jfieldID colorsel, main_vbox, ok_button, reset_button, cancel_button, help_button;
+} GtkColorSelectionDialog_FID_CACHE;
+
+typedef GtkColorSelectionDialog_FID_CACHE *PGtkColorSelectionDialog_FID_CACHE;
+
+typedef struct GtkBox_FID_CACHE {
+ int cached;
+ jclass GtkBoxClass;
+ jfieldID children, spacing, homogeneous;
+} GtkBox_FID_CACHE;
+
+typedef GtkBox_FID_CACHE *PGtkBox_FID_CACHE;
+
+typedef struct GtkHBox_FID_CACHE {
+ int cached;
+ jclass GtkHBoxClass;
+} GtkHBox_FID_CACHE;
+
+typedef GtkHBox_FID_CACHE *PGtkHBox_FID_CACHE;
+
+typedef struct GtkCombo_FID_CACHE {
+ int cached;
+ jclass GtkComboClass;
+ jfieldID entry, button, popup, popwin, list, entry_change_id, list_change_id, value_in_list, ok_if_empty, case_sensitive, use_arrows, use_arrows_always, current_button, activate_id;
+} GtkCombo_FID_CACHE;
+
+typedef GtkCombo_FID_CACHE *PGtkCombo_FID_CACHE;
+
+typedef struct GtkFileSelection_FID_CACHE {
+ int cached;
+ jclass GtkFileSelectionClass;
+ jfieldID dir_list, file_list, selection_entry, selection_text, main_vbox, ok_button, cancel_button, help_button, history_pulldown, history_menu, history_list, fileop_dialog, fileop_entry, fileop_file, cmpl_state, fileop_c_dir, fileop_del_file, fileop_ren_file, button_area, action_area;
+} GtkFileSelection_FID_CACHE;
+
+typedef GtkFileSelection_FID_CACHE *PGtkFileSelection_FID_CACHE;
+
+typedef struct GtkFontSelectionDialog_FID_CACHE {
+ int cached;
+ jclass GtkFontSelectionDialogClass;
+ jfieldID fontsel, main_vbox, action_area, ok_button, apply_button, cancel_button, dialog_width, auto_resize;
+} GtkFontSelectionDialog_FID_CACHE;
+
+typedef GtkFontSelectionDialog_FID_CACHE *PGtkFontSelectionDialog_FID_CACHE;
+
+typedef struct GtkCList_FID_CACHE {
+ int cached;
+ jclass GtkCListClass;
+ jfieldID clist_flags, row_mem_chunk, cell_mem_chunk, freeze_count, internal_allocation_x, internal_allocation_y, internal_allocation_width, internal_allocation_height, rows, row_center_offset, row_height, row_list, row_list_end, columns, column_title_area_x, column_title_area_y, column_title_area_width, column_title_area_height, title_window, column, clist_window, clist_window_width, clist_window_height, hoffset, voffset, shadow_type, selection_mode, selection, selection_end, undo_selection, undo_unselection, undo_anchor, button_actions0, button_actions1, button_actions2, button_actions3, button_actions4, drag_button, click_cell_row, click_cell_column, hadjustment, vadjustment, xor_gc, fg_gc, bg_gc, cursor_drag, x_drag, focus_row, anchor, anchor_state, drag_pos, htimer, vtimer, sort_type, compare, sort_column;
+} GtkCList_FID_CACHE;
+
+typedef GtkCList_FID_CACHE *PGtkCList_FID_CACHE;
+
+typedef struct GtkEditable_FID_CACHE {
+ int cached;
+ jclass GtkEditableClass;
+ jfieldID current_pos, selection_start_pos, selection_end_pos, has_selection, editable, visible, ic, ic_attr, clipboard_text;
+} GtkEditable_FID_CACHE;
+
+typedef GtkEditable_FID_CACHE *PGtkEditable_FID_CACHE;
+
+typedef struct GtkText_FID_CACHE {
+ int cached;
+ jclass GtkTextClass;
+ jfieldID first_line_start_index,first_onscreen_hor_pixel,first_onscreen_ver_pixel,default_tab_width,cursor_pos_x,cursor_pos_y,cursor_virtual_x;
+} GtkText_FID_CACHE;
+
+typedef GtkText_FID_CACHE *PGtkText_FID_CACHE;
+
+typedef struct GtkProgress_FID_CACHE {
+ int cached;
+ jclass GtkProgressClass;
+ jfieldID adjustment, offscreen_pixmap, format, x_align, y_align, show_text, activity_mode;
+} GtkProgress_FID_CACHE;
+
+typedef GtkProgress_FID_CACHE *PGtkProgress_FID_CACHE;
+
+typedef struct GtkProgressBar_FID_CACHE {
+ int cached;
+ jclass GtkProgressBarClass;
+ jfieldID bar_style, orientation, blocks, in_block, activity_pos, activity_step, activity_blocks, activity_dir;
+} GtkProgressBar_FID_CACHE;
+
+typedef GtkProgressBar_FID_CACHE *PGtkProgressBar_FID_CACHE;
+
+typedef struct GtkArg_FID_CACHE {
+ int cached;
+ jclass GtkArgClass;
+ jfieldID type, name, d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11;
+} GtkArg_FID_CACHE;
+
+typedef GtkArg_FID_CACHE *PGtkArg_FID_CACHE;
+
+typedef struct GtkRequisition_FID_CACHE {
+ int cached;
+ jclass GtkRequisitionClass;
+ jfieldID width, height;
+} GtkRequisition_FID_CACHE;
+
+typedef GtkRequisition_FID_CACHE *PGtkRequisition_FID_CACHE;
+
+typedef struct GtkStyle_FID_CACHE {
+ int cached;
+ jclass GtkStyleClazz;
+ jfieldID klass, fg0_pixel, fg0_red, fg0_green, fg0_blue, fg1_pixel, fg1_red, fg1_green, fg1_blue, fg2_pixel, fg2_red, fg2_green, fg2_blue, fg3_pixel, fg3_red, fg3_green, fg3_blue, fg4_pixel, fg4_red, fg4_green, fg4_blue, bg0_pixel, bg0_red, bg0_green, bg0_blue, bg1_pixel, bg1_red, bg1_green, bg1_blue, bg2_pixel, bg2_red, bg2_green, bg2_blue, bg3_pixel, bg3_red, bg3_green, bg3_blue, bg4_pixel, bg4_red, bg4_green, bg4_blue, light0_pixel, light0_red, light0_green, light0_blue, light1_pixel, light1_red, light1_green, light1_blue, light2_pixel, light2_red, light2_green, light2_blue, light3_pixel, light3_red, light3_green, light3_blue, light4_pixel, light4_red, light4_green, light4_blue, dark0_pixel, dark0_red, dark0_green, dark0_blue, dark1_pixel, dark1_red, dark1_green, dark1_blue, dark2_pixel, dark2_red, dark2_green, dark2_blue, dark3_pixel, dark3_red, dark3_green, dark3_blue, dark4_pixel, dark4_red, dark4_green, dark4_blue, mid0_pixel, mid0_red, mid0_green, mid0_blue, mid1_pixel, mid1_red, mid1_green, mid1_blue, mid2_pixel, mid2_red, mid2_green, mid2_blue, mid3_pixel, mid3_red, mid3_green, mid3_blue, mid4_pixel, mid4_red, mid4_green, mid4_blue, text0_pixel, text0_red, text0_green, text0_blue, text1_pixel, text1_red, text1_green, text1_blue, text2_pixel, text2_red, text2_green, text2_blue, text3_pixel, text3_red, text3_green, text3_blue, text4_pixel, text4_red, text4_green, text4_blue, base0_pixel, base0_red, base0_green, base0_blue, base1_pixel, base1_red, base1_green, base1_blue, base2_pixel, base2_red, base2_green, base2_blue, base3_pixel, base3_red, base3_green, base3_blue, base4_pixel, base4_red, base4_green, base4_blue, black_pixel, black_red, black_green, black_blue, white_pixel, white_red, white_green, white_blue, font, fg_gc0, fg_gc1, fg_gc2, fg_gc3, fg_gc4, bg_gc0, bg_gc1, bg_gc2, bg_gc3, bg_gc4, light_gc0, light_gc1, light_gc2, light_gc3, light_gc4, dark_gc0, dark_gc1, dark_gc2, dark_gc3, dark_gc4, mid_gc0, mid_gc1, mid_gc2, mid_gc3, mid_gc4, text_gc0, text_gc1, text_gc2, text_gc3, text_gc4, base_gc0, base_gc1, base_gc2, base_gc3, base_gc4, black_gc, white_gc, bg_pixmap0, bg_pixmap1, bg_pixmap2, bg_pixmap3, bg_pixmap4, bg_pixmap5;
+ jfieldID ref_count, attach_count, depth, colormap, engine, engine_data, rc_style, styles;
+} GtkStyle_FID_CACHE;
+
+typedef GtkStyle_FID_CACHE *PGtkStyle_FID_CACHE;
+
+typedef struct GtkStyleClass_FID_CACHE {
+ int cached;
+ jclass GtkStyleClassClazz;
+ jfieldID xthickness, ythickness;
+} GtkStyleClass_FID_CACHE;
+
+typedef GtkStyleClass_FID_CACHE *PGtkStyleClass_FID_CACHE;
+
+typedef struct GtkCListRow_FID_CACHE {
+ int cached;
+ jclass GtkCListRowClass;
+ jfieldID cell, state, foreground_red, foreground_green, foreground_blue, foreground_pixel, background_red, background_green, background_blue, background_pixel, style, data, destroy, fg_set, bg_set, selectable;
+} GtkCListRow_FID_CACHE;
+
+typedef GtkCListRow_FID_CACHE *PGtkCListRow_FID_CACHE;
+
+typedef struct GtkCListColumn_FID_CACHE {
+ int cached;
+ jclass GtkCListColumnClass;
+ jfieldID title, area_x, area_y, area_width, area_height, button, window, width, min_width, max_width, justification, visible, width_set, resizeable, auto_resize, button_passive;
+} GtkCListColumn_FID_CACHE;
+
+typedef GtkCListColumn_FID_CACHE *PGtkCListColumn_FID_CACHE;
+
+typedef struct GtkCTreeRow_FID_CACHE {
+ int cached;
+ jclass GtkCTreeRowClass;
+ jfieldID parent, sibling, children, pixmap_closed, mask_closed, pixmap_opened, mask_opened, level, is_leaf, expanded;
+} GtkCTreeRow_FID_CACHE;
+
+typedef GtkCTreeRow_FID_CACHE *PGtkCTreeRow_FID_CACHE;
+
+typedef struct GtkCTree_FID_CACHE {
+ int cached;
+ jclass GtkCTreeClass;
+ jfieldID tree_indent, tree_column;
+
+} GtkCTree_FID_CACHE;
+
+typedef GtkCTree_FID_CACHE *PGtkCTree_FID_CACHE;
+
+/* ----------- cache function prototypes ----------- */
+
+void cacheGdkColorFids(JNIEnv *env, jobject lpGdkColor, PGdkColor_FID_CACHE lpCache);
+void cacheGdkEventKeyFids(JNIEnv *env, jobject lpGdkEventKey, PGdkEventKey_FID_CACHE lpCache);
+void cacheGdkEventButtonFids(JNIEnv *env, jobject lpGdkEventButton, PGdkEventButton_FID_CACHE lpCache);
+void cacheGdkEventMotionFids(JNIEnv *env, jobject lpGdkEventMotion, PGdkEventMotion_FID_CACHE lpCache);
+void cacheGdkEventExposeFids(JNIEnv *env, jobject lpGdkEventExpose, PGdkEventExpose_FID_CACHE lpCache);
+void cacheGdkFontFids(JNIEnv *env, jobject lpGdkFont, PGdkFont_FID_CACHE lpCache);
+void cacheGdkGCValuesFids(JNIEnv *env, jobject lpGdkGCValues, PGdkGCValues_FID_CACHE lpCache);
+void cacheGdkImageFids(JNIEnv *env, jobject lpGdkImage, PGdkImage_FID_CACHE lpCache);
+void cacheGdkPointFids(JNIEnv *env, jobject lpGdkPoint, PGdkPoint_FID_CACHE lpCache);
+void cacheGdkRectangleFids(JNIEnv *env, jobject lpGdkRectangle, PGdkRectangle_FID_CACHE lpCache);
+void cacheGdkVisualFids(JNIEnv *env, jobject lpGdkVisual, PGdkVisual_FID_CACHE lpCache);
+
+void cacheGtkObjectFids(JNIEnv *env, jobject lpGtkObject, PGtkObject_FID_CACHE lpCache);
+void cacheGtkDataFids(JNIEnv *env, jobject lpGtkData, PGtkData_FID_CACHE lpCache);
+void cacheGtkAdjustmentFids(JNIEnv *env, jobject lpGtkAdjustment, PGtkAdjustment_FID_CACHE lpCache);
+void cacheGtkWidgetFids(JNIEnv *env, jobject lpGtkWidget, PGtkWidget_FID_CACHE lpCache);
+void cacheGtkContainerFids(JNIEnv *env, jobject lpGtkContainer, PGtkContainer_FID_CACHE lpCache);
+void cacheGtkBinFids(JNIEnv *env, jobject lpGtkBin, PGtkBin_FID_CACHE lpCache);
+void cacheGtkMenuFids(JNIEnv *env, jobject lpGtkMenu, PGtkMenu_FID_CACHE lpCache);
+void cacheGtkMenuShellFids(JNIEnv *env, jobject lpGtkMenuShell, PGtkMenuShell_FID_CACHE lpCache);
+void cacheGtkItemFids(JNIEnv *env, jobject lpGtkItem, PGtkItem_FID_CACHE lpCache);
+void cacheGtkMenuItemFids(JNIEnv *env, jobject lpGtkMenuItem, PGtkMenuItem_FID_CACHE lpCache);
+void cacheGtkCheckMenuItemFids(JNIEnv *env, jobject lpGtkCheckMenuItem, PGtkCheckMenuItem_FID_CACHE lpCache);
+void cacheGtkWindowFids(JNIEnv *env, jobject lpGtkWindow, PGtkWindow_FID_CACHE lpCache);
+void cacheGtkColorSelectionDialogFids(JNIEnv *env, jobject lpGtkColorSelectionDialog, PGtkColorSelectionDialog_FID_CACHE lpCache);
+void cacheGtkFileSelectionFids(JNIEnv *env, jobject lpGtkFileSelection, PGtkFileSelection_FID_CACHE lpCache);
+void cacheGtkFontSelectionDialogFids(JNIEnv *env, jobject lpGtkFontSelectionDialog, PGtkFontSelectionDialog_FID_CACHE lpCache);
+void cacheGtkBoxFids(JNIEnv *env, jobject lpGtkBox, PGtkBox_FID_CACHE lpCache);
+void cacheGtkHBoxFids(JNIEnv *env, jobject lpGtkHBox, PGtkHBox_FID_CACHE lpCache);
+void cacheGtkComboFids(JNIEnv *env, jobject lpGtkCombo, PGtkCombo_FID_CACHE lpCache);
+void cacheGtkCListFids(JNIEnv *env, jobject lpGtkCList, PGtkCList_FID_CACHE lpCache);
+void cacheGtkEditableFids(JNIEnv *env, jobject lpGtkEditable, PGtkEditable_FID_CACHE lpCache);
+void cacheGtkTextFids(JNIEnv *env, jobject lpGtkText, PGtkText_FID_CACHE lpCache);
+void cacheGtkProgressFids(JNIEnv *env, jobject lpGtkProgress, PGtkProgress_FID_CACHE lpCache);
+void cacheGtkProgressBarFids(JNIEnv *env, jobject lpGtkProgressBar, PGtkProgressBar_FID_CACHE lpCache);
+
+void cacheGtkAllocationFids(JNIEnv *env, jobject lpGtkAllocation, PGtkAllocation_FID_CACHE lpCache);
+void cacheGtkArgFids(JNIEnv *env, jobject lpGtkArg, PGtkArg_FID_CACHE lpCache);
+void cacheGtkRequisitionFids(JNIEnv *env, jobject lpGtkRequisition, PGtkRequisition_FID_CACHE lpCache);
+void cacheGtkStyleFids(JNIEnv *env, jobject lpGtkStyle, PGtkStyle_FID_CACHE lpCache);
+void cacheGtkStyleClassFids(JNIEnv *env, jobject lpGtkStyleClass, PGtkStyleClass_FID_CACHE lpCache);
+void cacheGtkCListColumnFids(JNIEnv *env, jobject lpGtkCListColumn, PGtkCListColumn_FID_CACHE lpCache);
+void cacheGtkCListRowFids(JNIEnv *env, jobject lpGtkCListRow, PGtkCListRow_FID_CACHE lpCache);
+void cacheGtkCTreeRowFids(JNIEnv *env, jobject lpGtkCTreeRow, PGtkCTreeRow_FID_CACHE lpCache);
+void cacheGtkCTreeFids(JNIEnv *env, jobject lpGtkCTree, PGtkCTree_FID_CACHE lpCache);
+
+/* ----------- swt getter and setter prototypes ----------- */
+/**
+ * These functions get or set object field ids assuming that the
+ * fids for these objects have already been cached.
+ *
+ * The header file just contains function prototypes
+ */
+void getGdkColorFields(JNIEnv *env, jobject lpObject, GdkColor *lpGdkColor, GdkColor_FID_CACHE *lpGdkColorFc);
+void setGdkColorFields(JNIEnv *env, jobject lpObject, GdkColor *lpGdkColor, GdkColor_FID_CACHE *lpGdkColorFc);
+void getGdkEventKeyFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventKey_FID_CACHE *lpGdkEventKeyFc);
+void setGdkEventKeyFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventKey_FID_CACHE *lpGdkEventKeyFc);
+void getGdkEventButtonFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventButton_FID_CACHE *lpGdkEventButtonFc);
+void setGdkEventButtonFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventButton_FID_CACHE *lpGdkEventButtonFc);
+void getGdkEventMotionFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventMotion_FID_CACHE *lpGdkEventMotionFc);
+void setGdkEventMotionFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventMotion_FID_CACHE *lpGdkEventMotionFc);
+void getGdkEventExposeFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventExpose_FID_CACHE *lpGdkEventExposeFc);
+void setGdkEventExposeFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventExpose_FID_CACHE *lpGdkEventExposeFc);
+void getGdkFontFields(JNIEnv *env, jobject lpObject, GdkFont *lpGdkFont, GdkFont_FID_CACHE *lpGdkFontFc);
+void setGdkFontFields(JNIEnv *env, jobject lpObject, GdkFont *lpGdkFont, GdkFont_FID_CACHE *lpGdkFontFc);
+void getGdkGCValuesFields(JNIEnv *env, jobject lpObject, GdkGCValues *lpGdkGCValues, GdkGCValues_FID_CACHE *lpGdkGCValuesFc);
+void setGdkGCValuesFields(JNIEnv *env, jobject lpObject, GdkGCValues *lpGdkGCValues, GdkGCValues_FID_CACHE *lpGdkGCValuesFc);
+void getGdkImageFields(JNIEnv *env, jobject lpObject, GdkImage *lpGdkImage, GdkImage_FID_CACHE *lpGdkImageFc);
+void setGdkImageFields(JNIEnv *env, jobject lpObject, GdkImage *lpGdkImage, GdkImage_FID_CACHE *lpGdkImageFc);
+void getGdkPointFields(JNIEnv *env, jobject lpObject, GdkPoint *lpGdkPoint, GdkPoint_FID_CACHE *lpGdkPointFc);
+void setGdkPointFields(JNIEnv *env, jobject lpObject, GdkPoint *lpGdkPoint, GdkPoint_FID_CACHE *lpGdkPointFc);
+void getGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpGdkRectangle, GdkRectangle_FID_CACHE *lpGdkRectangleFc);
+void setGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpGdkRectangle, GdkRectangle_FID_CACHE *lpGdkRectangleFc);
+void getGdkVisualFields(JNIEnv *env, jobject lpObject, GdkVisual *lpGdkVisual, GdkVisual_FID_CACHE *lpGdkVisualFc);
+void setGdkVisualFields(JNIEnv *env, jobject lpObject, GdkVisual *lpGdkVisual, GdkVisual_FID_CACHE *lpGdkVisualFc);
+void getGtkAllocationFields(JNIEnv *env, jobject lpObject, GtkAllocation *lpGtkAllocation, GtkAllocation_FID_CACHE *lpGtkAllocationFc);
+void setGtkAllocationFields(JNIEnv *env, jobject lpObject, GtkAllocation *lpGtkAllocation, GtkAllocation_FID_CACHE *lpGtkAllocationFc);
+void getGtkArgFields(JNIEnv *env, jobject lpObject, GtkArg *lpGtkArg, GtkArg_FID_CACHE *lpGtkArgFc);
+void setGtkArgFields(JNIEnv *env, jobject lpObject, GtkArg *lpGtkArg, GtkArg_FID_CACHE *lpGtkArgFc);
+void getGtkBinFields(JNIEnv *env, jobject lpObject, GtkBin *lpGtkBin, GtkBin_FID_CACHE *lpGtkBinFc);
+void setGtkBinFields(JNIEnv *env, jobject lpObject, GtkBin *lpGtkBin, GtkBin_FID_CACHE *lpGtkBinFc);
+void getGtkCListFields(JNIEnv *env, jobject lpObject, GtkCList *lpGtkCList, GtkCList_FID_CACHE *lpGtkCListFc);
+void setGtkCListFields(JNIEnv *env, jobject lpObject, GtkCList *lpGtkCList, GtkCList_FID_CACHE *lpGtkCListFc);
+void getGtkCListRowFields(JNIEnv *env, jobject lpObject, GtkCListRow *lpGtkCListRow, GtkCListRow_FID_CACHE *lpGtkCListRowFc);
+void setGtkCListRowFields(JNIEnv *env, jobject lpObject, GtkCListRow *lpGtkCListRow, GtkCListRow_FID_CACHE *lpGtkCListRowFc);
+void getGtkCListColumnFields(JNIEnv *env, jobject lpObject, GtkCListColumn *lpGtkCListColumn, GtkCListColumn_FID_CACHE *lpGtkCListColumnFc);
+void setGtkCListColumnFields(JNIEnv *env, jobject lpObject, GtkCListColumn *lpGtkCListColumn, GtkCListColumn_FID_CACHE *lpGtkCListColumnFc);
+void getGtkCTreeRowFields(JNIEnv *env, jobject lpObject, GtkCTreeRow *lpGtkCTreeRow, GtkCTreeRow_FID_CACHE *lpGtkCTreeRowFc);
+void setGtkCTreeRowFields(JNIEnv *env, jobject lpObject, GtkCTreeRow *lpGtkCTreeRow, GtkCTreeRow_FID_CACHE *lpGtkCTreeRowFc);
+void getGtkColorSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkColorSelectionDialog *lpGtkColorSelectionDialog, GtkColorSelectionDialog_FID_CACHE *lpGtkColorSelectionDialogFc);
+void setGtkColorSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkColorSelectionDialog *lpGtkColorSelectionDialog, GtkColorSelectionDialog_FID_CACHE *lpGtkColorSelectionDialogFc);
+void getGtkComboFields(JNIEnv *env, jobject lpObject, GtkCombo *lpGtkCombo, GtkCombo_FID_CACHE *lpGtkComboFc);
+void setGtkComboFields(JNIEnv *env, jobject lpObject, GtkCombo *lpGtkCombo, GtkCombo_FID_CACHE *lpGtkComboFc);
+void getGtkContainerFields(JNIEnv *env, jobject lpObject, GtkContainer *lpGtkContainer, GtkContainer_FID_CACHE *lpGtkContainerFc);
+void setGtkContainerFields(JNIEnv *env, jobject lpObject, GtkContainer *lpGtkContainer, GtkContainer_FID_CACHE *lpGtkContainerFc);
+void getGtkDataFields(JNIEnv *env, jobject lpObject, GtkData *lpGtkData, GtkData_FID_CACHE *lpGtkDataFc);
+void setGtkDataFields(JNIEnv *env, jobject lpObject, GtkData *lpGtkData, GtkData_FID_CACHE *lpGtkDataFc);
+void getGtkEditableFields(JNIEnv *env, jobject lpObject, GtkEditable *lpGtkEditable, GtkEditable_FID_CACHE *lpGtkEditableFc);
+void setGtkEditableFields(JNIEnv *env, jobject lpObject, GtkEditable *lpGtkEditable, GtkEditable_FID_CACHE *lpGtkEditableFc);
+void getGtkFrameFields(JNIEnv *env, jobject lpObject, GtkFrame *lpGtkFrame, GtkFrame_FID_CACHE *lpGtkFrameFc);
+void setGtkFrameFields(JNIEnv *env, jobject lpObject, GtkFrame *lpGtkFrame, GtkFrame_FID_CACHE *lpGtkFrameFc);
+void getGtkTextFields(JNIEnv *env, jobject lpObject, GtkText *lpGtkText, GtkText_FID_CACHE *lpGtkTextFc);
+void setGtkTextFields(JNIEnv *env, jobject lpObject, GtkText *lpGtkText, GtkText_FID_CACHE *lpGtkTextFc);
+void getGtkFileSelectionFields(JNIEnv *env, jobject lpObject, GtkFileSelection *lpGtkFileSelection, GtkFileSelection_FID_CACHE *lpGtkFileSelectionFc);
+void setGtkFileSelectionFields(JNIEnv *env, jobject lpObject, GtkFileSelection *lpGtkFileSelection, GtkFileSelection_FID_CACHE *lpGtkFileSelectionFc);
+void getGtkFontSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkFontSelectionDialog *lpGtkFontSelectionDialog, GtkFontSelectionDialog_FID_CACHE *lpGtkFontSelectionDialogFc);
+void setGtkFontSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkFontSelectionDialog *lpGtkFontSelectionDialog, GtkFontSelectionDialog_FID_CACHE *lpGtkFontSelectionDialogFc);
+void getGtkObjectFields(JNIEnv *env, jobject lpObject, GtkObject *lpGtkObject, GtkObject_FID_CACHE *lpGtkObjectFc);
+void setGtkObjectFields(JNIEnv *env, jobject lpObject, GtkObject *lpGtkObject, GtkObject_FID_CACHE *lpGtkObjectFc);
+void getGtkProgressFields(JNIEnv *env, jobject lpObject, GtkProgress *lpGtkProgress, GtkProgress_FID_CACHE *lpGtkProgressFc);
+void setGtkProgressFields(JNIEnv *env, jobject lpObject, GtkProgress *lpGtkProgress, GtkProgress_FID_CACHE *lpGtkProgressFc);
+void getGtkProgressBarFields(JNIEnv *env, jobject lpObject, GtkProgressBar *lpGtkProgressBar, GtkProgressBar_FID_CACHE *lpGtkProgressBarFc);
+void setGtkProgressBarFields(JNIEnv *env, jobject lpObject, GtkProgressBar *lpGtkProgressBar, GtkProgressBar_FID_CACHE *lpGtkProgressBarFc);
+void getGtkRequisitionFields(JNIEnv *env, jobject lpObject, GtkRequisition *lpGtkRequisition, GtkRequisition_FID_CACHE *lpGtkRequisitionFc);
+void setGtkRequisitionFields(JNIEnv *env, jobject lpObject, GtkRequisition *lpGtkRequisition, GtkRequisition_FID_CACHE *lpGtkRequisitionFc);
+void getGtkStyleFields(JNIEnv *env, jobject lpObject, GtkStyle *lpGtkStyle, GtkStyle_FID_CACHE *lpGtkStyleFc);
+void setGtkStyleFields(JNIEnv *env, jobject lpObject, GtkStyle *lpGtkStyle, GtkStyle_FID_CACHE *lpGtkStyleFc);
+void getGtkStyleClassFields(JNIEnv *env, jobject lpObject, GtkStyleClass *lpGtkStyleClass, GtkStyleClass_FID_CACHE *lpGtkStyleClassFc);
+void setGtkStyleClassFields(JNIEnv *env, jobject lpObject, GtkStyleClass *lpGtkStyleClass, GtkStyleClass_FID_CACHE *lpGtkStyleClassFc);
+void getGtkWidgetFields(JNIEnv *env, jobject lpObject, GtkWidget *lpGtkWidget, GtkWidget_FID_CACHE *lpGtkWidgetFc);
+void setGtkWidgetFields(JNIEnv *env, jobject lpObject, GtkWidget *lpGtkWidget, GtkWidget_FID_CACHE *lpGtkWidgetFc);
+void getGtkWindowFields(JNIEnv *env, jobject lpObject, GtkWindow *lpGtkWindow, GtkWindow_FID_CACHE *lpGtkWindowFc);
+void setGtkWindowFields(JNIEnv *env, jobject lpObject, GtkWindow *lpGtkWindow, GtkWindow_FID_CACHE *lpGtkWindowFc);
+void getGtkCheckMenuItemFields(JNIEnv *env, jobject lpObject, GtkCheckMenuItem *lpGtkCheckMenuItem, GtkCheckMenuItem_FID_CACHE *lpGtkCheckMenuItemFc);
+void setGtkCheckMenuItemFields(JNIEnv *env, jobject lpObject, GtkCheckMenuItem *lpGtkCheckMenuItem, GtkCheckMenuItem_FID_CACHE *lpGtkCheckMenuItemFc);
+void getGtkAdjustmentFields(JNIEnv *env, jobject lpObject, GtkAdjustment *lpGtkAdjustment, GtkAdjustment_FID_CACHE *lpGtkAdjustmentFc);
+void setGtkAdjustmentFields(JNIEnv *env, jobject lpObject, GtkAdjustment *lpGtkAdjustment, GtkAdjustment_FID_CACHE *lpGtkAdjustmentFc);
+void getGtkBoxFields(JNIEnv *env, jobject lpObject, GtkBox *lpGtkBox, GtkBox_FID_CACHE *lpGtkBoxFc);
+void setGtkBoxFields(JNIEnv *env, jobject lpObject, GtkBox *lpGtkBox, GtkBox_FID_CACHE *lpGtkBoxFc);
+void getGtkHBoxFields(JNIEnv *env, jobject lpObject, GtkHBox *lpGtkHBox, GtkHBox_FID_CACHE *lpGtkHBoxFc);
+void setGtkHBoxFields(JNIEnv *env, jobject lpObject, GtkHBox *lpGtkHBox, GtkHBox_FID_CACHE *lpGtkHBoxFc);
+void getGtkMenuFields(JNIEnv *env, jobject lpObject, GtkMenu *lpGtkMenu, GtkMenu_FID_CACHE *lpGtkMenuFc);
+void setGtkMenuFields(JNIEnv *env, jobject lpObject, GtkMenu *lpGtkMenu, GtkMenu_FID_CACHE *lpGtkMenuFc);
+void getGtkMenuShellFields(JNIEnv *env, jobject lpObject, GtkMenuShell *lpGtkMenuShell, GtkMenuShell_FID_CACHE *lpGtkMenuShellFc);
+void setGtkMenuShellFields(JNIEnv *env, jobject lpObject, GtkMenuShell *lpGtkMenuShell, GtkMenuShell_FID_CACHE *lpGtkMenuShellFc);
+void getGtkMenuItemFields(JNIEnv *env, jobject lpObject, GtkMenuItem *lpGtkMenuItem, GtkMenuItem_FID_CACHE *lpGtkMenuItemFc);
+void setGtkMenuItemFields(JNIEnv *env, jobject lpObject, GtkMenuItem *lpGtkMenuItem, GtkMenuItem_FID_CACHE *lpGtkMenuItemFc);
+void getGtkCTreeFields(JNIEnv *env, jobject lpObject, GtkCTree *lpGtkCTree, GtkCTree_FID_CACHE *lpGtkCTreeFc);
+void setGtkCTreeFields(JNIEnv *env, jobject lpObject, GtkCTree *lpGtkCTree, GtkCTree_FID_CACHE *lpGtkCTreeFc);
+
+extern GdkColor_FID_CACHE GdkColorFc;
+extern GdkEventKey_FID_CACHE GdkEventKeyFc;
+extern GdkEventButton_FID_CACHE GdkEventButtonFc;
+extern GdkEventMotion_FID_CACHE GdkEventMotionFc;
+extern GdkEventExpose_FID_CACHE GdkEventExposeFc;
+extern GdkFont_FID_CACHE GdkFontFc;
+extern GdkGCValues_FID_CACHE GdkGCValuesFc;
+extern GdkImage_FID_CACHE GdkImageFc;
+extern GdkPoint_FID_CACHE GdkPointFc;
+extern GdkRectangle_FID_CACHE GdkRectangleFc;
+extern GdkVisual_FID_CACHE GdkVisualFc;
+extern GtkObject_FID_CACHE GtkObjectFc;
+extern GtkData_FID_CACHE GtkDataFc;
+extern GtkAdjustment_FID_CACHE GtkAdjustmentFc;
+extern GtkAllocation_FID_CACHE GtkAllocationFc;
+extern GtkWidget_FID_CACHE GtkWidgetFc;
+extern GtkContainer_FID_CACHE GtkContainerFc;
+extern GtkBin_FID_CACHE GtkBinFc;
+extern GtkMenu_FID_CACHE GtkMenuFc;
+extern GtkItem_FID_CACHE GtkItemFc;
+extern GtkMenuShell_FID_CACHE GtkMenuShellFc;
+extern GtkMenuItem_FID_CACHE GtkMenuItemFc;
+extern GtkCheckMenuItem_FID_CACHE GtkCheckMenuItemFc;
+extern GtkWindow_FID_CACHE GtkWindowFc;
+extern GtkColorSelectionDialog_FID_CACHE GtkColorSelectionDialogFc;\
+extern GtkBox_FID_CACHE GtkBoxFc;
+extern GtkHBox_FID_CACHE GtkHBoxFc;
+extern GtkCombo_FID_CACHE GtkComboFc;
+extern GtkFileSelection_FID_CACHE GtkFileSelectionFc;
+extern GtkFrame_FID_CACHE GtkFrameFc;
+extern GtkFontSelectionDialog_FID_CACHE GtkFontSelectionDialogFc;
+extern GtkCList_FID_CACHE GtkCListFc;
+extern GtkEditable_FID_CACHE GtkEditableFc;
+extern GtkText_FID_CACHE GtkTextFc;
+extern GtkProgress_FID_CACHE GtkProgressFc;
+extern GtkProgressBar_FID_CACHE GtkProgressBarFc;
+extern GtkArg_FID_CACHE GtkArgFc;
+extern GtkRequisition_FID_CACHE GtkRequisitionFc;
+extern GtkStyle_FID_CACHE GtkStyleFc;
+extern GtkStyleClass_FID_CACHE GtkStyleClassFc;
+extern GtkCListRow_FID_CACHE GtkCListRowFc;
+extern GtkCListColumn_FID_CACHE GtkCListColumnFc;
+extern GtkCTreeRow_FID_CACHE GtkCTreeRowFc;
+extern GtkCTree_FID_CACHE GtkCTreeFc;
+
+#endif // INC_structs_H
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt.c
new file mode 100644
index 0000000..ea1b1f4
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt.c
@@ -0,0 +1,7647 @@
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+/**
+ * SWT OS natives implementation.
+ */
+
+/*#define PRINT_FAILED_RCODES*/
+#define NDEBUG
+
+#include "swt.h"
+#include "structs.h"
+
+#include <stdio.h>
+#include <assert.h>
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: GTK_WIDGET_TYPE
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1TYPE
+ (JNIEnv *env, jclass that, jint wid)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "GTK_WIDGET_TYPE");
+#endif
+
+ return GTK_WIDGET_TYPE((GtkWidget*)wid);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_label_get_type
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1get_1type
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_label_get_type");
+#endif
+
+ return gtk_label_get_type ();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_object_unref
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1unref
+ (JNIEnv *env, jclass that, jint object)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_object_unref");
+#endif
+
+ gtk_object_unref((GtkObject*)object);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_object_ref
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1destroy
+ (JNIEnv *env, jclass that, jint object)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_object_destroy");
+#endif
+
+ gtk_object_destroy((GtkObject*)object);
+}
+
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1get_1data_1by_1id
+ (JNIEnv *env, jclass that, jint object, jint data_id)
+{
+ jint result;
+
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_object_get_data_by_id");
+#endif
+ return (jint) gtk_object_get_data_by_id((GtkObject*)object, (GQuark) data_id);
+}
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1set_1data_1by_1id
+ (JNIEnv *env, jclass that, jint object, jint data_id, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_object_set_data_by_id");
+#endif
+
+ gtk_object_set_data_by_id ((GtkObject*)object, (GQuark) data_id, (gpointer) data);
+}
+
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1quark_1from_1string
+ (JNIEnv *env, jclass that, jbyteArray string)
+{
+ jint result;
+ jbyte *string1 = NULL;
+
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_quark_from_string");
+#endif
+
+ if (string) {
+ string1 = (*env)->GetByteArrayElements(env, string, NULL);
+ }
+ result = g_quark_from_string((gchar *) string1);
+ if (string) {
+ (*env)->ReleaseByteArrayElements(env, string, string1, 0);
+ }
+ return result;
+}
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1handler_1block_1by_1data
+ (JNIEnv *env, jclass that, jint object, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_signal_handler_block_by_data");
+#endif
+
+ gtk_signal_handler_block_by_data((GtkObject*)object, (gpointer) data);
+}
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1handler_1unblock_1by_1data
+ (JNIEnv *env, jclass that, jint object, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_signal_handler_unblock_by_data");
+#endif
+
+ gtk_signal_handler_unblock_by_data((GtkObject*)object, (gpointer) data);
+}
+
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1rgb_1init
+ (JNIEnv *env, jclass cl)
+{
+ gdk_rgb_init();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1FLAGS
+ (JNIEnv *env, jclass that, jint wid)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "GTK_WIDGET_FLAGS");
+#endif
+
+ return (jint) GTK_WIDGET_FLAGS((GtkWidget*)wid);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1SET_1FLAGS
+ (JNIEnv *env, jclass that, jint wid, jint flag)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "GTK_WIDGET_SET_FLAGS");
+#endif
+
+ GTK_WIDGET_SET_FLAGS((GtkWidget*)wid, flag);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1UNSET_1FLAGS
+ (JNIEnv *env, jclass that, jint wid, jint flag)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "GTK_WIDGET_UNSET_FLAGS");
+#endif
+
+ GTK_WIDGET_UNSET_FLAGS((GtkWidget*)wid, flag);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1NO_1WINDOW
+ (JNIEnv *env, jclass that, jint wid)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "GTK_WIDGET_NO_WINDOW");
+#endif
+
+ return (jboolean) GTK_WIDGET_NO_WINDOW((GtkWidget*)wid);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: GDK_ROOT_PARENT
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_GDK_1ROOT_1PARENT
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "GDK_ROOT_PARENT");
+#endif
+
+ return (jint) GDK_ROOT_PARENT();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1SENSITIVE
+ (JNIEnv *env, jclass that, jint wid)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "GTK_WIDGET_SENSITIVE");
+#endif
+
+ return (jboolean) GTK_WIDGET_SENSITIVE((GtkWidget*)wid);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1IS_1SENSITIVE
+ (JNIEnv *env, jclass that, jint wid)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "GTK_WIDGET_IS_SENSITIVE");
+#endif
+
+ return (jboolean) GTK_WIDGET_IS_SENSITIVE((GtkWidget*)wid);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_accel_group_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1accel_1group_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_accel_group_new");
+#endif
+
+ return (jint)gtk_accel_group_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_accel_group_unref
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1accel_1group_1unref
+ (JNIEnv *env, jclass that, jint accel_group)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_accel_group_unref");
+#endif
+
+ gtk_accel_group_unref((GtkAccelGroup*)accel_group);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_adjustment_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1adjustment_1new
+ (JNIEnv *env, jclass that, jfloat value, jfloat lower, jfloat upper, jfloat step_increment, jfloat page_increment, jfloat page_size)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_adjustment_new");
+#endif
+
+ return (jint)gtk_adjustment_new(value, lower, upper, step_increment, page_increment, page_size);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_adjustment_changed
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1adjustment_1changed
+ (JNIEnv *env, jclass that, jint adjustment)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_adjustment_changed");
+#endif
+
+ gtk_adjustment_changed((GtkAdjustment*)adjustment);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_adjustment_value_changed
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1adjustment_1value_1changed
+ (JNIEnv *env, jclass that, jint adjustment)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_adjustment_value_changed");
+#endif
+
+ gtk_adjustment_value_changed((GtkAdjustment*)adjustment);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_adjustment_set_value
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1adjustment_1set_1value
+ (JNIEnv *env, jclass that, jint adjustment, jfloat value)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_adjustment_set_value");
+#endif
+
+ gtk_adjustment_set_value((GtkAdjustment*)adjustment, value);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_arrow_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1arrow_1new
+ (JNIEnv *env, jclass that, jint arrow_type, jint shadow_type)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_arrow_new");
+#endif
+
+ return (jint)gtk_arrow_new((GtkArrowType)arrow_type, (GtkShadowType)shadow_type);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_arrow_set
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1arrow_1set
+ (JNIEnv *env, jclass that, jint arrow, jint arrow_type, jint shadow_type)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_arrow_set");
+#endif
+
+ gtk_arrow_set((GtkArrow*)arrow, (GtkArrowType)arrow_type, (GtkShadowType)shadow_type);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_box_pack_start
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1box_1pack_1start
+ (JNIEnv *env, jclass that, jint box, jint child, jboolean expand, jboolean fill, jint padding)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_box_pack_start");
+#endif
+
+ gtk_box_pack_start((GtkBox*)box, (GtkWidget*)child, (gboolean)expand, (gboolean)fill, padding);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_box_pack_end
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1box_1pack_1end
+ (JNIEnv *env, jclass that, jint box, jint child, jboolean expand, jboolean fill, jint padding)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_box_pack_end");
+#endif
+
+ gtk_box_pack_end((GtkBox*)box, (GtkWidget*)child, (gboolean)expand, (gboolean)fill, padding);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_button_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1button_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_button_new");
+#endif
+
+ return (jint)gtk_button_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_button_new_with_label
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1button_1new_1with_1label
+ (JNIEnv *env, jclass that, jbyteArray label)
+{
+ jint rc;
+ jbyte *label1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_button_new_with_label");
+#endif
+
+ if (label) {
+ label1 = (*env)->GetByteArrayElements(env, label, NULL);
+ }
+ rc = (jint)gtk_button_new_with_label((gchar*)label1);
+ if (label) {
+ (*env)->ReleaseByteArrayElements(env, label, label1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_check_button_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1button_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_check_button_new");
+#endif
+
+ return (jint)gtk_check_button_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_check_menu_item_new_with_label
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1menu_1item_1new_1with_1label
+ (JNIEnv *env, jclass that, jbyteArray label)
+{
+ jint rc;
+ jbyte *label1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_check_menu_item_new_with_label");
+#endif
+
+ if (label) {
+ label1 = (*env)->GetByteArrayElements(env, label, NULL);
+ }
+ rc = (jint)gtk_check_menu_item_new_with_label((gchar*)label1);
+ if (label) {
+ (*env)->ReleaseByteArrayElements(env, label, label1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_check_menu_item_set_active
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1menu_1item_1set_1active
+ (JNIEnv *env, jclass that, jint check_menu_item, jboolean is_active)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_check_menu_item_set_active");
+#endif
+
+ gtk_check_menu_item_set_active((GtkCheckMenuItem*)check_menu_item, (gboolean)is_active);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_check_menu_item_set_show_toggle
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1menu_1item_1set_1show_1toggle
+ (JNIEnv *env, jclass that, jint menu_item, jboolean always)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_check_menu_item_set_show_toggle");
+#endif
+
+ gtk_check_menu_item_set_show_toggle((GtkCheckMenuItem*)menu_item, (gboolean)always);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_color_selection_set_color
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1color_1selection_1set_1color
+ (JNIEnv *env, jclass that, jint colorsel, jdoubleArray color)
+{
+ jdouble *color1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_color_selection_set_color");
+#endif
+
+ if (color) {
+ color1 = (*env)->GetDoubleArrayElements(env, color, NULL);
+ }
+ gtk_color_selection_set_color((GtkColorSelection*)colorsel, (gdouble*)color1);
+ if (color) {
+ (*env)->ReleaseDoubleArrayElements(env, color, color1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_color_selection_get_color
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1color_1selection_1get_1color
+ (JNIEnv *env, jclass that, jint colorsel, jdoubleArray color)
+{
+ jdouble *color1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_color_selection_get_color");
+#endif
+
+ if (color) {
+ color1 = (*env)->GetDoubleArrayElements(env, color, NULL);
+ }
+ gtk_color_selection_get_color((GtkColorSelection*)colorsel, (gdouble*)color1);
+ if (color) {
+ (*env)->ReleaseDoubleArrayElements(env, color, color1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_color_selection_dialog_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1color_1selection_1dialog_1new
+ (JNIEnv *env, jclass that, jbyteArray title)
+{
+ jint rc;
+ jbyte *title1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_color_selection_dialog_new");
+#endif
+
+ if (title) {
+ title1 = (*env)->GetByteArrayElements(env, title, NULL);
+ }
+ rc = (jint)gtk_color_selection_dialog_new((gchar*)title1);
+ if (title) {
+ (*env)->ReleaseByteArrayElements(env, title, title1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_combo_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1combo_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_combo_new");
+#endif
+
+ return (jint)gtk_combo_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_combo_set_popdown_strings
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1combo_1set_1popdown_1strings
+ (JNIEnv *env, jclass that, jint combo, jint strings)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_combo_set_popdown_strings");
+#endif
+
+ gtk_combo_set_popdown_strings((GtkCombo*)combo, (GList*)strings);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_container_add
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1container_1add
+ (JNIEnv *env, jclass that, jint container, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_container_add");
+#endif
+
+ gtk_container_add((GtkContainer*)container, (GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_container_remove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1container_1remove
+ (JNIEnv *env, jclass that, jint container, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_container_remove");
+#endif
+
+ gtk_container_remove((GtkContainer*)container, (GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_container_children
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1container_1children
+ (JNIEnv *env, jclass that, jint container)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_container_children");
+#endif
+
+ return (jint)gtk_container_children((GtkContainer*)container);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1new
+ (JNIEnv *env, jclass that, jint columns, jint tree_column)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_new");
+#endif
+
+ return (jint)gtk_ctree_new((gint)columns, (gint)tree_column);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_insert_node
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1insert_1node
+ (JNIEnv *env, jclass that, jint ctree, jint parent, jint sibling, jintArray text, jbyte spacing, jint pixmap_closed, jint mask_closed, jint pixmap_opened, jint mask_opened, jboolean is_leaf, jboolean expanded)
+{
+ jint rc;
+ jint *text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_insert_node");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetIntArrayElements(env, text, NULL);
+ }
+ rc = (jint)gtk_ctree_insert_node((GtkCTree*)ctree, (GtkCTreeNode*)parent, (GtkCTreeNode*)sibling, (gchar**)text1, (guint8)spacing, (GdkPixmap*)pixmap_closed, (GdkBitmap*)mask_closed, (GdkPixmap*)pixmap_opened, (GdkBitmap*)mask_opened, (gboolean)is_leaf, (gboolean)expanded);
+ if (text) {
+ (*env)->ReleaseIntArrayElements(env, text, text1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_remove_node
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1remove_1node
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_remove_node");
+#endif
+
+ gtk_ctree_remove_node((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_post_recursive
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1post_1recursive
+ (JNIEnv *env, jclass that, jint ctree, jint node, jint func, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_post_recursive");
+#endif
+
+ gtk_ctree_post_recursive((GtkCTree*)ctree, (GtkCTreeNode*)node, (GtkCTreeFunc)func, (gpointer)data);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_is_viewable
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1is_1viewable
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_is_viewable");
+#endif
+
+ return (jboolean)gtk_ctree_is_viewable((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_node_nth
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1nth
+ (JNIEnv *env, jclass that, jint ctree, jint row)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_node_nth");
+#endif
+
+ return (jint)gtk_ctree_node_nth((GtkCTree*)ctree, row);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_is_hot_spot
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1is_1hot_1spot
+ (JNIEnv *env, jclass that, jint ctree, jint x, jint y)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_is_hot_spot");
+#endif
+
+ return (jboolean)gtk_ctree_is_hot_spot((GtkCTree*)ctree, (gint)x, (gint)y);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_expand
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1expand
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_expand");
+#endif
+
+ gtk_ctree_expand((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_collapse
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1collapse
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_collapse");
+#endif
+
+ gtk_ctree_collapse((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_select
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1select
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_select");
+#endif
+
+ gtk_ctree_select((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_select_recursive
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1select_1recursive
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_select_recursive");
+#endif
+
+ gtk_ctree_select_recursive((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_unselect_recursive
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1unselect_1recursive
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_unselect_recursive");
+#endif
+
+ gtk_ctree_unselect_recursive((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_set_node_info
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1set_1node_1info
+ (JNIEnv *env, jclass that, jint ctree, jint node, jbyteArray text, jbyte spacing, jint pixmap_closed, jint mask_closed, jint pixmap_opened, jint mask_opened, jboolean is_leaf, jboolean expanded)
+{
+ jbyte *text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_set_node_info");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetByteArrayElements(env, text, NULL);
+ }
+ gtk_ctree_set_node_info((GtkCTree*)ctree, (GtkCTreeNode*)node, (gchar*)text1, (guint8)spacing, (GdkPixmap*)pixmap_closed, (GdkBitmap*)mask_closed, (GdkPixmap*)pixmap_opened, (GdkBitmap*)mask_opened, (gboolean)is_leaf, (gboolean)expanded);
+ if (text) {
+ (*env)->ReleaseByteArrayElements(env, text, text1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_get_node_info
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1get_1node_1info
+ (JNIEnv *env, jclass that, jint ctree, jint node, jintArray text, jbyteArray spacing, jintArray pixmap_closed, jintArray mask_closed, jintArray pixmap_opened, jintArray mask_opened, jbooleanArray is_leaf, jbooleanArray expanded)
+{
+ jint rc;
+ jint *text1 = NULL;
+ jbyte *spacing1 = NULL;
+ jint *pixmap_closed1 = NULL;
+ jint *mask_closed1 = NULL;
+ jint *pixmap_opened1 = NULL;
+ jint *mask_opened1 = NULL;
+ jboolean *is_leaf1 = NULL;
+ jboolean *expanded1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_get_node_info");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetIntArrayElements(env, text, NULL);
+ }
+ if (spacing) {
+ spacing1 = (*env)->GetByteArrayElements(env, spacing, NULL);
+ }
+ if (pixmap_closed) {
+ pixmap_closed1 = (*env)->GetIntArrayElements(env, pixmap_closed, NULL);
+ }
+ if (mask_closed) {
+ mask_closed1 = (*env)->GetIntArrayElements(env, mask_closed, NULL);
+ }
+ if (pixmap_opened) {
+ pixmap_opened1 = (*env)->GetIntArrayElements(env, pixmap_opened, NULL);
+ }
+ if (mask_opened) {
+ mask_opened1 = (*env)->GetIntArrayElements(env, mask_opened, NULL);
+ }
+ if (is_leaf) {
+ is_leaf1 = (*env)->GetBooleanArrayElements(env, is_leaf, NULL);
+ }
+ if (expanded) {
+ expanded1 = (*env)->GetBooleanArrayElements(env, expanded, NULL);
+ }
+ rc = (jint)gtk_ctree_get_node_info((GtkCTree*)ctree, (GtkCTreeNode*)node, (gchar**)text1, (guint8*)spacing1, (GdkPixmap**)pixmap_closed1, (GdkBitmap**)mask_closed1, (GdkPixmap**)pixmap_opened1, (GdkBitmap**)mask_opened1, (gboolean*)is_leaf1, (gboolean*)expanded1);
+ if (text) {
+ (*env)->ReleaseIntArrayElements(env, text, text1, 0);
+ }
+ if (spacing) {
+ (*env)->ReleaseByteArrayElements(env, spacing, spacing1, 0);
+ }
+ if (pixmap_closed) {
+ (*env)->ReleaseIntArrayElements(env, pixmap_closed, pixmap_closed1, 0);
+ }
+ if (mask_closed) {
+ (*env)->ReleaseIntArrayElements(env, mask_closed, mask_closed1, 0);
+ }
+ if (pixmap_opened) {
+ (*env)->ReleaseIntArrayElements(env, pixmap_opened, pixmap_opened1, 0);
+ }
+ if (mask_opened) {
+ (*env)->ReleaseIntArrayElements(env, mask_opened, mask_opened1, 0);
+ }
+ if (is_leaf) {
+ (*env)->ReleaseBooleanArrayElements(env, is_leaf, is_leaf1, 0);
+ }
+ if (expanded) {
+ (*env)->ReleaseBooleanArrayElements(env, expanded, expanded1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_node_get_row_style
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1get_1row_1style
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_node_get_row_style");
+#endif
+
+ return (jint)gtk_ctree_node_get_row_style((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_node_set_row_data
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1set_1row_1data
+ (JNIEnv *env, jclass that, jint ctree, jint node, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_node_set_row_data");
+#endif
+
+ gtk_ctree_node_set_row_data((GtkCTree*)ctree, (GtkCTreeNode*)node, (gpointer)data);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_node_get_row_data
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1get_1row_1data
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_node_get_row_data");
+#endif
+
+ return (jint)gtk_ctree_node_get_row_data((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_node_moveto
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1moveto
+ (JNIEnv *env, jclass that, jint ctree, jint node, jint column, jfloat row_align, jfloat col_align)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_node_moveto");
+#endif
+
+ gtk_ctree_node_moveto((GtkCTree*)ctree, (GtkCTreeNode*)node, (gint)column, row_align, col_align);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_node_is_visible
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1is_1visible
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_node_is_visible");
+#endif
+
+ return (jint)gtk_ctree_node_is_visible((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_dialog_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1dialog_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_dialog_new");
+#endif
+
+ return (jint)gtk_dialog_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_drawing_area_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1drawing_1area_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_drawing_area_new");
+#endif
+
+ return (jint)gtk_drawing_area_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_drawing_area_size
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1drawing_1area_1size
+ (JNIEnv *env, jclass that, jint darea, jint width, jint height)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_drawing_area_size");
+#endif
+
+ gtk_drawing_area_size((GtkDrawingArea*)darea, (gint)width, (gint)height);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_editable_select_region
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1select_1region
+ (JNIEnv *env, jclass that, jint editable, jint start, jint end)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_editable_select_region");
+#endif
+
+ gtk_editable_select_region((GtkEditable*)editable, (gint)start, (gint)end);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_editable_insert_text
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1insert_1text
+ (JNIEnv *env, jclass that, jint editable, jbyteArray new_text, jint new_text_length, jintArray position)
+{
+ jbyte *new_text1 = NULL;
+ jint *position1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_editable_insert_text");
+#endif
+
+ if (new_text) {
+ new_text1 = (*env)->GetByteArrayElements(env, new_text, NULL);
+ }
+ if (position) {
+ position1 = (*env)->GetIntArrayElements(env, position, NULL);
+ }
+ gtk_editable_insert_text((GtkEditable*)editable, (gchar*)new_text1, (gint)new_text_length, (gint*)position1);
+ if (new_text) {
+ (*env)->ReleaseByteArrayElements(env, new_text, new_text1, 0);
+ }
+ if (position) {
+ (*env)->ReleaseIntArrayElements(env, position, position1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_editable_delete_text
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1delete_1text
+ (JNIEnv *env, jclass that, jint editable, jint start_pos, jint end_pos)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_editable_delete_text");
+#endif
+
+ gtk_editable_delete_text((GtkEditable*)editable, (gint)start_pos, (gint)end_pos);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_editable_get_chars
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1get_1chars
+ (JNIEnv *env, jclass that, jint editable, jint start_pos, jint end_pos)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_editable_get_chars");
+#endif
+
+ return (jint)gtk_editable_get_chars((GtkEditable*)editable, (gint)start_pos, (gint)end_pos);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_editable_delete_selection
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1delete_1selection
+ (JNIEnv *env, jclass that, jint editable)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_editable_delete_selection");
+#endif
+
+ gtk_editable_delete_selection((GtkEditable*)editable);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_editable_set_position
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1set_1position
+ (JNIEnv *env, jclass that, jint editable, jint position)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_editable_set_position");
+#endif
+
+ gtk_editable_set_position((GtkEditable*)editable, (gint)position);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_editable_get_position
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1get_1position
+ (JNIEnv *env, jclass that, jint editable)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_editable_get_position");
+#endif
+
+ return (jint)gtk_editable_get_position((GtkEditable*)editable);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_editable_set_editable
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1set_1editable
+ (JNIEnv *env, jclass that, jint editable, jboolean is_editable)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_editable_set_editable");
+#endif
+
+ gtk_editable_set_editable((GtkEditable*)editable, (gboolean)is_editable);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_entry_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_entry_new");
+#endif
+
+ return (jint)gtk_entry_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_entry_set_text
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1set_1text
+ (JNIEnv *env, jclass that, jint entry, jbyteArray text)
+{
+ jbyte *text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_entry_set_text");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetByteArrayElements(env, text, NULL);
+ }
+ gtk_entry_set_text((GtkEntry*)entry, (gchar*)text1);
+ if (text) {
+ (*env)->ReleaseByteArrayElements(env, text, text1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_entry_append_text
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1append_1text
+ (JNIEnv *env, jclass that, jint entry, jbyteArray text)
+{
+ jbyte *text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_entry_append_text");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetByteArrayElements(env, text, NULL);
+ }
+ gtk_entry_append_text((GtkEntry*)entry, (gchar*)text1);
+ if (text) {
+ (*env)->ReleaseByteArrayElements(env, text, text1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_entry_get_text
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1get_1text
+ (JNIEnv *env, jclass that, jint entry)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_entry_get_text");
+#endif
+
+ return (jint)gtk_entry_get_text((GtkEntry*)entry);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_entry_set_visibility
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1set_1visibility
+ (JNIEnv *env, jclass that, jint entry, jboolean visible)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_entry_set_visibility");
+#endif
+
+ gtk_entry_set_visibility((GtkEntry*)entry, (gboolean)visible);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_entry_set_editable
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1set_1editable
+ (JNIEnv *env, jclass that, jint entry, jboolean editable)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_entry_set_editable");
+#endif
+
+ gtk_entry_set_editable((GtkEntry*)entry, (gboolean)editable);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_entry_set_max_length
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1set_1max_1length
+ (JNIEnv *env, jclass that, jint entry, jshort max)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_entry_set_max_length");
+#endif
+
+ gtk_entry_set_max_length((GtkEntry*)entry, (guint16)max);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_event_box_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1event_1box_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_event_box_new");
+#endif
+
+ return (jint)gtk_event_box_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_file_selection_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1file_1selection_1new
+ (JNIEnv *env, jclass that, jbyteArray title)
+{
+ jint rc;
+ jbyte *title1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_file_selection_new");
+#endif
+
+ if (title) {
+ title1 = (*env)->GetByteArrayElements(env, title, NULL);
+ }
+ rc = (jint)gtk_file_selection_new((gchar*)title1);
+ if (title) {
+ (*env)->ReleaseByteArrayElements(env, title, title1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_file_selection_set_filename
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1file_1selection_1set_1filename
+ (JNIEnv *env, jclass that, jint filesel, jbyteArray filename)
+{
+ jbyte *filename1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_file_selection_set_filename");
+#endif
+
+ if (filename) {
+ filename1 = (*env)->GetByteArrayElements(env, filename, NULL);
+ }
+ gtk_file_selection_set_filename((GtkFileSelection*)filesel, (gchar*)filename1);
+ if (filename) {
+ (*env)->ReleaseByteArrayElements(env, filename, filename1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_file_selection_get_filename
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1file_1selection_1get_1filename
+ (JNIEnv *env, jclass that, jint filesel)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_file_selection_get_filename");
+#endif
+
+ return (jint)gtk_file_selection_get_filename((GtkFileSelection*)filesel);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_file_selection_complete
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1file_1selection_1complete
+ (JNIEnv *env, jclass that, jint filesel, jbyteArray pattern)
+{
+ jbyte *pattern1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_file_selection_complete");
+#endif
+
+ if (pattern) {
+ pattern1 = (*env)->GetByteArrayElements(env, pattern, NULL);
+ }
+ gtk_file_selection_complete((GtkFileSelection*)filesel, (gchar*)pattern1);
+ if (pattern) {
+ (*env)->ReleaseByteArrayElements(env, pattern, pattern1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_fixed_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1fixed_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_fixed_new");
+#endif
+
+ return (jint)gtk_fixed_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_fixed_put
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1fixed_1put
+ (JNIEnv *env, jclass that, jint fixed, jint widget, jshort x, jshort y)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_fixed_put");
+#endif
+
+ gtk_fixed_put((GtkFixed*)fixed, (GtkWidget*)widget, (gint16)x, (gint16)y);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_fixed_move
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1fixed_1move
+ (JNIEnv *env, jclass that, jint fixed, jint widget, jshort x, jshort y)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_fixed_move");
+#endif
+
+ gtk_fixed_move((GtkFixed*)fixed, (GtkWidget*)widget, (gint16)x, (gint16)y);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_font_selection_set_font_name
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1font_1selection_1set_1font_1name
+ (JNIEnv *env, jclass that, jint fontsel, jbyteArray fontname)
+{
+ jboolean rc;
+ jbyte *fontname1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_font_selection_set_font_name");
+#endif
+
+ if (fontname) {
+ fontname1 = (*env)->GetByteArrayElements(env, fontname, NULL);
+ }
+ rc = (jboolean)gtk_font_selection_set_font_name((GtkFontSelection*)fontsel, (gchar*)fontname1);
+ if (fontname) {
+ (*env)->ReleaseByteArrayElements(env, fontname, fontname1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_font_selection_dialog_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1font_1selection_1dialog_1new
+ (JNIEnv *env, jclass that, jbyteArray title)
+{
+ jint rc;
+ jbyte *title1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_font_selection_dialog_new");
+#endif
+
+ if (title) {
+ title1 = (*env)->GetByteArrayElements(env, title, NULL);
+ }
+ rc = (jint)gtk_font_selection_dialog_new((gchar*)title1);
+ if (title) {
+ (*env)->ReleaseByteArrayElements(env, title, title1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_font_selection_dialog_get_font_name
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1font_1selection_1dialog_1get_1font_1name
+ (JNIEnv *env, jclass that, jint fsd)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_font_selection_dialog_get_font_name");
+#endif
+
+ return (jint)gtk_font_selection_dialog_get_font_name((GtkFontSelectionDialog*)fsd);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_font_selection_dialog_set_font_name
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1font_1selection_1dialog_1set_1font_1name
+ (JNIEnv *env, jclass that, jint fsd, jbyteArray fontname)
+{
+ jboolean rc;
+ jbyte *fontname1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_font_selection_dialog_set_font_name");
+#endif
+
+ if (fontname) {
+ fontname1 = (*env)->GetByteArrayElements(env, fontname, NULL);
+ }
+ rc = (jboolean)gtk_font_selection_dialog_set_font_name((GtkFontSelectionDialog*)fsd, (gchar*)fontname1);
+ if (fontname) {
+ (*env)->ReleaseByteArrayElements(env, fontname, fontname1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_frame_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1frame_1new
+ (JNIEnv *env, jclass that, jbyteArray label)
+{
+ jint rc;
+ jbyte *label1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_frame_new");
+#endif
+
+ if (label) {
+ label1 = (*env)->GetByteArrayElements(env, label, NULL);
+ }
+ rc = (jint)gtk_frame_new((gchar*)label1);
+ if (label) {
+ (*env)->ReleaseByteArrayElements(env, label, label1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_frame_set_label
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1frame_1set_1label
+ (JNIEnv *env, jclass that, jint frame, jbyteArray label)
+{
+ jbyte *label1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_frame_set_label");
+#endif
+
+ if (label) {
+ label1 = (*env)->GetByteArrayElements(env, label, NULL);
+ }
+ gtk_frame_set_label((GtkFrame*)frame, (gchar*)label1);
+ if (label) {
+ (*env)->ReleaseByteArrayElements(env, label, label1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_frame_set_shadow_type
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1frame_1set_1shadow_1type
+ (JNIEnv *env, jclass that, jint frame, jint type)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_frame_set_shadow_type");
+#endif
+
+ gtk_frame_set_shadow_type((GtkFrame*)frame, (GtkShadowType)type);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_hbox_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1hbox_1new
+ (JNIEnv *env, jclass that, jboolean homogeneous, jint spacing)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_hbox_new");
+#endif
+
+ return (jint)gtk_hbox_new((gboolean)homogeneous, (gint)spacing);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_hscale_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1hscale_1new
+ (JNIEnv *env, jclass that, jint adjustment)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_hscale_new");
+#endif
+
+ return (jint)gtk_hscale_new((GtkAdjustment*)adjustment);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_hscrollbar_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1hscrollbar_1new
+ (JNIEnv *env, jclass that, jint adjustment)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_hscrollbar_new");
+#endif
+
+ return (jint)gtk_hscrollbar_new((GtkAdjustment*)adjustment);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_hseparator_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1hseparator_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_hseparator_new");
+#endif
+
+ return (jint)gtk_hseparator_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_label_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1new
+ (JNIEnv *env, jclass that, jbyteArray str)
+{
+ jint rc;
+ jbyte *str1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_label_new");
+#endif
+
+ if (str) {
+ str1 = (*env)->GetByteArrayElements(env, str, NULL);
+ }
+ rc = (jint)gtk_label_new((gchar*)str1);
+ if (str) {
+ (*env)->ReleaseByteArrayElements(env, str, str1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_label_set_text
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1set_1text
+ (JNIEnv *env, jclass that, jint label, jbyteArray str)
+{
+ jbyte *str1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_label_set_text");
+#endif
+
+ if (str) {
+ str1 = (*env)->GetByteArrayElements(env, str, NULL);
+ }
+ gtk_label_set_text((GtkLabel*)label, (gchar*)str1);
+ if (str) {
+ (*env)->ReleaseByteArrayElements(env, str, str1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_label_set_justify
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1set_1justify
+ (JNIEnv *env, jclass that, jint label, jint jtype)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_label_set_justify");
+#endif
+
+ gtk_label_set_justify((GtkLabel*)label, (GtkJustification)jtype);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_label_set_pattern
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1set_1pattern
+ (JNIEnv *env, jclass that, jint label, jbyteArray pattern)
+{
+ jbyte *pattern1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_label_set_pattern");
+#endif
+
+ if (pattern) {
+ pattern1 = (*env)->GetByteArrayElements(env, pattern, NULL);
+ }
+ gtk_label_set_pattern((GtkLabel*)label, (gchar*)pattern1);
+ if (pattern) {
+ (*env)->ReleaseByteArrayElements(env, pattern, pattern1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_label_set_line_wrap
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1set_1line_1wrap
+ (JNIEnv *env, jclass that, jint label, jboolean wrap)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_label_set_line_wrap");
+#endif
+
+ gtk_label_set_line_wrap((GtkLabel*)label, (gboolean)wrap);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_label_parse_uline
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1parse_1uline
+ (JNIEnv *env, jclass that, jint label, jbyteArray string)
+{
+ jint rc;
+ jbyte *string1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_label_parse_uline");
+#endif
+
+ if (string) {
+ string1 = (*env)->GetByteArrayElements(env, string, NULL);
+ }
+ rc = (jint)gtk_label_parse_uline((GtkLabel*)label, (gchar*)string1);
+ if (string) {
+ (*env)->ReleaseByteArrayElements(env, string, string1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_list_clear_items
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1list_1clear_1items
+ (JNIEnv *env, jclass that, jint list, jint start, jint end)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_list_clear_items");
+#endif
+
+ gtk_list_clear_items((GtkList*)list, (gint)start, (gint)end);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_list_select_item
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1list_1select_1item
+ (JNIEnv *env, jclass that, jint list, jint item)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_list_select_item");
+#endif
+
+ gtk_list_select_item((GtkList*)list, (gint)item);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_check_version
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1version
+ (JNIEnv *env, jclass that, jint required_major, jint required_minor, jint required_micro)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_check_version");
+#endif
+
+ return (jint)gtk_check_version(required_major, required_minor, required_micro);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_init_check
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1init_1check
+ (JNIEnv *env, jclass that, jintArray argc, jintArray argv)
+{
+ jboolean rc;
+ jint *argc1 = NULL;
+ jint *argv1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_init_check");
+#endif
+
+ if (argc) {
+ argc1 = (*env)->GetIntArrayElements(env, argc, NULL);
+ }
+ if (argv) {
+ argv1 = (*env)->GetIntArrayElements(env, argv, NULL);
+ }
+ rc = (jboolean)gtk_init_check((int*)argc1, (char***)argv1);
+ if (argc) {
+ (*env)->ReleaseIntArrayElements(env, argc, argc1, 0);
+ }
+ if (argv) {
+ (*env)->ReleaseIntArrayElements(env, argv, argv1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_events_pending
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1events_1pending
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_events_pending");
+#endif
+
+ return (jint)gtk_events_pending();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_main
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1main
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_main");
+#endif
+
+ gtk_main();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_main_quit
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1main_1quit
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_main_quit");
+#endif
+
+ gtk_main_quit();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_main_iteration
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1main_1iteration
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_main_iteration");
+#endif
+
+ return (jint)gtk_main_iteration();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_grab_add
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1grab_1add
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_grab_add");
+#endif
+
+ gtk_grab_add((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_grab_get_current
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1grab_1get_1current
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_grab_get_current");
+#endif
+
+ return (jint)gtk_grab_get_current();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_grab_remove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1grab_1remove
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_grab_remove");
+#endif
+
+ gtk_grab_remove((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_timeout_add
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1timeout_1add
+ (JNIEnv *env, jclass that, jint interval, jint function, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_timeout_add");
+#endif
+
+ return (jint)gtk_timeout_add((guint32)interval, (GtkFunction)function, (gpointer)data);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_timeout_remove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1timeout_1remove
+ (JNIEnv *env, jclass that, jint timeout_handler_id)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_timeout_remove");
+#endif
+
+ gtk_timeout_remove(timeout_handler_id);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_new");
+#endif
+
+ return (jint)gtk_menu_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_insert
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1insert
+ (JNIEnv *env, jclass that, jint menu, jint child, jint position)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_insert");
+#endif
+
+ gtk_menu_insert((GtkMenu*)menu, (GtkWidget*)child, (gint)position);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_popup
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1popup
+ (JNIEnv *env, jclass that, jint menu, jint parent_menu_shell, jint parent_menu_item, jint func, jint data, jint button, jint activate_time)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_popup");
+#endif
+
+ gtk_menu_popup((GtkMenu*)menu, (GtkWidget*)parent_menu_shell, (GtkWidget*)parent_menu_item, (GtkMenuPositionFunc)func, (gpointer)data, button, (guint32)activate_time);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_popdown
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1popdown
+ (JNIEnv *env, jclass that, jint menu)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_popdown");
+#endif
+
+ gtk_menu_popdown((GtkMenu*)menu);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_bar_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1bar_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_bar_new");
+#endif
+
+ return (jint)gtk_menu_bar_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_bar_insert
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1bar_1insert
+ (JNIEnv *env, jclass that, jint menu_bar, jint child, jint position)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_bar_insert");
+#endif
+
+ gtk_menu_bar_insert((GtkMenuBar*)menu_bar, (GtkWidget*)child, (gint)position);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_item_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1item_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_item_new");
+#endif
+
+ return (jint)gtk_menu_item_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_item_new_with_label
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1item_1new_1with_1label
+ (JNIEnv *env, jclass that, jbyteArray label)
+{
+ jint rc;
+ jbyte *label1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_item_new_with_label");
+#endif
+
+ if (label) {
+ label1 = (*env)->GetByteArrayElements(env, label, NULL);
+ }
+ rc = (jint)gtk_menu_item_new_with_label((gchar*)label1);
+ if (label) {
+ (*env)->ReleaseByteArrayElements(env, label, label1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_item_set_submenu
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1item_1set_1submenu
+ (JNIEnv *env, jclass that, jint menu_item, jint submenu)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_item_set_submenu");
+#endif
+
+ gtk_menu_item_set_submenu((GtkMenuItem*)menu_item, (GtkWidget*)submenu);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_item_remove_submenu
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1item_1remove_1submenu
+ (JNIEnv *env, jclass that, jint menu_item)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_item_remove_submenu");
+#endif
+
+ gtk_menu_item_remove_submenu((GtkMenuItem*)menu_item);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_misc_set_alignment
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1misc_1set_1alignment
+ (JNIEnv *env, jclass that, jint misc, jfloat xalign, jfloat yalign)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_misc_set_alignment");
+#endif
+
+ gtk_misc_set_alignment((GtkMisc*)misc, xalign, yalign);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_notebook_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_notebook_new");
+#endif
+
+ return (jint)gtk_notebook_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_notebook_append_page
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1append_1page
+ (JNIEnv *env, jclass that, jint notebook, jint child, jint tab_label)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_notebook_append_page");
+#endif
+
+ gtk_notebook_append_page((GtkNotebook*)notebook, (GtkWidget*)child, (GtkWidget*)tab_label);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_notebook_remove_page
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1remove_1page
+ (JNIEnv *env, jclass that, jint notebook, jint page_num)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_notebook_remove_page");
+#endif
+
+ gtk_notebook_remove_page((GtkNotebook*)notebook, (gint)page_num);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_notebook_get_current_page
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1get_1current_1page
+ (JNIEnv *env, jclass that, jint notebook)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_notebook_get_current_page");
+#endif
+
+ return (jint)gtk_notebook_get_current_page((GtkNotebook*)notebook);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_notebook_set_page
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1set_1page
+ (JNIEnv *env, jclass that, jint notebook, jint page_num)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_notebook_set_page");
+#endif
+
+ gtk_notebook_set_page((GtkNotebook*)notebook, (gint)page_num);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_notebook_set_show_tabs
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1set_1show_1tabs
+ (JNIEnv *env, jclass that, jint notebook, jboolean show_tabs)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_notebook_set_show_tabs");
+#endif
+
+ gtk_notebook_set_show_tabs((GtkNotebook*)notebook, (gboolean)show_tabs);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_object_ref
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1ref
+ (JNIEnv *env, jclass that, jint object)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_object_ref");
+#endif
+
+ gtk_object_ref((GtkObject*)object);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_object_set_user_data
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1set_1user_1data
+ (JNIEnv *env, jclass that, jint object, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_object_set_user_data");
+#endif
+
+ gtk_object_set_user_data((GtkObject*)object, (gpointer)data);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_object_get_user_data
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1get_1user_1data
+ (JNIEnv *env, jclass that, jint object)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_object_get_user_data");
+#endif
+
+ return (jint)gtk_object_get_user_data((GtkObject*)object);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_pixmap_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1pixmap_1new
+ (JNIEnv *env, jclass that, jint pixmap, jint mask)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_pixmap_new");
+#endif
+
+ return (jint)gtk_pixmap_new((GdkPixmap*)pixmap, (GdkBitmap*)mask);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_pixmap_set
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1pixmap_1set
+ (JNIEnv *env, jclass that, jint pixmap, jint val, jint mask)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_pixmap_set");
+#endif
+
+ gtk_pixmap_set((GtkPixmap*)pixmap, (GdkPixmap*)val, (GdkBitmap*)mask);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_progress_configure
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1progress_1configure
+ (JNIEnv *env, jclass that, jint progress, jfloat value, jfloat min, jfloat max)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_progress_configure");
+#endif
+
+ gtk_progress_configure((GtkProgress*)progress, value, min, max);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_progress_bar_new_with_adjustment
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1progress_1bar_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_progress_bar_new");
+#endif
+
+ return (jint)gtk_progress_bar_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_progress_bar_set_bar_style
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1progress_1bar_1set_1bar_1style
+ (JNIEnv *env, jclass that, jint pbar, jint style)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_progress_bar_set_bar_style");
+#endif
+
+ gtk_progress_bar_set_bar_style((GtkProgressBar*)pbar, (GtkProgressBarStyle)style);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_progress_bar_set_orientation
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1progress_1bar_1set_1orientation
+ (JNIEnv *env, jclass that, jint pbar, jint orientation)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_progress_bar_set_orientation");
+#endif
+
+ gtk_progress_bar_set_orientation((GtkProgressBar*)pbar, (GtkProgressBarOrientation)orientation);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_radio_button_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1radio_1button_1new
+ (JNIEnv *env, jclass that, jint group)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_radio_button_new");
+#endif
+
+ return (jint)gtk_radio_button_new((GSList*)group);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_radio_button_group
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1radio_1button_1group
+ (JNIEnv *env, jclass that, jint radio_button)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_radio_button_group");
+#endif
+
+ return (jint)gtk_radio_button_group((GtkRadioButton*)radio_button);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_radio_menu_item_new_with_label
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1radio_1menu_1item_1new_1with_1label
+ (JNIEnv *env, jclass that, jint group, jbyteArray label)
+{
+ jint rc;
+ jbyte *label1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_radio_menu_item_new_with_label");
+#endif
+
+ if (label) {
+ label1 = (*env)->GetByteArrayElements(env, label, NULL);
+ }
+ rc = (jint)gtk_radio_menu_item_new_with_label((GSList*)group, (gchar*)label1);
+ if (label) {
+ (*env)->ReleaseByteArrayElements(env, label, label1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_range_get_adjustment
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1range_1get_1adjustment
+ (JNIEnv *env, jclass that, jint range)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_range_get_adjustment");
+#endif
+
+ return (jint)gtk_range_get_adjustment((GtkRange*)range);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_scale_set_digits
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scale_1set_1digits
+ (JNIEnv *env, jclass that, jint scale, jint digits)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_scale_set_digits");
+#endif
+
+ gtk_scale_set_digits((GtkScale*)scale, (gint)digits);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_scale_set_draw_value
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scale_1set_1draw_1value
+ (JNIEnv *env, jclass that, jint scale, jboolean draw_value)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_scale_set_draw_value");
+#endif
+
+ gtk_scale_set_draw_value((GtkScale*)scale, (gboolean)draw_value);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_scale_set_value_pos
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scale_1set_1value_1pos
+ (JNIEnv *env, jclass that, jint scale, jint pos)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_scale_set_value_pos");
+#endif
+
+ gtk_scale_set_value_pos((GtkScale*)scale, (GtkPositionType)pos);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_scrolled_window_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scrolled_1window_1new
+ (JNIEnv *env, jclass that, jint hadjustment, jint vadjustment)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_scrolled_window_new");
+#endif
+
+ return (jint)gtk_scrolled_window_new((GtkAdjustment*)hadjustment, (GtkAdjustment*)vadjustment);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_scrolled_window_get_hadjustment
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scrolled_1window_1get_1hadjustment
+ (JNIEnv *env, jclass that, jint scrolled_window)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_scrolled_window_get_hadjustment");
+#endif
+
+ return (jint)gtk_scrolled_window_get_hadjustment((GtkScrolledWindow*)scrolled_window);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_scrolled_window_get_vadjustment
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scrolled_1window_1get_1vadjustment
+ (JNIEnv *env, jclass that, jint scrolled_window)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_scrolled_window_get_vadjustment");
+#endif
+
+ return (jint)gtk_scrolled_window_get_vadjustment((GtkScrolledWindow*)scrolled_window);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_scrolled_window_set_policy
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scrolled_1window_1set_1policy
+ (JNIEnv *env, jclass that, jint scrolled_window, jint hscrollbar_policy, jint vscrollbar_policy)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_scrolled_window_set_policy");
+#endif
+
+ gtk_scrolled_window_set_policy((GtkScrolledWindow*)scrolled_window, (GtkPolicyType)hscrollbar_policy, (GtkPolicyType)vscrollbar_policy);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_selection_owner_set
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1selection_1owner_1set
+ (JNIEnv *env, jclass that, jint widget, jint selection, jint time)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_selection_owner_set");
+#endif
+
+ return (jint)gtk_selection_owner_set((GtkWidget*)widget, (GdkAtom)selection, (guint32)time);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_selection_convert
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1selection_1convert
+ (JNIEnv *env, jclass that, jint widget, jint selection, jint target, jint time)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_selection_convert");
+#endif
+
+ return (jint)gtk_selection_convert((GtkWidget*)widget, (GdkAtom)selection, (GdkAtom)target, (guint32)time);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_signal_emit_stop_by_name
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1emit_1stop_1by_1name
+ (JNIEnv *env, jclass that, jint object, jbyteArray name)
+{
+ jbyte *name1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_signal_emit_stop_by_name");
+#endif
+
+ if (name) {
+ name1 = (*env)->GetByteArrayElements(env, name, NULL);
+ }
+ gtk_signal_emit_stop_by_name((GtkObject*)object, (gchar*)name1);
+ if (name) {
+ (*env)->ReleaseByteArrayElements(env, name, name1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_signal_connect
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1connect
+ (JNIEnv *env, jclass that, jint object, jbyteArray name, jint func, jint func_data)
+{
+ jint rc;
+ jbyte *name1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_signal_connect");
+#endif
+
+ if (name) {
+ name1 = (*env)->GetByteArrayElements(env, name, NULL);
+ }
+ rc = (jint)gtk_signal_connect((GtkObject*)object, (gchar*)name1, (GtkSignalFunc)func, (gpointer)func_data);
+ if (name) {
+ (*env)->ReleaseByteArrayElements(env, name, name1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_signal_connect_after
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1connect_1after
+ (JNIEnv *env, jclass that, jint object, jbyteArray name, jint func, jint func_data)
+{
+ jint rc;
+ jbyte *name1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_signal_connect_after");
+#endif
+
+ if (name) {
+ name1 = (*env)->GetByteArrayElements(env, name, NULL);
+ }
+ rc = (jint)gtk_signal_connect_after((GtkObject*)object, (gchar*)name1, (GtkSignalFunc)func, (gpointer)func_data);
+ if (name) {
+ (*env)->ReleaseByteArrayElements(env, name, name1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_signal_handler_block_by_func
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1handler_1block_1by_1func
+ (JNIEnv *env, jclass that, jint object, jint func, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_signal_handler_block_by_func");
+#endif
+
+ gtk_signal_handler_block_by_func((GtkObject*)object, (GtkSignalFunc)func, (gpointer)data);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_signal_handler_unblock_by_func
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1handler_1unblock_1by_1func
+ (JNIEnv *env, jclass that, jint object, jint func, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_signal_handler_unblock_by_func");
+#endif
+
+ gtk_signal_handler_unblock_by_func((GtkObject*)object, (GtkSignalFunc)func, (gpointer)data);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_style_copy
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1style_1copy
+ (JNIEnv *env, jclass that, jint style)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_style_copy");
+#endif
+
+ return (jint)gtk_style_copy((GtkStyle*)style);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_style_unref
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1style_1unref
+ (JNIEnv *env, jclass that, jint style)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_style_unref");
+#endif
+
+ gtk_style_unref((GtkStyle*)style);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_text_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1text_1new
+ (JNIEnv *env, jclass that, jint hadj, jint vadj)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_text_new");
+#endif
+
+ return (jint)gtk_text_new((GtkAdjustment*)hadj, (GtkAdjustment*)vadj);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_text_set_word_wrap
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1text_1set_1word_1wrap
+ (JNIEnv *env, jclass that, jint text, jint word_wrap)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_text_set_word_wrap");
+#endif
+
+ gtk_text_set_word_wrap((GtkText*)text, (gint)word_wrap);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_text_get_length
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1text_1get_1length
+ (JNIEnv *env, jclass that, jint text)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_text_get_length");
+#endif
+
+ return (jint)gtk_text_get_length((GtkText*)text);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_toggle_button_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toggle_1button_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_toggle_button_new");
+#endif
+
+ return (jint)gtk_toggle_button_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_toggle_button_set_active
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toggle_1button_1set_1active
+ (JNIEnv *env, jclass that, jint toggle_button, jboolean is_active)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_toggle_button_set_active");
+#endif
+
+ gtk_toggle_button_set_active((GtkToggleButton*)toggle_button, (gboolean)is_active);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_toggle_button_get_active
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toggle_1button_1get_1active
+ (JNIEnv *env, jclass that, jint toggle_button)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_toggle_button_get_active");
+#endif
+
+ return (jboolean)gtk_toggle_button_get_active((GtkToggleButton*)toggle_button);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_toolbar_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1new
+ (JNIEnv *env, jclass that, jint orientation, jint style)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_toolbar_new");
+#endif
+
+ return (jint)gtk_toolbar_new((GtkOrientation)orientation, (GtkToolbarStyle)style);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_toolbar_insert_element
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1insert_1element
+ (JNIEnv *env, jclass that, jint toolbar, jint type, jint widget, jbyteArray text, jbyteArray tooltip_text, jbyteArray tooltip_private_text, jint icon, jint callback, jint user_data, jint position)
+{
+ jint rc;
+ jbyte *text1 = NULL;
+ jbyte *tooltip_text1 = NULL;
+ jbyte *tooltip_private_text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_toolbar_insert_element");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetByteArrayElements(env, text, NULL);
+ }
+ if (tooltip_text) {
+ tooltip_text1 = (*env)->GetByteArrayElements(env, tooltip_text, NULL);
+ }
+ if (tooltip_private_text) {
+ tooltip_private_text1 = (*env)->GetByteArrayElements(env, tooltip_private_text, NULL);
+ }
+ rc = (jint)gtk_toolbar_insert_element((GtkToolbar*)toolbar, (GtkToolbarChildType)type, (GtkWidget*)widget, (char*)text1, (char*)tooltip_text1, (char*)tooltip_private_text1, (GtkWidget*)icon, (GtkSignalFunc)callback, (gpointer)user_data, (gint)position);
+ if (text) {
+ (*env)->ReleaseByteArrayElements(env, text, text1, 0);
+ }
+ if (tooltip_text) {
+ (*env)->ReleaseByteArrayElements(env, tooltip_text, tooltip_text1, 0);
+ }
+ if (tooltip_private_text) {
+ (*env)->ReleaseByteArrayElements(env, tooltip_private_text, tooltip_private_text1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_toolbar_insert_widget
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1insert_1widget
+ (JNIEnv *env, jclass that, jint toolbar, jint widget, jbyteArray tooltip_text, jbyteArray tooltip_private_text, jint position)
+{
+ jbyte *tooltip_text1 = NULL;
+ jbyte *tooltip_private_text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_toolbar_insert_widget");
+#endif
+
+ if (tooltip_text) {
+ tooltip_text1 = (*env)->GetByteArrayElements(env, tooltip_text, NULL);
+ }
+ if (tooltip_private_text) {
+ tooltip_private_text1 = (*env)->GetByteArrayElements(env, tooltip_private_text, NULL);
+ }
+ gtk_toolbar_insert_widget((GtkToolbar*)toolbar, (GtkWidget*)widget, (char*)tooltip_text1, (char*)tooltip_private_text1, (gint)position);
+ if (tooltip_text) {
+ (*env)->ReleaseByteArrayElements(env, tooltip_text, tooltip_text1, 0);
+ }
+ if (tooltip_private_text) {
+ (*env)->ReleaseByteArrayElements(env, tooltip_private_text, tooltip_private_text1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_toolbar_set_orientation
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1set_1orientation
+ (JNIEnv *env, jclass that, jint toolbar, jint orientation)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_toolbar_set_orientation");
+#endif
+
+ gtk_toolbar_set_orientation((GtkToolbar*)toolbar, (GtkOrientation)orientation);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_toolbar_set_button_relief
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1set_1button_1relief
+ (JNIEnv *env, jclass that, jint toolbar, jint relief)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_toolbar_set_button_relief");
+#endif
+
+ gtk_toolbar_set_button_relief((GtkToolbar*)toolbar, (GtkReliefStyle)relief);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_tooltips_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1tooltips_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_tooltips_new");
+#endif
+
+ return (jint)gtk_tooltips_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_tooltips_set_tip
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1tooltips_1set_1tip
+ (JNIEnv *env, jclass that, jint tooltips, jint widget, jbyteArray tip_text, jbyteArray tip_private)
+{
+ jbyte *tip_text1 = NULL;
+ jbyte *tip_private1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_tooltips_set_tip");
+#endif
+
+ if (tip_text) {
+ tip_text1 = (*env)->GetByteArrayElements(env, tip_text, NULL);
+ }
+ if (tip_private) {
+ tip_private1 = (*env)->GetByteArrayElements(env, tip_private, NULL);
+ }
+ gtk_tooltips_set_tip((GtkTooltips*)tooltips, (GtkWidget*)widget, (gchar*)tip_text1, (gchar*)tip_private1);
+ if (tip_text) {
+ (*env)->ReleaseByteArrayElements(env, tip_text, tip_text1, 0);
+ }
+ if (tip_private) {
+ (*env)->ReleaseByteArrayElements(env, tip_private, tip_private1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_vbox_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1vbox_1new
+ (JNIEnv *env, jclass that, jboolean homogeneous, jint spacing)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_vbox_new");
+#endif
+
+ return (jint)gtk_vbox_new((gboolean)homogeneous, (gint)spacing);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_vscale_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1vscale_1new
+ (JNIEnv *env, jclass that, jint adjustment)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_vscale_new");
+#endif
+
+ return (jint)gtk_vscale_new((GtkAdjustment*)adjustment);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_vscrollbar_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1vscrollbar_1new
+ (JNIEnv *env, jclass that, jint adjustment)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_vscrollbar_new");
+#endif
+
+ return (jint)gtk_vscrollbar_new((GtkAdjustment*)adjustment);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_vseparator_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1vseparator_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_vseparator_new");
+#endif
+
+ return (jint)gtk_vseparator_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_destroy
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1destroy
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_destroy");
+#endif
+
+ gtk_widget_destroy((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_show
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1show
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_show");
+#endif
+
+ gtk_widget_show((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_show_now
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1show_1now
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_show_now");
+#endif
+
+ gtk_widget_show_now((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_hide
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1hide
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_hide");
+#endif
+
+ gtk_widget_hide((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_realize
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1realize
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_realize");
+#endif
+
+ gtk_widget_realize((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_queue_draw
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1queue_1draw
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_queue_draw");
+#endif
+
+ gtk_widget_queue_draw((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_size_request
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1size_1request
+ (JNIEnv *env, jclass that, jint widget, jobject requisition)
+{
+ DECL_GLOB(pGlob)
+ GtkRequisition requisition_struct, *requisition1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_size_request");
+#endif
+
+ if (requisition) {
+ requisition1 = &requisition_struct;
+ cacheGtkRequisitionFids(env, requisition, &PGLOB(GtkRequisitionFc));
+ getGtkRequisitionFields(env, requisition, requisition1, &PGLOB(GtkRequisitionFc));
+ }
+ gtk_widget_size_request((GtkWidget*)widget, (GtkRequisition*)requisition1);
+ if (requisition) {
+ setGtkRequisitionFields(env, requisition, requisition1, &PGLOB(GtkRequisitionFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_size_allocate
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1size_1allocate
+ (JNIEnv *env, jclass that, jint widget, jobject allocation)
+{
+ DECL_GLOB(pGlob)
+ GtkAllocation allocation_struct, *allocation1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_size_allocate");
+#endif
+
+ if (allocation) {
+ allocation1 = &allocation_struct;
+ cacheGtkAllocationFids(env, allocation, &PGLOB(GtkAllocationFc));
+ getGtkAllocationFields(env, allocation, allocation1, &PGLOB(GtkAllocationFc));
+ }
+ gtk_widget_size_allocate((GtkWidget*)widget, (GtkAllocation*)allocation1);
+ if (allocation) {
+ setGtkAllocationFields(env, allocation, allocation1, &PGLOB(GtkAllocationFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_add_accelerator
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1add_1accelerator
+ (JNIEnv *env, jclass that, jint widget, jbyteArray accel_signal, jint accel_group, jint accel_key, jint accel_mods, jint accel_flags)
+{
+ jbyte *accel_signal1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_add_accelerator");
+#endif
+
+ if (accel_signal) {
+ accel_signal1 = (*env)->GetByteArrayElements(env, accel_signal, NULL);
+ }
+ gtk_widget_add_accelerator((GtkWidget*)widget, (gchar*)accel_signal1, (GtkAccelGroup*)accel_group, accel_key, accel_mods, (GtkAccelFlags)accel_flags);
+ if (accel_signal) {
+ (*env)->ReleaseByteArrayElements(env, accel_signal, accel_signal1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_remove_accelerator
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1remove_1accelerator
+ (JNIEnv *env, jclass that, jint widget, jint accel_group, jint accel_key, jint accel_mods)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_remove_accelerator");
+#endif
+
+ gtk_widget_remove_accelerator((GtkWidget*)widget, (GtkAccelGroup*)accel_group, accel_key, accel_mods);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_event
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1event
+ (JNIEnv *env, jclass that, jint widget, jint event)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_event");
+#endif
+
+ return (jint)gtk_widget_event((GtkWidget*)widget, (GdkEvent*)event);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_reparent
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1reparent
+ (JNIEnv *env, jclass that, jint widget, jint new_parent)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_reparent");
+#endif
+
+ gtk_widget_reparent((GtkWidget*)widget, (GtkWidget*)new_parent);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_grab_focus
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1grab_1focus
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_grab_focus");
+#endif
+
+ gtk_widget_grab_focus((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_set_state
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1state
+ (JNIEnv *env, jclass that, jint widget, jint state)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_set_state");
+#endif
+
+ gtk_widget_set_state((GtkWidget*)widget, (GtkStateType)state);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_set_sensitive
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1sensitive
+ (JNIEnv *env, jclass that, jint widget, jboolean sensitive)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_set_sensitive");
+#endif
+
+ gtk_widget_set_sensitive((GtkWidget*)widget, (gboolean)sensitive);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_set_parent
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1parent
+ (JNIEnv *env, jclass that, jint widget, jint parent)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_set_parent");
+#endif
+
+ gtk_widget_set_parent((GtkWidget*)widget, (GtkWidget*)parent);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_set_uposition
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1uposition
+ (JNIEnv *env, jclass that, jint widget, jint x, jint y)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_set_uposition");
+#endif
+
+ gtk_widget_set_uposition((GtkWidget*)widget, (gint)x, (gint)y);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_set_usize
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1usize
+ (JNIEnv *env, jclass that, jint widget, jint width, jint height)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_set_usize");
+#endif
+
+ gtk_widget_set_usize((GtkWidget*)widget, (gint)width, (gint)height);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_add_events
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1add_1events
+ (JNIEnv *env, jclass that, jint widget, jint events)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_add_events");
+#endif
+
+ gtk_widget_add_events((GtkWidget*)widget, (gint)events);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_set_style
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1style
+ (JNIEnv *env, jclass that, jint widget, jint style)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_set_style");
+#endif
+
+ gtk_widget_set_style((GtkWidget*)widget, (GtkStyle*)style);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_ensure_style
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1ensure_1style
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_ensure_style");
+#endif
+
+ gtk_widget_ensure_style((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_get_style
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1get_1style
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_get_style");
+#endif
+
+ return (jint)gtk_widget_get_style((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_get_default_style
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1get_1default_1style
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_get_default_style");
+#endif
+
+ return (jint)gtk_widget_get_default_style();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_window_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1new
+ (JNIEnv *env, jclass that, jint type)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_window_new");
+#endif
+
+ return (jint)gtk_window_new((GtkWindowType)type);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_window_set_title
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1set_1title
+ (JNIEnv *env, jclass that, jint window, jbyteArray title)
+{
+ jbyte *title1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_window_set_title");
+#endif
+
+ if (title) {
+ title1 = (*env)->GetByteArrayElements(env, title, NULL);
+ }
+ gtk_window_set_title((GtkWindow*)window, (gchar*)title1);
+ if (title) {
+ (*env)->ReleaseByteArrayElements(env, title, title1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_window_set_policy
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1set_1policy
+ (JNIEnv *env, jclass that, jint window, jint allow_shrink, jint allow_grow, jint auto_shrink)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_window_set_policy");
+#endif
+
+ gtk_window_set_policy((GtkWindow*)window, (gint)allow_shrink, (gint)allow_grow, (gint)auto_shrink);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_window_add_accel_group
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1add_1accel_1group
+ (JNIEnv *env, jclass that, jint window, jint accel_group)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_window_add_accel_group");
+#endif
+
+ gtk_window_add_accel_group((GtkWindow*)window, (GtkAccelGroup*)accel_group);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_event_get
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1event_1get
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_event_get");
+#endif
+
+ return (jint)gdk_event_get();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_event_get_graphics_expose
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1event_1get_1graphics_1expose
+ (JNIEnv *env, jclass that, jint window)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_event_get_graphics_expose");
+#endif
+
+ return (jint)gdk_event_get_graphics_expose((GdkWindow*)window);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_event_free
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1event_1free
+ (JNIEnv *env, jclass that, jint event)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_event_free");
+#endif
+
+ gdk_event_free((GdkEvent*)event);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_time_get
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1time_1get
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_time_get");
+#endif
+
+ return (jint)gdk_time_get();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_screen_width
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1screen_1width
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_screen_width");
+#endif
+
+ return (jint)gdk_screen_width();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_screen_height
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1screen_1height
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_screen_height");
+#endif
+
+ return (jint)gdk_screen_height();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_screen_width_mm
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1screen_1width_1mm
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_screen_width_mm");
+#endif
+
+ return (jint)gdk_screen_width_mm();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_flush
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1flush
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_flush");
+#endif
+
+ gdk_flush();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_beep
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1beep
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_beep");
+#endif
+
+ gdk_beep();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_visual_get_system
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1visual_1get_1system
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_visual_get_system");
+#endif
+
+ return (jint)gdk_visual_get_system();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_at_pointer
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1at_1pointer
+ (JNIEnv *env, jclass that, jintArray win_x, jintArray win_y)
+{
+ jint rc;
+ jint *win_x1 = NULL;
+ jint *win_y1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_at_pointer");
+#endif
+
+ if (win_x) {
+ win_x1 = (*env)->GetIntArrayElements(env, win_x, NULL);
+ }
+ if (win_y) {
+ win_y1 = (*env)->GetIntArrayElements(env, win_y, NULL);
+ }
+ rc = (jint)gdk_window_at_pointer((gint*)win_x1, (gint*)win_y1);
+ if (win_x) {
+ (*env)->ReleaseIntArrayElements(env, win_x, win_x1, 0);
+ }
+ if (win_y) {
+ (*env)->ReleaseIntArrayElements(env, win_y, win_y1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_clear_area
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1clear_1area
+ (JNIEnv *env, jclass that, jint window, jint x, jint y, jint width, jint height)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_clear_area");
+#endif
+
+ gdk_window_clear_area((GdkWindow*)window, (gint)x, (gint)y, (gint)width, (gint)height);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_clear_area_e
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1clear_1area_1e
+ (JNIEnv *env, jclass that, jint window, jint x, jint y, jint width, jint height)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_clear_area_e");
+#endif
+
+ gdk_window_clear_area_e((GdkWindow*)window, (gint)x, (gint)y, (gint)width, (gint)height);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_copy_area
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1copy_1area
+ (JNIEnv *env, jclass that, jint window, jint gc, jint x, jint y, jint source_window, jint source_x, jint source_y, jint width, jint height)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_copy_area");
+#endif
+
+ gdk_window_copy_area((GdkWindow*)window, (GdkGC*)gc, (gint)x, (gint)y, (GdkWindow*)source_window, (gint)source_x, (gint)source_y, (gint)width, (gint)height);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_raise
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1raise
+ (JNIEnv *env, jclass that, jint window)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_raise");
+#endif
+
+ gdk_window_raise((GdkWindow*)window);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_lower
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1lower
+ (JNIEnv *env, jclass that, jint window)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_lower");
+#endif
+
+ gdk_window_lower((GdkWindow*)window);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_set_user_data
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1set_1user_1data
+ (JNIEnv *env, jclass that, jint window, jint user_data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_set_user_data");
+#endif
+
+ gdk_window_set_user_data((GdkWindow*)window, (gpointer)user_data);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_set_cursor
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1set_1cursor
+ (JNIEnv *env, jclass that, jint window, jint cursor)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_set_cursor");
+#endif
+
+ gdk_window_set_cursor((GdkWindow*)window, (GdkCursor*)cursor);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_get_user_data
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1get_1user_1data
+ (JNIEnv *env, jclass that, jint window, jintArray data)
+{
+ jint *data1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_get_user_data");
+#endif
+
+ if (data) {
+ data1 = (*env)->GetIntArrayElements(env, data, NULL);
+ }
+ gdk_window_get_user_data((GdkWindow*)window, (gpointer*)data1);
+ if (data) {
+ (*env)->ReleaseIntArrayElements(env, data, data1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_get_geometry
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1get_1geometry
+ (JNIEnv *env, jclass that, jint window, jintArray x, jintArray y, jintArray width, jintArray height, jintArray depth)
+{
+ jint *x1 = NULL;
+ jint *y1 = NULL;
+ jint *width1 = NULL;
+ jint *height1 = NULL;
+ jint *depth1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_get_geometry");
+#endif
+
+ if (x) {
+ x1 = (*env)->GetIntArrayElements(env, x, NULL);
+ }
+ if (y) {
+ y1 = (*env)->GetIntArrayElements(env, y, NULL);
+ }
+ if (width) {
+ width1 = (*env)->GetIntArrayElements(env, width, NULL);
+ }
+ if (height) {
+ height1 = (*env)->GetIntArrayElements(env, height, NULL);
+ }
+ if (depth) {
+ depth1 = (*env)->GetIntArrayElements(env, depth, NULL);
+ }
+ gdk_window_get_geometry((GdkWindow*)window, (gint*)x1, (gint*)y1, (gint*)width1, (gint*)height1, (gint*)depth1);
+ if (x) {
+ (*env)->ReleaseIntArrayElements(env, x, x1, 0);
+ }
+ if (y) {
+ (*env)->ReleaseIntArrayElements(env, y, y1, 0);
+ }
+ if (width) {
+ (*env)->ReleaseIntArrayElements(env, width, width1, 0);
+ }
+ if (height) {
+ (*env)->ReleaseIntArrayElements(env, height, height1, 0);
+ }
+ if (depth) {
+ (*env)->ReleaseIntArrayElements(env, depth, depth1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_get_origin
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1get_1origin
+ (JNIEnv *env, jclass that, jint window, jintArray x, jintArray y)
+{
+ jint rc;
+ jint *x1 = NULL;
+ jint *y1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_get_origin");
+#endif
+
+ if (x) {
+ x1 = (*env)->GetIntArrayElements(env, x, NULL);
+ }
+ if (y) {
+ y1 = (*env)->GetIntArrayElements(env, y, NULL);
+ }
+ rc = (jint)gdk_window_get_origin((GdkWindow*)window, (gint*)x1, (gint*)y1);
+ if (x) {
+ (*env)->ReleaseIntArrayElements(env, x, x1, 0);
+ }
+ if (y) {
+ (*env)->ReleaseIntArrayElements(env, y, y1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_get_pointer
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1get_1pointer
+ (JNIEnv *env, jclass that, jint window, jintArray x, jintArray y, jint mask)
+{
+ jint rc;
+ jint *x1 = NULL;
+ jint *y1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_get_pointer");
+#endif
+
+ if (x) {
+ x1 = (*env)->GetIntArrayElements(env, x, NULL);
+ }
+ if (y) {
+ y1 = (*env)->GetIntArrayElements(env, y, NULL);
+ }
+ rc = (jint)gdk_window_get_pointer((GdkWindow*)window, (gint*)x1, (gint*)y1, (GdkModifierType*)mask);
+ if (x) {
+ (*env)->ReleaseIntArrayElements(env, x, x1, 0);
+ }
+ if (y) {
+ (*env)->ReleaseIntArrayElements(env, y, y1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_set_icon
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1set_1icon
+ (JNIEnv *env, jclass that, jint window, jint icon_window, jint pixmap, jint mask)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_set_icon");
+#endif
+
+ gdk_window_set_icon((GdkWindow*)window, (GdkWindow*)icon_window, (GdkPixmap*)pixmap, (GdkBitmap*)mask);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_set_decorations
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1set_1decorations
+ (JNIEnv *env, jclass that, jint window, jint decorations)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_set_decorations");
+#endif
+
+ gdk_window_set_decorations((GdkWindow*)window, (GdkWMDecoration)decorations);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_cursor_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1cursor_1new
+ (JNIEnv *env, jclass that, jint cursor_type)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_cursor_new");
+#endif
+
+ return (jint)gdk_cursor_new((GdkCursorType)cursor_type);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_cursor_new_from_pixmap
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1cursor_1new_1from_1pixmap
+ (JNIEnv *env, jclass that, jint source, jint mask, jobject fg, jobject bg, jint x, jint y)
+{
+ DECL_GLOB(pGlob)
+ jint rc;
+ GdkColor fg_struct, *fg1 = NULL;
+ GdkColor bg_struct, *bg1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_cursor_new_from_pixmap");
+#endif
+
+ if (fg) {
+ fg1 = &fg_struct;
+ cacheGdkColorFids(env, fg, &PGLOB(GdkColorFc));
+ getGdkColorFields(env, fg, fg1, &PGLOB(GdkColorFc));
+ }
+ if (bg) {
+ bg1 = &bg_struct;
+ cacheGdkColorFids(env, bg, &PGLOB(GdkColorFc));
+ getGdkColorFields(env, bg, bg1, &PGLOB(GdkColorFc));
+ }
+ rc = (jint)gdk_cursor_new_from_pixmap((GdkPixmap*)source, (GdkPixmap*)mask, (GdkColor*)fg1, (GdkColor*)bg1, (gint)x, (gint)y);
+ if (fg) {
+ setGdkColorFields(env, fg, fg1, &PGLOB(GdkColorFc));
+ }
+ if (bg) {
+ setGdkColorFields(env, bg, bg1, &PGLOB(GdkColorFc));
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_cursor_destroy
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1cursor_1destroy
+ (JNIEnv *env, jclass that, jint cursor)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_cursor_destroy");
+#endif
+
+ gdk_cursor_destroy((GdkCursor*)cursor);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1new
+ (JNIEnv *env, jclass that, jint window)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_new");
+#endif
+
+ return (jint)gdk_gc_new((GdkWindow*)window);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_unref
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1unref
+ (JNIEnv *env, jclass that, jint gc)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_unref");
+#endif
+
+ gdk_gc_unref((GdkGC*)gc);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_destroy
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1destroy
+ (JNIEnv *env, jclass that, jint gc)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_destroy");
+#endif
+
+ gdk_gc_destroy((GdkGC*)gc);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_get_values
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1get_1values
+ (JNIEnv *env, jclass that, jint gc, jobject values)
+{
+ DECL_GLOB(pGlob)
+ GdkGCValues values_struct, *values1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_get_values");
+#endif
+
+ if (values) {
+ values1 = &values_struct;
+ cacheGdkGCValuesFids(env, values, &PGLOB(GdkGCValuesFc));
+ getGdkGCValuesFields(env, values, values1, &PGLOB(GdkGCValuesFc));
+ }
+ gdk_gc_get_values((GdkGC*)gc, (GdkGCValues*)values1);
+ if (values) {
+ setGdkGCValuesFields(env, values, values1, &PGLOB(GdkGCValuesFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_foreground
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1foreground
+ (JNIEnv *env, jclass that, jint gc, jobject color)
+{
+ DECL_GLOB(pGlob)
+ GdkColor color_struct, *color1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_foreground");
+#endif
+
+ if (color) {
+ color1 = &color_struct;
+ cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
+ getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+ gdk_gc_set_foreground((GdkGC*)gc, (GdkColor*)color1);
+ if (color) {
+ setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_background
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1background
+ (JNIEnv *env, jclass that, jint gc, jobject color)
+{
+ DECL_GLOB(pGlob)
+ GdkColor color_struct, *color1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_background");
+#endif
+
+ if (color) {
+ color1 = &color_struct;
+ cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
+ getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+ gdk_gc_set_background((GdkGC*)gc, (GdkColor*)color1);
+ if (color) {
+ setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_font
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1font
+ (JNIEnv *env, jclass that, jint gc, jint font)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_font");
+#endif
+
+ gdk_gc_set_font((GdkGC*)gc, (GdkFont*)font);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_function
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1function
+ (JNIEnv *env, jclass that, jint gc, jint function)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_function");
+#endif
+
+ gdk_gc_set_function((GdkGC*)gc, (GdkFunction)function);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_fill
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1fill
+ (JNIEnv *env, jclass that, jint gc, jint fill)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_fill");
+#endif
+
+ gdk_gc_set_fill((GdkGC*)gc, (GdkFill)fill);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_stipple
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1stipple
+ (JNIEnv *env, jclass that, jint gc, jint stipple)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_stipple");
+#endif
+
+ gdk_gc_set_stipple((GdkGC*)gc, (GdkPixmap*)stipple);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_clip_mask
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1clip_1mask
+ (JNIEnv *env, jclass that, jint gc, jint mask)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_clip_mask");
+#endif
+
+ gdk_gc_set_clip_mask((GdkGC*)gc, (GdkBitmap*)mask);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_clip_rectangle
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1clip_1rectangle
+ (JNIEnv *env, jclass that, jint gc, jobject rectangle)
+{
+ DECL_GLOB(pGlob)
+ GdkRectangle rectangle_struct, *rectangle1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_clip_rectangle");
+#endif
+
+ if (rectangle) {
+ rectangle1 = &rectangle_struct;
+ cacheGdkRectangleFids(env, rectangle, &PGLOB(GdkRectangleFc));
+ getGdkRectangleFields(env, rectangle, rectangle1, &PGLOB(GdkRectangleFc));
+ }
+ gdk_gc_set_clip_rectangle((GdkGC*)gc, (GdkRectangle*)rectangle1);
+ if (rectangle) {
+ setGdkRectangleFields(env, rectangle, rectangle1, &PGLOB(GdkRectangleFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_clip_region
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1clip_1region
+ (JNIEnv *env, jclass that, jint gc, jint region)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_clip_region");
+#endif
+
+ gdk_gc_set_clip_region((GdkGC*)gc, (GdkRegion*)region);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_subwindow
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1subwindow
+ (JNIEnv *env, jclass that, jint gc, jint mode)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_subwindow");
+#endif
+
+ gdk_gc_set_subwindow((GdkGC*)gc, (GdkSubwindowMode)mode);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_exposures
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1exposures
+ (JNIEnv *env, jclass that, jint gc, jboolean exposures)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_exposures");
+#endif
+
+ gdk_gc_set_exposures((GdkGC*)gc, (gboolean)exposures);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_line_attributes
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1line_1attributes
+ (JNIEnv *env, jclass that, jint gc, jint line_width, jint line_style, jint cap_style, jint join_style)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_line_attributes");
+#endif
+
+ gdk_gc_set_line_attributes((GdkGC*)gc, (gint)line_width, (GdkLineStyle)line_style, (GdkCapStyle)cap_style, (GdkJoinStyle)join_style);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_dashes
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1dashes
+ (JNIEnv *env, jclass that, jint gc, jint dash_offset, jbyteArray dash_list, jint n)
+{
+ jbyte *dash_list1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_dashes");
+#endif
+
+ if (dash_list) {
+ dash_list1 = (*env)->GetByteArrayElements(env, dash_list, NULL);
+ }
+ gdk_gc_set_dashes((GdkGC*)gc, (gint)dash_offset, (gint8*)dash_list1, (gint)n);
+ if (dash_list) {
+ (*env)->ReleaseByteArrayElements(env, dash_list, dash_list1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_pixmap_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1pixmap_1new
+ (JNIEnv *env, jclass that, jint window, jint width, jint height, jint depth)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_pixmap_new");
+#endif
+
+ return (jint)gdk_pixmap_new((GdkWindow*)window, (gint)width, (gint)height, (gint)depth);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_bitmap_create_from_data
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1bitmap_1create_1from_1data
+ (JNIEnv *env, jclass that, jint window, jbyteArray data, jint width, jint height)
+{
+ jint rc;
+ jbyte *data1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_bitmap_create_from_data");
+#endif
+
+ if (data) {
+ data1 = (*env)->GetByteArrayElements(env, data, NULL);
+ }
+ rc = (jint)gdk_bitmap_create_from_data((GdkWindow*)window, (gchar*)data1, (gint)width, (gint)height);
+ if (data) {
+ (*env)->ReleaseByteArrayElements(env, data, data1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_pixmap_unref
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1pixmap_1unref
+ (JNIEnv *env, jclass that, jint pixmap)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_pixmap_unref");
+#endif
+
+ gdk_pixmap_unref((GdkPixmap*)pixmap);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_bitmap_unref
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1bitmap_1unref
+ (JNIEnv *env, jclass that, jint pixmap)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_bitmap_unref");
+#endif
+
+ gdk_bitmap_unref((GdkBitmap*)pixmap);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_image_get
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1image_1get
+ (JNIEnv *env, jclass that, jint window, jint x, jint y, jint width, jint height)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_image_get");
+#endif
+
+ return (jint)gdk_image_get((GdkWindow*)window, (gint)x, (gint)y, (gint)width, (gint)height);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_image_get_pixel
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1image_1get_1pixel
+ (JNIEnv *env, jclass that, jint image, jint x, jint y)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_image_get_pixel");
+#endif
+
+ return (jint)gdk_image_get_pixel((GdkImage*)image, (gint)x, (gint)y);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_colormap_get_system
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1colormap_1get_1system
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_colormap_get_system");
+#endif
+
+ return (jint)gdk_colormap_get_system();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_color_free
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1color_1free
+ (JNIEnv *env, jclass that, jobject color)
+{
+ DECL_GLOB(pGlob)
+ GdkColor color_struct, *color1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_color_free");
+#endif
+
+ if (color) {
+ color1 = &color_struct;
+ cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
+ getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+ gdk_color_free((GdkColor*)color1);
+ if (color) {
+ setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_colors_free
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1colors_1free
+ (JNIEnv *env, jclass that, jint colormap, jintArray pixels, jint npixels, jint planes)
+{
+ jint *pixels1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_colors_free");
+#endif
+
+ if (pixels) {
+ pixels1 = (*env)->GetIntArrayElements(env, pixels, NULL);
+ }
+ gdk_colors_free((GdkColormap*)colormap, (gulong*)pixels1, (gint)npixels, (gulong)planes);
+ if (pixels) {
+ (*env)->ReleaseIntArrayElements(env, pixels, pixels1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_color_white
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1color_1white
+ (JNIEnv *env, jclass that, jint colormap, jobject color)
+{
+ DECL_GLOB(pGlob)
+ jboolean rc;
+ GdkColor color_struct, *color1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_color_white");
+#endif
+
+ if (color) {
+ color1 = &color_struct;
+ cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
+ getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+ rc = (jboolean)gdk_color_white((GdkColormap*)colormap, (GdkColor*)color1);
+ if (color) {
+ setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_color_alloc
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1color_1alloc
+ (JNIEnv *env, jclass that, jint colormap, jobject color)
+{
+ DECL_GLOB(pGlob)
+ jboolean rc;
+ GdkColor color_struct, *color1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_color_alloc");
+#endif
+
+ if (color) {
+ color1 = &color_struct;
+ cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
+ getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+ rc = (jboolean)gdk_color_alloc((GdkColormap*)colormap, (GdkColor*)color1);
+ if (color) {
+ setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_font_load
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1font_1load
+ (JNIEnv *env, jclass that, jbyteArray font_name)
+{
+ jint rc;
+ jbyte *font_name1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_font_load");
+#endif
+
+ if (font_name) {
+ font_name1 = (*env)->GetByteArrayElements(env, font_name, NULL);
+ }
+ rc = (jint)gdk_font_load((gchar*)font_name1);
+ if (font_name) {
+ (*env)->ReleaseByteArrayElements(env, font_name, font_name1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_font_ref
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1font_1ref
+ (JNIEnv *env, jclass that, jint font)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_font_ref");
+#endif
+
+ return (jint)gdk_font_ref((GdkFont*)font);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_font_unref
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1font_1unref
+ (JNIEnv *env, jclass that, jint font)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_font_unref");
+#endif
+
+ gdk_font_unref((GdkFont*)font);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_font_equal
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1font_1equal
+ (JNIEnv *env, jclass that, jint fonta, jint fontb)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_font_equal");
+#endif
+
+ return (jboolean)gdk_font_equal((GdkFont*)fonta, (GdkFont*)fontb);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_string_width
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1string_1width
+ (JNIEnv *env, jclass that, jint font, jbyteArray string)
+{
+ jint rc;
+ jbyte *string1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_string_width");
+#endif
+
+ if (string) {
+ string1 = (*env)->GetByteArrayElements(env, string, NULL);
+ }
+ rc = (jint)gdk_string_width((GdkFont*)font, (gchar*)string1);
+ if (string) {
+ (*env)->ReleaseByteArrayElements(env, string, string1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_char_width
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1char_1width
+ (JNIEnv *env, jclass that, jint font, jbyte character)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_char_width");
+#endif
+
+ return (jint)gdk_char_width((GdkFont*)font, (gchar)character);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_string_height
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1string_1height
+ (JNIEnv *env, jclass that, jint font, jbyteArray string)
+{
+ jint rc;
+ jbyte *string1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_string_height");
+#endif
+
+ if (string) {
+ string1 = (*env)->GetByteArrayElements(env, string, NULL);
+ }
+ rc = (jint)gdk_string_height((GdkFont*)font, (gchar*)string1);
+ if (string) {
+ (*env)->ReleaseByteArrayElements(env, string, string1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_string_extents
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1string_1extents
+ (JNIEnv *env, jclass that, jint font, jbyteArray string, jintArray lbearing, jintArray rbearing, jintArray width, jintArray ascent, jintArray descent)
+{
+ jbyte *string1 = NULL;
+ jint *lbearing1 = NULL;
+ jint *rbearing1 = NULL;
+ jint *width1 = NULL;
+ jint *ascent1 = NULL;
+ jint *descent1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_string_extents");
+#endif
+
+ if (string) {
+ string1 = (*env)->GetByteArrayElements(env, string, NULL);
+ }
+ if (lbearing) {
+ lbearing1 = (*env)->GetIntArrayElements(env, lbearing, NULL);
+ }
+ if (rbearing) {
+ rbearing1 = (*env)->GetIntArrayElements(env, rbearing, NULL);
+ }
+ if (width) {
+ width1 = (*env)->GetIntArrayElements(env, width, NULL);
+ }
+ if (ascent) {
+ ascent1 = (*env)->GetIntArrayElements(env, ascent, NULL);
+ }
+ if (descent) {
+ descent1 = (*env)->GetIntArrayElements(env, descent, NULL);
+ }
+ gdk_string_extents((GdkFont*)font, (gchar*)string1, (gint*)lbearing1, (gint*)rbearing1, (gint*)width1, (gint*)ascent1, (gint*)descent1);
+ if (string) {
+ (*env)->ReleaseByteArrayElements(env, string, string1, 0);
+ }
+ if (lbearing) {
+ (*env)->ReleaseIntArrayElements(env, lbearing, lbearing1, 0);
+ }
+ if (rbearing) {
+ (*env)->ReleaseIntArrayElements(env, rbearing, rbearing1, 0);
+ }
+ if (width) {
+ (*env)->ReleaseIntArrayElements(env, width, width1, 0);
+ }
+ if (ascent) {
+ (*env)->ReleaseIntArrayElements(env, ascent, ascent1, 0);
+ }
+ if (descent) {
+ (*env)->ReleaseIntArrayElements(env, descent, descent1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_draw_line
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1line
+ (JNIEnv *env, jclass that, jint drawable, jint gc, jint x1, jint y1, jint x2, jint y2)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_draw_line");
+#endif
+
+ gdk_draw_line((GdkDrawable*)drawable, (GdkGC*)gc, (gint)x1, (gint)y1, (gint)x2, (gint)y2);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_draw_rectangle
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1rectangle
+ (JNIEnv *env, jclass that, jint drawable, jint gc, jint filled, jint x, jint y, jint width, jint height)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_draw_rectangle");
+#endif
+
+ gdk_draw_rectangle((GdkDrawable*)drawable, (GdkGC*)gc, (gint)filled, (gint)x, (gint)y, (gint)width, (gint)height);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_draw_arc
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1arc
+ (JNIEnv *env, jclass that, jint drawable, jint gc, jint filled, jint x, jint y, jint width, jint height, jint angle1, jint angle2)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_draw_arc");
+#endif
+
+ gdk_draw_arc((GdkDrawable*)drawable, (GdkGC*)gc, (gint)filled, (gint)x, (gint)y, (gint)width, (gint)height, (gint)angle1, (gint)angle2);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_draw_polygon
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1polygon
+ (JNIEnv *env, jclass that, jint drawable, jint gc, jint filled, jshortArray points, jint npoints)
+{
+ jshort *points1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_draw_polygon");
+#endif
+
+ if (points) {
+ points1 = (*env)->GetShortArrayElements(env, points, NULL);
+ }
+ gdk_draw_polygon((GdkDrawable*)drawable, (GdkGC*)gc, (gint)filled, (GdkPoint*)points1, (gint)npoints);
+ if (points) {
+ (*env)->ReleaseShortArrayElements(env, points, points1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_draw_string
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1string
+ (JNIEnv *env, jclass that, jint drawable, jint font, jint gc, jint x, jint y, jbyteArray string)
+{
+ jbyte *string1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_draw_string");
+#endif
+
+ if (string) {
+ string1 = (*env)->GetByteArrayElements(env, string, NULL);
+ }
+ gdk_draw_string((GdkDrawable*)drawable, (GdkFont*)font, (GdkGC*)gc, (gint)x, (gint)y, (gchar*)string1);
+ if (string) {
+ (*env)->ReleaseByteArrayElements(env, string, string1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_draw_pixmap
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1pixmap
+ (JNIEnv *env, jclass that, jint drawable, jint gc, jint src, jint xsrc, jint ysrc, jint xdest, jint ydest, jint width, jint height)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_draw_pixmap");
+#endif
+
+ gdk_draw_pixmap((GdkDrawable*)drawable, (GdkGC*)gc, (GdkDrawable*)src, (gint)xsrc, (gint)ysrc, (gint)xdest, (gint)ydest, (gint)width, (gint)height);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_draw_lines
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1lines
+ (JNIEnv *env, jclass that, jint drawable, jint gc, jshortArray points, jint npoints)
+{
+ jshort *points1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_draw_lines");
+#endif
+
+ if (points) {
+ points1 = (*env)->GetShortArrayElements(env, points, NULL);
+ }
+ gdk_draw_lines((GdkDrawable*)drawable, (GdkGC*)gc, (GdkPoint*)points1, (gint)npoints);
+ if (points) {
+ (*env)->ReleaseShortArrayElements(env, points, points1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_atom_intern
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1atom_1intern
+ (JNIEnv *env, jclass that, jbyteArray atom_name, jint only_if_exists)
+{
+ jint rc;
+ jbyte *atom_name1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_atom_intern");
+#endif
+
+ if (atom_name) {
+ atom_name1 = (*env)->GetByteArrayElements(env, atom_name, NULL);
+ }
+ rc = (jint)gdk_atom_intern((gchar*)atom_name1, (gint)only_if_exists);
+ if (atom_name) {
+ (*env)->ReleaseByteArrayElements(env, atom_name, atom_name1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_region_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_region_new");
+#endif
+
+ return (jint)gdk_region_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_region_destroy
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1destroy
+ (JNIEnv *env, jclass that, jint region)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_region_destroy");
+#endif
+
+ gdk_region_destroy((GdkRegion*)region);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_region_get_clipbox
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1get_1clipbox
+ (JNIEnv *env, jclass that, jint region, jobject rectangle)
+{
+ DECL_GLOB(pGlob)
+ GdkRectangle rectangle_struct, *rectangle1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_region_get_clipbox");
+#endif
+
+ if (rectangle) {
+ rectangle1 = &rectangle_struct;
+ cacheGdkRectangleFids(env, rectangle, &PGLOB(GdkRectangleFc));
+ getGdkRectangleFields(env, rectangle, rectangle1, &PGLOB(GdkRectangleFc));
+ }
+ gdk_region_get_clipbox((GdkRegion*)region, (GdkRectangle*)rectangle1);
+ if (rectangle) {
+ setGdkRectangleFields(env, rectangle, rectangle1, &PGLOB(GdkRectangleFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_region_empty
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1empty
+ (JNIEnv *env, jclass that, jint region)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_region_empty");
+#endif
+
+ return (jboolean)gdk_region_empty((GdkRegion*)region);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_region_equal
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1equal
+ (JNIEnv *env, jclass that, jint region1, jint region2)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_region_equal");
+#endif
+
+ return (jboolean)gdk_region_equal((GdkRegion*)region1, (GdkRegion*)region2);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_region_point_in
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1point_1in
+ (JNIEnv *env, jclass that, jint region, jint x, jint y)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_region_point_in");
+#endif
+
+ return (jboolean)gdk_region_point_in((GdkRegion*)region, (int)x, (int)y);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_region_rect_in
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1rect_1in
+ (JNIEnv *env, jclass that, jint region, jobject rect)
+{
+ DECL_GLOB(pGlob)
+ jint rc;
+ GdkRectangle rect_struct, *rect1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_region_rect_in");
+#endif
+
+ if (rect) {
+ rect1 = &rect_struct;
+ cacheGdkRectangleFids(env, rect, &PGLOB(GdkRectangleFc));
+ getGdkRectangleFields(env, rect, rect1, &PGLOB(GdkRectangleFc));
+ }
+ rc = (jint)gdk_region_rect_in((GdkRegion*)region, (GdkRectangle*)rect1);
+ if (rect) {
+ setGdkRectangleFields(env, rect, rect1, &PGLOB(GdkRectangleFc));
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_region_union_with_rect
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1union_1with_1rect
+ (JNIEnv *env, jclass that, jint region, jobject rect)
+{
+ DECL_GLOB(pGlob)
+ jint rc;
+ GdkRectangle rect_struct, *rect1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_region_union_with_rect");
+#endif
+
+ if (rect) {
+ rect1 = &rect_struct;
+ cacheGdkRectangleFids(env, rect, &PGLOB(GdkRectangleFc));
+ getGdkRectangleFields(env, rect, rect1, &PGLOB(GdkRectangleFc));
+ }
+ rc = (jint)gdk_region_union_with_rect((GdkRegion*)region, (GdkRectangle*)rect1);
+ if (rect) {
+ setGdkRectangleFields(env, rect, rect1, &PGLOB(GdkRectangleFc));
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_regions_union
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1regions_1union
+ (JNIEnv *env, jclass that, jint source1, jint source2)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_regions_union");
+#endif
+
+ return (jint)gdk_regions_union((GdkRegion*)source1, (GdkRegion*)source2);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_regions_subtract
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1regions_1subtract
+ (JNIEnv *env, jclass that, jint source1, jint source2)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_regions_subtract");
+#endif
+
+ return (jint)gdk_regions_subtract((GdkRegion*)source1, (GdkRegion*)source2);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_list_free
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1free
+ (JNIEnv *env, jclass that, jint list)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_list_free");
+#endif
+
+ g_list_free((GList*)list);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_list_append
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1append
+ (JNIEnv *env, jclass that, jint list, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_list_append");
+#endif
+
+ return (jint)g_list_append((GList*)list, (gpointer)data);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_list_nth
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1nth
+ (JNIEnv *env, jclass that, jint list, jint n)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_list_nth");
+#endif
+
+ return (jint)g_list_nth((GList*)list, n);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_list_length
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1length
+ (JNIEnv *env, jclass that, jint list)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_list_length");
+#endif
+
+ return (jint)g_list_length((GList*)list);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_list_nth_data
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1nth_1data
+ (JNIEnv *env, jclass that, jint list, jint n)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_list_nth_data");
+#endif
+
+ return (jint)g_list_nth_data((GList*)list, n);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_slist_nth
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1slist_1nth
+ (JNIEnv *env, jclass that, jint list, jint n)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_slist_nth");
+#endif
+
+ return (jint)g_slist_nth((GSList*)list, n);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_slist_length
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1slist_1length
+ (JNIEnv *env, jclass that, jint list)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_slist_length");
+#endif
+
+ return (jint)g_slist_length((GSList*)list);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_slist_nth_data
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1slist_1nth_1data
+ (JNIEnv *env, jclass that, jint list, jint n)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_slist_nth_data");
+#endif
+
+ return (jint)g_slist_nth_data((GSList*)list, n);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_malloc
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1malloc
+ (JNIEnv *env, jclass that, jint size)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_malloc");
+#endif
+
+ return (jint)g_malloc((gulong)size);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_free
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1free
+ (JNIEnv *env, jclass that, jint mem)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_free");
+#endif
+
+ g_free((gpointer)mem);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_strdup
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1strdup
+ (JNIEnv *env, jclass that, jbyteArray str)
+{
+ jint rc;
+ jbyte *str1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_strdup");
+#endif
+
+ if (str) {
+ str1 = (*env)->GetByteArrayElements(env, str, NULL);
+ }
+ rc = (jint)g_strdup((gchar*)str1);
+ if (str) {
+ (*env)->ReleaseByteArrayElements(env, str, str1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_get_home_dir
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1get_1home_1dir
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_get_home_dir");
+#endif
+
+ return (jint)g_get_home_dir();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1new
+ (JNIEnv *env, jclass that, jint columns)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_new");
+#endif
+
+ return (jint)gtk_clist_new((gint)columns);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_shadow_type
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1shadow_1type
+ (JNIEnv *env, jclass that, jint clist, jint type)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_shadow_type");
+#endif
+
+ gtk_clist_set_shadow_type((GtkCList*)clist, (GtkShadowType)type);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_selection_mode
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1selection_1mode
+ (JNIEnv *env, jclass that, jint clist, jint mode)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_selection_mode");
+#endif
+
+ gtk_clist_set_selection_mode((GtkCList*)clist, (GtkSelectionMode)mode);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_freeze
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1freeze
+ (JNIEnv *env, jclass that, jint clist)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_freeze");
+#endif
+
+ gtk_clist_freeze((GtkCList*)clist);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_thaw
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1thaw
+ (JNIEnv *env, jclass that, jint clist)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_thaw");
+#endif
+
+ gtk_clist_thaw((GtkCList*)clist);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_column_titles_show
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1column_1titles_1show
+ (JNIEnv *env, jclass that, jint clist)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_column_titles_show");
+#endif
+
+ gtk_clist_column_titles_show((GtkCList*)clist);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_column_titles_hide
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1column_1titles_1hide
+ (JNIEnv *env, jclass that, jint clist)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_column_titles_hide");
+#endif
+
+ gtk_clist_column_titles_hide((GtkCList*)clist);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_column_title_passive
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1column_1title_1passive
+ (JNIEnv *env, jclass that, jint clist, jint column)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_column_title_passive");
+#endif
+
+ gtk_clist_column_title_passive((GtkCList*)clist, (gint)column);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_column_titles_passive
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1column_1titles_1passive
+ (JNIEnv *env, jclass that, jint clist)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_column_titles_passive");
+#endif
+
+ gtk_clist_column_titles_passive((GtkCList*)clist);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_column_title
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1title
+ (JNIEnv *env, jclass that, jint clist, jint column, jbyteArray title)
+{
+ jbyte *title1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_column_title");
+#endif
+
+ if (title) {
+ title1 = (*env)->GetByteArrayElements(env, title, NULL);
+ }
+ gtk_clist_set_column_title((GtkCList*)clist, (gint)column, (gchar*)title1);
+ if (title) {
+ (*env)->ReleaseByteArrayElements(env, title, title1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_column_justification
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1justification
+ (JNIEnv *env, jclass that, jint clist, jint column, jint justification)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_column_justification");
+#endif
+
+ gtk_clist_set_column_justification((GtkCList*)clist, (gint)column, (GtkJustification)justification);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_column_visibility
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1visibility
+ (JNIEnv *env, jclass that, jint clist, jint column, jboolean visible)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_column_visibility");
+#endif
+
+ gtk_clist_set_column_visibility((GtkCList*)clist, (gint)column, (gboolean)visible);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_column_resizeable
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1resizeable
+ (JNIEnv *env, jclass that, jint clist, jint column, jboolean resizeable)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_column_resizeable");
+#endif
+
+ gtk_clist_set_column_resizeable((GtkCList*)clist, (gint)column, (gboolean)resizeable);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_column_width
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1width
+ (JNIEnv *env, jclass that, jint clist, jint column, jint width)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_column_width");
+#endif
+
+ gtk_clist_set_column_width((GtkCList*)clist, (gint)column, (gint)width);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_moveto
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1moveto
+ (JNIEnv *env, jclass that, jint clist, jint row, jint column, jfloat row_align, jfloat col_align)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_moveto");
+#endif
+
+ gtk_clist_moveto((GtkCList*)clist, (gint)row, (gint)column, row_align, col_align);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_text
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1text
+ (JNIEnv *env, jclass that, jint clist, jint row, jint column, jbyteArray text)
+{
+ jbyte *text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_text");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetByteArrayElements(env, text, NULL);
+ }
+ gtk_clist_set_text((GtkCList*)clist, (gint)row, (gint)column, (gchar*)text1);
+ if (text) {
+ (*env)->ReleaseByteArrayElements(env, text, text1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_get_text
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1get_1text
+ (JNIEnv *env, jclass that, jint clist, jint row, jint column, jintArray text)
+{
+ jint rc;
+ jint *text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_get_text");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetIntArrayElements(env, text, NULL);
+ }
+ rc = (jint)gtk_clist_get_text((GtkCList*)clist, (gint)row, (gint)column, (gchar**)text1);
+ if (text) {
+ (*env)->ReleaseIntArrayElements(env, text, text1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_pixmap
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1pixmap
+ (JNIEnv *env, jclass that, jint clist, jint row, jint column, jint pixmap, jint mask)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_pixmap");
+#endif
+
+ gtk_clist_set_pixmap((GtkCList*)clist, (gint)row, (gint)column, (GdkPixmap*)pixmap, (GdkBitmap*)mask);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_pixtext
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1pixtext
+ (JNIEnv *env, jclass that, jint clist, jint row, jint column, jbyteArray text, jbyte spacing, jint pixmap, jint mask)
+{
+ jbyte *text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_pixtext");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetByteArrayElements(env, text, NULL);
+ }
+ gtk_clist_set_pixtext((GtkCList*)clist, (gint)row, (gint)column, (gchar*)text1, (guint8)spacing, (GdkPixmap*)pixmap, (GdkBitmap*)mask);
+ if (text) {
+ (*env)->ReleaseByteArrayElements(env, text, text1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_append
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1append
+ (JNIEnv *env, jclass that, jint clist, jintArray text)
+{
+ jint rc;
+ jint *text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_append");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetIntArrayElements(env, text, NULL);
+ }
+ rc = (jint)gtk_clist_append((GtkCList*)clist, (gchar**)text1);
+ if (text) {
+ (*env)->ReleaseIntArrayElements(env, text, text1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_insert
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1insert
+ (JNIEnv *env, jclass that, jint clist, jint row, jintArray text)
+{
+ jint rc;
+ jint *text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_insert");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetIntArrayElements(env, text, NULL);
+ }
+ rc = (jint)gtk_clist_insert((GtkCList*)clist, (gint)row, (gchar**)text1);
+ if (text) {
+ (*env)->ReleaseIntArrayElements(env, text, text1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_remove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1remove
+ (JNIEnv *env, jclass that, jint clist, jint row)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_remove");
+#endif
+
+ gtk_clist_remove((GtkCList*)clist, (gint)row);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_select_row
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1select_1row
+ (JNIEnv *env, jclass that, jint clist, jint row, jint column)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_select_row");
+#endif
+
+ gtk_clist_select_row((GtkCList*)clist, (gint)row, (gint)column);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_unselect_row
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1unselect_1row
+ (JNIEnv *env, jclass that, jint clist, jint row, jint column)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_unselect_row");
+#endif
+
+ gtk_clist_unselect_row((GtkCList*)clist, (gint)row, (gint)column);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_clear
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1clear
+ (JNIEnv *env, jclass that, jint clist)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_clear");
+#endif
+
+ gtk_clist_clear((GtkCList*)clist);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_get_selection_info
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1get_1selection_1info
+ (JNIEnv *env, jclass that, jint clist, jint x, jint y, jintArray row, jintArray column)
+{
+ jint rc;
+ jint *row1 = NULL;
+ jint *column1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_get_selection_info");
+#endif
+
+ if (row) {
+ row1 = (*env)->GetIntArrayElements(env, row, NULL);
+ }
+ if (column) {
+ column1 = (*env)->GetIntArrayElements(env, column, NULL);
+ }
+ rc = (jint)gtk_clist_get_selection_info((GtkCList*)clist, (gint)x, (gint)y, (gint*)row1, (gint*)column1);
+ if (row) {
+ (*env)->ReleaseIntArrayElements(env, row, row1, 0);
+ }
+ if (column) {
+ (*env)->ReleaseIntArrayElements(env, column, column1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_select_all
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1select_1all
+ (JNIEnv *env, jclass that, jint clist)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_select_all");
+#endif
+
+ gtk_clist_select_all((GtkCList*)clist);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_unselect_all
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1unselect_1all
+ (JNIEnv *env, jclass that, jint clist)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_unselect_all");
+#endif
+
+ gtk_clist_unselect_all((GtkCList*)clist);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkColor_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkColor src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkColorFids(env, src, &PGLOB(GdkColorFc));
+ getGdkColorFields(env, src, src1, &PGLOB(GdkColorFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkColor_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkColor_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkColor dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkColor_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkColorFids(env, dest, &PGLOB(GdkColorFc));
+ setGdkColorFields(env, dest, dest1, &PGLOB(GdkColorFc));
+ }
+}
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkStyleClass_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkStyleClass dest_struct, *dest1 = NULL;
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkStyleClassFids(env, dest, &PGLOB(GtkStyleClassFc));
+ setGtkStyleClassFields(env, dest, dest1, &PGLOB(GtkStyleClassFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventKey_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkEvent src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkEventKeyFids(env, src, &PGLOB(GdkEventKeyFc));
+ getGdkEventKeyFields(env, src, src1, &PGLOB(GdkEventKeyFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkEventKey_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventKey_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkEvent dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventKey_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkEventKeyFids(env, dest, &PGLOB(GdkEventKeyFc));
+ setGdkEventKeyFields(env, dest, dest1, &PGLOB(GdkEventKeyFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventButton_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkEvent src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkEventButtonFids(env, src, &PGLOB(GdkEventButtonFc));
+ getGdkEventButtonFields(env, src, src1, &PGLOB(GdkEventButtonFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkEventButton_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventButton_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkEvent dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventButton_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkEventButtonFids(env, dest, &PGLOB(GdkEventButtonFc));
+ setGdkEventButtonFields(env, dest, dest1, &PGLOB(GdkEventButtonFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventMotion_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkEvent src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkEventMotionFids(env, src, &PGLOB(GdkEventMotionFc));
+ getGdkEventMotionFields(env, src, src1, &PGLOB(GdkEventMotionFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkEventMotion_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventMotion_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkEvent dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventMotion_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkEventMotionFids(env, dest, &PGLOB(GdkEventMotionFc));
+ setGdkEventMotionFields(env, dest, dest1, &PGLOB(GdkEventMotionFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventExpose_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkEvent src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkEventExposeFids(env, src, &PGLOB(GdkEventExposeFc));
+ getGdkEventExposeFields(env, src, src1, &PGLOB(GdkEventExposeFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkEventExpose_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventExpose_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkEvent dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventExpose_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkEventExposeFids(env, dest, &PGLOB(GdkEventExposeFc));
+ setGdkEventExposeFields(env, dest, dest1, &PGLOB(GdkEventExposeFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkFont_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkFont src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkFontFids(env, src, &PGLOB(GdkFontFc));
+ getGdkFontFields(env, src, src1, &PGLOB(GdkFontFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkFont_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkFont_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkFont dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkFont_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkFontFids(env, dest, &PGLOB(GdkFontFc));
+ setGdkFontFields(env, dest, dest1, &PGLOB(GdkFontFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkGCValues_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkGCValues src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkGCValuesFids(env, src, &PGLOB(GdkGCValuesFc));
+ getGdkGCValuesFields(env, src, src1, &PGLOB(GdkGCValuesFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkGCValues_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkGCValues_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkGCValues dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkGCValues_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkGCValuesFids(env, dest, &PGLOB(GdkGCValuesFc));
+ setGdkGCValuesFields(env, dest, dest1, &PGLOB(GdkGCValuesFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkImage_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkImage src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkImageFids(env, src, &PGLOB(GdkImageFc));
+ getGdkImageFields(env, src, src1, &PGLOB(GdkImageFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkImage_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkImage_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkImage dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkImage_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkImageFids(env, dest, &PGLOB(GdkImageFc));
+ setGdkImageFields(env, dest, dest1, &PGLOB(GdkImageFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkPoint_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkPoint src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkPointFids(env, src, &PGLOB(GdkPointFc));
+ getGdkPointFields(env, src, src1, &PGLOB(GdkPointFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkPoint_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkPoint_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkPoint dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkPoint_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkPointFids(env, dest, &PGLOB(GdkPointFc));
+ setGdkPointFields(env, dest, dest1, &PGLOB(GdkPointFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkRectangle_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkRectangle src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkRectangleFids(env, src, &PGLOB(GdkRectangleFc));
+ getGdkRectangleFields(env, src, src1, &PGLOB(GdkRectangleFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkRectangle_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkRectangle_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkRectangle dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkRectangle_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkRectangleFids(env, dest, &PGLOB(GdkRectangleFc));
+ setGdkRectangleFields(env, dest, dest1, &PGLOB(GdkRectangleFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkVisual_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkVisual src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkVisualFids(env, src, &PGLOB(GdkVisualFc));
+ getGdkVisualFields(env, src, src1, &PGLOB(GdkVisualFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkVisual_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkVisual_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkVisual dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkVisual_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkVisualFids(env, dest, &PGLOB(GdkVisualFc));
+ setGdkVisualFields(env, dest, dest1, &PGLOB(GdkVisualFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkAllocation src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkAllocationFids(env, src, &PGLOB(GtkAllocationFc));
+ getGtkAllocationFields(env, src, src1, &PGLOB(GtkAllocationFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkAllocation_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkAllocation dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkAllocation_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkAllocationFids(env, dest, &PGLOB(GtkAllocationFc));
+ setGtkAllocationFields(env, dest, dest1, &PGLOB(GtkAllocationFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkArg_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkArg src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkArgFids(env, src, &PGLOB(GtkArgFc));
+ getGtkArgFields(env, src, src1, &PGLOB(GtkArgFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkArg_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkArg_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkArg dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkArg_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkArgFids(env, dest, &PGLOB(GtkArgFc));
+ setGtkArgFields(env, dest, dest1, &PGLOB(GtkArgFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkBin_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkBin src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkBinFids(env, src, &PGLOB(GtkBinFc));
+ getGtkBinFields(env, src, src1, &PGLOB(GtkBinFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkBin_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkBin_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkBin dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkBin_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkBinFids(env, dest, &PGLOB(GtkBinFc));
+ setGtkBinFields(env, dest, dest1, &PGLOB(GtkBinFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCList_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCList src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkCListFids(env, src, &PGLOB(GtkCListFc));
+ getGtkCListFields(env, src, src1, &PGLOB(GtkCListFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCList_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCList_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCList dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCList_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkCListFids(env, dest, &PGLOB(GtkCListFc));
+ setGtkCListFields(env, dest, dest1, &PGLOB(GtkCListFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkMenu_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkMenu src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkMenuFids(env, src, &PGLOB(GtkMenuFc));
+ getGtkMenuFields(env, src, src1, &PGLOB(GtkMenuFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkMenu_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkMenu_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkMenu dest_struct={0}, *dest1 = NULL;
+
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkMenu_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkMenuFids(env, dest, &PGLOB(GtkMenuFc));
+ setGtkMenuFields(env, dest, dest1, &PGLOB(GtkMenuFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCTree_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCTree src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkCTreeFids(env, src, &PGLOB(GtkCTreeFc));
+ getGtkCTreeFields(env, src, src1, &PGLOB(GtkCTreeFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCTree_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCTree_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCTree dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCTree_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkCTreeFids(env, dest, &PGLOB(GtkCTreeFc));
+ setGtkCTreeFields(env, dest, dest1, &PGLOB(GtkCTreeFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkColorSelectionDialog_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkColorSelectionDialog src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkColorSelectionDialogFids(env, src, &PGLOB(GtkColorSelectionDialogFc));
+ getGtkColorSelectionDialogFields(env, src, src1, &PGLOB(GtkColorSelectionDialogFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkColorSelectionDialog_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkColorSelectionDialog_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkColorSelectionDialog dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkColorSelectionDialog_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkColorSelectionDialogFids(env, dest, &PGLOB(GtkColorSelectionDialogFc));
+ setGtkColorSelectionDialogFields(env, dest, dest1, &PGLOB(GtkColorSelectionDialogFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCombo_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCombo src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkComboFids(env, src, &PGLOB(GtkComboFc));
+ getGtkComboFields(env, src, src1, &PGLOB(GtkComboFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCombo_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCombo_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCombo dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCombo_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkComboFids(env, dest, &PGLOB(GtkComboFc));
+ setGtkComboFields(env, dest, dest1, &PGLOB(GtkComboFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkContainer_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkContainer src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkContainerFids(env, src, &PGLOB(GtkContainerFc));
+ getGtkContainerFields(env, src, src1, &PGLOB(GtkContainerFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkContainer_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkContainer_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkContainer dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkContainer_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkContainerFids(env, dest, &PGLOB(GtkContainerFc));
+ setGtkContainerFields(env, dest, dest1, &PGLOB(GtkContainerFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkData_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkData src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkDataFids(env, src, &PGLOB(GtkDataFc));
+ getGtkDataFields(env, src, src1, &PGLOB(GtkDataFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkData_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkData_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkData dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkData_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkDataFids(env, dest, &PGLOB(GtkDataFc));
+ setGtkDataFields(env, dest, dest1, &PGLOB(GtkDataFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkEditable_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkEditable src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkEditableFids(env, src, &PGLOB(GtkEditableFc));
+ getGtkEditableFields(env, src, src1, &PGLOB(GtkEditableFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkEditable_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkEditable_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkEditable dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkEditable_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkEditableFids(env, dest, &PGLOB(GtkEditableFc));
+ setGtkEditableFields(env, dest, dest1, &PGLOB(GtkEditableFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkText_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkText src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkTextFids(env, src, &PGLOB(GtkTextFc));
+ getGtkTextFields(env, src, src1, &PGLOB(GtkTextFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkText_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkText_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkText dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkText_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkTextFids(env, dest, &PGLOB(GtkTextFc));
+ setGtkTextFields(env, dest, dest1, &PGLOB(GtkTextFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_text_inquiry
+ * Signature:
+ * Not implemented yet;
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_text_inquiry__Lorg_eclipse_swt_internal_gtk_GtkText_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkFileSelection_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkFileSelection src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkFileSelectionFids(env, src, &PGLOB(GtkFileSelectionFc));
+ getGtkFileSelectionFields(env, src, src1, &PGLOB(GtkFileSelectionFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkFileSelection_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkFileSelection_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkFileSelection dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkFileSelection_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkFileSelectionFids(env, dest, &PGLOB(GtkFileSelectionFc));
+ setGtkFileSelectionFields(env, dest, dest1, &PGLOB(GtkFileSelectionFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkFontSelectionDialog_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkFontSelectionDialog src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkFontSelectionDialogFids(env, src, &PGLOB(GtkFontSelectionDialogFc));
+ getGtkFontSelectionDialogFields(env, src, src1, &PGLOB(GtkFontSelectionDialogFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkFontSelectionDialog_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkFontSelectionDialog_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkFontSelectionDialog dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkFontSelectionDialog_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkFontSelectionDialogFids(env, dest, &PGLOB(GtkFontSelectionDialogFc));
+ setGtkFontSelectionDialogFields(env, dest, dest1, &PGLOB(GtkFontSelectionDialogFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkObject_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkObject src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkObjectFids(env, src, &PGLOB(GtkObjectFc));
+ getGtkObjectFields(env, src, src1, &PGLOB(GtkObjectFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkObject_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkObject_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkObject dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkObject_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkObjectFids(env, dest, &PGLOB(GtkObjectFc));
+ setGtkObjectFields(env, dest, dest1, &PGLOB(GtkObjectFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkProgress_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkProgress src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkProgressFids(env, src, &PGLOB(GtkProgressFc));
+ getGtkProgressFields(env, src, src1, &PGLOB(GtkProgressFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkProgress_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkProgress_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkProgress dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkProgress_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkProgressFids(env, dest, &PGLOB(GtkProgressFc));
+ setGtkProgressFields(env, dest, dest1, &PGLOB(GtkProgressFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkProgressBar_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkProgressBar src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkProgressBarFids(env, src, &PGLOB(GtkProgressBarFc));
+ getGtkProgressBarFields(env, src, src1, &PGLOB(GtkProgressBarFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkProgressBar_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkProgressBar_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkProgressBar dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkProgressBar_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkProgressBarFids(env, dest, &PGLOB(GtkProgressBarFc));
+ setGtkProgressBarFields(env, dest, dest1, &PGLOB(GtkProgressBarFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkRequisition_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkRequisition src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkRequisitionFids(env, src, &PGLOB(GtkRequisitionFc));
+ getGtkRequisitionFields(env, src, src1, &PGLOB(GtkRequisitionFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkRequisition_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkRequisition_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkRequisition dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkRequisition_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkRequisitionFids(env, dest, &PGLOB(GtkRequisitionFc));
+ setGtkRequisitionFields(env, dest, dest1, &PGLOB(GtkRequisitionFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkStyle_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkStyle src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkStyleFids(env, src, &PGLOB(GtkStyleFc));
+ getGtkStyleFields(env, src, src1, &PGLOB(GtkStyleFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkStyle_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkStyle_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkStyle dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkStyle_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkStyleFids(env, dest, &PGLOB(GtkStyleFc));
+ setGtkStyleFields(env, dest, dest1, &PGLOB(GtkStyleFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkWidget_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkWidget src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkWidgetFids(env, src, &PGLOB(GtkWidgetFc));
+ getGtkWidgetFields(env, src, src1, &PGLOB(GtkWidgetFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkWidget_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkWidget_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkWidget dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkWidget_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkWidgetFids(env, dest, &PGLOB(GtkWidgetFc));
+ setGtkWidgetFields(env, dest, dest1, &PGLOB(GtkWidgetFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkFrame_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkFrame src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkFrameFids(env, src, &PGLOB(GtkFrameFc));
+ getGtkFrameFields(env, src, src1, &PGLOB(GtkFrameFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkFrame_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkFrame_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkFrame dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkFrame_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkFrameFids(env, dest, &PGLOB(GtkFrameFc));
+ setGtkFrameFields(env, dest, dest1, &PGLOB(GtkFrameFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkWindow_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkWindow src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkWindowFids(env, src, &PGLOB(GtkWindowFc));
+ getGtkWindowFields(env, src, src1, &PGLOB(GtkWindowFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkWindow_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkWindow_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkWindow dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkWindow_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkWindowFids(env, dest, &PGLOB(GtkWindowFc));
+ setGtkWindowFields(env, dest, dest1, &PGLOB(GtkWindowFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCheckMenuItem_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCheckMenuItem src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkCheckMenuItemFids(env, src, &PGLOB(GtkCheckMenuItemFc));
+ getGtkCheckMenuItemFields(env, src, src1, &PGLOB(GtkCheckMenuItemFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCheckMenuItem_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCheckMenuItem_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCheckMenuItem dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCheckMenuItem_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkCheckMenuItemFids(env, dest, &PGLOB(GtkCheckMenuItemFc));
+ setGtkCheckMenuItemFields(env, dest, dest1, &PGLOB(GtkCheckMenuItemFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkAdjustment_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkAdjustment src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkAdjustmentFids(env, src, &PGLOB(GtkAdjustmentFc));
+ getGtkAdjustmentFields(env, src, src1, &PGLOB(GtkAdjustmentFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkAdjustment_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkAdjustment_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkAdjustment dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkAdjustment_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkAdjustmentFids(env, dest, &PGLOB(GtkAdjustmentFc));
+ setGtkAdjustmentFields(env, dest, dest1, &PGLOB(GtkAdjustmentFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkBox_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkBox src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkBoxFids(env, src, &PGLOB(GtkBoxFc));
+ getGtkBoxFields(env, src, src1, &PGLOB(GtkBoxFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkBox_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkBox_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkBox dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkBox_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkBoxFids(env, dest, &PGLOB(GtkBoxFc));
+ setGtkBoxFields(env, dest, dest1, &PGLOB(GtkBoxFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkHBox_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkHBox src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkHBoxFids(env, src, &PGLOB(GtkHBoxFc));
+ getGtkHBoxFields(env, src, src1, &PGLOB(GtkHBoxFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkHBox_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkHBox_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkHBox dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkHBox_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkHBoxFids(env, dest, &PGLOB(GtkHBoxFc));
+ setGtkHBoxFields(env, dest, dest1, &PGLOB(GtkHBoxFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkMenuItem_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkMenuItem src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkMenuItemFids(env, src, &PGLOB(GtkMenuItemFc));
+ getGtkMenuItemFields(env, src, src1, &PGLOB(GtkMenuItemFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkMenuItem_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkMenuItem_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkMenuItem dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkMenuItem_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkMenuItemFids(env, dest, &PGLOB(GtkMenuItemFc));
+ setGtkMenuItemFields(env, dest, dest1, &PGLOB(GtkMenuItemFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCListRow_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCListRow src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkCListRowFids(env, src, &PGLOB(GtkCListRowFc));
+ getGtkCListRowFields(env, src, src1, &PGLOB(GtkCListRowFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCListRow_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCListRow_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCListRow dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCListRow_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkCListRowFids(env, dest, &PGLOB(GtkCListRowFc));
+ setGtkCListRowFields(env, dest, dest1, &PGLOB(GtkCListRowFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCListColumn_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCListColumn src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkCListColumnFids(env, src, &PGLOB(GtkCListColumnFc));
+ getGtkCListColumnFields(env, src, src1, &PGLOB(GtkCListColumnFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCListColumn_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCListColumn_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCListColumn dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCListColumn_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkCListColumnFids(env, dest, &PGLOB(GtkCListColumnFc));
+ setGtkCListColumnFields(env, dest, dest1, &PGLOB(GtkCListColumnFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCTreeRow_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCTreeRow src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkCTreeRowFids(env, src, &PGLOB(GtkCTreeRowFc));
+ getGtkCTreeRowFields(env, src, src1, &PGLOB(GtkCTreeRowFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCTreeRow_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCTreeRow_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCTreeRow dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCTreeRow_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkCTreeRowFids(env, dest, &PGLOB(GtkCTreeRowFc));
+ setGtkCTreeRowFields(env, dest, dest1, &PGLOB(GtkCTreeRowFc));
+ }
+}
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__I_3BI
+ (JNIEnv *env, jclass that, jint dest, jbyteArray src, jint count)
+{
+ jbyte *src1;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__I_3BI\n");
+#endif
+
+ if (src) {
+ src1 = (*env)->GetByteArrayElements(env, src, NULL);
+ memmove((void*)dest, (void*)src1, count);
+ (*env)->ReleaseByteArrayElements(env, src, src1, 0);
+ }
+}
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__I_3II
+ (JNIEnv *env, jclass that, jint dest, jintArray src, jint count)
+{
+ jint *src1;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__I_3II\n");
+#endif
+
+ if (src) {
+ src1 = (*env)->GetIntArrayElements(env, src, NULL);
+ memmove((void*)dest, (void*)src1, count);
+ (*env)->ReleaseIntArrayElements(env, src, src1, 0);
+ }
+}
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove___3III
+ (JNIEnv *env, jclass that, jintArray dest, jint src, jint count)
+{
+ jint *dest1;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__III\n");
+#endif
+
+ if (dest) {
+ dest1 = (*env)->GetIntArrayElements(env, dest, NULL);
+ memmove((void*)dest1, (void*)src, count);
+ (*env)->ReleaseIntArrayElements(env, dest, dest1, 0);
+ }
+}
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove___3BII
+ (JNIEnv *env, jclass that, jbyteArray dest, jint src, jint count)
+{
+ jbyte *dest1;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove___3BII\n");
+#endif
+
+ if (dest) {
+ dest1 = (*env)->GetByteArrayElements(env, dest, NULL);
+ memmove((void*)dest1, (void*)src, count);
+ (*env)->ReleaseByteArrayElements(env, dest, dest1, 0);
+ }
+}
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove___3I_3BI
+ (JNIEnv *env, jclass that, jintArray dest, jbyteArray src, jint count)
+{
+ jint *dest1;
+ jbyte *src1;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove___3I_3BI\n");
+#endif
+
+ if (src && dest) {
+ dest1 = (*env)->GetIntArrayElements(env, dest, NULL);
+ src1 = (*env)->GetByteArrayElements(env, dest, NULL);
+ memmove((void*)dest1, (void*)src1, count);
+ (*env)->ReleaseIntArrayElements(env, dest, dest1, 0);
+ (*env)->ReleaseByteArrayElements(env, src, src1, 0);
+ }
+}
+
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_strlen
+ (JNIEnv *env, jclass that, jint string)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "strlen\n");
+#endif
+
+ return (jint)strlen((char*)string);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: XListFonts
+ * Signature: ([BI[I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_XListFonts
+ (JNIEnv *env, jclass that, jbyteArray pattern, jint maxnames, jintArray actual_count_return)
+{
+ jbyte *pattern1 = NULL;
+ jint *actual_count_return1=NULL;
+ jint rc;
+
+ if (pattern)
+ pattern1 = (*env)->GetByteArrayElements(env, pattern, NULL);
+ if (actual_count_return)
+ actual_count_return1 = (*env)->GetIntArrayElements(env, actual_count_return, NULL);
+
+ rc = (jint) XListFonts(GDK_DISPLAY(), (char *)pattern1, maxnames, (int *)actual_count_return1);
+
+ if (pattern)
+ (*env)->ReleaseByteArrayElements(env, pattern, pattern1, 0);
+ if (actual_count_return)
+ (*env)->ReleaseIntArrayElements(env, actual_count_return, actual_count_return1, 0);
+ return rc;
+}
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDKPIXBUF.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDKPIXBUF.java
new file mode 100644
index 0000000..713ba8d
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDKPIXBUF.java
@@ -0,0 +1,225 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+import org.eclipse.swt.internal.Library;
+
+public class GDKPIXBUF extends OS {
+
+ /* GdkColorspace enumeration */
+ /* R/G/B additive color space */
+ public final static int GDK_COLORSPACE_RGB = 0;
+
+ /* GIF-like animation overlay modes for frames */
+ public final static int GDK_PIXBUF_FRAME_RETAIN = 0;
+ public final static int GDK_PIXBUF_FRAME_DISPOSE = 1;
+ public final static int GDK_PIXBUF_FRAME_REVERT = 2;
+
+ /* Alpha compositing mode */
+ public final static int GDK_PIXBUF_ALPHA_BILEVEL = 0;
+ public final static int GDK_PIXBUF_ALPHA_FULL = 1;
+
+ /* Interpolation modes */
+ public final static int GDK_INTERP_NEAREST = 0;
+ public final static int GDK_INTERP_TILES = 1;
+ public final static int GDK_INTERP_BILINEAR = 2;
+ public final static int GDK_INTERP_HYPER = 3;
+
+
+/*
+ * NATIVES
+ */
+
+/* GdkPixbuf accessors */
+
+/**
+ * Returns the colorspace of the pixbuf argument
+ */
+public static final native int gdk_pixbuf_get_colorspace (int pixbuf);
+
+/**
+ * Returns the number of channels in the pixbuf argument
+ */
+public static final native int gdk_pixbuf_get_n_channels (int pixbuf);
+
+/**
+ * Returns true if the pixbuf specified by the argument has an alpha channel
+ * (opacity information), and false otherwise.
+ */
+public static final native boolean gdk_pixbuf_get_has_alpha (int pixbuf);
+
+/**
+ * Returns the number of bits per pixel in each channel.
+ * Normally 8.
+ */
+public static final native int gdk_pixbuf_get_bits_per_sample (int pixbuf);
+
+/**
+ * Returns the address of the actual image data in the OS memory.
+ */
+public static final native int gdk_pixbuf_get_pixels (int pixbuf);
+
+/**
+ * Returns the width of the pixbuf specified by the argument.
+ */
+public static final native int gdk_pixbuf_get_width (int pixbuf);
+
+/**
+ * Returns the height of the pixbuf specified by the argument.
+ */
+public static final native int gdk_pixbuf_get_height (int pixbuf);
+
+/**
+ * Returns the rowstride of the pixbuf specified by the argument.
+ */
+public static final native int gdk_pixbuf_get_rowstride (int pixbuf);
+
+
+/* PIXBUF CREATION FROM DATA IN MEMORY */
+
+/**
+ * Create a blank pixbuf with an optimal rowstride and a new buffer
+ */
+public static final native int gdk_pixbuf_new (
+ int colorspace,
+ boolean has_alpha,
+ int bits_per_sample,
+ int width,
+ int height);
+
+public static final native int gdk_pixbuf_copy(int source);
+
+public static final native int gdk_pixbuf_new_from_data (
+ byte[] data,
+ int colorspace,
+ boolean has_alpha,
+ int bits_per_sample,
+ int width,
+ int height,
+ int rowstride,
+ int destroy_fn,
+ int destroy_fn_data);
+
+public static final native int gdk_pixbuf_new_from_xpm_data (int pdata);
+
+
+/* PIXBUF CREATION - FILE LOADING */
+
+public static final native int gdk_pixbuf_new_from_file (byte[] filename);
+
+
+
+/* RENDERING TO A DRAWABLE */
+
+
+public static final native void gdk_pixbuf_render_to_drawable_alpha (int pixbuf,
+ int drawable,
+ int src_x, int src_y,
+ int dest_x, int dest_y,
+ int width, int height,
+ int alpha_mode,
+ int alpha_threshold,
+ int dither,
+ int x_dither, int y_dither);
+
+public static final native void gdk_pixbuf_render_to_drawable (int pixbuf,
+ int drawable,
+ int gc,
+ int src_x, int src_y,
+ int dest_x, int dest_y,
+ int width, int height,
+ int dither,
+ int x_dither, int y_dither);
+
+/* SCALING */
+
+public static final native void gdk_pixbuf_scale (
+ int src, int dest,
+ int dest_x,
+ int dest_y,
+ int dest_width,
+ int dest_height,
+ double offset_x,
+ double offset_y,
+ double scale_x,
+ double scale_y,
+ int interp_type);
+
+public static final native void gdk_pixbuf_composite (
+ int src, int dest,
+ int dest_x,
+ int dest_y,
+ int dest_width,
+ int dest_height,
+ double offset_x,
+ double offset_y,
+ double scale_x,
+ double scale_y,
+ int interp_type,
+ int overall_alpha);
+
+public static final native void gdk_pixbuf_composite_color (
+ int src,
+ int dest,
+ int dest_x,
+ int dest_y,
+ int dest_width,
+ int dest_height,
+ double offset_x,
+ double offset_y,
+ double scale_x,double scale_y,
+ int interp_type,
+ int overall_alpha,
+ int check_x,
+ int check_y,
+ int check_size,
+ int color1,
+ int color2);
+
+public static final native int gdk_pixbuf_scale_simple (
+ int src,
+ int dest_width,
+ int dest_height,
+ int interp_type);
+
+public static final native int gdk_pixbuf_composite_color_simple (
+ int src,int dest_width,
+ int dest_height,
+ int interp_type,
+ int overall_alpha,
+ int check_size,
+ int color1,
+ int color2);
+
+
+
+public static final native int gdk_pixbuf_get_from_drawable (
+ int dest,
+ int src,
+ int cmap,
+ int src_x,
+ int src_y,
+ int dest_x,
+ int dest_y,
+ int width,
+ int height);
+
+
+
+/* LOAD THE DLL */
+
+static {
+ Library.loadLibrary ("swt-pixbuf");
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkColor.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkColor.java
new file mode 100644
index 0000000..1db777f
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkColor.java
@@ -0,0 +1,22 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkColor {
+ public int pixel;
+ public short red;
+ public short green;
+ public short blue;
+ public static final int sizeof = 10;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEvent.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEvent.java
new file mode 100644
index 0000000..6da6571
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEvent.java
@@ -0,0 +1,21 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkEvent {
+ public int type;
+ public int window;
+ public byte send_event;
+ public static final int sizeof = 88;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventButton.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventButton.java
new file mode 100644
index 0000000..17d1feb
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventButton.java
@@ -0,0 +1,29 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkEventButton extends GdkEvent {
+ public int time;
+ public long x;
+ public long y;
+ public long pressure;
+ public long xtilt;
+ public long ytilt;
+ public int state;
+ public int button;
+ public int source;
+ public int deviceid;
+ public long x_root;
+ public long y_root;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventExpose.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventExpose.java
new file mode 100644
index 0000000..6fd9920
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventExpose.java
@@ -0,0 +1,22 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkEventExpose extends GdkEvent {
+ public short x;
+ public short y;
+ public short width;
+ public short height;
+ public int count;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventKey.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventKey.java
new file mode 100644
index 0000000..6e4acde
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventKey.java
@@ -0,0 +1,22 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkEventKey extends GdkEvent {
+ public int time;
+ public int state;
+ public int keyval;
+ public int length;
+ public int string;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventMotion.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventMotion.java
new file mode 100644
index 0000000..5a8d5b9
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventMotion.java
@@ -0,0 +1,29 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkEventMotion extends GdkEvent {
+ public int time;
+ public long x;
+ public long y;
+ public long pressure;
+ public long xtilt;
+ public long ytilt;
+ public int state;
+ public int is_hint;
+ public int source;
+ public int deviceid;
+ public long x_root;
+ public long y_root;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkFont.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkFont.java
new file mode 100644
index 0000000..6d7df17
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkFont.java
@@ -0,0 +1,21 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkFont {
+ public int type;
+ public int ascent;
+ public int descent;
+ public static final int sizeof = 12;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkGCValues.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkGCValues.java
new file mode 100644
index 0000000..df0b4d5
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkGCValues.java
@@ -0,0 +1,42 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkGCValues {
+ public int foreground_pixel;
+ public short foreground_red;
+ public short foreground_green;
+ public short foreground_blue;
+ public int background_pixel;
+ public short background_red;
+ public short background_green;
+ public short background_blue;
+ public int font;
+ public int function;
+ public int fill;
+ public int tile;
+ public int stipple;
+ public int clip_mask;
+ public int subwindow_mode;
+ public int ts_x_origin;
+ public int ts_y_origin;
+ public int clip_x_origin;
+ public int clip_y_origin;
+ public int graphics_exposures;
+ public int line_width;
+ public int line_style;
+ public int cap_style;
+ public int join_style;
+ public static final int sizeof = 84;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkRectangle.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkRectangle.java
new file mode 100644
index 0000000..1dad9e7
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkRectangle.java
@@ -0,0 +1,22 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkRectangle {
+ public short x;
+ public short y;
+ public short width;
+ public short height;
+ public static final int sizeof = 8;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkVisual.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkVisual.java
new file mode 100644
index 0000000..3b0630a
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkVisual.java
@@ -0,0 +1,32 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkVisual {
+ public int type;
+ public int depth;
+ public int byte_order;
+ public int colormap_size;
+ public int bits_per_rgb;
+ public int red_mask;
+ public int red_shift;
+ public int red_prec;
+ public int green_mask;
+ public int green_shift;
+ public int green_prec;
+ public int blue_mask;
+ public int blue_shift;
+ public int blue_prec;
+ public static final int sizeof = 56;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkAdjustment.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkAdjustment.java
new file mode 100644
index 0000000..b1a5598
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkAdjustment.java
@@ -0,0 +1,24 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkAdjustment extends GtkObject {
+ public float lower;
+ public float upper;
+ public float value;
+ public float step_increment;
+ public float page_increment;
+ public float page_size;
+ public static final int sizeof = 40;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkAllocation.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkAllocation.java
new file mode 100644
index 0000000..fc264d9
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkAllocation.java
@@ -0,0 +1,22 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkAllocation {
+ public short x;
+ public short y;
+ public short width;
+ public short height;
+ public static final int sizeof = 8;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkBin.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkBin.java
new file mode 100644
index 0000000..d408fc5
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkBin.java
@@ -0,0 +1,19 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkBin extends GtkContainer {
+ public int child;
+ public static final int sizeof = 64;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkBox.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkBox.java
new file mode 100644
index 0000000..f948c7e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkBox.java
@@ -0,0 +1,21 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkBox extends GtkContainer {
+ public int children;
+ public short spacing;
+ public int homogeneous;
+ public static final int sizeof = 68;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCList.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCList.java
new file mode 100644
index 0000000..cb4843b
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCList.java
@@ -0,0 +1,74 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkCList extends GtkContainer {
+ public short clist_flags;
+ public int row_mem_chunk;
+ public int cell_mem_chunk;
+ public int freeze_count;
+ public short internal_allocation_x;
+ public short internal_allocation_y;
+ public short internal_allocation_width;
+ public short internal_allocation_height;
+ public int rows;
+ public int row_center_offset;
+ public int row_height;
+ public int row_list;
+ public int row_list_end;
+ public int columns;
+ public short column_title_area_x;
+ public short column_title_area_y;
+ public short column_title_area_width;
+ public short column_title_area_height;
+ public int title_window;
+ public int column;
+ public int clist_window;
+ public int clist_window_width;
+ public int clist_window_height;
+ public int hoffset;
+ public int voffset;
+ public int shadow_type;
+ public int selection_mode;
+ public int selection;
+ public int selection_end;
+ public int undo_selection;
+ public int undo_unselection;
+ public int undo_anchor;
+ public byte button_actions0;
+ public byte button_actions1;
+ public byte button_actions2;
+ public byte button_actions3;
+ public byte button_actions4;
+ public byte drag_button;
+ public int click_cell_row;
+ public int click_cell_column;
+ public int hadjustment;
+ public int vadjustment;
+ public int xor_gc;
+ public int fg_gc;
+ public int bg_gc;
+ public int cursor_drag;
+ public int x_drag;
+ public int focus_row;
+ public int anchor;
+ public int anchor_state;
+ public int drag_pos;
+ public int htimer;
+ public int vtimer;
+ public int sort_type;
+ public int compare;
+ public int sort_column;
+ public static final int sizeof = 252;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCListColumn.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCListColumn.java
new file mode 100644
index 0000000..818924d
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCListColumn.java
@@ -0,0 +1,34 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkCListColumn {
+ public int title;
+ public short area_x;
+ public short area_y;
+ public short area_width;
+ public short area_height;
+ public int button;
+ public int window;
+ public int width;
+ public int min_width;
+ public int max_width;
+ public int justification;
+ public int visible;
+ public int width_set;
+ public int resizeable;
+ public int auto_resize;
+ public int button_passive;
+ public static final int sizeof = 40;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCListRow.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCListRow.java
new file mode 100644
index 0000000..73c9063
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCListRow.java
@@ -0,0 +1,34 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkCListRow {
+ public int cell;
+ public int state;
+ public short foreground_red;
+ public short foreground_green;
+ public short foreground_blue;
+ public int foreground_pixel;
+ public short background_red;
+ public short background_green;
+ public short background_blue;
+ public int background_pixel;
+ public int style;
+ public int data;
+ public int destroy; // bitfield: 1
+ public int fg_set; // bitfield: 1
+ public int bg_set; // bitfield: 1
+ public int selectable; // bitfield: 1
+ public static final int sizeof = 48;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCTree.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCTree.java
new file mode 100644
index 0000000..7f6bb8e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCTree.java
@@ -0,0 +1,20 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkCTree extends GtkCList {
+ public int tree_indent;
+ public int tree_column;
+ public static final int sizeof = 276;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCTreeRow.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCTreeRow.java
new file mode 100644
index 0000000..ce9e4d6
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCTreeRow.java
@@ -0,0 +1,28 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkCTreeRow extends GtkCListRow {
+ public int parent;
+ public int sibling;
+ public int children;
+ public int pixmap_closed;
+ public int mask_closed;
+ public int pixmap_opened;
+ public int mask_opened;
+ public short level;
+ public int is_leaf; // bitfield: 1
+ public int expanded; // bitfield: 1
+ public static final int sizeof = 80;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCheckMenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCheckMenuItem.java
new file mode 100644
index 0000000..ce3c4db
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCheckMenuItem.java
@@ -0,0 +1,20 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkCheckMenuItem extends GtkMenuItem {
+ public int active;
+ public int always_show_toggle;
+ public static final int sizeof = 88;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkColorSelectionDialog.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkColorSelectionDialog.java
new file mode 100644
index 0000000..b677e23
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkColorSelectionDialog.java
@@ -0,0 +1,24 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkColorSelectionDialog extends GtkWindow {
+ public int colorsel;
+ public int main_vbox;
+ public int ok_button;
+ public int reset_button;
+ public int cancel_button;
+ public int help_button;
+ public static final int sizeof = 120;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCombo.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCombo.java
new file mode 100644
index 0000000..2b44b57
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkCombo.java
@@ -0,0 +1,32 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkCombo extends GtkHBox {
+ public int entry;
+ public int button;
+ public int popup;
+ public int popwin;
+ public int list;
+ public int entry_change_id;
+ public int list_change_id;
+ public int value_in_list; // bitfield : 1
+ public int ok_if_empty; // bitfield : 1
+ public int case_sensitive; // bitfield : 1
+ public int use_arrows; // bitfield : 1
+ public int use_arrows_always; // bitfield : 1
+ public short current_button;
+ public int activate_id;
+ public static final int sizeof = 104;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkContainer.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkContainer.java
new file mode 100644
index 0000000..52cb47a
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkContainer.java
@@ -0,0 +1,23 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkContainer extends GtkWidget {
+ public int focus_child;
+ public int border_width;
+ public int need_resize;
+ public int resize_mode;
+ public int resize_widgets;
+ public static final int sizeof = 60;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkDialog.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkDialog.java
new file mode 100644
index 0000000..d4f2ddf
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkDialog.java
@@ -0,0 +1,21 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkDialog extends GtkWindow {
+ public int vbox;
+ public int action_area;
+ public static final int sizeof = 104;
+}
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkEditable.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkEditable.java
new file mode 100644
index 0000000..8f2b772
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkEditable.java
@@ -0,0 +1,27 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkEditable extends GtkWidget {
+ public int current_pos;
+ public int selection_start_pos;
+ public int selection_end_pos;
+ public int has_selection; // bitfield : 1
+ public int editable; // bitfield : 1
+ public int visible; // bitfield : 1
+ public int ic;
+ public int ic_attr;
+ public int clipboard_text;
+ public static final int sizeof = 76;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFileSelection.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFileSelection.java
new file mode 100644
index 0000000..ebaf37d
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFileSelection.java
@@ -0,0 +1,38 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkFileSelection extends GtkWindow {
+ public int dir_list;
+ public int file_list;
+ public int selection_entry;
+ public int selection_text;
+ public int main_vbox;
+ public int ok_button;
+ public int cancel_button;
+ public int help_button;
+ public int history_pulldown;
+ public int history_menu;
+ public int history_list;
+ public int fileop_dialog;
+ public int fileop_entry;
+ public int fileop_file;
+ public int cmpl_state;
+ public int fileop_c_dir;
+ public int fileop_del_file;
+ public int fileop_ren_file;
+ public int button_area;
+ public int action_area;
+ public static final int sizeof = 176;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFontSelectionDialog.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFontSelectionDialog.java
new file mode 100644
index 0000000..09ee759
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFontSelectionDialog.java
@@ -0,0 +1,26 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkFontSelectionDialog extends GtkWindow {
+ public int fontsel;
+ public int main_vbox;
+ public int action_area;
+ public int ok_button;
+ public int apply_button;
+ public int cancel_button;
+ public int dialog_width;
+ public int auto_resize;
+ public static final int sizeof = 132;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFrame.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFrame.java
new file mode 100644
index 0000000..0541461
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkFrame.java
@@ -0,0 +1,24 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkFrame extends GtkBin {
+ public int label;
+ public short shadow_type;
+ public short label_width;
+ public short label_height;
+ public float label_xalign;
+ public float label_yalign;
+ public static final int sizeof = 84;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkHBox.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkHBox.java
new file mode 100644
index 0000000..6566014
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkHBox.java
@@ -0,0 +1,18 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkHBox extends GtkBox {
+ public static final int sizeof = 68;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkItem.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkItem.java
new file mode 100644
index 0000000..80db35e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkItem.java
@@ -0,0 +1,18 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkItem extends GtkBin {
+ public static final int sizeof = 64;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkMenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkMenuItem.java
new file mode 100644
index 0000000..ed45420
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkMenuItem.java
@@ -0,0 +1,28 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkMenuItem extends GtkItem {
+ public int submenu;
+ public int accelerator_signal;
+ public int toggle_size;
+ public int accelerator_width;
+ public int show_toggle_indicator;
+ public int show_submenu_indicator;
+ public int submenu_placement;
+ public int submenu_direction;
+ public int right_justify;
+ public int timer;
+ public static final int sizeof = 84;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkObject.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkObject.java
new file mode 100644
index 0000000..226d4a7
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkObject.java
@@ -0,0 +1,22 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkObject {
+ public int klass;
+ public int flags;
+ public int ref_count;
+ public int object_data;
+ public static final int sizeof = 16;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkRequisition.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkRequisition.java
new file mode 100644
index 0000000..0c12fe4
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkRequisition.java
@@ -0,0 +1,20 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkRequisition {
+ public short width;
+ public short height;
+ public static final int sizeof = 4;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkStyle.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkStyle.java
new file mode 100644
index 0000000..a070672
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkStyle.java
@@ -0,0 +1,112 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkStyle {
+ public int klass;
+ public int fg0_pixel;
+ public short fg0_red, fg0_green, fg0_blue;
+ public int fg1_pixel;
+ public short fg1_red, fg1_green, fg1_blue;
+ public int fg2_pixel;
+ public short fg2_red, fg2_green, fg2_blue;
+ public int fg3_pixel;
+ public short fg3_red, fg3_green, fg3_blue;
+ public int fg4_pixel;
+ public short fg4_red, fg4_green, fg4_blue;
+ public int bg0_pixel;
+ public short bg0_red, bg0_green, bg0_blue;
+ public int bg1_pixel;
+ public short bg1_red, bg1_green, bg1_blue;
+ public int bg2_pixel;
+ public short bg2_red, bg2_green, bg2_blue;
+ public int bg3_pixel;
+ public short bg3_red, bg3_green, bg3_blue;
+ public int bg4_pixel;
+ public short bg4_red, bg4_green, bg4_blue;
+ public int light0_pixel;
+ public short light0_red, light0_green, light0_blue;
+ public int light1_pixel;
+ public short light1_red, light1_green, light1_blue;
+ public int light2_pixel;
+ public short light2_red, light2_green, light2_blue;
+ public int light3_pixel;
+ public short light3_red, light3_green, light3_blue;
+ public int light4_pixel;
+ public short light4_red, light4_green, light4_blue;
+ public int dark0_pixel;
+ public short dark0_red, dark0_green, dark0_blue;
+ public int dark1_pixel;
+ public short dark1_red, dark1_green, dark1_blue;
+ public int dark2_pixel;
+ public short dark2_red, dark2_green, dark2_blue;
+ public int dark3_pixel;
+ public short dark3_red, dark3_green, dark3_blue;
+ public int dark4_pixel;
+ public short dark4_red, dark4_green, dark4_blue;
+ public int mid0_pixel;
+ public short mid0_red, mid0_green, mid0_blue;
+ public int mid1_pixel;
+ public short mid1_red, mid1_green, mid1_blue;
+ public int mid2_pixel;
+ public short mid2_red, mid2_green, mid2_blue;
+ public int mid3_pixel;
+ public short mid3_red, mid3_green, mid3_blue;
+ public int mid4_pixel;
+ public short mid4_red, mid4_green, mid4_blue;
+ public int text0_pixel;
+ public short text0_red, text0_green, text0_blue;
+ public int text1_pixel;
+ public short text1_red, text1_green, text1_blue;
+ public int text2_pixel;
+ public short text2_red, text2_green, text2_blue;
+ public int text3_pixel;
+ public short text3_red, text3_green, text3_blue;
+ public int text4_pixel;
+ public short text4_red, text4_green, text4_blue;
+ public int base0_pixel;
+ public short base0_red, base0_green, base0_blue;
+ public int base1_pixel;
+ public short base1_red, base1_green, base1_blue;
+ public int base2_pixel;
+ public short base2_red, base2_green, base2_blue;
+ public int base3_pixel;
+ public short base3_red, base3_green, base3_blue;
+ public int base4_pixel;
+ public short base4_red, base4_green, base4_blue;
+ public int black_pixel;
+ public short black_red, black_green, black_blue;
+ public int white_pixel;
+ public short white_red, white_green, white_blue;
+ public int font;
+ public int fg_gc0, fg_gc1, fg_gc2, fg_gc3, fg_gc4;
+ public int bg_gc0, bg_gc1, bg_gc2, bg_gc3, bg_gc4;
+ public int light_gc0, light_gc1, light_gc2, light_gc3, light_gc4;
+ public int dark_gc0, dark_gc1, dark_gc2, dark_gc3, dark_gc4;
+ public int mid_gc0, mid_gc1, mid_gc2, mid_gc3, mid_gc4;
+ public int text_gc0, text_gc1, text_gc2, text_gc3, text_gc4;
+ public int base_gc0, base_gc1, base_gc2, base_gc3, base_gc4;
+ public int black_gc;
+ public int white_gc;
+ public int bg_pixmap0, bg_pixmap1, bg_pixmap2, bg_pixmap3, bg_pixmap4, bg_pixmap5;
+ public int ref_count;
+ public int attach_count;
+ public int depth;
+ public int colormap;
+ public int engine;
+ public int engine_data;
+ public int rc_style;
+ public int styles;
+ public static final int sizeof = 652;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkStyleClass.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkStyleClass.java
new file mode 100644
index 0000000..a086ab4
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkStyleClass.java
@@ -0,0 +1,20 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkStyleClass {
+ public int xthickness;
+ public int ythickness;
+ public static final int sizeof = 8;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkText.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkText.java
new file mode 100644
index 0000000..fda4196
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkText.java
@@ -0,0 +1,25 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkText extends GtkEditable {
+ public int first_line_start_index;
+ public int first_onscreen_hor_pixel;
+ public int first_onscreen_ver_pixel;
+ public int default_tab_width;
+ public int cursor_pos_x;
+ public int cursor_pos_y;
+ public int cursor_virtual_x;
+ public static final int sizeof = 244;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkWidget.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkWidget.java
new file mode 100644
index 0000000..405fbeb
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkWidget.java
@@ -0,0 +1,31 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkWidget extends GtkObject {
+ public short private_flags;
+ public byte state;
+ public byte saved_state;
+ public int name;
+ public int style;
+ public short req_width;
+ public short req_height;
+ public short alloc_x;
+ public short alloc_y;
+ public short alloc_width;
+ public short alloc_height;
+ public int window;
+ public int parent;
+ public static final int sizeof = 48;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkWindow.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkWindow.java
new file mode 100644
index 0000000..152dc72
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GtkWindow.java
@@ -0,0 +1,33 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkWindow extends GtkBin {
+ public int title;
+ public int wmclass_name;
+ public int wmclass_class;
+ public int type;
+ public int focus_widget;
+ public int default_widget;
+ public int transient_parent;
+ public short resize_count;
+ public int allow_shrink;
+ public int allow_grow;
+ public int auto_shrink;
+ public int handling_resize;
+ public int position;
+ public int use_uposition;
+ public int modal;
+ public static final int sizeof = 96;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
new file mode 100644
index 0000000..467ae53
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
@@ -0,0 +1,637 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+import org.eclipse.swt.internal.Library;
+
+public class OS {
+ static {
+ Library.loadLibrary("swt-pi");
+ }
+
+
+ public static final int GDK_NONE = 0;
+
+ /* For Display.KeyTable: */
+ /* Keyboard and mouse masks */
+ public static final int GDK_Alt_L = 0xFFE9;
+ public static final int GDK_Alt_R = 0xFFEA;
+ public static final int GDK_Shift_L = 0xFFE1;
+ public static final int GDK_Shift_R = 0xFFE2;
+ public static final int GDK_Control_L = 0xFFE3;
+ public static final int GDK_Control_R = 0xFFE4;
+ /* Non-numeric keypad constants */
+ public static final int GDK_Up = 0xFF52;
+ public static final int GDK_Down = 0xFF54;
+ public static final int GDK_Left = 0xFF51;
+ public static final int GDK_Right = 0xFF53;
+ public static final int GDK_Page_Up = 0xFF55;
+ public static final int GDK_Page_Down = 0xFF56;
+ public static final int GDK_Home = 0xFF50;
+ public static final int GDK_End = 0xFF57;
+ public static final int GDK_Insert = 0xFF63;
+ public static final int GDK_Delete = 0xFFFF;
+ /* Functions Keys */
+ public static final int GDK_F1 = 0xFFBE;
+ public static final int GDK_F2 = 0xFFBF;
+ public static final int GDK_F3 = 0xFFC0;
+ public static final int GDK_F4 = 0xFFC1;
+ public static final int GDK_F5 = 0xFFC2;
+ public static final int GDK_F6 = 0xFFC3;
+ public static final int GDK_F7 = 0xFFC4;
+ public static final int GDK_F8 = 0xFFC5;
+ public static final int GDK_F9 = 0xFFC6;
+ public static final int GDK_F10 = 0xFFC7;
+ public static final int GDK_F11 = 0xFFC8;
+ public static final int GDK_F12 = 0xFFC9;
+ public static final int GDK_Return = 0xFF0D;
+ /* Numeric Keypad */
+ public static final int GDK_KP_Add = 0xFFAB;
+ public static final int GDK_KP_Subtract = 0xFFAD;
+ public static final int GDK_KP_Multiply = 0xFFAA;
+ public static final int GDK_KP_Divide = 0xFFAF;
+ public static final int GDK_KP_Enter = 0xFF8D;
+ public static final int GDK_KP_Decimal = 0xFFAE;
+ public static final int GDK_KP_0 = 0xFFB0;
+ public static final int GDK_KP_1 = 0xFFB1;
+ public static final int GDK_KP_2 = 0xFFB2;
+ public static final int GDK_KP_3 = 0xFFB3;
+ public static final int GDK_KP_4 = 0xFFB4;
+ public static final int GDK_KP_5 = 0xFFB5;
+ public static final int GDK_KP_6 = 0xFFB6;
+ public static final int GDK_KP_7 = 0xFFB7;
+ public static final int GDK_KP_8 = 0xFFB8;
+ public static final int GDK_KP_9 = 0xFFB9;
+
+ public static final int GDK_FONT_FONT = 0;
+ public static final int GDK_FONT_FONTSET = 1;
+ public static final int GDK_COPY = 0;
+ public static final int GDK_INVERT = 1;
+ public static final int GDK_XOR = 2;
+ public static final int GDK_STIPPLED = 2;
+ public static final int GDK_LINE_SOLID = 0;
+ public static final int GDK_LINE_ON_OFF_DASH = 1;
+ public static final int GDK_LINE_DOUBLE_DASH = 2;
+ public static final int GDK_CAP_BUTT = 1;
+ public static final int GDK_JOIN_MITER = 0;
+ public static final int GDK_X_CURSOR = 0;
+ public static final int GDK_BOTTOM_LEFT_CORNER = 12;
+ public static final int GDK_BOTTOM_RIGHT_CORNER = 14;
+ public static final int GDK_BOTTOM_SIDE = 16;
+ public static final int GDK_CROSS = 30;
+ public static final int GDK_DIAMOND_CROSS = 36;
+ public static final int GDK_DOUBLE_ARROW = 42;
+ public static final int GDK_HAND1 = 58;
+ public static final int GDK_LEFT_PTR = 68;
+ public static final int GDK_LEFT_SIDE = 70;
+ public static final int GDK_QUESTION_ARROW = 92;
+ public static final int GDK_RIGHT_PTR = 94;
+ public static final int GDK_RIGHT_SIDE = 96;
+ public static final int GDK_SB_H_DOUBLE_ARROW = 108;
+ public static final int GDK_SB_UP_ARROW = 114;
+ public static final int GDK_SB_V_DOUBLE_ARROW = 116;
+ public static final int GDK_SIZING = 120;
+ public static final int GDK_TOP_LEFT_CORNER = 134;
+ public static final int GDK_TOP_RIGHT_CORNER = 136;
+ public static final int GDK_TOP_SIDE = 138;
+ public static final int GDK_WATCH = 150;
+ public static final int GDK_XTERM = 152;
+ public static final int GDK_CURSOR_IS_PIXMAP = -1;
+ public static final int GDK_MOTION_NOTIFY = 3;
+ public static final int GDK_BUTTON_PRESS = 4;
+ public static final int GDK_2BUTTON_PRESS = 5;
+ public static final int GDK_3BUTTON_PRESS = 6;
+ public static final int GDK_BUTTON_RELEASE = 7;
+ public static final int GDK_KEY_PRESS = 8;
+ public static final int GDK_KEY_RELEASE = 9;
+ public static final int GDK_NO_EXPOSE = 30;
+ public static final int GDK_EXPOSURE_MASK = 1 << 1;
+ public static final int GDK_POINTER_MOTION_MASK = 1 << 2;
+ public static final int GDK_POINTER_MOTION_HINT_MASK = 1 << 3;
+ public static final int GDK_BUTTON_MOTION_MASK = 1 << 4;
+ public static final int GDK_BUTTON1_MOTION_MASK = 1 << 5;
+ public static final int GDK_BUTTON2_MOTION_MASK = 1 << 6;
+ public static final int GDK_BUTTON3_MOTION_MASK = 1 << 7;
+ public static final int GDK_BUTTON_PRESS_MASK = 1 << 8;
+ public static final int GDK_BUTTON_RELEASE_MASK = 1 << 9;
+ public static final int GDK_KEY_PRESS_MASK = 1 << 10;
+ public static final int GDK_KEY_RELEASE_MASK = 1 << 11;
+ public static final int GDK_ENTER_NOTIFY_MASK = 1 << 12;
+ public static final int GDK_LEAVE_NOTIFY_MASK = 1 << 13;
+ public static final int GDK_FOCUS_CHANGE_MASK = 1 << 14;
+ public static final int GDK_SHIFT_MASK = 1 << 0;
+ public static final int GDK_LOCK_MASK = 1 << 1;
+ public static final int GDK_CONTROL_MASK = 1 << 2;
+ public static final int GDK_MOD1_MASK = 1 << 3;
+ public static final int GDK_BUTTON1_MASK = 1 << 8;
+ public static final int GDK_BUTTON2_MASK = 1 << 9;
+ public static final int GDK_BUTTON3_MASK = 1 << 10;
+ public static final int GDK_RELEASE_MASK = 1 << 13;
+ public static final int GDK_MODIFIER_MASK = 0x3fff;
+ public static final int GDK_INCLUDE_INFERIORS = 1;
+ public static final int GDK_DECOR_ALL = 1 << 0;
+ public static final int GDK_DECOR_BORDER = 1 << 1;
+ public static final int GDK_DECOR_RESIZEH = 1 << 2;
+ public static final int GDK_DECOR_TITLE = 1 << 3;
+ public static final int GDK_DECOR_MENU = 1 << 4;
+ public static final int GDK_DECOR_MINIMIZE = 1 << 5;
+ public static final int GDK_DECOR_MAXIMIZE = 1 << 6;
+ public static final int GDK_OVERLAP_RECTANGLE_IN = 0;
+ public static final int GDK_OVERLAP_RECTANGLE_OUT = 1;
+ public static final int GDK_OVERLAP_RECTANGLE_PART = 2;
+ public static final int GDK_RGB_DITHER_NONE = 0;
+ public static final int GDK_RGB_DITHER_NORMAL = 1;
+ public static final int GDK_RGB_DITHER_MAX = 2;
+ public static final int GTK_ARROW_UP = 0;
+ public static final int GTK_ARROW_DOWN = 1;
+ public static final int GTK_ARROW_LEFT = 2;
+ public static final int GTK_ARROW_RIGHT = 3;
+ public static final int GTK_JUSTIFY_LEFT = 0;
+ public static final int GTK_JUSTIFY_RIGHT = 1;
+ public static final int GTK_JUSTIFY_CENTER = 2;
+ public static final int GTK_JUSTIFY_FILL = 3;
+ public static final int GTK_ORIENTATION_HORIZONTAL = 0;
+ public static final int GTK_ORIENTATION_VERTICAL = 1;
+ public static final int GTK_POLICY_ALWAYS = 0;
+ public static final int GTK_POLICY_AUTOMATIC = 1; // can't fix now
+ public static final int GTK_POLICY_NEVER = 2;
+ public static final int GTK_RELIEF_NORMAL = 0;
+// public static final int GTK_RELIEF_HALF = 1;
+ public static final int GTK_RELIEF_NONE = 2;
+ public static final int GTK_SELECTION_SINGLE = 0; // extra code in Table, can't fix now
+ public static final int GTK_SELECTION_BROWSE = 1;
+ public static final int GTK_SELECTION_MULTIPLE = 2;
+ public static final int GTK_SELECTION_EXTENDED = 3;
+ public static final int GTK_SHADOW_NONE = 0;
+ public static final int GTK_SHADOW_IN = 1;
+ public static final int GTK_SHADOW_OUT = 2;
+ public static final int GTK_SHADOW_ETCHED_IN = 3;
+ public static final int GTK_SHADOW_ETCHED_OUT = 4;
+ public static final int GTK_STATE_NORMAL = 0;
+ public static final int GTK_STATE_ACTIVE = 1;
+ public static final int GTK_STATE_PRELIGHT = 2;
+ public static final int GTK_STATE_SELECTED = 3;
+ public static final int GTK_STATE_INSENSITIVE = 4;
+ public static final int GTK_TOP_BOTTOM = 0;
+ public static final int GTK_LEFT_RIGHT = 1;
+ public static final int GTK_TOOLBAR_ICONS = 0;
+ public static final int GTK_TOOLBAR_TEXT = 1;
+ public static final int GTK_TOOLBAR_BOTH = 2;
+ public static final int GTK_VISIBILITY_NONE = 0;
+ public static final int GTK_VISIBILITY_PARTIAL = 1;
+ public static final int GTK_VISIBILITY_FULL = 2;
+ public static final int GTK_WINDOW_TOPLEVEL = 0;
+ public static final int GTK_WINDOW_DIALOG = 1;
+ public static final int GTK_WINDOW_POPUP = 2;
+ public static final int GTK_ACCEL_VISIBLE = 1 << 0;
+ public static final int GTK_NO_WINDOW = 1 << 5;
+ public static final int GTK_MAPPED = 1 << 7;
+ public static final int GTK_VISIBLE = 1 << 8;
+ public static final int GTK_SENSITIVE = 1 << 9;
+ public static final int GTK_CAN_FOCUS = 1 << 11;
+ public static final int GTK_HAS_FOCUS = 1 << 12;
+ public static final int GTK_CLIST_SHOW_TITLES = 1 << 2;
+ public static final int GTK_PROGRESS_CONTINUOUS = 0;
+ public static final int GTK_PROGRESS_DISCRETE = 1;
+ public static final int GTK_PROGRESS_LEFT_TO_RIGHT = 0;
+ public static final int GTK_PROGRESS_RIGHT_TO_LEFT = 1;
+ public static final int GTK_PROGRESS_BOTTOM_TO_TOP = 2;
+ public static final int GTK_PROGRESS_TOP_TO_BOTTOM = 3;
+ public static final int GTK_TOOLBAR_CHILD_SPACE = 0;
+ public static final int GTK_TOOLBAR_CHILD_BUTTON = 1;
+ public static final int GTK_TOOLBAR_CHILD_TOGGLEBUTTON = 2;
+ public static final int GTK_TOOLBAR_CHILD_RADIOBUTTON = 3;
+ public static final int GTK_TOOLBAR_CHILD_WIDGET = 4;
+
+public static final native int GTK_WIDGET_FLAGS(int wid);
+public static final native void GTK_WIDGET_SET_FLAGS(int wid,int flag);
+public static final native void GTK_WIDGET_UNSET_FLAGS(int wid,int flag);
+public static final native boolean GTK_WIDGET_NO_WINDOW(int wid);
+public static final native void gdk_rgb_init();
+public static final native boolean GTK_WIDGET_SENSITIVE(int wid);
+public static final native boolean GTK_WIDGET_IS_SENSITIVE(int wid);
+public static final native void memmove(GtkStyleClass dest, int src, int size);
+public static final native void gtk_signal_handler_block_by_data(int object, int data);
+public static final native void gtk_signal_handler_unblock_by_data(int object, int data);
+public static final native int gtk_object_get_data_by_id(int object, int data_id);
+public static final native void gtk_object_set_data_by_id(int object, int data_id, int data);
+public static final native int g_quark_from_string(byte [] string);
+public static final native void gtk_object_unref(int object);
+public static final native void gtk_object_destroy(int object);
+public static final native int GTK_WIDGET_TYPE(int wid);
+public static final native int gtk_label_get_type();
+
+public static final native void g_free(int mem);
+public static final native int g_get_home_dir();
+public static final native int g_list_length(int list);
+public static final native int g_list_nth(int list, int n);
+public static final native int g_list_nth_data(int list, int n);
+public static final native void g_list_free(int list);
+public static final native int g_malloc(int size);
+public static final native int g_list_append(int list, int data);
+public static final native int g_slist_length(int list);
+public static final native int g_slist_nth(int list, int n);
+public static final native int g_slist_nth_data(int list, int n);
+public static final native int g_strdup(byte[] str);
+public static final native int gdk_colormap_get_system();
+public static final native void gdk_colors_free(int colormap, int[] pixels, int npixels, int planes);
+public static final native boolean gdk_color_alloc(int colormap, GdkColor color);
+public static final native int gdk_cursor_new(int cursor_type);
+public static final native int gdk_bitmap_create_from_data(int window, byte[] data, int width, int height);
+public static final native int gdk_cursor_new_from_pixmap(int source, int mask, GdkColor fg, GdkColor bg, int x, int y);
+public static final native void gdk_cursor_destroy(int cursor);
+public static final native int gdk_font_load(byte[] font_name);
+public static final native int gdk_font_ref(int font);
+public static final native void gdk_font_unref(int font);
+public static final native boolean gdk_font_equal(int fonta, int fontb);
+public static final native int gdk_char_width(int font, byte character);
+public static final native void gdk_gc_get_values(int gc, GdkGCValues values);
+public static final native void gdk_gc_set_font(int gc, int font);
+public static final native void gdk_gc_set_foreground(int gc, GdkColor color);
+public static final native void gdk_gc_set_background(int gc, GdkColor color);
+public static final native void gdk_gc_set_clip_mask(int gc, int mask);
+public static final native void gdk_gc_set_clip_rectangle(int gc, GdkRectangle rectangle);
+public static final native void gdk_gc_set_clip_region(int gc, int region);
+public static final native void gdk_gc_set_line_attributes(int gc, int line_width, int line_style, int cap_style, int join_style);
+public static final native void gdk_gc_set_dashes(int gc, int dash_offset, byte[] dash_list, int n);
+public static final native void gdk_gc_set_function(int gc, int function);
+public static final native void gdk_draw_line(int drawable, int gc, int x1, int y1, int x2, int y2);
+public static final native void gdk_draw_arc(int drawable, int gc, int filled, int x, int y, int width, int height, int angle1, int angle2);
+public static final native void gdk_draw_rectangle(int drawable, int gc, int filled, int x, int y, int width, int height);
+public static final native void gdk_draw_pixmap(int drawable, int gc, int src, int xsrc, int ysrc, int xdest, int ydest, int width, int height);
+public static final native void gdk_draw_lines(int drawable, int gc, short[] points, int npoints);
+public static final native void gdk_draw_polygon(int drawable, int gc, int filled, short[] points, int npoints);
+public static final native void gdk_draw_string(int drawable, int font, int gc, int x, int y, byte[] string);
+public static final native void gdk_gc_unref(int gc);
+public static final native int gdk_gc_new(int window);
+public static final native void gdk_gc_destroy(int gc);
+public static final native void gdk_bitmap_unref(int pixmap);
+public static final native boolean gdk_color_white(int colormap, GdkColor color);
+public static final native int gdk_image_get(int window, int x, int y, int width, int height);
+public static final native int gdk_image_get_pixel(int image, int x, int y);
+public static final native void gdk_gc_set_exposures(int gc, boolean exposures);
+public static final native int gdk_event_get_graphics_expose(int window);
+public static final native void gdk_event_free(int event);
+public static final native void gdk_flush();
+public static final native void gdk_beep();
+public static final native void gdk_color_free(GdkColor color);
+public static final native int GDK_ROOT_PARENT();
+public static final native void gdk_gc_set_stipple(int gc, int stipple);
+public static final native void gdk_gc_set_subwindow(int gc, int mode);
+public static final native void gdk_gc_set_fill(int gc, int fill);
+public static final native int gdk_atom_intern(byte[] atom_name, int only_if_exists);
+public static final native int gdk_event_get();
+public static final native void gdk_pixmap_unref(int pixmap);
+public static final native void gdk_region_get_clipbox(int region, GdkRectangle rectangle);
+public static final native int gdk_region_new();
+public static final native int gdk_region_union_with_rect(int region, GdkRectangle rect);
+public static final native int gdk_regions_subtract(int source1, int source2);
+public static final native int gdk_regions_union(int source1, int source2);
+public static final native void gdk_region_destroy(int region);
+public static final native int gdk_pixmap_new(int window, int width, int height, int depth);
+public static final native boolean gdk_region_point_in(int region, int x, int y);
+public static final native boolean gdk_region_empty(int region);
+public static final native boolean gdk_region_equal(int region1, int region2);
+public static final native int gdk_screen_height();
+public static final native int gdk_screen_width();
+public static final native int gdk_region_rect_in(int region, GdkRectangle rect);
+public static final native int gdk_visual_get_system();
+public static final native void gdk_string_extents(int font, byte[] string, int[] lbearing, int[] rbearing, int[] width, int[] ascent, int[] descent);
+public static final native int gdk_string_height(int font, byte[] string);
+public static final native int gdk_string_width(int font, byte[] string);
+public static final native void gdk_window_copy_area(int window, int gc, int x, int y, int source_window, int source_x, int source_y, int width, int height);
+public static final native void gdk_window_clear_area(int window, int x, int y, int width, int height);
+public static final native void gdk_window_clear_area_e(int window, int x, int y, int width, int height);
+public static final native int gdk_window_at_pointer(int[] win_x, int[] win_y);
+public static final native int gdk_time_get();
+public static final native int gdk_screen_width_mm();
+public static final native void gdk_window_get_geometry(int window, int[] x, int[] y, int[] width, int[] height, int[] depth);
+public static final native void gdk_window_raise(int window);
+public static final native void gdk_window_lower(int window);
+public static final native int gdk_window_get_origin(int window, int[] x, int[] y);
+public static final native int gdk_window_get_pointer(int window, int[] x, int[] y, int mask);
+public static final native void gdk_window_set_cursor(int window, int cursor);
+public static final native void gdk_window_set_icon(int window, int icon_window, int pixmap, int mask);
+public static final native void gdk_window_set_user_data(int window, int user_data);
+public static final native void gdk_window_get_user_data(int window, int[] data);
+public static final native void gdk_window_set_decorations(int window, int decorations);
+public static final native int gtk_adjustment_new(float value, float lower, float upper, float step_increment, float page_increment, float page_size);
+public static final native void gtk_adjustment_changed(int adjustment);
+public static final native void gtk_adjustment_set_value(int adjustment, float value);
+public static final native void gtk_adjustment_value_changed(int adjustment);
+public static final native int gtk_accel_group_new();
+public static final native void gtk_accel_group_unref(int accel_group);
+public static final native int gtk_arrow_new(int arrow_type, int shadow_type);
+public static final native void gtk_arrow_set(int arrow, int arrow_type, int shadow_type);
+public static final native void gtk_box_pack_start(int box, int child, boolean expand, boolean fill, int padding);
+public static final native void gtk_box_pack_end(int box, int child, boolean expand, boolean fill, int padding);
+public static final native int gtk_button_new();
+public static final native int gtk_check_button_new();
+public static final native int gtk_check_version(int required_major, int required_minor, int required_micro);
+public static final native int gtk_clist_append(int clist, int[] text);
+public static final native void gtk_clist_clear(int clist);
+public static final native int gtk_check_menu_item_new_with_label(byte[] label);
+public static final native int gtk_button_new_with_label(byte[] label);
+public static final native void gtk_clist_column_title_passive(int clist, int column);
+public static final native void gtk_clist_column_titles_show(int clist);
+public static final native void gtk_clist_column_titles_hide(int clist);
+public static final native void gtk_clist_freeze(int clist);
+public static final native void gtk_check_menu_item_set_show_toggle(int menu_item, boolean always);
+public static final native void gtk_clist_column_titles_passive(int clist);
+public static final native void gtk_check_menu_item_set_active(int check_menu_item, boolean is_active);
+public static final native int gtk_clist_insert(int clist, int row, int[] text);
+public static final native int gtk_clist_new(int columns);
+public static final native void gtk_clist_set_selection_mode(int clist, int mode);
+public static final native int gtk_clist_get_text(int clist, int row, int column, int[] text);
+public static final native void gtk_clist_remove(int clist, int row);
+public static final native void gtk_clist_select_row(int clist, int row, int column);
+public static final native void gtk_clist_select_all(int clist);
+public static final native void gtk_clist_moveto(int clist, int row, int column, float row_align, float col_align);
+public static final native void gtk_clist_set_column_title(int clist, int column, byte[] title);
+public static final native void gtk_clist_set_column_visibility(int clist, int column, boolean visible);
+public static final native int gtk_clist_get_selection_info(int clist, int x, int y, int[] row, int[] column);
+public static final native void gtk_clist_set_column_justification(int clist, int column, int justification);
+public static final native void gtk_clist_set_column_resizeable(int clist, int column, boolean resizeable);
+public static final native void gtk_clist_set_column_width(int clist, int column, int width);
+public static final native void gtk_clist_set_pixtext(int clist, int row, int column, byte[] text, byte spacing, int pixmap, int mask);
+public static final native void gtk_clist_set_pixmap(int clist, int row, int column, int pixmap, int mask);
+public static final native void gtk_container_add(int container, int widget);
+public static final native int gtk_container_children(int container);
+public static final native int gtk_color_selection_dialog_new(byte[] title);
+public static final native void gtk_color_selection_get_color(int colorsel, double[] color);
+public static final native void gtk_color_selection_set_color(int colorsel, double[] color);
+public static final native int gtk_combo_new();
+public static final native void gtk_combo_set_popdown_strings(int combo, int strings);
+public static final native void gtk_clist_set_shadow_type(int clist, int type);
+public static final native void gtk_clist_unselect_row(int clist, int row, int column);
+public static final native void gtk_clist_unselect_all(int clist);
+public static final native void gtk_clist_set_text(int clist, int row, int column, byte[] text);
+public static final native void gtk_clist_thaw(int clist);
+public static final native void gtk_container_remove(int container, int widget);
+public static final native int gtk_ctree_new(int columns, int tree_column);
+public static final native int gtk_ctree_insert_node(int ctree, int parent, int sibling, int[] text, byte spacing, int pixmap_closed, int mask_closed, int pixmap_opened, int mask_opened, boolean is_leaf, boolean expanded);
+public static final native int gtk_ctree_node_get_row_data(int ctree, int node);
+public static final native void gtk_ctree_expand(int ctree, int node);
+public static final native boolean gtk_ctree_is_hot_spot(int ctree, int x, int y);
+public static final native boolean gtk_ctree_is_viewable(int ctree, int node);
+public static final native int gtk_ctree_node_get_row_style(int ctree, int node);
+public static final native void gtk_ctree_collapse(int ctree, int node);
+public static final native int gtk_ctree_get_node_info(int ctree, int node, int[] text, byte[] spacing, int[] pixmap_closed, int[] mask_closed, int[] pixmap_opened, int[] mask_opened, boolean[] is_leaf, boolean[] expanded);
+public static final native void gtk_ctree_node_set_row_data(int ctree, int node, int data);
+public static final native void gtk_ctree_select(int ctree, int node);
+public static final native int gtk_ctree_node_nth(int ctree, int row);
+public static final native void gtk_ctree_select_recursive(int ctree, int node);
+public static final native void gtk_ctree_unselect_recursive(int ctree, int node);
+public static final native void gtk_ctree_post_recursive(int ctree, int node, int func, int data);
+public static final native void gtk_ctree_remove_node(int ctree, int node);
+public static final native int gtk_ctree_node_is_visible(int ctree, int node);
+public static final native void gtk_ctree_node_moveto(int ctree, int node, int column, float row_align, float col_align);
+public static final native void gtk_ctree_set_node_info(int ctree, int node, byte[] text, byte spacing, int pixmap_closed, int mask_closed, int pixmap_opened, int mask_opened, boolean is_leaf, boolean expanded);
+public static final native int gtk_drawing_area_new();
+public static final native int gtk_dialog_new();
+public static final native int gtk_event_box_new();
+public static final native int gtk_editable_get_position(int editable);
+public static final native void gtk_editable_set_position(int editable, int position);
+public static final native int gtk_fixed_new();
+public static final native void gtk_entry_set_editable(int entry, boolean editable);
+public static final native void gtk_fixed_put(int fixed, int widget, short x, short y);
+public static final native int gtk_entry_get_text(int entry);
+public static final native void gtk_entry_set_text(int entry, byte[] text);
+public static final native void gtk_editable_select_region(int editable, int start, int end);
+public static final native void gtk_editable_delete_text(int editable, int start_pos, int end_pos);
+public static final native void gtk_editable_insert_text(int editable, byte[] new_text, int new_text_length, int[] position);
+public static final native void gtk_drawing_area_size(int darea, int width, int height);
+public static final native int gtk_events_pending();
+public static final native int gtk_file_selection_get_filename(int filesel);
+public static final native int gtk_file_selection_new(byte[] title);
+public static final native void gtk_file_selection_set_filename(int filesel, byte[] filename);
+public static final native void gtk_file_selection_complete(int filesel, byte[] pattern);
+public static final native int gtk_font_selection_dialog_get_font_name(int fsd);
+public static final native int gtk_font_selection_dialog_new(byte[] title);
+public static final native boolean gtk_font_selection_dialog_set_font_name(int fsd, byte[] fontname);
+public static final native void gtk_editable_set_editable(int editable, boolean is_editable);
+public static final native boolean gtk_font_selection_set_font_name(int fontsel, byte[] fontname);
+public static final native int gtk_entry_new();
+public static final native void gtk_entry_append_text(int entry, byte[] text);
+public static final native void gtk_editable_delete_selection(int editable);
+public static final native int gtk_editable_get_chars(int editable, int start_pos, int end_pos);
+public static final native void gtk_entry_set_visibility(int entry, boolean visible);
+public static final native void gtk_entry_set_max_length(int entry, short max);
+public static final native void gtk_fixed_move(int fixed, int widget, short x, short y);
+public static final native boolean gtk_init_check(int[] argc, int[] argv);
+public static final native int gtk_frame_new(byte[] label);
+public static final native void gtk_frame_set_shadow_type(int frame, int type);
+public static final native void gtk_frame_set_label(int frame, byte[] label);
+public static final native int gtk_hseparator_new();
+public static final native int gtk_hbox_new(boolean homogeneous, int spacing);
+public static final native void gtk_grab_add(int widget);
+public static final native int gtk_grab_get_current();
+public static final native void gtk_grab_remove(int widget);
+public static final native int gtk_hscale_new(int adjustment);
+public static final native int gtk_hscrollbar_new(int adjustment);
+public static final native void gtk_label_set_justify(int label, int jtype);
+public static final native int gtk_label_new(byte[] str);
+public static final native void gtk_label_set_pattern(int label, byte[] pattern);
+public static final native void gtk_main_quit();
+public static final native void gtk_main();
+public static final native void gtk_list_clear_items(int list, int start, int end);
+public static final native void gtk_list_select_item(int list, int item);
+public static final native int gtk_main_iteration();
+public static final native void gtk_label_set_line_wrap(int label, boolean wrap);
+public static final native int gtk_label_parse_uline(int label, byte[] string);
+public static final native void gtk_label_set_text(int label, byte[] str);
+public static final native void gtk_misc_set_alignment(int misc, float xalign, float yalign);
+public static final native int gtk_menu_bar_new();
+public static final native int gtk_menu_new();
+public static final native void gtk_menu_popdown(int menu);
+public static final native void gtk_menu_popup(int menu, int parent_menu_shell, int parent_menu_item, int func, int data, int button, int activate_time);
+public static final native int gtk_menu_item_new();
+public static final native int gtk_menu_item_new_with_label(byte[] label);
+public static final native void gtk_menu_bar_insert(int menu_bar, int child, int position);
+public static final native void gtk_menu_insert(int menu, int child, int position);
+public static final native void gtk_menu_item_set_submenu(int menu_item, int submenu);
+public static final native void gtk_menu_item_remove_submenu(int menu_item);
+public static final native int gtk_notebook_new();
+public static final native void gtk_notebook_append_page(int notebook, int child, int tab_label);
+public static final native int gtk_notebook_get_current_page(int notebook);
+public static final native void gtk_object_ref(int object);
+public static final native void gtk_notebook_set_show_tabs(int notebook, boolean show_tabs);
+public static final native void gtk_notebook_remove_page(int notebook, int page_num);
+public static final native void gtk_notebook_set_page(int notebook, int page_num);
+public static final native void gtk_object_set_user_data(int object, int data);
+public static final native int gtk_object_get_user_data(int object);
+public static final native int gtk_pixmap_new(int pixmap, int mask);
+public static final native int gtk_progress_bar_new();
+public static final native void gtk_progress_bar_set_orientation(int pbar, int orientation);
+public static final native void gtk_progress_bar_set_bar_style(int pbar, int style);
+public static final native void gtk_progress_configure(int progress, float value, float min, float max);
+public static final native void gtk_pixmap_set(int pixmap, int val, int mask);
+public static final native int gtk_radio_button_new(int group);
+public static final native int gtk_radio_button_group(int radio_button);
+public static final native int gtk_radio_menu_item_new_with_label(int group, byte[] label);
+public static final native int gtk_range_get_adjustment(int range);
+public static final native int gtk_scrolled_window_new(int hadjustment, int vadjustment);
+public static final native void gtk_scale_set_digits(int scale, int digits);
+public static final native void gtk_scale_set_draw_value(int scale, boolean draw_value);
+public static final native void gtk_scale_set_value_pos(int scale, int pos);
+public static final native int gtk_scrolled_window_get_hadjustment(int scrolled_window);
+public static final native void gtk_scrolled_window_set_policy(int scrolled_window, int hscrollbar_policy, int vscrollbar_policy);
+public static final native int gtk_scrolled_window_get_vadjustment(int scrolled_window);
+public static final native int gtk_selection_convert(int widget, int selection, int target, int time);
+public static final native int gtk_signal_connect(int object, byte[] name, int func, int func_data);
+public static final native int gtk_selection_owner_set(int widget, int selection, int time);
+public static final native void gtk_signal_emit_stop_by_name(int object, byte[] name);
+public static final native void gtk_signal_handler_block_by_func(int object, int func, int data);
+public static final native void gtk_signal_handler_unblock_by_func(int object, int func, int data);
+public static final native int gtk_signal_connect_after(int object, byte[] name, int func, int func_data);
+public static final native int gtk_style_copy(int style);
+public static final native void gtk_style_unref(int style);
+public static final native int gtk_toggle_button_new();
+public static final native void gtk_toggle_button_set_active(int toggle_button, boolean is_active);
+public static final native boolean gtk_toggle_button_get_active(int toggle_button);
+public static final native int gtk_timeout_add(int interval, int function, int data);
+public static final native void gtk_timeout_remove(int timeout_handler_id);
+public static final native int gtk_text_new(int hadj, int vadj);
+public static final native void gtk_text_set_word_wrap(int text, int word_wrap);
+public static final native int gtk_text_get_length(int text);
+public static final native int gtk_toolbar_new(int orientation, int style);
+public static final native void gtk_toolbar_set_button_relief(int toolbar, int relief);
+public static final native void gtk_toolbar_insert_widget(int toolbar, int widget, byte[] tooltip_text, byte[] tooltip_private_text, int position);
+public static final native void gtk_toolbar_set_orientation(int toolbar, int orientation);
+public static final native int gtk_toolbar_insert_element(int toolbar, int type, int widget, byte[] text, byte[] tooltip_text, byte[] tooltip_private_text, int icon, int callback, int user_data, int position);
+public static final native int gtk_tooltips_new();
+public static final native int gtk_vseparator_new();
+public static final native int gtk_vbox_new(boolean homogeneous, int spacing);
+public static final native int gtk_vscale_new(int adjustment);
+public static final native int gtk_vscrollbar_new(int adjustment);
+public static final native void gtk_tooltips_set_tip(int tooltips, int widget, byte[] tip_text, byte[] tip_private);
+public static final native int gtk_widget_get_default_style();
+public static final native void gtk_widget_add_events(int widget, int events);
+public static final native void gtk_widget_destroy(int widget);
+public static final native int gtk_widget_event(int widget, int event);
+public static final native void gtk_widget_hide(int widget);
+public static final native void gtk_widget_grab_focus(int widget);
+public static final native int gtk_widget_get_style(int widget);
+public static final native void gtk_widget_add_accelerator(int widget, byte[] accel_signal, int accel_group, int accel_key, int accel_mods, int accel_flags);
+public static final native void gtk_widget_ensure_style(int widget);
+public static final native void gtk_widget_show(int widget);
+public static final native void gtk_widget_realize(int widget);
+static int malloc(String name) {
+ int length = name.length();
+ char [] unicode = new char [length];
+ name.getChars (0, length, unicode, 0);
+ byte[] buffer = new byte [length + 1];
+ for (int i = 0; i < length; i++) {
+ buffer[i] = (byte) unicode[i];
+ }
+ return OS.g_strdup (buffer);
+}
+public static final native void gtk_widget_show_now(int widget);
+public static final native void gtk_widget_queue_draw(int widget);
+public static final native void gtk_widget_set_style(int widget, int style);
+public static final native void gtk_widget_set_sensitive(int widget, boolean sensitive);
+public static final native void gtk_widget_set_state(int widget, int state);
+public static final native int gtk_window_new(int type);
+public static final native void gtk_widget_size_request(int widget, GtkRequisition requisition);
+public static final native void gtk_widget_set_uposition(int widget, int x, int y);
+public static final native void gtk_widget_set_usize(int widget, int width, int height);
+public static final native void gtk_widget_remove_accelerator(int widget, int accel_group, int accel_key, int accel_mods);
+public static final native void gtk_widget_set_parent(int widget, int parent);
+public static final native void gtk_window_add_accel_group(int window, int accel_group);
+public static final native void gtk_window_set_policy(int window, int allow_shrink, int allow_grow, int auto_shrink);
+public static final native void gtk_window_set_title(int window, byte[] title);
+public static final native void gtk_widget_reparent(int widget, int new_parent);
+public static final native void gtk_widget_size_allocate(int widget, GtkAllocation allocation);
+public static final native int XListFonts(byte[] pattern, int maxFonts, int[] pnum_fonts);
+public static final native void memmove(int[] dest, int src, int size);
+public static final native int strlen (int str);
+
+/* NEW MEMMOVES - doesn't work because of inheritance of natives */
+public static final native void memmove(byte[] dest, int src, int size);
+public static final native void memmove(int dest, GtkStyle src, int size);
+public static final native void memmove(GdkFont dest, int src, int size);
+public static final native void memmove(GtkStyle dest, int src, int size);
+public static final native void memmove(int[] dest, byte[] src, int size);
+public static final native void memmove(int dest, byte[] src, int size);
+public static final native void memmove(GdkColor dest, int src, int size);
+public static final native void memmove(GdkEventButton dest, int src, int size);
+public static final native void memmove(GdkEventExpose dest, int src, int size);
+public static final native void memmove(GdkEventKey dest, int src, int size);
+public static final native void memmove(GdkEventMotion dest, int src, int size);
+public static final native void memmove(int dest, int[] src, int size);
+public static final native void memmove(GdkVisual dest, int src, int size);
+public static final native void memmove(GtkAdjustment dest, int src, int size);
+public static final native void memmove(GtkBin dest, int src, int size);
+public static final native void memmove(GtkCList dest, int src, int size);
+public static final native void memmove(GtkCombo dest, int src, int size);
+public static final native void memmove(GtkContainer dest, int src, int size);
+public static final native void memmove(GtkCTreeRow dest, int src, int size);
+public static final native void memmove(GtkEditable dest, int src, int size);
+public static final native void memmove(GtkObject dest, int src, int size);
+public static final native void memmove(GtkWidget dest, int src, int size);
+public static final native void memmove(int dest, GtkAdjustment src, int size);
+public static final native void memmove(int dest, GtkBin src, int size);
+public static final native void memmove(int dest, GtkCListColumn src, int size);
+public static final native void memmove(GtkCListRow dest, int src, int size);
+public static final native void memmove(GtkCListColumn dest, int src, int size);
+public static final native void memmove(int dest, GtkEditable src, int size);
+public static final native void memmove(int dest, GtkText src, int size);
+public static final native void memmove(int dest, GtkObject src, int size);
+
+/* OLD MEMMOVES - these need to be pruned */
+public static final native void memmove(int dest, GdkColor src, int size);
+public static final native void memmove(int dest, GdkEventButton src, int size);
+public static final native void memmove(int dest, GdkEventExpose src, int size);
+public static final native void memmove(int dest, GdkEventKey src, int size);
+public static final native void memmove(int dest, GdkEventMotion src, int size);
+public static final native void memmove(int dest, GdkGCValues src, int size);
+public static final native void memmove(int dest, GdkRectangle src, int size);
+public static final native void memmove(int dest, GdkVisual src, int size);
+public static final native void memmove(int dest, GtkAllocation src, int size);
+//public static final native void memmove(int dest, GtkArg src, int size);
+public static final native void memmove(int dest, GtkBox src, int size);
+public static final native void memmove(int dest, GtkCList src, int size);
+public static final native void memmove(int dest, GtkCListRow src, int size);
+public static final native void memmove(int dest, GtkCTreeRow src, int size);
+public static final native void memmove(int dest, GtkCheckMenuItem src, int size);
+public static final native void memmove(int dest, GtkColorSelectionDialog src, int size);
+public static final native void memmove(int dest, GtkCombo src, int size);
+public static final native void memmove(int dest, GtkContainer src, int size);
+//public static final native void memmove(int dest, GtkData src, int size);
+public static final native void memmove(int dest, GtkFileSelection src, int size);
+public static final native void memmove(int dest, GtkFontSelectionDialog src, int size);
+public static final native void memmove(int dest, GtkHBox src, int size);
+public static final native void memmove(int dest, GtkMenuItem src, int size);
+public static final native void memmove(int dest, GtkRequisition src, int size);
+public static final native void memmove(int dest, GtkWidget src, int size);
+public static final native void memmove(int dest, GtkWindow src, int size);
+public static final native void memmove(int dest, GtkCTree src, int size);
+public static final native void memmove(GdkGCValues dest, int src, int size);
+public static final native void memmove(GdkRectangle dest, int src, int size);
+public static final native void memmove(GtkAllocation dest, int src, int size);
+//public static final native void memmove(GtkArg dest, int src, int size);
+public static final native void memmove(GtkBox dest, int src, int size);
+public static final native void memmove(GtkCheckMenuItem dest, int src, int size);
+public static final native void memmove(GtkColorSelectionDialog dest, int src, int size);
+//public static final native void memmove(GtkData dest, int src, int size);
+public static final native void memmove(GtkFrame dest, int src, int size);
+public static final native void memmove(GtkFileSelection dest, int src, int size);
+public static final native void memmove(GtkFontSelectionDialog dest, int src, int size);
+public static final native void memmove(GtkHBox dest, int src, int size);
+public static final native void memmove(GtkMenuItem dest, int src, int size);
+public static final native void memmove(GtkRequisition dest, int src, int size);
+public static final native void memmove(GtkText dest, int src, int size);
+public static final native void memmove(GtkWindow dest, int src, int size);
+public static final native void memmove(GtkCTree dest, int src, int size);
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/about.html b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/about.html
new file mode 100644
index 0000000..ee4dc99
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/about.html
@@ -0,0 +1,59 @@
+<html>
+<head>
+<title>About</title>
+<style type="text/css">
+p, table, td, th { font-family: arial, helvetica, geneva; font-size: 10pt}
+pre { font-family: "Courier New", Courier, mono; font-size: 10pt}
+h2 { font-family: arial, helvetica, geneva; font-size: 18pt; font-weight: bold ; line-height: 14px}
+code { font-family: "Courier New", Courier, mono; font-size: 10pt}
+sup { font-family: arial,helvetica,geneva; font-size: 10px}
+h3 { font-family: arial, helvetica, geneva; font-size: 14pt; font-weight: bold}
+li { font-family: arial, helvetica, geneva; font-size: 10pt}
+h1 { font-family: arial, helvetica, geneva; font-size: 28px; font-weight: bold}
+body { font-family: arial, helvetica, geneva; font-size: 10pt; clip: rect( ); margin-top: 5mm; margin-left: 3mm}
+</style>
+</head>
+<body>
+<body lang=EN-US link=blue vlink=purple>
+<table border=0 cellspacing=5 cellpadding=2 width="100%" >
+ <tr>
+ <td align=LEFT valign=TOP colspan="2" bgcolor="#0080C0"><b><font color="#FFFFFF" face="Arial,Helvetica">About This Plug-in Sub-directory</font></b></td>
+ </tr>
+ <tr>
+ <td>
+<p>4th December, 2001</p>
+<h3>License</h3>
+<p>All content in this plug-in sub-directory ("Content") is made available by Eclipse.org under the following terms and conditions:</p>
+
+<p>The following two files shall be defined as the SWT:</p>
+<ul>
+ <li>libswt-linux-2018.so</li>
+ <li>swt.jar</li>
+</ul>
+
+<p>A. The SWT is licensed to you under the terms and conditions of the <a href="http://www.eclipse.org/legal/cpl-v05.html">Common Public License Version 0.5</a> ("CPL").
+For the purposes of the CPL the term "Program" shall mean the SWT.</p>
+
+<p>B. All other files contained in this sub-directory shall be defined as the GTK+ Binding. The GTK+ Binding contains portions of GTK+ ("Library"). GTK+ is made available
+by The Free Software Foundation. Use of the Library is governed by the terms and conditions of the
+<a href="http://www.gnu.org/licenses/lgpl.html">GNU Lesser General Public License Version 2.1</a> ("LGPL"). Use of the GTK+ Binding on a standalone basis, is also governed
+by the terms and conditions of the LGPL. A copy of the LGPL is provided with the Content.</p>
+
+<p>C. In accordance with Section 6 of the LGPL, you may combine or link a "work that uses the Library" (e.g. the SWT) with the Library to produce a work
+containing portions of the Library (e.g. the GTK+ Binding) and distribute that work under the terms of your choice (e.g. the CPL) provided you comply with all
+other terms and conditions of Section 6 as well as other Sections of the LGPL. Please note, if you modify the GTK+ Binding such modifications shall be
+governed by the terms and conditions of the LGPL. Also note, the terms of the CPL permit you to modify the combined work and the source code of the combined
+work is provided for debugging purposes so there is no need to reverse engineer the combined work.</p>
+
+<p>If you wish to provide Contributions related to the SWT, such Contributions shall be made under the terms of the CPL. If you wish to make
+Contributions related to the GTK+ Binding such Contributions shall be made under the terms of the LGPL and the CPL (with respect to portions
+of the contribution for which you are the copyright holder).</p>
+</td></tr></table>
+</body>
+</html>
+
+
+
+
+
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/cpl-v05.html b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/cpl-v05.html
new file mode 100644
index 0000000..800c779
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/cpl-v05.html
@@ -0,0 +1,239 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<!-- saved from url=(0041)http://www.eclipse.org/legal/cpl-v05.html -->
+<HTML><HEAD><TITLE>Common Public License Version 0.5</TITLE>
+<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
+<META content="MSHTML 5.00.3315.2870" name=GENERATOR></HEAD>
+<BODY bgColor=#ffffff>
+<DIV align=center>
+<P>
+<TABLE border=0 cellPadding=10 cellSpacing=10 width="90%">
+ <TBODY>
+ <TR>
+ <TD vAlign=top width="75%"><FONT face="Arial, Helvetica, sans serif"
+ size=3>
+ <H1>Common Public License Version 0.5</H1><TT>
+ <P><FONT face="Courier New, Courier, mono">THE ACCOMPANYING PROGRAM IS
+ PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY
+ USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S
+ ACCEPTANCE OF THIS AGREEMENT. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><B>1. DEFINITIONS
+ </B></FONT></P>
+ <P><FONT face="Courier New, Courier, mono">"Contribution"
+means:</FONT></P>
+ <BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">a) in the case of the initial
+ Contributor, the initial code and documentation distributed under this
+ Agreement, and </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">b) in the case of each
+ subsequent Contributor:</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">i) changes to the Program,
+ and</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">ii) additions to the
+ Program;</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">where such changes and/or
+ additions to the Program originate from and are distributed by that
+ particular Contributor. A Contribution 'originates' from a Contributor
+ if it was added to the Program by such Contributor itself or anyone
+ acting on such Contributor's behalf. Contributions do not include
+ additions to the Program which: (i) are separate modules of software
+ distributed in conjunction with the Program under their own license
+ agreement, and (ii) are not derivative works of the
+ Program.</FONT></P></BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">"Contributor" means any person
+ or entity that distributes the Program. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">"Licensed Patents " mean patent
+ claims licensable by a Contributor which are necessarily infringed by the
+ use or sale of its Contribution alone or when combined with the
+ Program.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">"Program" means the
+ Contributions distributed in accordance with this Agreement. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">"Recipient" means anyone who
+ receives the Program under this Agreement, including all Contributors.
+ </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><B>2. GRANT OF
+ RIGHTS</B></FONT></P>
+ <BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">a) Subject to the terms of
+ this Agreement, each Contributor hereby grants Recipient a
+ non-exclusive, worldwide, royalty-free copyright license to reproduce,
+ prepare derivative works of, publicly display, publicly perform,
+ distribute and sublicense the Contribution of such Contributor, if any,
+ and such derivative works, in source code and object code
+ form.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">b) Subject to the terms of
+ this Agreement, each Contributor hereby grants Recipient a
+ non-exclusive, worldwide, royalty-free patent license under Licensed
+ Patents to make, use, sell, offer to sell, import and otherwise transfer
+ the Contribution of such Contributor, if any, in source code and object
+ code form. This patent license shall apply to the combination of the
+ Contribution and the Program if, at the time the Contribution is added
+ by the Contributor, such addition of the Contribution causes such
+ combination to be covered by the Licensed Patents. The patent license
+ shall not apply to any other combinations which include the
+ Contribution. No hardware per se is licensed hereunder.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">c) Recipient understands that
+ although each Contributor grants the licenses to its Contributions set
+ forth herein, no assurances are provided by any Contributor that the
+ Program does not infringe the patent or other intellectual property
+ rights of any other entity. Each Contributor disclaims any liability to
+ Recipient for claims brought by any other entity based on infringement
+ of intellectual property rights or otherwise. As a condition to
+ exercising the rights and licenses granted hereunder, each Recipient
+ hereby assumes sole responsibility to secure any other intellectual
+ property rights needed, if any. For example, if a third party patent
+ license is required to allow Recipient to distribute the Program, it is
+ Recipient's responsibility to acquire that license before distributing
+ the Program.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">d) Each Contributor
+ represents that to its knowledge it has sufficient copyright rights in
+ its Contribution, if any, to grant the copyright license set forth in
+ this Agreement.</FONT></P></BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>3.
+ REQUIREMENTS</STRONG> </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">A Contributor may choose to
+ distribute the Program in object code form under its own license
+ agreement, provided that: </FONT></P>
+ <BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">a) it complies with the terms
+ and conditions of this Agreement; and</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">b) its license
+ agreement:</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">i) effectively disclaims on
+ behalf of all Contributors all warranties and conditions, express and
+ implied, including warranties or conditions of title and
+ non-infringement, and implied warranties or conditions of
+ merchantability and fitness for a particular purpose; </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">ii) effectively excludes on
+ behalf of all Contributors all liability for damages, including direct,
+ indirect, special, incidental and consequential damages, such as lost
+ profits; </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">iii) states that any
+ provisions which differ from this Agreement are offered by that
+ Contributor alone and not by any other party; and </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">iv) states that source code
+ for the Program is available from such Contributor, and informs
+ licensees how to obtain it in a reasonable manner on or through a medium
+ customarily used for software exchange. </FONT></P></BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">When the Program is made
+ available in source code form:</FONT></P>
+ <BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">a) it must be made available
+ under this Agreement; and</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">b) a copy of this Agreement
+ must be included with each copy of the Program. </FONT></P></BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">Contributors may not remove or
+ alter any copyright notices contained within the Program.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">Each Contributor must identify
+ itself as the originator of its Contribution, if any, in a manner that
+ reasonably allows subsequent Recipients to identify the originator of the
+ Contribution. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>4. COMMERCIAL
+ DISTRIBUTION</STRONG> </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">Commercial distributors of
+ software may accept certain responsibilities with respect to end users,
+ business partners and the like. While this license is intended to
+ facilitate the commercial use of the Program, the Contributor who includes
+ the Program in a commercial product offering should do so in a manner
+ which does not create potential liability for other Contributors.
+ Therefore, if a Contributor includes the Program in a commercial product
+ offering, such Contributor ("Commercial Contributor") hereby agrees to
+ defend and indemnify every other Contributor ("Indemnified Contributor")
+ against any losses, damages and costs (collectively "Losses") arising from
+ claims, lawsuits and other legal actions brought by a third party against
+ the Indemnified Contributor to the extent caused by the acts or omissions
+ of such Commercial Contributor in connection with its distribution of the
+ Program in a commercial product offering. The obligations in this section
+ do not apply to any claims or Losses relating to any actual or alleged
+ intellectual property infringement. In order to qualify, an Indemnified
+ Contributor must: a) promptly notify the Commercial Contributor in writing
+ of such claim, and b) allow the Commercial Contributor to control, and
+ cooperate with the Commercial Contributor in, the defense and any related
+ settlement negotiations. The Indemnified Contributor may participate in
+ any such claim at its own expense. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">For example, a Contributor
+ might include the Program in a commercial product offering, Product X.
+ That Contributor is then a Commercial Contributor. If that Commercial
+ Contributor then makes performance claims, or offers warranties related to
+ Product X, those performance claims and warranties are such Commercial
+ Contributor's responsibility alone. Under this section, the Commercial
+ Contributor would have to defend claims against the other Contributors
+ related to those performance claims and warranties, and if a court
+ requires any other Contributor to pay any damages as a result, the
+ Commercial Contributor must pay those damages. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>5. NO
+ WARRANTY</STRONG></FONT></P>
+ <P><FONT face="Courier New, Courier, mono">EXCEPT AS EXPRESSLY SET FORTH
+ IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+ WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+ WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+ NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ Each Recipient is solely responsible for determining the appropriateness
+ of using and distributing the Program and assumes all risks associated
+ with its exercise of rights under this Agreement, including but not
+ limited to the risks and costs of program errors, compliance with
+ applicable laws, damage to or loss of data, programs or equipment, and
+ unavailability or interruption of operations. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>6. DISCLAIMER OF
+ LIABILITY </STRONG></FONT></P>
+ <P><FONT face="Courier New, Courier, mono">EXCEPT AS EXPRESSLY SET FORTH
+ IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY
+ LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY
+ RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>7.
+ GENERAL</STRONG></FONT></P>
+ <P><FONT face="Courier New, Courier, mono">If any provision of this
+ Agreement is invalid or unenforceable under applicable law, it shall not
+ affect the validity or enforceability of the remainder of the terms of
+ this Agreement, and without further action by the parties hereto, such
+ provision shall be reformed to the minimum extent necessary to make such
+ provision valid and enforceable. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">If Recipient institutes patent
+ litigation against a Contributor with respect to a patent applicable to
+ software (including a cross-claim or counterclaim in a lawsuit), then any
+ patent licenses granted by that Contributor to such Recipient under this
+ Agreement shall terminate as of the date such litigation is filed. In
+ addition, If Recipient institutes patent litigation against any entity
+ (including a cross-claim or counterclaim in a lawsuit) alleging that the
+ Program itself (excluding combinations of the Program with other software
+ or hardware) infringes such Recipient's patent(s), then such Recipient's
+ rights granted under Section 2(b) shall terminate as of the date such
+ litigation is filed.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">All Recipient's rights under
+ this Agreement shall terminate if it fails to comply with any of the
+ material terms or conditions of this Agreement and does not cure such
+ failure in a reasonable period of time after becoming aware of such
+ noncompliance. If all Recipient's rights under this Agreement terminate,
+ Recipient agrees to cease use and distribution of the Program as soon as
+ reasonably practicable. However, Recipient's obligations under this
+ Agreement and any licenses granted by Recipient relating to the Program
+ shall continue and survive. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">Everyone is permitted to copy
+ and distribute copies of this Agreement, but in order to avoid
+ inconsistency the Agreement is copyrighted and may only be modified in the
+ following manner. The Agreement Steward reserves the right to publish new
+ versions (including revisions) of this Agreement from time to time. No one
+ other than the Agreement Steward has the right to modify this Agreement.
+ IBM is the initial Agreement Steward. IBM may assign the responsibility to
+ serve as the Agreement Steward to a suitable separate entity. Each new
+ version of the Agreement will be given a distinguishing version number.
+ The Program (including Contributions) may always be distributed subject to
+ the version of the Agreement under which it was received. In addition,
+ after a new version of the Agreement is published, Contributor may elect
+ to distribute the Program (including its Contributions) under the new
+ version. Except as expressly stated in Sections 2(a) and 2(b) above,
+ Recipient receives no rights or licenses to the intellectual property of
+ any Contributor under this Agreement, whether expressly, by implication,
+ estoppel or otherwise. All rights in the Program not expressly granted
+ under this Agreement are reserved. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">This Agreement is governed by
+ the laws of the State of New York and the intellectual property laws of
+ the United States of America. No party to this Agreement will bring a
+ legal action under this Agreement more than one year after the cause of
+ action arose. Each party waives its rights to a jury trial in any
+ resulting litigation.</FONT></P></TT></FONT></TD></TR></TBODY></TABLE>
+<P></P></DIV></BODY></HTML>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/lgpl-v21.txt b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/lgpl-v21.txt
new file mode 100644
index 0000000..3f50d04
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/lgpl-v21.txt
@@ -0,0 +1,506 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
+
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/build.csh b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/build.csh
new file mode 100644
index 0000000..05e11d1
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/build.csh
Binary files differ
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/make_gtk.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/make_gtk.mak
new file mode 100644
index 0000000..b2f9488
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/make_gtk.mak
@@ -0,0 +1,132 @@
+# Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+#
+# The contents of this file are made available under the terms
+# of the GNU Lesser General Public License (LGPL) Version 2.1 that
+# accompanies this distribution (lgpl-v21.txt). The LGPL is also
+# available at http://www.gnu.org/licenses/lgpl.html. If the version
+# of the LGPL at http://www.gnu.org is different to the version of
+# the LGPL accompanying this distribution and there is any conflict
+# between the two license versions, the terms of the LGPL accompanying
+# this distribution shall govern.
+#
+# Makefile for creating SWT libraries on Linux
+
+include make_common.mak
+
+SWT_VERSION=$(maj_ver)$(min_ver)
+
+
+# Define the installation directories for various products.
+# Your system may have these in a different place.
+# IVE_HOME - IBM's version of Java (J9)
+IVE_HOME = /bluebird/teamswt/swt-builddir/ive
+#IVE_HOME = /opt/IBMvame1.4/ive
+
+JAVA_JNI=$(IVE_HOME)/bin/include
+JAVAH=$(IVE_HOME)/bin/javah
+LD_LIBRARY_PATH=$(IVE_HOME)/bin
+
+# Define the various DLL (shared) libraries to be made.
+
+SWT_PREFIX = swt
+OS_PREFIX = linux
+SWT_DLL = lib$(SWT_PREFIX)-$(OS_PREFIX)-$(SWT_VERSION).so
+SWTPI_DLL = lib$(SWT_PREFIX)-pi-$(OS_PREFIX)-$(SWT_VERSION).so
+
+GNOME_PREFIX = swt-gnome
+GNOME_DLL = lib$(GNOME_PREFIX)-$(OS_PREFIX)-$(SWT_VERSION).so
+GNOME_LIB = -x -shared \
+ -L/usr/lib \
+ -lgnome -lglib \
+ -lm -ldl
+
+PIXBUF_PREFIX = swt-pixbuf
+PIXBUF_DLL = lib$(PIXBUF_PREFIX)-$(OS_PREFIX)-$(SWT_VERSION).so
+
+
+#
+# Target Rules
+#
+
+all: make_swt make_pixbuf # make_gnome
+
+make_swt: $(SWT_DLL) $(SWTPI_DLL)
+
+#make_gnome: $(GNOME_DLL)
+
+make_pixbuf: $(PIXBUF_DLL)
+
+
+# All about Linking
+
+$(SWT_DLL): callback.o
+ ld -x -shared \
+ -o $(SWT_DLL) callback.o
+
+# Note: your setup may be different. Consult `gtk-config --libs`
+$(SWTPI_DLL): swt.o structs.o
+ ld -x -shared \
+ -L/usr/lib -L/usr/X11R6/lib \
+ -lgtk -lgdk -lgmodule -lglib \
+ -ldl -lXi -lXext -lX11 -lm -lc \
+ -o $(SWTPI_DLL) swt.o structs.o
+
+#$(GNOME_DLL): gnome.o
+# ld -o $@ gnome.o $(GNOME_LIB)
+
+$(PIXBUF_DLL): pixbuf.o
+ ld -x -shared \
+ -L/usr/lib -L/usr/X11R6/lib \
+ -lgdk_pixbuf \
+ -lgtk -lgdk -lgmodule -lglib \
+ -ldl -lXi -lXext -lX11 -lm -lc \
+ -o $(PIXBUF_DLL) pixbuf.o
+
+
+# All about Compiling
+
+SWT_C_FLAGS = -c -O -s \
+ -DSWT_VERSION=$(SWT_VERSION) \
+ -DLINUX -DGTK \
+ -fpic \
+ -I$(JAVA_JNI) \
+ `gtk-config --cflags`
+
+SWT_PIXBUF_FLAGS = -c -O -s \
+ -DSWT_VERSION=$(SWT_VERSION) \
+ -DLINUX -DGTK \
+ -fpic \
+ -I$(JAVA_JNI) \
+ -I/usr/include/gdk-pixbuf \
+ `gtk-config --cflags`
+
+SWT_GNOME_FLAGS = -c -O -s \
+ -DSWT_VERSION=$(SWT_VERSION) \
+ -DLINUX -DGTK \
+ -fpic \
+ -I$(JAVA_JNI) \
+ `gnome-config --cflags gnome`
+
+swt.o: swt.c swt.h
+ gcc $(SWT_C_FLAGS) swt.c
+
+structs.o: structs.c
+ gcc $(SWT_C_FLAGS) structs.c
+
+callback.o: callback.c
+ gcc $(SWT_C_FLAGS) callback.c
+
+globals.o: globals.c
+ gcc $(SWT_C_FLAGS) globals.c
+
+library.o: library.c
+ gcc $(SWT_C_FLAGS) library.c
+
+pixbuf.o: pixbuf.c
+ gcc $(SWT_PIXBUF_FLAGS) pixbuf.c
+
+#gnome.o: gnome.c
+# gcc $(SWT_GNOME_FLAGS) gnome.c
+
+clean:
+ rm -f *.o *.so
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/pixbuf.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/pixbuf.c
new file mode 100644
index 0000000..f624fe3
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/pixbuf.c
@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+#include "swt.h"
+#include <gtk/gtk.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_get_colorspace
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1colorspace
+ (JNIEnv *env, jclass cl, jint pixbuf)
+{
+ return (jint) gdk_pixbuf_get_colorspace((GdkPixbuf*)pixbuf);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_get_n_channels
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1n_1channels
+ (JNIEnv *env, jclass cl, jint pixbuf)
+{
+ return (jint) gdk_pixbuf_get_n_channels((GdkPixbuf*)pixbuf);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_get_has_alpha
+ * Signature: (I)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1has_1alpha
+ (JNIEnv *env, jclass cl, jint pixbuf)
+{
+ return (jboolean) gdk_pixbuf_get_has_alpha((GdkPixbuf*)pixbuf);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_get_bits_per_sample
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1bits_1per_1sample
+ (JNIEnv *env, jclass cl, jint pixbuf)
+{
+ return (jint) gdk_pixbuf_get_bits_per_sample((GdkPixbuf*)pixbuf);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_get_pixels
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1pixels
+ (JNIEnv *env, jclass cl, jint pixbuf)
+{
+ return (jint) gdk_pixbuf_get_pixels((GdkPixbuf*)pixbuf);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_get_width
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1width
+ (JNIEnv *env, jclass cl, jint pixbuf)
+{
+ return (jint) gdk_pixbuf_get_width((GdkPixbuf*)pixbuf);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_get_height
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1height
+ (JNIEnv *env, jclass cl, jint pixbuf)
+{
+ return (jint) gdk_pixbuf_get_height((GdkPixbuf*)pixbuf);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_get_rowstride
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1rowstride
+ (JNIEnv *env, jclass cl, jint pixbuf)
+{
+ return (jint) gdk_pixbuf_get_rowstride((GdkPixbuf*)pixbuf);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_new
+ * Signature: (IZIII)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1new
+ (JNIEnv *env, jclass cl,
+ jint colorspace,
+ jboolean hasAlpha,
+ jint bpc,
+ jint width, jint height)
+{
+ return (jint) gdk_pixbuf_new (
+ colorspace,
+ (gboolean) hasAlpha,
+ bpc,
+ width, height
+ );
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_copy
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1copy
+ (JNIEnv *env, jclass cl, jint source) {
+ return (jint)gdk_pixbuf_copy ((GdkPixbuf*) source);
+}
+
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_render_to_drawable
+ * Signature: (IIIIIIIIIIII)V
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1render_1to_1drawable
+ (JNIEnv *env, jclass cl,
+ jint pixbuf,
+ jint drawable,
+ jint gc,
+ jint src_x, jint src_y,
+ jint dest_x, jint dest_y,
+ jint width, jint height,
+ jint dithering,
+ jint x_dither, jint y_dither) {
+ gdk_pixbuf_render_to_drawable (
+ (GdkPixbuf*) pixbuf,
+ (GdkDrawable*) drawable,
+ (GdkGC*) gc,
+ src_x, src_y,
+ dest_x, dest_y,
+ width, height,
+ dithering,
+ x_dither, y_dither
+ );
+}
+
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_render_to_drawable_alpha
+ * Signature: (IIIIIIIIIIIII)V
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1render_1to_1drawable_1alpha
+ (JNIEnv *env, jclass cl,
+ jint pixbuf,
+ jint drawable,
+ jint src_x, jint src_y, jint dest_x, jint dest_y,
+ jint width, jint height,
+ jint alphaMode,
+ jint alphaThreshold,
+ jint dithering,
+ jint x_dither, jint y_dither)
+{
+ gdk_pixbuf_render_to_drawable_alpha (
+ (GdkPixbuf*) pixbuf,
+ (GdkDrawable*) drawable,
+ src_x, src_y,
+ dest_x, dest_y,
+ width, height,
+ alphaMode,
+ alphaThreshold,
+ dithering,
+ x_dither, y_dither
+ );
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_scale
+ * Signature: (IIIIIIDDDDI)V
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1scale
+ (JNIEnv *env, jclass cl,
+ jint source, jint dest,
+ jint dest_x, jint dest_y,
+ jint dest_width, jint dest_height,
+ jdouble offset_x, jdouble offset_y,
+ jdouble scale_x, jdouble scale_y,
+ jint interp_type) {
+ gdk_pixbuf_scale ((GdkPixbuf*)source, (GdkPixbuf*)dest,
+ dest_x, dest_y,
+ dest_width, dest_height,
+ offset_x, offset_y,
+ scale_x, scale_y,
+ interp_type
+ );
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_GDKPIXBUF
+ * Method: gdk_pixbuf_get_from_drawable
+ * Signature: (IIIIIIIII)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GDKPIXBUF_gdk_1pixbuf_1get_1from_1drawable
+ (JNIEnv *env, jclass cl,
+ jint dest, jint src, jint cmap,
+ jint src_x, jint src_y,
+ jint dest_x, jint dest_y,
+ jint width, jint height)
+{
+ gdk_pixbuf_get_from_drawable (
+ (GdkPixbuf*) dest,
+ (GdkDrawable*) src,
+ (GdkColormap*) cmap,
+ src_x, src_y,
+ dest_x, dest_y,
+ width, height);
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/structs.c
new file mode 100644
index 0000000..db094ff
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/structs.c
@@ -0,0 +1,2663 @@
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+/**
+ * JNI SWT object field getters and setters declarations for Windows structs
+ */
+
+#include "swt.h"
+#include "structs.h"
+
+/* Globals */
+GdkColor_FID_CACHE GdkColorFc;
+GdkEventKey_FID_CACHE GdkEventKeyFc;
+GdkEventButton_FID_CACHE GdkEventButtonFc;
+GdkEventMotion_FID_CACHE GdkEventMotionFc;
+GdkEventExpose_FID_CACHE GdkEventExposeFc;
+GdkFont_FID_CACHE GdkFontFc;
+GdkGCValues_FID_CACHE GdkGCValuesFc;
+GdkImage_FID_CACHE GdkImageFc;
+GdkPoint_FID_CACHE GdkPointFc;
+GdkRectangle_FID_CACHE GdkRectangleFc;
+GdkVisual_FID_CACHE GdkVisualFc;
+GtkObject_FID_CACHE GtkObjectFc;
+GtkData_FID_CACHE GtkDataFc;
+GtkAdjustment_FID_CACHE GtkAdjustmentFc;
+GtkAllocation_FID_CACHE GtkAllocationFc;
+GtkWidget_FID_CACHE GtkWidgetFc;
+GtkContainer_FID_CACHE GtkContainerFc;
+GtkBin_FID_CACHE GtkBinFc;
+GtkMenu_FID_CACHE GtkMenuFc;
+GtkItem_FID_CACHE GtkItemFc;
+GtkMenuShell_FID_CACHE GtkMenuShellFc;
+GtkMenuItem_FID_CACHE GtkMenuItemFc;
+GtkCheckMenuItem_FID_CACHE GtkCheckMenuItemFc;
+GtkWindow_FID_CACHE GtkWindowFc;
+GtkColorSelectionDialog_FID_CACHE GtkColorSelectionDialogFc;\
+GtkBox_FID_CACHE GtkBoxFc;
+GtkHBox_FID_CACHE GtkHBoxFc;
+GtkCombo_FID_CACHE GtkComboFc;
+GtkFileSelection_FID_CACHE GtkFileSelectionFc;
+GtkFrame_FID_CACHE GtkFrameFc;
+GtkFontSelectionDialog_FID_CACHE GtkFontSelectionDialogFc;
+GtkCList_FID_CACHE GtkCListFc;
+GtkEditable_FID_CACHE GtkEditableFc;
+GtkText_FID_CACHE GtkTextFc;
+GtkProgress_FID_CACHE GtkProgressFc;
+GtkProgressBar_FID_CACHE GtkProgressBarFc;
+GtkArg_FID_CACHE GtkArgFc;
+GtkRequisition_FID_CACHE GtkRequisitionFc;
+GtkStyle_FID_CACHE GtkStyleFc;
+GtkStyleClass_FID_CACHE GtkStyleClassFc;
+GtkCListRow_FID_CACHE GtkCListRowFc;
+GtkCListColumn_FID_CACHE GtkCListColumnFc;
+GtkCTreeRow_FID_CACHE GtkCTreeRowFc;
+GtkCTree_FID_CACHE GtkCTreeFc;
+
+/* ----------- fid and class caches ----------- */
+/*
+ * Used for Java objects passed into JNI that are
+ * declared like:
+ *
+ * nativeFunction (Rectangle p1, Rectangle p2, Rectangle p3)
+ *
+ * and not like this
+ *
+ * nativeFunction (Object p1, Object p2, Object p3)
+ *
+ *
+ */
+void cacheGdkColorFids(JNIEnv *env, jobject lpGdkColor, PGdkColor_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkColorClass = (*env)->GetObjectClass(env, lpGdkColor);
+
+ lpCache->pixel = (*env)->GetFieldID(env, lpCache->GdkColorClass, "pixel", "I");
+ lpCache->red = (*env)->GetFieldID(env, lpCache->GdkColorClass, "red", "S");
+ lpCache->green = (*env)->GetFieldID(env, lpCache->GdkColorClass, "green", "S");
+ lpCache->blue = (*env)->GetFieldID(env, lpCache->GdkColorClass, "blue", "S");
+ lpCache->cached = 1;
+};
+
+void cacheGdkEventKeyFids(JNIEnv *env, jobject lpGdkEventKey, PGdkEventKey_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkEventKeyClass = (*env)->GetObjectClass(env, lpGdkEventKey);
+
+ lpCache->type = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "type", "I");
+ lpCache->window = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "window", "I");
+ lpCache->send_event = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "send_event", "B");
+ lpCache->time = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "time", "I");
+ lpCache->state = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "state", "I");
+ lpCache->keyval = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "keyval", "I");
+ lpCache->length = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "length", "I");
+ lpCache->string = (*env)->GetFieldID(env, lpCache->GdkEventKeyClass, "string", "I");
+ lpCache->cached = 1;
+};
+
+void cacheGdkEventButtonFids(JNIEnv *env, jobject lpGdkEventButton, PGdkEventButton_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkEventButtonClass = (*env)->GetObjectClass(env, lpGdkEventButton);
+ lpCache->type = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "type", "I");
+ lpCache->window = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "window", "I");
+ lpCache->send_event = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "send_event", "B");
+ lpCache->time = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "time", "I");
+ lpCache->x = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "x", "J");
+ lpCache->y = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "y", "J");
+ lpCache->pressure = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "pressure", "J");
+ lpCache->xtilt = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "xtilt", "J");
+ lpCache->ytilt = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "ytilt", "J");
+ lpCache->state = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "state", "I");
+ lpCache->button = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "button", "I");
+ lpCache->source = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "source", "I");
+ lpCache->deviceid = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "deviceid", "I");
+ lpCache->x_root = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "x_root", "J");
+ lpCache->y_root = (*env)->GetFieldID(env, lpCache->GdkEventButtonClass, "y_root", "J");
+
+ lpCache->cached = 1;
+};
+
+void cacheGdkEventMotionFids(JNIEnv *env, jobject lpGdkEventMotion, PGdkEventMotion_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkEventMotionClass = (*env)->GetObjectClass(env, lpGdkEventMotion);
+ lpCache->type = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "type", "I");
+ lpCache->window = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "window", "I");
+ lpCache->send_event = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "send_event", "B");
+ lpCache->time = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "time", "I");
+ lpCache->x = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "x", "J");
+ lpCache->y = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "y", "J");
+ lpCache->pressure = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "pressure", "J");
+ lpCache->xtilt = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "xtilt", "J");
+ lpCache->ytilt = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "ytilt", "J");
+ lpCache->state = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "state", "I");
+ lpCache->is_hint = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "is_hint", "I");
+ lpCache->source = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "source", "I");
+ lpCache->deviceid = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "deviceid", "I");
+ lpCache->x_root = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "x_root", "J");
+ lpCache->y_root = (*env)->GetFieldID(env, lpCache->GdkEventMotionClass, "y_root", "J");
+
+ lpCache->cached = 1;
+};
+
+void cacheGdkEventExposeFids(JNIEnv *env, jobject lpGdkEventExpose, PGdkEventExpose_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkEventExposeClass = (*env)->GetObjectClass(env, lpGdkEventExpose);
+ lpCache->type = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "type", "I");
+ lpCache->window = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "window", "I");
+ lpCache->send_event = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "send_event", "B");
+ lpCache->x = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "x", "S");
+ lpCache->y = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "y", "S");
+ lpCache->width = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "width", "S");
+ lpCache->height = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "height", "S");
+ lpCache->count = (*env)->GetFieldID(env, lpCache->GdkEventExposeClass, "count", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGdkFontFids(JNIEnv *env, jobject lpGdkFont, PGdkFont_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkFontClass = (*env)->GetObjectClass(env, lpGdkFont);
+ lpCache->type = (*env)->GetFieldID(env, lpCache->GdkFontClass, "type", "I");
+ lpCache->ascent = (*env)->GetFieldID(env, lpCache->GdkFontClass, "ascent", "I");
+ lpCache->descent = (*env)->GetFieldID(env, lpCache->GdkFontClass, "descent", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGdkGCValuesFids(JNIEnv *env, jobject lpGdkGCValues, PGdkGCValues_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkGCValuesClass = (*env)->GetObjectClass(env, lpGdkGCValues);
+
+ lpCache->foreground_pixel = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "foreground_pixel", "I");
+ lpCache->foreground_red = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "foreground_red", "S");
+ lpCache->foreground_green = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "foreground_green", "S");
+ lpCache->foreground_blue = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "foreground_blue", "S");
+ lpCache->background_pixel = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "background_pixel", "I");
+ lpCache->background_red = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "background_red", "S");
+ lpCache->background_green = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "background_green", "S");
+ lpCache->background_blue = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "background_blue", "S");
+ lpCache->font = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "font", "I");
+ lpCache->function = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "function", "I");
+ lpCache->fill = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "fill", "I");
+ lpCache->tile = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "tile", "I");
+ lpCache->stipple = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "stipple", "I");
+ lpCache->clip_mask = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "clip_mask", "I");
+ lpCache->subwindow_mode = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "subwindow_mode", "I");
+ lpCache->ts_x_origin = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "ts_x_origin", "I");
+ lpCache->ts_y_origin = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "ts_y_origin", "I");
+ lpCache->clip_x_origin = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "clip_x_origin", "I");
+ lpCache->clip_y_origin = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "clip_y_origin", "I");
+ lpCache->graphics_exposures = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "graphics_exposures", "I");
+ lpCache->line_width = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "line_width", "I");
+ lpCache->line_style = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "line_style", "I");
+ lpCache->cap_style = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "cap_style", "I");
+ lpCache->join_style = (*env)->GetFieldID(env, lpCache->GdkGCValuesClass, "join_style", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGdkImageFids(JNIEnv *env, jobject lpGdkImage, PGdkImage_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkImageClass = (*env)->GetObjectClass(env, lpGdkImage);
+ lpCache->type = (*env)->GetFieldID(env, lpCache->GdkImageClass, "type", "I");
+ lpCache->visual = (*env)->GetFieldID(env, lpCache->GdkImageClass, "visual", "I");
+ lpCache->byte_order = (*env)->GetFieldID(env, lpCache->GdkImageClass, "byte_order", "I");
+ lpCache->width = (*env)->GetFieldID(env, lpCache->GdkImageClass, "width", "S");
+ lpCache->height = (*env)->GetFieldID(env, lpCache->GdkImageClass, "height", "S");
+ lpCache->depth = (*env)->GetFieldID(env, lpCache->GdkImageClass, "depth", "S");
+ lpCache->bpp = (*env)->GetFieldID(env, lpCache->GdkImageClass, "bpp", "S");
+ lpCache->bpl = (*env)->GetFieldID(env, lpCache->GdkImageClass, "bpl", "S");
+ lpCache->mem = (*env)->GetFieldID(env, lpCache->GdkImageClass, "mem", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGdkPointFids(JNIEnv *env, jobject lpGdkPoint, PGdkPoint_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkPointClass = (*env)->GetObjectClass(env, lpGdkPoint);
+ lpCache->x = (*env)->GetFieldID(env, lpCache->GdkPointClass, "x", "S");
+ lpCache->y = (*env)->GetFieldID(env, lpCache->GdkPointClass, "y", "S");
+
+ lpCache->cached = 1;
+};
+
+void cacheGdkRectangleFids(JNIEnv *env, jobject lpGdkRectangle, PGdkRectangle_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkRectangleClass = (*env)->GetObjectClass(env, lpGdkRectangle);
+ lpCache->x = (*env)->GetFieldID(env, lpCache->GdkRectangleClass, "x", "S");
+ lpCache->y = (*env)->GetFieldID(env, lpCache->GdkRectangleClass, "y", "S");
+ lpCache->width = (*env)->GetFieldID(env, lpCache->GdkRectangleClass, "width", "S");
+ lpCache->height = (*env)->GetFieldID(env, lpCache->GdkRectangleClass, "height", "S");
+
+ lpCache->cached = 1;
+};
+
+void cacheGdkVisualFids(JNIEnv *env, jobject lpGdkVisual, PGdkVisual_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GdkVisualClass = (*env)->GetObjectClass(env, lpGdkVisual);
+ lpCache->type = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "type", "I");
+ lpCache->depth = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "depth", "I");
+ lpCache->byte_order = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "byte_order", "I");
+ lpCache->colormap_size = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "colormap_size", "I");
+ lpCache->bits_per_rgb = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "bits_per_rgb", "I");
+ lpCache->red_mask = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "red_mask", "I");
+ lpCache->red_shift = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "red_shift", "I");
+ lpCache->red_prec = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "red_prec", "I");
+ lpCache->green_mask = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "green_mask", "I");
+ lpCache->green_shift = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "green_shift", "I");
+ lpCache->green_prec = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "green_prec", "I");
+ lpCache->blue_mask = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "blue_mask", "I");
+ lpCache->blue_shift = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "blue_shift", "I");
+ lpCache->blue_prec = (*env)->GetFieldID(env, lpCache->GdkVisualClass, "blue_prec", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkAllocationFids(JNIEnv *env, jobject lpGtkAllocation, PGtkAllocation_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GtkAllocationClass = (*env)->GetObjectClass(env, lpGtkAllocation);
+ lpCache->x = (*env)->GetFieldID(env, lpCache->GtkAllocationClass, "x", "S");
+ lpCache->y = (*env)->GetFieldID(env, lpCache->GtkAllocationClass, "y", "S");
+ lpCache->width = (*env)->GetFieldID(env, lpCache->GtkAllocationClass, "width", "S");
+ lpCache->height = (*env)->GetFieldID(env, lpCache->GtkAllocationClass, "height", "S");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkArgFids(JNIEnv *env, jobject lpGtkArg, PGtkArg_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GtkArgClass = (*env)->GetObjectClass(env, lpGtkArg);
+
+ fprintf(stderr, "WARNING: Unimplemented method cacheGtkArgFids.\n");
+ lpCache->cached = 1;
+};
+
+void cacheGtkBinFids(JNIEnv *env, jobject lpGtkBin, PGtkBin_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkBinClass = (*env)->GetObjectClass(env, lpGtkBin);
+ cacheGtkContainerFids(env, lpGtkBin, &PGLOB(GtkContainerFc));
+ lpCache->child = (*env)->GetFieldID(env, lpCache->GtkBinClass, "child", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkCListFids(JNIEnv *env, jobject lpGtkCList, PGtkCList_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkCListClass = (*env)->GetObjectClass(env, lpGtkCList);
+ cacheGtkContainerFids(env, lpGtkCList, &PGLOB(GtkContainerFc));
+ lpCache->clist_flags = (*env)->GetFieldID(env, lpCache->GtkCListClass, "clist_flags", "S");
+ lpCache->row_mem_chunk = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_mem_chunk", "I");
+ lpCache->cell_mem_chunk = (*env)->GetFieldID(env, lpCache->GtkCListClass, "cell_mem_chunk", "I");
+ lpCache->freeze_count = (*env)->GetFieldID(env, lpCache->GtkCListClass, "freeze_count", "I");
+ lpCache->internal_allocation_x = (*env)->GetFieldID(env, lpCache->GtkCListClass, "internal_allocation_x", "S");
+ lpCache->internal_allocation_y = (*env)->GetFieldID(env, lpCache->GtkCListClass, "internal_allocation_y", "S");
+ lpCache->internal_allocation_width = (*env)->GetFieldID(env, lpCache->GtkCListClass, "internal_allocation_width", "S");
+ lpCache->internal_allocation_height = (*env)->GetFieldID(env, lpCache->GtkCListClass, "internal_allocation_height", "S");
+ lpCache->rows = (*env)->GetFieldID(env, lpCache->GtkCListClass, "rows", "I");
+ lpCache->row_center_offset = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_center_offset", "I");
+ lpCache->row_height = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_height", "I");
+ lpCache->row_list = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_list", "I");
+ lpCache->row_list_end = (*env)->GetFieldID(env, lpCache->GtkCListClass, "row_list_end", "I");
+ lpCache->columns = (*env)->GetFieldID(env, lpCache->GtkCListClass, "columns", "I");
+ lpCache->column_title_area_x = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column_title_area_x", "S");
+ lpCache->column_title_area_y = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column_title_area_y", "S");
+ lpCache->column_title_area_width = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column_title_area_width", "S");
+ lpCache->column_title_area_height = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column_title_area_height", "S");
+ lpCache->title_window = (*env)->GetFieldID(env, lpCache->GtkCListClass, "title_window", "I");
+ lpCache->column = (*env)->GetFieldID(env, lpCache->GtkCListClass, "column", "I");
+ lpCache->clist_window = (*env)->GetFieldID(env, lpCache->GtkCListClass, "clist_window", "I");
+ lpCache->clist_window_width = (*env)->GetFieldID(env, lpCache->GtkCListClass, "clist_window_width", "I");
+ lpCache->clist_window_height = (*env)->GetFieldID(env, lpCache->GtkCListClass, "clist_window_height", "I");
+ lpCache->hoffset = (*env)->GetFieldID(env, lpCache->GtkCListClass, "hoffset", "I");
+ lpCache->voffset = (*env)->GetFieldID(env, lpCache->GtkCListClass, "voffset", "I");
+ lpCache->shadow_type = (*env)->GetFieldID(env, lpCache->GtkCListClass, "shadow_type", "I");
+ lpCache->selection_mode = (*env)->GetFieldID(env, lpCache->GtkCListClass, "selection_mode", "I");
+ lpCache->selection = (*env)->GetFieldID(env, lpCache->GtkCListClass, "selection", "I");
+ lpCache->selection_end = (*env)->GetFieldID(env, lpCache->GtkCListClass, "selection_end", "I");
+ lpCache->undo_selection = (*env)->GetFieldID(env, lpCache->GtkCListClass, "undo_selection", "I");
+ lpCache->undo_unselection = (*env)->GetFieldID(env, lpCache->GtkCListClass, "undo_unselection", "I");
+ lpCache->undo_anchor = (*env)->GetFieldID(env, lpCache->GtkCListClass, "undo_anchor", "I");
+ lpCache->button_actions0 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions0", "B");
+ lpCache->button_actions1 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions1", "B");
+ lpCache->button_actions2 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions2", "B");
+ lpCache->button_actions3 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions3", "B");
+ lpCache->button_actions4 = (*env)->GetFieldID(env, lpCache->GtkCListClass, "button_actions4", "B");
+ lpCache->drag_button = (*env)->GetFieldID(env, lpCache->GtkCListClass, "drag_button", "B");
+ lpCache->click_cell_row = (*env)->GetFieldID(env, lpCache->GtkCListClass, "click_cell_row", "I");
+ lpCache->click_cell_column = (*env)->GetFieldID(env, lpCache->GtkCListClass, "click_cell_column", "I");
+ lpCache->hadjustment = (*env)->GetFieldID(env, lpCache->GtkCListClass, "hadjustment", "I");
+ lpCache->vadjustment = (*env)->GetFieldID(env, lpCache->GtkCListClass, "vadjustment", "I");
+ lpCache->xor_gc = (*env)->GetFieldID(env, lpCache->GtkCListClass, "xor_gc", "I");
+ lpCache->fg_gc = (*env)->GetFieldID(env, lpCache->GtkCListClass, "fg_gc", "I");
+ lpCache->bg_gc = (*env)->GetFieldID(env, lpCache->GtkCListClass, "bg_gc", "I");
+ lpCache->cursor_drag = (*env)->GetFieldID(env, lpCache->GtkCListClass, "cursor_drag", "I");
+ lpCache->x_drag = (*env)->GetFieldID(env, lpCache->GtkCListClass, "x_drag", "I");
+ lpCache->focus_row = (*env)->GetFieldID(env, lpCache->GtkCListClass, "focus_row", "I");
+ lpCache->anchor = (*env)->GetFieldID(env, lpCache->GtkCListClass, "anchor", "I");
+ lpCache->anchor_state = (*env)->GetFieldID(env, lpCache->GtkCListClass, "anchor_state", "I");
+ lpCache->drag_pos = (*env)->GetFieldID(env, lpCache->GtkCListClass, "drag_pos", "I");
+ lpCache->htimer = (*env)->GetFieldID(env, lpCache->GtkCListClass, "htimer", "I");
+ lpCache->vtimer = (*env)->GetFieldID(env, lpCache->GtkCListClass, "vtimer", "I");
+ lpCache->sort_type = (*env)->GetFieldID(env, lpCache->GtkCListClass, "sort_type", "I");
+ lpCache->compare = (*env)->GetFieldID(env, lpCache->GtkCListClass, "compare", "I");
+ lpCache->sort_column = (*env)->GetFieldID(env, lpCache->GtkCListClass, "sort_column", "I");
+
+ lpCache->cached = 1;
+};
+
+
+void cacheGtkColorSelectionDialogFids(JNIEnv *env, jobject lpGtkColorSelectionDialog, PGtkColorSelectionDialog_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkColorSelectionDialogClass = (*env)->GetObjectClass(env, lpGtkColorSelectionDialog);
+ cacheGtkWindowFids(env, lpGtkColorSelectionDialog, &PGLOB(GtkWindowFc));
+ lpCache->colorsel = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "colorsel", "I");
+ lpCache->main_vbox = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "main_vbox", "I");
+ lpCache->ok_button = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "ok_button", "I");
+ lpCache->reset_button = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "reset_button", "I");
+ lpCache->cancel_button = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "cancel_button", "I");
+ lpCache->help_button = (*env)->GetFieldID(env, lpCache->GtkColorSelectionDialogClass, "help_button", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkComboFids(JNIEnv *env, jobject lpGtkCombo, PGtkCombo_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkComboClass = (*env)->GetObjectClass(env, lpGtkCombo);
+ cacheGtkHBoxFids(env, lpGtkCombo, &PGLOB(GtkHBoxFc));
+ lpCache->entry = (*env)->GetFieldID(env, lpCache->GtkComboClass, "entry", "I");
+ lpCache->button = (*env)->GetFieldID(env, lpCache->GtkComboClass, "button", "I");
+ lpCache->popup = (*env)->GetFieldID(env, lpCache->GtkComboClass, "popup", "I");
+ lpCache->popwin = (*env)->GetFieldID(env, lpCache->GtkComboClass, "popwin", "I");
+ lpCache->list = (*env)->GetFieldID(env, lpCache->GtkComboClass, "list", "I");
+ lpCache->entry_change_id = (*env)->GetFieldID(env, lpCache->GtkComboClass, "entry_change_id", "I");
+ lpCache->list_change_id = (*env)->GetFieldID(env, lpCache->GtkComboClass, "list_change_id", "I");
+ lpCache->value_in_list = (*env)->GetFieldID(env, lpCache->GtkComboClass, "value_in_list", "I");
+ lpCache->ok_if_empty = (*env)->GetFieldID(env, lpCache->GtkComboClass, "ok_if_empty", "I");
+ lpCache->case_sensitive = (*env)->GetFieldID(env, lpCache->GtkComboClass, "case_sensitive", "I");
+ lpCache->use_arrows = (*env)->GetFieldID(env, lpCache->GtkComboClass, "use_arrows", "I");
+ lpCache->use_arrows_always = (*env)->GetFieldID(env, lpCache->GtkComboClass, "use_arrows_always", "I");
+ lpCache->current_button = (*env)->GetFieldID(env, lpCache->GtkComboClass, "current_button", "S");
+ lpCache->activate_id = (*env)->GetFieldID(env, lpCache->GtkComboClass, "activate_id", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkContainerFids(JNIEnv *env, jobject lpGtkContainer, PGtkContainer_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkContainerClass = (*env)->GetObjectClass(env, lpGtkContainer);
+ cacheGtkWidgetFids(env, lpGtkContainer, &PGLOB(GtkWidgetFc));
+ lpCache->focus_child = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "focus_child", "I");
+ lpCache->border_width = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "border_width", "I");
+ lpCache->need_resize = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "need_resize", "I");
+ lpCache->resize_mode = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "resize_mode", "I");
+ lpCache->resize_widgets = (*env)->GetFieldID(env, lpCache->GtkContainerClass, "resize_widgets", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkDataFids(JNIEnv *env, jobject lpGtkData, PGtkData_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkDataClass = (*env)->GetObjectClass(env, lpGtkData);
+ cacheGtkObjectFids(env, lpGtkData, &PGLOB(GtkObjectFc));
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkEditableFids(JNIEnv *env, jobject lpGtkEditable, PGtkEditable_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkEditableClass = (*env)->GetObjectClass(env, lpGtkEditable);
+ cacheGtkWidgetFids(env, lpGtkEditable, &PGLOB(GtkWidgetFc));
+ lpCache->current_pos = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "current_pos", "I");
+ lpCache->selection_start_pos = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "selection_start_pos", "I");
+ lpCache->selection_end_pos = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "selection_end_pos", "I");
+ lpCache->has_selection = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "has_selection", "I");
+ lpCache->editable = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "editable", "I");
+ lpCache->visible = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "visible", "I");
+ lpCache->ic = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "ic", "I");
+ lpCache->ic_attr = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "ic_attr", "I");
+ lpCache->clipboard_text = (*env)->GetFieldID(env, lpCache->GtkEditableClass, "clipboard_text", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkTextFids(JNIEnv *env, jobject lpGtkText, PGtkText_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkTextClass = (*env)->GetObjectClass(env, lpGtkText);
+ cacheGtkEditableFids(env, lpGtkText, &PGLOB(GtkEditableFc));
+
+ lpCache->first_line_start_index = (*env)->GetFieldID(env, lpCache->GtkTextClass, "first_line_start_index", "I");
+ lpCache->first_onscreen_hor_pixel = (*env)->GetFieldID(env, lpCache->GtkTextClass, "first_onscreen_hor_pixel", "I");
+ lpCache->first_onscreen_ver_pixel = (*env)->GetFieldID(env, lpCache->GtkTextClass, "first_onscreen_ver_pixel", "I");
+ lpCache->default_tab_width = (*env)->GetFieldID(env, lpCache->GtkTextClass, "default_tab_width", "I");
+ lpCache->cursor_pos_x = (*env)->GetFieldID(env, lpCache->GtkTextClass, "cursor_pos_x", "I");
+ lpCache->cursor_pos_y = (*env)->GetFieldID(env, lpCache->GtkTextClass, "cursor_pos_y", "I");
+ lpCache->cursor_virtual_x = (*env)->GetFieldID(env, lpCache->GtkTextClass, "cursor_virtual_x", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkFileSelectionFids(JNIEnv *env, jobject lpGtkFileSelection, PGtkFileSelection_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkFileSelectionClass = (*env)->GetObjectClass(env, lpGtkFileSelection);
+ cacheGtkWindowFids(env, lpGtkFileSelection, &PGLOB(GtkWindowFc));
+ lpCache->dir_list = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "dir_list", "I");
+ lpCache->file_list = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "file_list", "I");
+ lpCache->selection_entry = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "selection_entry", "I");
+ lpCache->selection_text = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "selection_text", "I");
+ lpCache->main_vbox = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "main_vbox", "I");
+ lpCache->ok_button = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "ok_button", "I");
+ lpCache->cancel_button = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "cancel_button", "I");
+ lpCache->help_button = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "help_button", "I");
+ lpCache->history_pulldown = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "history_pulldown", "I");
+ lpCache->history_menu = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "history_menu", "I");
+ lpCache->history_list = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "history_list", "I");
+ lpCache->fileop_dialog = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_dialog", "I");
+ lpCache->fileop_entry = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_entry", "I");
+ lpCache->fileop_file = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_file", "I");
+ lpCache->cmpl_state = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "cmpl_state", "I");
+ lpCache->fileop_c_dir = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_c_dir", "I");
+ lpCache->fileop_del_file = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_del_file", "I");
+ lpCache->fileop_ren_file = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "fileop_ren_file", "I");
+ lpCache->button_area = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "button_area", "I");
+ lpCache->action_area = (*env)->GetFieldID(env, lpCache->GtkFileSelectionClass, "action_area", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkFontSelectionDialogFids(JNIEnv *env, jobject lpGtkFontSelectionDialog, PGtkFontSelectionDialog_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkFontSelectionDialogClass = (*env)->GetObjectClass(env, lpGtkFontSelectionDialog);
+ cacheGtkWindowFids(env, lpGtkFontSelectionDialog, &PGLOB(GtkWindowFc));
+ lpCache->fontsel = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "fontsel", "I");
+ lpCache->main_vbox = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "main_vbox", "I");
+ lpCache->action_area = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "action_area", "I");
+ lpCache->ok_button = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "ok_button", "I");
+ lpCache->apply_button = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "apply_button", "I");
+ lpCache->cancel_button = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "cancel_button", "I");
+ lpCache->dialog_width = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "dialog_width", "I");
+ lpCache->auto_resize = (*env)->GetFieldID(env, lpCache->GtkFontSelectionDialogClass, "auto_resize", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkObjectFids(JNIEnv *env, jobject lpGtkObject, PGtkObject_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GtkObjectClass = (*env)->GetObjectClass(env, lpGtkObject);
+ lpCache->klass = (*env)->GetFieldID(env, lpCache->GtkObjectClass, "klass", "I");
+ lpCache->flags = (*env)->GetFieldID(env, lpCache->GtkObjectClass, "flags", "I");
+ lpCache->ref_count = (*env)->GetFieldID(env, lpCache->GtkObjectClass, "ref_count", "I");
+ lpCache->object_data = (*env)->GetFieldID(env, lpCache->GtkObjectClass, "object_data", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkProgressFids(JNIEnv *env, jobject lpGtkProgress, PGtkProgress_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GtkProgressClass = (*env)->GetObjectClass(env, lpGtkProgress);
+
+ fprintf(stderr, "WARNING: Unimplemented method cacheGtkProgressFids.\n");
+ lpCache->cached = 1;
+};
+
+void cacheGtkProgressBarFids(JNIEnv *env, jobject lpGtkProgressBar, PGtkProgressBar_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkProgressBarClass = (*env)->GetObjectClass(env, lpGtkProgressBar);
+ cacheGtkProgressFids(env, lpGtkProgressBar, &PGLOB(GtkProgressFc));
+ lpCache->bar_style = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "bar_style", "I");
+ lpCache->orientation = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "orientation", "I");
+ lpCache->blocks = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "blocks", "I");
+ lpCache->in_block = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "in_block", "I");
+ lpCache->activity_pos = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "activity_pos", "I");
+ lpCache->activity_step = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "activity_step", "I");
+ lpCache->activity_blocks = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "activity_blocks", "I");
+ lpCache->activity_dir = (*env)->GetFieldID(env, lpCache->GtkProgressBarClass, "activity_dir", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkRequisitionFids(JNIEnv *env, jobject lpGtkRequisition, PGtkRequisition_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GtkRequisitionClass = (*env)->GetObjectClass(env, lpGtkRequisition);
+ lpCache->width = (*env)->GetFieldID(env, lpCache->GtkRequisitionClass, "width", "S");
+ lpCache->height = (*env)->GetFieldID(env, lpCache->GtkRequisitionClass, "height", "S");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkStyleFids(JNIEnv *env, jobject lpGtkStyle, PGtkStyle_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GtkStyleClazz = (*env)->GetObjectClass(env, lpGtkStyle);
+ lpCache->klass = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "klass", "I");
+ lpCache->fg0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg0_pixel", "I");
+ lpCache->fg0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg0_red", "S");
+ lpCache->fg0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg0_green", "S");
+ lpCache->fg0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg0_blue", "S");
+ lpCache->fg1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg1_pixel", "I");
+ lpCache->fg1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg1_red", "S");
+ lpCache->fg1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg1_green", "S");
+ lpCache->fg1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg1_blue", "S");
+ lpCache->fg2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg2_pixel", "I");
+ lpCache->fg2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg2_red", "S");
+ lpCache->fg2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg2_green", "S");
+ lpCache->fg2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg2_blue", "S");
+ lpCache->fg3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg3_pixel", "I");
+ lpCache->fg3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg3_red", "S");
+ lpCache->fg3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg3_green", "S");
+ lpCache->fg3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg3_blue", "S");
+ lpCache->fg4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg4_pixel", "I");
+ lpCache->fg4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg4_red", "S");
+ lpCache->fg4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg4_green", "S");
+ lpCache->fg4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg4_blue", "S");
+ lpCache->bg0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg0_pixel", "I");
+ lpCache->bg0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg0_red", "S");
+ lpCache->bg0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg0_green", "S");
+ lpCache->bg0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg0_blue", "S");
+ lpCache->bg1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg1_pixel", "I");
+ lpCache->bg1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg1_red", "S");
+ lpCache->bg1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg1_green", "S");
+ lpCache->bg1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg1_blue", "S");
+ lpCache->bg2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg2_pixel", "I");
+ lpCache->bg2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg2_red", "S");
+ lpCache->bg2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg2_green", "S");
+ lpCache->bg2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg2_blue", "S");
+ lpCache->bg3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg3_pixel", "I");
+ lpCache->bg3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg3_red", "S");
+ lpCache->bg3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg3_green", "S");
+ lpCache->bg3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg3_blue", "S");
+ lpCache->bg4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg4_pixel", "I");
+ lpCache->bg4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg4_red", "S");
+ lpCache->bg4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg4_green", "S");
+ lpCache->bg4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg4_blue", "S");
+ lpCache->light0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light0_pixel", "I");
+ lpCache->light0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light0_red", "S");
+ lpCache->light0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light0_green", "S");
+ lpCache->light0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light0_blue", "S");
+ lpCache->light1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light1_pixel", "I");
+ lpCache->light1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light1_red", "S");
+ lpCache->light1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light1_green", "S");
+ lpCache->light1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light1_blue", "S");
+ lpCache->light2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light2_pixel", "I");
+ lpCache->light2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light2_red", "S");
+ lpCache->light2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light2_green", "S");
+ lpCache->light2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light2_blue", "S");
+ lpCache->light3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light3_pixel", "I");
+ lpCache->light3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light3_red", "S");
+ lpCache->light3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light3_green", "S");
+ lpCache->light3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light3_blue", "S");
+ lpCache->light4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light4_pixel", "I");
+ lpCache->light4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light4_red", "S");
+ lpCache->light4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light4_green", "S");
+ lpCache->light4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light4_blue", "S");
+ lpCache->dark0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark0_pixel", "I");
+ lpCache->dark0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark0_red", "S");
+ lpCache->dark0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark0_green", "S");
+ lpCache->dark0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark0_blue", "S");
+ lpCache->dark1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark1_pixel", "I");
+ lpCache->dark1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark1_red", "S");
+ lpCache->dark1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark1_green", "S");
+ lpCache->dark1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark1_blue", "S");
+ lpCache->dark2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark2_pixel", "I");
+ lpCache->dark2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark2_red", "S");
+ lpCache->dark2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark2_green", "S");
+ lpCache->dark2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark2_blue", "S");
+ lpCache->dark3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark3_pixel", "I");
+ lpCache->dark3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark3_red", "S");
+ lpCache->dark3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark3_green", "S");
+ lpCache->dark3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark3_blue", "S");
+ lpCache->dark4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark4_pixel", "I");
+ lpCache->dark4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark4_red", "S");
+ lpCache->dark4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark4_green", "S");
+ lpCache->dark4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark4_blue", "S");
+ lpCache->mid0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid0_pixel", "I");
+ lpCache->mid0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid0_red", "S");
+ lpCache->mid0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid0_green", "S");
+ lpCache->mid0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid0_blue", "S");
+ lpCache->mid1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid1_pixel", "I");
+ lpCache->mid1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid1_red", "S");
+ lpCache->mid1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid1_green", "S");
+ lpCache->mid1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid1_blue", "S");
+ lpCache->mid2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid2_pixel", "I");
+ lpCache->mid2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid2_red", "S");
+ lpCache->mid2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid2_green", "S");
+ lpCache->mid2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid2_blue", "S");
+ lpCache->mid3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid3_pixel", "I");
+ lpCache->mid3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid3_red", "S");
+ lpCache->mid3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid3_green", "S");
+ lpCache->mid3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid3_blue", "S");
+ lpCache->mid4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid4_pixel", "I");
+ lpCache->mid4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid4_red", "S");
+ lpCache->mid4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid4_green", "S");
+ lpCache->mid4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid4_blue", "S");
+ lpCache->text0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text0_pixel", "I");
+ lpCache->text0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text0_red", "S");
+ lpCache->text0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text0_green", "S");
+ lpCache->text0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text0_blue", "S");
+ lpCache->text1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text1_pixel", "I");
+ lpCache->text1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text1_red", "S");
+ lpCache->text1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text1_green", "S");
+ lpCache->text1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text1_blue", "S");
+ lpCache->text2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text2_pixel", "I");
+ lpCache->text2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text2_red", "S");
+ lpCache->text2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text2_green", "S");
+ lpCache->text2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text2_blue", "S");
+ lpCache->text3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text3_pixel", "I");
+ lpCache->text3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text3_red", "S");
+ lpCache->text3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text3_green", "S");
+ lpCache->text3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text3_blue", "S");
+ lpCache->text4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text4_pixel", "I");
+ lpCache->text4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text4_red", "S");
+ lpCache->text4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text4_green", "S");
+ lpCache->text4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text4_blue", "S");
+ lpCache->base0_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base0_pixel", "I");
+ lpCache->base0_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base0_red", "S");
+ lpCache->base0_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base0_green", "S");
+ lpCache->base0_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base0_blue", "S");
+ lpCache->base1_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base1_pixel", "I");
+ lpCache->base1_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base1_red", "S");
+ lpCache->base1_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base1_green", "S");
+ lpCache->base1_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base1_blue", "S");
+ lpCache->base2_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base2_pixel", "I");
+ lpCache->base2_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base2_red", "S");
+ lpCache->base2_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base2_green", "S");
+ lpCache->base2_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base2_blue", "S");
+ lpCache->base3_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base3_pixel", "I");
+ lpCache->base3_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base3_red", "S");
+ lpCache->base3_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base3_green", "S");
+ lpCache->base3_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base3_blue", "S");
+ lpCache->base4_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base4_pixel", "I");
+ lpCache->base4_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base4_red", "S");
+ lpCache->base4_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base4_green", "S");
+ lpCache->base4_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base4_blue", "S");
+ lpCache->black_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_pixel", "I");
+ lpCache->black_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_red", "S");
+ lpCache->black_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_green", "S");
+ lpCache->black_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_blue", "S");
+ lpCache->white_pixel = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_pixel", "I");
+ lpCache->white_red = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_red", "S");
+ lpCache->white_green = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_green", "S");
+ lpCache->white_blue = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_blue", "S");
+ lpCache->font = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "font", "I");
+ lpCache->fg_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc0", "I");
+ lpCache->fg_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc1", "I");
+ lpCache->fg_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc2", "I");
+ lpCache->fg_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc3", "I");
+ lpCache->fg_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "fg_gc4", "I");
+ lpCache->bg_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc0", "I");
+ lpCache->bg_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc1", "I");
+ lpCache->bg_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc2", "I");
+ lpCache->bg_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc3", "I");
+ lpCache->bg_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_gc4", "I");
+ lpCache->light_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc0", "I");
+ lpCache->light_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc1", "I");
+ lpCache->light_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc2", "I");
+ lpCache->light_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc3", "I");
+ lpCache->light_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "light_gc4", "I");
+ lpCache->dark_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc0", "I");
+ lpCache->dark_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc1", "I");
+ lpCache->dark_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc2", "I");
+ lpCache->dark_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc3", "I");
+ lpCache->dark_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "dark_gc4", "I");
+ lpCache->mid_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc0", "I");
+ lpCache->mid_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc1", "I");
+ lpCache->mid_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc2", "I");
+ lpCache->mid_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc3", "I");
+ lpCache->mid_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "mid_gc4", "I");
+ lpCache->text_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc0", "I");
+ lpCache->text_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc1", "I");
+ lpCache->text_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc2", "I");
+ lpCache->text_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc3", "I");
+ lpCache->text_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "text_gc4", "I");
+ lpCache->base_gc0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc0", "I");
+ lpCache->base_gc1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc1", "I");
+ lpCache->base_gc2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc2", "I");
+ lpCache->base_gc3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc3", "I");
+ lpCache->base_gc4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "base_gc4", "I");
+ lpCache->black_gc = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "black_gc", "I");
+ lpCache->white_gc = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "white_gc", "I");
+ lpCache->bg_pixmap0 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap0", "I");
+ lpCache->bg_pixmap1 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap1", "I");
+ lpCache->bg_pixmap2 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap2", "I");
+ lpCache->bg_pixmap3 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap3", "I");
+ lpCache->bg_pixmap4 = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "bg_pixmap4", "I");
+ lpCache->ref_count = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "ref_count", "I");
+ lpCache->attach_count = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "attach_count", "I");
+ lpCache->depth = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "depth", "I");
+ lpCache->colormap = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "colormap", "I");
+ lpCache->engine = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "engine", "I");
+ lpCache->engine_data = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "engine_data", "I");
+ lpCache->rc_style = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "rc_style", "I");
+ lpCache->styles = (*env)->GetFieldID(env, lpCache->GtkStyleClazz, "styles", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkStyleClassFids(JNIEnv *env, jobject lpGtkStyleClass, PGtkStyleClass_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GtkStyleClassClazz = (*env)->GetObjectClass(env, lpGtkStyleClass);
+ lpCache->xthickness = (*env)->GetFieldID(env, lpCache->GtkStyleClassClazz, "xthickness", "I");
+ lpCache->ythickness = (*env)->GetFieldID(env, lpCache->GtkStyleClassClazz, "ythickness", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkWidgetFids(JNIEnv *env, jobject lpGtkWidget, PGtkWidget_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkWidgetClass = (*env)->GetObjectClass(env, lpGtkWidget);
+ cacheGtkObjectFids(env, lpGtkWidget, &PGLOB(GtkObjectFc));
+ lpCache->private_flags = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "private_flags", "S");
+ lpCache->state = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "state", "B");
+ lpCache->saved_state = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "saved_state", "B");
+ lpCache->name = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "name", "I");
+ lpCache->style = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "style", "I");
+ lpCache->req_width = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "req_width", "S");
+ lpCache->req_height = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "req_height", "S");
+ lpCache->alloc_x = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "alloc_x", "S");
+ lpCache->alloc_y = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "alloc_y", "S");
+ lpCache->alloc_width = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "alloc_width", "S");
+ lpCache->alloc_height = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "alloc_height", "S");
+ lpCache->window = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "window", "I");
+ lpCache->parent = (*env)->GetFieldID(env, lpCache->GtkWidgetClass, "parent", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkFrameFids(JNIEnv *env, jobject lpGtkFrame, PGtkFrame_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkFrameClass = (*env)->GetObjectClass(env, lpGtkFrame);
+ cacheGtkBinFids(env, lpGtkFrame, &PGLOB(GtkBinFc));
+ lpCache->label = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label", "I");
+ lpCache->shadow_type = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "shadow_type", "S");
+ lpCache->label_width = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label_width", "S");
+ lpCache->label_height = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label_height", "S");
+ lpCache->label_xalign = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label_xalign", "F");
+ lpCache->label_yalign = (*env)->GetFieldID(env, lpCache->GtkFrameClass, "label_yalign", "F");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkWindowFids(JNIEnv *env, jobject lpGtkWindow, PGtkWindow_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkWindowClass = (*env)->GetObjectClass(env, lpGtkWindow);
+ cacheGtkBinFids(env, lpGtkWindow, &PGLOB(GtkBinFc));
+ lpCache->title = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "title", "I");
+ lpCache->wmclass_name = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "wmclass_name", "I");
+ lpCache->wmclass_class = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "wmclass_class", "I");
+ lpCache->type = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "type", "I");
+ lpCache->focus_widget = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "focus_widget", "I");
+ lpCache->default_widget = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "default_widget", "I");
+ lpCache->transient_parent = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "transient_parent", "I");
+ lpCache->resize_count = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "resize_count", "S");
+ lpCache->allow_shrink = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "allow_shrink", "I");
+ lpCache->allow_grow = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "allow_grow", "I");
+ lpCache->auto_shrink = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "auto_shrink", "I");
+ lpCache->handling_resize = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "handling_resize", "I");
+ lpCache->position = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "position", "I");
+ lpCache->use_uposition = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "use_uposition", "I");
+ lpCache->modal = (*env)->GetFieldID(env, lpCache->GtkWindowClass, "modal", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkCheckMenuItemFids(JNIEnv *env, jobject lpGtkCheckMenuItem, PGtkCheckMenuItem_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkCheckMenuItemClass = (*env)->GetObjectClass(env, lpGtkCheckMenuItem);
+ cacheGtkMenuItemFids(env, lpGtkCheckMenuItem, &PGLOB(GtkMenuItemFc));
+ lpCache->active = (*env)->GetFieldID(env, lpCache->GtkCheckMenuItemClass, "active", "I");
+ lpCache->always_show_toggle = (*env)->GetFieldID(env, lpCache->GtkCheckMenuItemClass, "always_show_toggle", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkAdjustmentFids(JNIEnv *env, jobject lpGtkAdjustment, PGtkAdjustment_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkAdjustmentClass = (*env)->GetObjectClass(env, lpGtkAdjustment);
+ cacheGtkDataFids(env, lpGtkAdjustment, &PGLOB(GtkDataFc));
+ lpCache->lower = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "lower", "F");
+ lpCache->upper = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "upper", "F");
+ lpCache->value = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "value", "F");
+ lpCache->step_increment = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "step_increment", "F");
+ lpCache->page_increment = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "page_increment", "F");
+ lpCache->page_size = (*env)->GetFieldID(env, lpCache->GtkAdjustmentClass, "page_size", "F");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkBoxFids(JNIEnv *env, jobject lpGtkBox, PGtkBox_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkBoxClass = (*env)->GetObjectClass(env, lpGtkBox);
+ cacheGtkContainerFids(env, lpGtkBox, &PGLOB(GtkContainerFc));
+ lpCache->children = (*env)->GetFieldID(env, lpCache->GtkBoxClass, "children", "I");
+ lpCache->spacing = (*env)->GetFieldID(env, lpCache->GtkBoxClass, "spacing", "S");
+ lpCache->homogeneous = (*env)->GetFieldID(env, lpCache->GtkBoxClass, "homogeneous", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkHBoxFids(JNIEnv *env, jobject lpGtkHBox, PGtkHBox_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkHBoxClass = (*env)->GetObjectClass(env, lpGtkHBox);
+ cacheGtkBoxFids(env, lpGtkHBox, &PGLOB(GtkBoxFc));
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkMenuFids(JNIEnv *env, jobject lpGtkMenu, PGtkMenu_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkMenuClass = (*env)->GetObjectClass(env, lpGtkMenu);
+ cacheGtkMenuShellFids(env, lpGtkMenu, &PGLOB(GtkMenuShellFc));
+ lpCache->parent_menu_item = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "parent_menu_item", "I");
+ lpCache->old_active_menu_item = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "old_active_menu_item", "I");
+ lpCache->accel_group = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "accel_group", "I");
+ lpCache->position_func = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "position_func", "I");
+ lpCache->position_func_data = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "position_func_data", "I");
+ lpCache->toplevel = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "toplevel", "I");
+ lpCache->tearoff_window = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "tearoff_window", "I");
+ lpCache->torn_off = (*env)->GetFieldID(env, lpCache->GtkMenuClass, "torn_off", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkMenuShellFids(JNIEnv *env, jobject lpGtkMenuShell, PGtkMenuShell_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkMenuShellClass = (*env)->GetObjectClass(env, lpGtkMenuShell);
+ cacheGtkContainerFids(env, lpGtkMenuShell, &PGLOB(GtkContainerFc));
+ lpCache->active = (*env)->GetFieldID(env, lpCache->GtkMenuShellClass, "active", "I");
+ lpCache->cached = 1;
+
+};
+
+void cacheGtkItemFids(JNIEnv *env, jobject lpGtkItem, PGtkItem_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkItemClass = (*env)->GetObjectClass(env, lpGtkItem);
+ cacheGtkBinFids(env, lpGtkItem, &PGLOB(GtkBinFc));
+
+ lpCache->cached = 1;
+}
+
+void cacheGtkMenuItemFids(JNIEnv *env, jobject lpGtkMenuItem, PGtkMenuItem_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkMenuItemClass = (*env)->GetObjectClass(env, lpGtkMenuItem);
+ cacheGtkItemFids(env, lpGtkMenuItem, &PGLOB(GtkItemFc));
+ lpCache->submenu = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "submenu", "I");
+ lpCache->accelerator_signal = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "accelerator_signal", "I");
+ lpCache->toggle_size = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "toggle_size", "I");
+ lpCache->accelerator_width = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "accelerator_width", "I");
+ lpCache->show_toggle_indicator = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "show_toggle_indicator", "I");
+ lpCache->show_submenu_indicator = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "show_submenu_indicator", "I");
+ lpCache->submenu_placement = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "submenu_placement", "I");
+ lpCache->submenu_direction = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "submenu_direction", "I");
+ lpCache->right_justify = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "right_justify", "I");
+ lpCache->timer = (*env)->GetFieldID(env, lpCache->GtkMenuItemClass, "timer", "I");
+
+ lpCache->cached = 1;
+};
+
+void cacheGtkCListRowFids(JNIEnv *env, jobject lpGtkCListRow, PGtkCListRow_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GtkCListRowClass = (*env)->GetObjectClass(env, lpGtkCListRow);
+ lpCache->cell = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "cell", "I");
+ lpCache->state = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "state", "I");
+ lpCache->foreground_red = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "foreground_red", "S");
+ lpCache->foreground_green = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "foreground_green", "S");
+ lpCache->foreground_blue = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "foreground_blue", "S");
+ lpCache->foreground_pixel = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "foreground_pixel", "I");
+ lpCache->background_red = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "background_red", "S");
+ lpCache->background_green = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "background_green", "S");
+ lpCache->background_blue = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "background_blue", "S");
+ lpCache->background_pixel = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "background_pixel", "I");
+ lpCache->style = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "style", "I");
+ lpCache->data = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "data", "I");
+ lpCache->destroy = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "destroy", "I");
+ lpCache->fg_set = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "fg_set", "I");
+ lpCache->bg_set = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "bg_set", "I");
+ lpCache->selectable = (*env)->GetFieldID(env, lpCache->GtkCListRowClass, "selectable", "I");
+
+ lpCache->cached = 1;
+}
+
+void cacheGtkCListColumnFids(JNIEnv *env, jobject lpGtkCListColumn, PGtkCListColumn_FID_CACHE lpCache)
+{
+ if (lpCache->cached) return;
+
+ lpCache->GtkCListColumnClass = (*env)->GetObjectClass(env, lpGtkCListColumn);
+ lpCache->title = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "title", "I");
+ lpCache->area_x = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "area_x", "S");
+ lpCache->area_y = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "area_y", "S");
+ lpCache->area_width = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "area_width", "S");
+ lpCache->area_height = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "area_height", "S");
+ lpCache->button = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "button", "I");
+ lpCache->window = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "window", "I");
+ lpCache->width = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "width", "I");
+ lpCache->min_width = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "min_width", "I");
+ lpCache->max_width = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "max_width", "I");
+ lpCache->justification = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "justification", "I");
+ lpCache->visible = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "visible", "I");
+ lpCache->width_set = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "width_set", "I");
+ lpCache->resizeable = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "resizeable", "I");
+ lpCache->auto_resize = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "auto_resize", "I");
+ lpCache->button_passive = (*env)->GetFieldID(env, lpCache->GtkCListColumnClass, "button_passive", "I");
+
+ lpCache->cached = 1;
+}
+
+void cacheGtkCTreeFids(JNIEnv *env, jobject lpGtkCTree, PGtkCTree_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkCTreeClass = (*env)->GetObjectClass(env, lpGtkCTree);
+ cacheGtkCListFids(env, lpGtkCTree, &PGLOB(GtkCListFc));
+ lpCache->tree_indent = (*env)->GetFieldID(env, lpCache->GtkCTreeClass, "tree_indent", "I");
+ lpCache->tree_column = (*env)->GetFieldID(env, lpCache->GtkCTreeClass, "tree_column", "I");
+
+ lpCache->cached = 1;
+}
+
+void cacheGtkCTreeRowFids(JNIEnv *env, jobject lpGtkCTreeRow, PGtkCTreeRow_FID_CACHE lpCache)
+{
+ DECL_GLOB(pGlob)
+ if (lpCache->cached) return;
+
+ lpCache->GtkCTreeRowClass = (*env)->GetObjectClass(env, lpGtkCTreeRow);
+ cacheGtkCListRowFids(env, lpGtkCTreeRow, &PGLOB(GtkCListRowFc));
+ lpCache->parent = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "parent", "I");
+ lpCache->sibling = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "sibling", "I");
+ lpCache->children = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "children", "I");
+ lpCache->pixmap_closed = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "pixmap_closed", "I");
+ lpCache->mask_closed = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "mask_closed", "I");
+ lpCache->pixmap_opened = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "pixmap_opened", "I");
+ lpCache->mask_opened = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "mask_opened", "I");
+ lpCache->level = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "level", "S");
+ lpCache->is_leaf = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "is_leaf", "I");
+ lpCache->expanded = (*env)->GetFieldID(env, lpCache->GtkCTreeRowClass, "expanded", "I");
+
+ lpCache->cached = 1;
+}
+
+/* ----------- swt getters and setters ----------- */
+/**
+ * These functions get or set object field ids assuming that the
+ * fids for these objects have already been cached.
+ *
+ */
+void getGdkColorFields(JNIEnv *env, jobject lpObject, GdkColor *lpGdkColor, GdkColor_FID_CACHE *lpGdkColorFc)
+{
+ lpGdkColor->pixel = (*env)->GetIntField(env, lpObject, lpGdkColorFc->pixel);
+ lpGdkColor->red = (*env)->GetShortField(env, lpObject, lpGdkColorFc->red);
+ lpGdkColor->green = (*env)->GetShortField(env, lpObject, lpGdkColorFc->green);
+ lpGdkColor->blue = (*env)->GetShortField(env, lpObject, lpGdkColorFc->blue);
+}
+
+void setGdkColorFields(JNIEnv *env, jobject lpObject, GdkColor *lpGdkColor, GdkColor_FID_CACHE *lpGdkColorFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGdkColorFc->pixel, (jint)lpGdkColor->pixel);
+ (*env)->SetShortField(env, lpObject, lpGdkColorFc->red, (jshort)lpGdkColor->red);
+ (*env)->SetShortField(env, lpObject, lpGdkColorFc->green, (jshort)lpGdkColor->green);
+ (*env)->SetShortField(env, lpObject, lpGdkColorFc->blue, (jshort)lpGdkColor->blue);
+}
+
+void getGdkEventKeyFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventKey_FID_CACHE *lpGdkEventKeyFc)
+{
+ GdkEventKey *lpGdkEventKey = (GdkEventKey*)lpGdkEvent;
+ lpGdkEventKey->type = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->type);
+ lpGdkEventKey->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->window);
+ lpGdkEventKey->send_event = (*env)->GetByteField(env, lpObject, lpGdkEventKeyFc->send_event);
+ lpGdkEventKey->time = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->time);
+ lpGdkEventKey->state = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->state);
+ lpGdkEventKey->keyval = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->keyval);
+ lpGdkEventKey->length = (*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->length);
+ lpGdkEventKey->string = (char*)(*env)->GetIntField(env, lpObject, lpGdkEventKeyFc->string);
+}
+
+void setGdkEventKeyFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventKey_FID_CACHE *lpGdkEventKeyFc)
+{
+ GdkEventKey *lpGdkEventKey = (GdkEventKey*)lpGdkEvent;
+ (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->type, (jint)lpGdkEventKey->type);
+ (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->window, (jint)lpGdkEventKey->window);
+ (*env)->SetByteField(env, lpObject, lpGdkEventKeyFc->send_event, (jbyte)lpGdkEventKey->send_event);
+ (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->time, (jint)lpGdkEventKey->time);
+ (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->state, (jint)lpGdkEventKey->state);
+ (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->keyval, (jint)lpGdkEventKey->keyval);
+ (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->length, (jint)lpGdkEventKey->length);
+ (*env)->SetIntField(env, lpObject, lpGdkEventKeyFc->string, (jint)lpGdkEventKey->string);
+}
+
+void getGdkEventButtonFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventButton_FID_CACHE *lpGdkEventButtonFc)
+{
+ GdkEventButton *lpGdkEventButton = (GdkEventButton*)lpGdkEvent;
+ lpGdkEventButton->type = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->type);
+ lpGdkEventButton->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->window);
+ lpGdkEventButton->send_event = (*env)->GetByteField(env, lpObject, lpGdkEventButtonFc->send_event);
+ lpGdkEventButton->time = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->time);
+ lpGdkEventButton->x = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->x);
+ lpGdkEventButton->y = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->y);
+ lpGdkEventButton->pressure = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->pressure);
+ lpGdkEventButton->xtilt = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->xtilt);
+ lpGdkEventButton->ytilt = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->ytilt);
+ lpGdkEventButton->state = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->state);
+ lpGdkEventButton->button = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->button);
+ lpGdkEventButton->source = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->source);
+ lpGdkEventButton->deviceid = (*env)->GetIntField(env, lpObject, lpGdkEventButtonFc->deviceid);
+ lpGdkEventButton->x_root = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->x_root);
+ lpGdkEventButton->y_root = (*env)->GetLongField(env, lpObject, lpGdkEventButtonFc->y_root);
+}
+
+void setGdkEventButtonFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventButton_FID_CACHE *lpGdkEventButtonFc)
+{
+ GdkEventButton *lpGdkEventButton = (GdkEventButton*)lpGdkEvent;
+ (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->type, (jint)lpGdkEventButton->type);
+ (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->window, (jint)lpGdkEventButton->window);
+ (*env)->SetByteField(env, lpObject, lpGdkEventButtonFc->send_event, (jbyte)lpGdkEventButton->send_event);
+ (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->time, (jint)lpGdkEventButton->time);
+ (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->x, (jlong)lpGdkEventButton->x);
+ (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->y, (jlong)lpGdkEventButton->y);
+ (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->pressure, (jlong)lpGdkEventButton->pressure);
+ (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->xtilt, (jlong)lpGdkEventButton->xtilt);
+ (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->ytilt, (jlong)lpGdkEventButton->ytilt);
+ (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->state, (jint)lpGdkEventButton->state);
+ (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->button, (jint)lpGdkEventButton->button);
+ (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->source, (jint)lpGdkEventButton->source);
+ (*env)->SetIntField(env, lpObject, lpGdkEventButtonFc->deviceid, (jint)lpGdkEventButton->deviceid);
+ (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->x_root, (jlong)lpGdkEventButton->x_root);
+ (*env)->SetLongField(env, lpObject, lpGdkEventButtonFc->y_root, (jlong)lpGdkEventButton->y_root);
+}
+
+void getGdkEventMotionFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventMotion_FID_CACHE *lpGdkEventMotionFc)
+{
+ GdkEventMotion *lpGdkEventMotion = (GdkEventMotion*)lpGdkEvent;
+ lpGdkEventMotion->type = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->type);
+ lpGdkEventMotion->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->window);
+ lpGdkEventMotion->send_event = (*env)->GetByteField(env, lpObject, lpGdkEventMotionFc->send_event);
+ lpGdkEventMotion->time = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->time);
+ lpGdkEventMotion->x = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->x);
+ lpGdkEventMotion->y = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->y);
+ lpGdkEventMotion->pressure = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->pressure);
+ lpGdkEventMotion->xtilt = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->xtilt);
+ lpGdkEventMotion->ytilt = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->ytilt);
+ lpGdkEventMotion->state = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->state);
+ lpGdkEventMotion->is_hint = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->is_hint);
+ lpGdkEventMotion->source = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->source);
+ lpGdkEventMotion->deviceid = (*env)->GetIntField(env, lpObject, lpGdkEventMotionFc->deviceid);
+ lpGdkEventMotion->x_root = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->x_root);
+ lpGdkEventMotion->y_root = (*env)->GetLongField(env, lpObject, lpGdkEventMotionFc->y_root);
+}
+
+void setGdkEventMotionFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventMotion_FID_CACHE *lpGdkEventMotionFc)
+{
+ GdkEventMotion *lpGdkEventMotion = (GdkEventMotion*)lpGdkEvent;
+ (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->type, lpGdkEventMotion->type);
+ (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->window, (jint)lpGdkEventMotion->window);
+ (*env)->SetByteField(env, lpObject, lpGdkEventMotionFc->send_event, lpGdkEventMotion->send_event);
+ (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->time, (jint)lpGdkEventMotion->time);
+ (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->x, (jlong)lpGdkEventMotion->x);
+ (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->y, (jlong)lpGdkEventMotion->y);
+ (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->pressure, (jlong)lpGdkEventMotion->pressure);
+ (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->xtilt, (jlong)lpGdkEventMotion->xtilt);
+ (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->ytilt, (jlong)lpGdkEventMotion->ytilt);
+ (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->state, (jint)lpGdkEventMotion->state);
+ (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->is_hint, (jint)lpGdkEventMotion->is_hint);
+ (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->source, (jint)lpGdkEventMotion->source);
+ (*env)->SetIntField(env, lpObject, lpGdkEventMotionFc->deviceid, (jint)lpGdkEventMotion->deviceid);
+ (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->x_root, (jlong)lpGdkEventMotion->x_root);
+ (*env)->SetLongField(env, lpObject, lpGdkEventMotionFc->y_root, (jlong)lpGdkEventMotion->y_root);
+}
+
+void getGdkEventExposeFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventExpose_FID_CACHE *lpGdkEventExposeFc)
+{
+ GdkEventExpose *lpGdkEventExpose = (GdkEventExpose*)lpGdkEvent;
+ lpGdkEventExpose->area.x = (*env)->GetShortField(env, lpObject, lpGdkEventExposeFc->x);
+ lpGdkEventExpose->area.y = (*env)->GetShortField(env, lpObject, lpGdkEventExposeFc->y);
+ lpGdkEventExpose->area.width = (*env)->GetShortField(env, lpObject, lpGdkEventExposeFc->width);
+ lpGdkEventExpose->area.height = (*env)->GetShortField(env, lpObject, lpGdkEventExposeFc->height);
+ lpGdkEventExpose->count = (*env)->GetIntField(env, lpObject, lpGdkEventExposeFc->count);
+}
+
+void setGdkEventExposeFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventExpose_FID_CACHE *lpGdkEventExposeFc)
+{
+ GdkEventExpose *lpGdkEventExpose = (GdkEventExpose*)lpGdkEvent;
+ (*env)->SetShortField(env, lpObject, lpGdkEventExposeFc->x, (jshort)lpGdkEventExpose->area.x);
+ (*env)->SetShortField(env, lpObject, lpGdkEventExposeFc->y, (jshort)lpGdkEventExpose->area.y);
+ (*env)->SetShortField(env, lpObject, lpGdkEventExposeFc->width, (jshort)lpGdkEventExpose->area.width);
+ (*env)->SetShortField(env, lpObject, lpGdkEventExposeFc->height, (jshort)lpGdkEventExpose->area.height);
+ (*env)->SetIntField(env, lpObject, lpGdkEventExposeFc->count, (jint)lpGdkEventExpose->count);
+}
+
+void getGdkFontFields(JNIEnv *env, jobject lpObject, GdkFont *lpGdkFont, GdkFont_FID_CACHE *lpGdkFontFc)
+{
+ lpGdkFont->type = (*env)->GetIntField(env, lpObject, lpGdkFontFc->type);
+ lpGdkFont->ascent = (*env)->GetIntField(env, lpObject, lpGdkFontFc->ascent);
+ lpGdkFont->descent = (*env)->GetIntField(env, lpObject, lpGdkFontFc->descent);
+}
+
+void setGdkFontFields(JNIEnv *env, jobject lpObject, GdkFont *lpGdkFont, GdkFont_FID_CACHE *lpGdkFontFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGdkFontFc->type, (jint)lpGdkFont->type);
+ (*env)->SetIntField(env, lpObject, lpGdkFontFc->ascent, (jint)lpGdkFont->ascent);
+ (*env)->SetIntField(env, lpObject, lpGdkFontFc->descent, (jint)lpGdkFont->descent);
+}
+
+void getGdkGCValuesFields(JNIEnv *env, jobject lpObject, GdkGCValues *lpGdkGCValues, GdkGCValues_FID_CACHE *lpGdkGCValuesFc)
+{
+ lpGdkGCValues->foreground.pixel = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->foreground_pixel);
+ lpGdkGCValues->foreground.red = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->foreground_red);
+ lpGdkGCValues->foreground.green = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->foreground_green);
+ lpGdkGCValues->foreground.blue = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->foreground_blue);
+ lpGdkGCValues->background.pixel = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->background_pixel);
+ lpGdkGCValues->background.red = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->background_red);
+ lpGdkGCValues->background.green = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->background_green);
+ lpGdkGCValues->background.blue = (*env)->GetShortField(env, lpObject, lpGdkGCValuesFc->background_blue);
+ lpGdkGCValues->font = (GdkFont*)(*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->font);
+ lpGdkGCValues->function = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->function);
+ lpGdkGCValues->fill = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->fill);
+ lpGdkGCValues->tile = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->tile);
+ lpGdkGCValues->stipple = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->stipple);
+ lpGdkGCValues->clip_mask = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->clip_mask);
+ lpGdkGCValues->subwindow_mode = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->subwindow_mode);
+ lpGdkGCValues->ts_x_origin = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->ts_x_origin);
+ lpGdkGCValues->ts_y_origin = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->ts_y_origin);
+ lpGdkGCValues->clip_x_origin = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->clip_x_origin);
+ lpGdkGCValues->clip_y_origin = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->clip_y_origin);
+ lpGdkGCValues->graphics_exposures = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->graphics_exposures);
+ lpGdkGCValues->line_width = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->line_width);
+ lpGdkGCValues->line_style = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->line_style);
+ lpGdkGCValues->cap_style = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->cap_style);
+ lpGdkGCValues->join_style = (*env)->GetIntField(env, lpObject, lpGdkGCValuesFc->join_style);
+}
+
+void setGdkGCValuesFields(JNIEnv *env, jobject lpObject, GdkGCValues *lpGdkGCValues, GdkGCValues_FID_CACHE *lpGdkGCValuesFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->foreground_pixel, (jint)lpGdkGCValues->foreground.pixel);
+ (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->foreground_red, (jshort)lpGdkGCValues->foreground.red);
+ (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->foreground_green, (jshort)lpGdkGCValues->foreground.green);
+ (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->foreground_blue, (jshort)lpGdkGCValues->foreground.blue);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->background_pixel, (jint)lpGdkGCValues->background.pixel);
+ (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->background_red, (jshort)lpGdkGCValues->background.red);
+ (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->background_green, (jshort)lpGdkGCValues->background.green);
+ (*env)->SetShortField(env, lpObject, lpGdkGCValuesFc->background_blue, (jshort)lpGdkGCValues->background.blue);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->font, (jint)lpGdkGCValues->font);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->function, (jint)lpGdkGCValues->function);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->fill, (jint)lpGdkGCValues->fill);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->tile, (jint)lpGdkGCValues->tile);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->stipple, (jint)lpGdkGCValues->stipple);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->clip_mask, (jint)lpGdkGCValues->clip_mask);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->subwindow_mode, (jint)lpGdkGCValues->subwindow_mode);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->ts_x_origin, (jint)lpGdkGCValues->ts_x_origin);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->ts_y_origin, (jint)lpGdkGCValues->ts_y_origin);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->clip_x_origin, (jint)lpGdkGCValues->clip_x_origin);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->clip_y_origin, (jint)lpGdkGCValues->clip_y_origin);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->graphics_exposures, (jint)lpGdkGCValues->graphics_exposures);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->line_width, (jint)lpGdkGCValues->line_width);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->line_style, (jint)lpGdkGCValues->line_style);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->cap_style, (jint)lpGdkGCValues->cap_style);
+ (*env)->SetIntField(env, lpObject, lpGdkGCValuesFc->join_style, (jint)lpGdkGCValues->join_style);
+}
+
+void getGdkImageFields(JNIEnv *env, jobject lpObject, GdkImage *lpGdkImage, GdkImage_FID_CACHE *lpGdkImageFc)
+{
+ lpGdkImage->type = (*env)->GetIntField(env, lpObject, lpGdkImageFc->type);
+ lpGdkImage->visual = (GdkVisual*)(*env)->GetIntField(env, lpObject, lpGdkImageFc->visual);
+ lpGdkImage->byte_order = (*env)->GetIntField(env, lpObject, lpGdkImageFc->byte_order);
+ lpGdkImage->width = (*env)->GetShortField(env, lpObject, lpGdkImageFc->width);
+ lpGdkImage->height = (*env)->GetShortField(env, lpObject, lpGdkImageFc->height);
+ lpGdkImage->depth = (*env)->GetShortField(env, lpObject, lpGdkImageFc->depth);
+ lpGdkImage->bpp = (*env)->GetShortField(env, lpObject, lpGdkImageFc->bpp);
+ lpGdkImage->bpl = (*env)->GetShortField(env, lpObject, lpGdkImageFc->bpl);
+ lpGdkImage->mem = (gpointer)(*env)->GetIntField(env, lpObject, lpGdkImageFc->mem);
+}
+
+void setGdkImageFields(JNIEnv *env, jobject lpObject, GdkImage *lpGdkImage, GdkImage_FID_CACHE *lpGdkImageFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGdkImageFc->type, (jint)lpGdkImage->type);
+ (*env)->SetIntField(env, lpObject, lpGdkImageFc->visual, (jint)lpGdkImage->visual);
+ (*env)->SetIntField(env, lpObject, lpGdkImageFc->byte_order, (jint)lpGdkImage->byte_order);
+ (*env)->SetShortField(env, lpObject, lpGdkImageFc->width, (jshort)lpGdkImage->width);
+ (*env)->SetShortField(env, lpObject, lpGdkImageFc->height, (jshort)lpGdkImage->height);
+ (*env)->SetShortField(env, lpObject, lpGdkImageFc->depth, (jshort)lpGdkImage->depth);
+ (*env)->SetShortField(env, lpObject, lpGdkImageFc->bpp, (jshort)lpGdkImage->bpp);
+ (*env)->SetShortField(env, lpObject, lpGdkImageFc->bpl, (jshort)lpGdkImage->bpl);
+ (*env)->SetIntField(env, lpObject, lpGdkImageFc->mem, (jint)lpGdkImage->mem);
+}
+
+void getGdkPointFields(JNIEnv *env, jobject lpObject, GdkPoint *lpGdkPoint, GdkPoint_FID_CACHE *lpGdkPointFc)
+{
+ lpGdkPoint->x = (*env)->GetShortField(env, lpObject, lpGdkPointFc->x);
+ lpGdkPoint->y = (*env)->GetShortField(env, lpObject, lpGdkPointFc->y);
+}
+
+void setGdkPointFields(JNIEnv *env, jobject lpObject, GdkPoint *lpGdkPoint, GdkPoint_FID_CACHE *lpGdkPointFc)
+{
+ (*env)->SetShortField(env, lpObject, lpGdkPointFc->x, (jshort)lpGdkPoint->x);
+ (*env)->SetShortField(env, lpObject, lpGdkPointFc->y, (jshort)lpGdkPoint->y);
+}
+
+void getGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpGdkRectangle, GdkRectangle_FID_CACHE *lpGdkRectangleFc)
+{
+ lpGdkRectangle->x = (*env)->GetShortField(env, lpObject, lpGdkRectangleFc->x);
+ lpGdkRectangle->y = (*env)->GetShortField(env, lpObject, lpGdkRectangleFc->y);
+ lpGdkRectangle->width = (*env)->GetShortField(env, lpObject, lpGdkRectangleFc->width);
+ lpGdkRectangle->height = (*env)->GetShortField(env, lpObject, lpGdkRectangleFc->height);
+}
+
+void setGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpGdkRectangle, GdkRectangle_FID_CACHE *lpGdkRectangleFc)
+{
+ (*env)->SetShortField(env, lpObject, lpGdkRectangleFc->x, (jshort)lpGdkRectangle->x);
+ (*env)->SetShortField(env, lpObject, lpGdkRectangleFc->y, (jshort)lpGdkRectangle->y);
+ (*env)->SetShortField(env, lpObject, lpGdkRectangleFc->width, (jshort)lpGdkRectangle->width);
+ (*env)->SetShortField(env, lpObject, lpGdkRectangleFc->height, (jshort)lpGdkRectangle->height);
+}
+
+void getGdkVisualFields(JNIEnv *env, jobject lpObject, GdkVisual *lpGdkVisual, GdkVisual_FID_CACHE *lpGdkVisualFc)
+{
+ lpGdkVisual->type = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->type);
+ lpGdkVisual->depth = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->depth);
+ lpGdkVisual->byte_order = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->byte_order);
+ lpGdkVisual->colormap_size = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->colormap_size);
+ lpGdkVisual->bits_per_rgb = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->bits_per_rgb);
+ lpGdkVisual->red_mask = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->red_mask);
+ lpGdkVisual->red_shift = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->red_shift);
+ lpGdkVisual->red_prec = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->red_prec);
+ lpGdkVisual->green_mask = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->green_mask);
+ lpGdkVisual->green_shift = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->green_shift);
+ lpGdkVisual->green_prec = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->green_prec);
+ lpGdkVisual->blue_mask = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->blue_mask);
+ lpGdkVisual->blue_shift = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->blue_shift);
+ lpGdkVisual->blue_prec = (*env)->GetIntField(env, lpObject, lpGdkVisualFc->blue_prec);
+}
+
+void setGdkVisualFields(JNIEnv *env, jobject lpObject, GdkVisual *lpGdkVisual, GdkVisual_FID_CACHE *lpGdkVisualFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->type, (jint)lpGdkVisual->type);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->depth, (jint)lpGdkVisual->depth);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->byte_order, (jint)lpGdkVisual->byte_order);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->colormap_size, (jint)lpGdkVisual->colormap_size);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->bits_per_rgb, (jint)lpGdkVisual->bits_per_rgb);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->red_mask, (jint)lpGdkVisual->red_mask);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->red_shift, (jint)lpGdkVisual->red_shift);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->red_prec, (jint)lpGdkVisual->red_prec);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->green_mask, (jint)lpGdkVisual->green_mask);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->green_shift, (jint)lpGdkVisual->green_shift);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->green_prec, (jint)lpGdkVisual->green_prec);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->blue_mask, (jint)lpGdkVisual->blue_mask);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->blue_shift, (jint)lpGdkVisual->blue_shift);
+ (*env)->SetIntField(env, lpObject, lpGdkVisualFc->blue_prec, (jint)lpGdkVisual->blue_prec);
+}
+
+void getGtkAllocationFields(JNIEnv *env, jobject lpObject, GtkAllocation *lpGtkAllocation, GtkAllocation_FID_CACHE *lpGtkAllocationFc)
+{
+ lpGtkAllocation->x = (*env)->GetShortField(env, lpObject, lpGtkAllocationFc->x);
+ lpGtkAllocation->y = (*env)->GetShortField(env, lpObject, lpGtkAllocationFc->y);
+ lpGtkAllocation->width = (*env)->GetShortField(env, lpObject, lpGtkAllocationFc->width);
+ lpGtkAllocation->height = (*env)->GetShortField(env, lpObject, lpGtkAllocationFc->height);
+}
+
+void setGtkAllocationFields(JNIEnv *env, jobject lpObject, GtkAllocation *lpGtkAllocation, GtkAllocation_FID_CACHE *lpGtkAllocationFc)
+{
+ (*env)->SetShortField(env, lpObject, lpGtkAllocationFc->x, lpGtkAllocation->x);
+ (*env)->SetShortField(env, lpObject, lpGtkAllocationFc->y, lpGtkAllocation->y);
+ (*env)->SetShortField(env, lpObject, lpGtkAllocationFc->width, lpGtkAllocation->width);
+ (*env)->SetShortField(env, lpObject, lpGtkAllocationFc->height, lpGtkAllocation->height);
+}
+
+void getGtkArgFields(JNIEnv *env, jobject lpObject, GtkArg *lpGtkArg, GtkArg_FID_CACHE *lpGtkArgFc)
+{
+ fprintf(stderr, "WARNING: Unimplemented method getGtkArgFields.\n");
+}
+
+void setGtkArgFields(JNIEnv *env, jobject lpObject, GtkArg *lpGtkArg, GtkArg_FID_CACHE *lpGtkArgFc)
+{
+ fprintf(stderr, "WARNING: Unimplemented method setGtkArgFields.\n");
+}
+
+void getGtkBinFields(JNIEnv *env, jobject lpObject, GtkBin *lpGtkBin, GtkBin_FID_CACHE *lpGtkBinFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkContainerFields(env, lpObject, &lpGtkBin->container, &PGLOB(GtkContainerFc));
+ lpGtkBin->child = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkBinFc->child);
+}
+
+void setGtkBinFields(JNIEnv *env, jobject lpObject, GtkBin *lpGtkBin, GtkBin_FID_CACHE *lpGtkBinFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkContainerFields(env, lpObject, &lpGtkBin->container, &PGLOB(GtkContainerFc));
+ (*env)->SetIntField(env, lpObject, lpGtkBinFc->child, (jint)lpGtkBin->child);
+}
+
+void getGtkBoxFields(JNIEnv *env, jobject lpObject, GtkBox *lpGtkBox, GtkBox_FID_CACHE *lpGtkBoxFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkContainerFields(env, lpObject, &lpGtkBox->container, &PGLOB(GtkContainerFc));
+ lpGtkBox->children = (GList*)(*env)->GetIntField(env, lpObject, lpGtkBoxFc->children);
+ lpGtkBox->spacing = (*env)->GetShortField(env, lpObject, lpGtkBoxFc->spacing);
+ lpGtkBox->homogeneous = (*env)->GetIntField(env, lpObject, lpGtkBoxFc->homogeneous);
+}
+
+void setGtkBoxFields(JNIEnv *env, jobject lpObject, GtkBox *lpGtkBox, GtkBox_FID_CACHE *lpGtkBoxFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkContainerFields(env, lpObject, &lpGtkBox->container, &PGLOB(GtkContainerFc));
+ (*env)->SetIntField(env, lpObject, lpGtkBoxFc->children, (jint)lpGtkBox->children);
+ (*env)->SetShortField(env, lpObject, lpGtkBoxFc->spacing, (jshort)lpGtkBox->spacing);
+ (*env)->SetIntField(env, lpObject, lpGtkBoxFc->homogeneous, (jint)lpGtkBox->homogeneous);
+}
+
+void getGtkCListFields(JNIEnv *env, jobject lpObject, GtkCList *lpGtkCList, GtkCList_FID_CACHE *lpGtkCListFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkContainerFields(env, lpObject, &lpGtkCList->container, &PGLOB(GtkContainerFc));
+ lpGtkCList->flags = (*env)->GetShortField(env, lpObject, lpGtkCListFc->clist_flags);
+ lpGtkCList->row_mem_chunk = (GMemChunk*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->row_mem_chunk);
+ lpGtkCList->cell_mem_chunk = (GMemChunk*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->cell_mem_chunk);
+ lpGtkCList->freeze_count = (*env)->GetIntField(env, lpObject, lpGtkCListFc->freeze_count);
+ lpGtkCList->internal_allocation.x = (*env)->GetShortField(env, lpObject, lpGtkCListFc->internal_allocation_x);
+ lpGtkCList->internal_allocation.y = (*env)->GetShortField(env, lpObject, lpGtkCListFc->internal_allocation_y);
+ lpGtkCList->internal_allocation.width = (*env)->GetShortField(env, lpObject, lpGtkCListFc->internal_allocation_width);
+ lpGtkCList->internal_allocation.height = (*env)->GetShortField(env, lpObject, lpGtkCListFc->internal_allocation_height);
+ lpGtkCList->rows = (*env)->GetIntField(env, lpObject, lpGtkCListFc->rows);
+ lpGtkCList->row_center_offset = (*env)->GetIntField(env, lpObject, lpGtkCListFc->row_center_offset);
+ lpGtkCList->row_height = (*env)->GetIntField(env, lpObject, lpGtkCListFc->row_height);
+ lpGtkCList->row_list = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->row_list);
+ lpGtkCList->row_list_end = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->row_list_end);
+ lpGtkCList->columns = (*env)->GetIntField(env, lpObject, lpGtkCListFc->columns);
+ lpGtkCList->column_title_area.x = (*env)->GetShortField(env, lpObject, lpGtkCListFc->column_title_area_x);
+ lpGtkCList->column_title_area.y = (*env)->GetShortField(env, lpObject, lpGtkCListFc->column_title_area_y);
+ lpGtkCList->column_title_area.width = (*env)->GetShortField(env, lpObject, lpGtkCListFc->column_title_area_width);
+ lpGtkCList->column_title_area.height = (*env)->GetShortField(env, lpObject, lpGtkCListFc->column_title_area_height);
+ lpGtkCList->title_window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->title_window);
+ lpGtkCList->column = (GtkCListColumn*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->column);
+ lpGtkCList->clist_window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->clist_window);
+ lpGtkCList->clist_window_width = (*env)->GetIntField(env, lpObject, lpGtkCListFc->clist_window_width);
+ lpGtkCList->clist_window_height = (*env)->GetIntField(env, lpObject, lpGtkCListFc->clist_window_height);
+ lpGtkCList->hoffset = (*env)->GetIntField(env, lpObject, lpGtkCListFc->hoffset);
+ lpGtkCList->voffset = (*env)->GetIntField(env, lpObject, lpGtkCListFc->voffset);
+ lpGtkCList->shadow_type = (*env)->GetIntField(env, lpObject, lpGtkCListFc->shadow_type);
+ lpGtkCList->selection_mode = (*env)->GetIntField(env, lpObject, lpGtkCListFc->selection_mode);
+ lpGtkCList->selection = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->selection);
+ lpGtkCList->selection_end = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->selection_end);
+ lpGtkCList->undo_selection = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->undo_selection);
+ lpGtkCList->undo_unselection = (GList*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->undo_unselection);
+ lpGtkCList->undo_anchor = (*env)->GetIntField(env, lpObject, lpGtkCListFc->undo_anchor);
+ lpGtkCList->button_actions[0] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions0);
+ lpGtkCList->button_actions[1] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions1);
+ lpGtkCList->button_actions[2] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions2);
+ lpGtkCList->button_actions[3] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions3);
+ lpGtkCList->button_actions[4] = (*env)->GetByteField(env, lpObject, lpGtkCListFc->button_actions4);
+ lpGtkCList->drag_button = (*env)->GetByteField(env, lpObject, lpGtkCListFc->drag_button);
+ lpGtkCList->click_cell.row = (*env)->GetIntField(env, lpObject, lpGtkCListFc->click_cell_row);
+ lpGtkCList->click_cell.column = (*env)->GetIntField(env, lpObject, lpGtkCListFc->click_cell_column);
+ lpGtkCList->hadjustment = (GtkAdjustment*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->hadjustment);
+ lpGtkCList->vadjustment = (GtkAdjustment*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->vadjustment);
+ lpGtkCList->xor_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->xor_gc);
+ lpGtkCList->bg_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->bg_gc);
+ lpGtkCList->bg_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->bg_gc);
+ lpGtkCList->cursor_drag = (GdkCursor*)(*env)->GetIntField(env, lpObject, lpGtkCListFc->cursor_drag);
+ lpGtkCList->x_drag = (*env)->GetIntField(env, lpObject, lpGtkCListFc->x_drag);
+ lpGtkCList->focus_row = (*env)->GetIntField(env, lpObject, lpGtkCListFc->focus_row);
+ lpGtkCList->anchor = (*env)->GetIntField(env, lpObject, lpGtkCListFc->anchor);
+ lpGtkCList->anchor_state = (*env)->GetIntField(env, lpObject, lpGtkCListFc->anchor_state);
+ lpGtkCList->drag_pos = (*env)->GetIntField(env, lpObject, lpGtkCListFc->drag_pos);
+ lpGtkCList->htimer = (*env)->GetIntField(env, lpObject, lpGtkCListFc->htimer);
+ lpGtkCList->vtimer = (*env)->GetIntField(env, lpObject, lpGtkCListFc->vtimer);
+ lpGtkCList->sort_type = (*env)->GetIntField(env, lpObject, lpGtkCListFc->sort_type);
+ lpGtkCList->compare = (GtkCListCompareFunc)(*env)->GetIntField(env, lpObject, lpGtkCListFc->compare);
+ lpGtkCList->sort_column = (*env)->GetIntField(env, lpObject, lpGtkCListFc->sort_column);
+}
+
+void setGtkCListFields(JNIEnv *env, jobject lpObject, GtkCList *lpGtkCList, GtkCList_FID_CACHE *lpGtkCListFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkContainerFields(env, lpObject, &lpGtkCList->container, &PGLOB(GtkContainerFc));
+ (*env)->SetShortField(env, lpObject, lpGtkCListFc->clist_flags, (jshort)lpGtkCList->flags);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_mem_chunk, (jint)lpGtkCList->row_mem_chunk);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->cell_mem_chunk, (jint)lpGtkCList->cell_mem_chunk);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->freeze_count, (jint)lpGtkCList->freeze_count);
+ (*env)->SetShortField(env, lpObject, lpGtkCListFc->internal_allocation_x, (jshort)lpGtkCList->internal_allocation.x);
+ (*env)->SetShortField(env, lpObject, lpGtkCListFc->internal_allocation_y, (jshort)lpGtkCList->internal_allocation.y);
+ (*env)->SetShortField(env, lpObject, lpGtkCListFc->internal_allocation_width, (jshort)lpGtkCList->internal_allocation.width);
+ (*env)->SetShortField(env, lpObject, lpGtkCListFc->internal_allocation_height, (jshort)lpGtkCList->internal_allocation.height);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->rows, (jint)lpGtkCList->rows);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_center_offset, (jint)lpGtkCList->row_center_offset);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_height, (jint)lpGtkCList->row_height);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_list, (jint)lpGtkCList->row_list);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->row_list_end, (jint)lpGtkCList->row_list_end);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->columns, (jint)lpGtkCList->columns);
+ (*env)->SetShortField(env, lpObject, lpGtkCListFc->column_title_area_x, (jshort)lpGtkCList->column_title_area.x);
+ (*env)->SetShortField(env, lpObject, lpGtkCListFc->column_title_area_y, (jshort)lpGtkCList->column_title_area.y);
+ (*env)->SetShortField(env, lpObject, lpGtkCListFc->column_title_area_width, (jshort)lpGtkCList->column_title_area.width);
+ (*env)->SetShortField(env, lpObject, lpGtkCListFc->column_title_area_height, (jshort)lpGtkCList->column_title_area.height);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->title_window, (jint)lpGtkCList->title_window);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->column, (jint)lpGtkCList->column);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->clist_window, (jint)lpGtkCList->clist_window);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->clist_window_width, (jint)lpGtkCList->clist_window_width);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->clist_window_height, (jint)lpGtkCList->clist_window_height);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->hoffset, (jint)lpGtkCList->hoffset);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->voffset, (jint)lpGtkCList->voffset);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->shadow_type, (jint)lpGtkCList->shadow_type);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->selection_mode, (jint)lpGtkCList->selection_mode);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->selection, (jint)lpGtkCList->selection);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->selection_end, (jint)lpGtkCList->selection_end);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->undo_selection, (jint)lpGtkCList->undo_selection);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->undo_unselection, (jint)lpGtkCList->undo_unselection);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->undo_anchor, (jint)lpGtkCList->undo_anchor);
+ (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions0, (jbyte)lpGtkCList->button_actions[0]);
+ (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions1, (jbyte)lpGtkCList->button_actions[1]);
+ (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions2, (jbyte)lpGtkCList->button_actions[2]);
+ (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions3, (jbyte)lpGtkCList->button_actions[3]);
+ (*env)->SetByteField(env, lpObject, lpGtkCListFc->button_actions4, (jbyte)lpGtkCList->button_actions[4]);
+ (*env)->SetByteField(env, lpObject, lpGtkCListFc->drag_button, (jbyte)lpGtkCList->drag_button);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->click_cell_row, (jint)lpGtkCList->click_cell.row);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->click_cell_column, (jint)lpGtkCList->click_cell.column);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->hadjustment, (jint)lpGtkCList->hadjustment);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->vadjustment, (jint)lpGtkCList->vadjustment);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->xor_gc, (jint)lpGtkCList->xor_gc);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->bg_gc, (jint)lpGtkCList->bg_gc);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->bg_gc, (jint)lpGtkCList->bg_gc);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->cursor_drag, (jint)lpGtkCList->cursor_drag);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->x_drag, (jint)lpGtkCList->x_drag);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->focus_row, (jint)lpGtkCList->focus_row);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->anchor, (jint)lpGtkCList->anchor);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->anchor_state, (jint)lpGtkCList->anchor_state);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->drag_pos, (jint)lpGtkCList->drag_pos);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->htimer, (jint)lpGtkCList->htimer);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->vtimer, (jint)lpGtkCList->vtimer);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->sort_type, (jint)lpGtkCList->sort_type);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->compare, (jint)lpGtkCList->compare);
+ (*env)->SetIntField(env, lpObject, lpGtkCListFc->sort_column, (jint)lpGtkCList->sort_column);
+}
+
+void getGtkColorSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkColorSelectionDialog *lpGtkColorSelectionDialog, GtkColorSelectionDialog_FID_CACHE *lpGtkColorSelectionDialogFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkWindowFields(env, lpObject, &lpGtkColorSelectionDialog->window, &PGLOB(GtkWindowFc));
+ lpGtkColorSelectionDialog->colorsel = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->colorsel);
+ lpGtkColorSelectionDialog->main_vbox = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->main_vbox);
+ lpGtkColorSelectionDialog->ok_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->ok_button);
+ lpGtkColorSelectionDialog->reset_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->reset_button);
+ lpGtkColorSelectionDialog->cancel_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->cancel_button);
+ lpGtkColorSelectionDialog->help_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkColorSelectionDialogFc->help_button);
+}
+
+void setGtkColorSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkColorSelectionDialog *lpGtkColorSelectionDialog, GtkColorSelectionDialog_FID_CACHE *lpGtkColorSelectionDialogFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkWindowFields(env, lpObject, &lpGtkColorSelectionDialog->window, &PGLOB(GtkWindowFc));
+ (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->colorsel, (jint)lpGtkColorSelectionDialog->colorsel);
+ (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->main_vbox, (jint)lpGtkColorSelectionDialog->main_vbox);
+ (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->ok_button, (jint)lpGtkColorSelectionDialog->ok_button);
+ (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->reset_button, (jint)lpGtkColorSelectionDialog->reset_button);
+ (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->cancel_button, (jint)lpGtkColorSelectionDialog->cancel_button);
+ (*env)->SetIntField(env, lpObject, lpGtkColorSelectionDialogFc->help_button, (jint)lpGtkColorSelectionDialog->help_button);
+}
+
+void getGtkComboFields(JNIEnv *env, jobject lpObject, GtkCombo *lpGtkCombo, GtkCombo_FID_CACHE *lpGtkComboFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkHBoxFields(env, lpObject, &lpGtkCombo->hbox, &PGLOB(GtkHBoxFc));
+ lpGtkCombo->entry = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->entry);
+ lpGtkCombo->button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->button);
+ lpGtkCombo->popup = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->popup);
+ lpGtkCombo->popwin = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->popwin);
+ lpGtkCombo->list = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkComboFc->list);
+ lpGtkCombo->entry_change_id = (*env)->GetIntField(env, lpObject, lpGtkComboFc->entry_change_id);
+ lpGtkCombo->list_change_id = (*env)->GetIntField(env, lpObject, lpGtkComboFc->list_change_id);
+ lpGtkCombo->value_in_list = (*env)->GetIntField(env, lpObject, lpGtkComboFc->value_in_list);
+ lpGtkCombo->ok_if_empty = (*env)->GetIntField(env, lpObject, lpGtkComboFc->ok_if_empty);
+ lpGtkCombo->case_sensitive = (*env)->GetIntField(env, lpObject, lpGtkComboFc->case_sensitive);
+ lpGtkCombo->use_arrows = (*env)->GetIntField(env, lpObject, lpGtkComboFc->use_arrows);
+ lpGtkCombo->use_arrows_always = (*env)->GetIntField(env, lpObject, lpGtkComboFc->use_arrows_always);
+ lpGtkCombo->current_button = (*env)->GetShortField(env, lpObject, lpGtkComboFc->current_button);
+ lpGtkCombo->activate_id = (*env)->GetIntField(env, lpObject, lpGtkComboFc->activate_id);
+}
+
+void setGtkComboFields(JNIEnv *env, jobject lpObject, GtkCombo *lpGtkCombo, GtkCombo_FID_CACHE *lpGtkComboFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkHBoxFields(env, lpObject, &lpGtkCombo->hbox, &PGLOB(GtkHBoxFc));
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->entry, (jint)lpGtkCombo->entry);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->button, (jint)lpGtkCombo->button);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->popup, (jint)lpGtkCombo->popup);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->popwin, (jint)lpGtkCombo->popwin);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->list, (jint)lpGtkCombo->list);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->entry_change_id, (jint)lpGtkCombo->entry_change_id);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->list_change_id, (jint)lpGtkCombo->list_change_id);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->value_in_list, (jint)lpGtkCombo->value_in_list);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->ok_if_empty, (jint)lpGtkCombo->ok_if_empty);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->case_sensitive, (jint)lpGtkCombo->case_sensitive);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->use_arrows, (jint)lpGtkCombo->use_arrows);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->use_arrows_always, (jint)lpGtkCombo->use_arrows_always);
+ (*env)->SetShortField(env, lpObject, lpGtkComboFc->current_button, (jshort)lpGtkCombo->current_button);
+ (*env)->SetIntField(env, lpObject, lpGtkComboFc->activate_id, (jint)lpGtkCombo->activate_id);
+}
+
+void getGtkContainerFields(JNIEnv *env, jobject lpObject, GtkContainer *lpGtkContainer, GtkContainer_FID_CACHE *lpGtkContainerFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkWidgetFields(env, lpObject, &lpGtkContainer->widget, &PGLOB(GtkWidgetFc));
+ lpGtkContainer->focus_child = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkContainerFc->focus_child);
+ lpGtkContainer->border_width = (*env)->GetIntField(env, lpObject, lpGtkContainerFc->border_width);
+ lpGtkContainer->need_resize = (*env)->GetIntField(env, lpObject, lpGtkContainerFc->need_resize);
+ lpGtkContainer->resize_mode = (*env)->GetIntField(env, lpObject, lpGtkContainerFc->resize_mode);
+ lpGtkContainer->resize_widgets = (GSList*)(*env)->GetIntField(env, lpObject, lpGtkContainerFc->resize_widgets);
+}
+
+void setGtkContainerFields(JNIEnv *env, jobject lpObject, GtkContainer *lpGtkContainer, GtkContainer_FID_CACHE *lpGtkContainerFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkWidgetFields(env, lpObject, &lpGtkContainer->widget, &PGLOB(GtkWidgetFc));
+ (*env)->SetIntField(env, lpObject, lpGtkContainerFc->focus_child, (jint)lpGtkContainer->focus_child);
+ (*env)->SetIntField(env, lpObject, lpGtkContainerFc->border_width, (jint)lpGtkContainer->border_width);
+ (*env)->SetIntField(env, lpObject, lpGtkContainerFc->need_resize, (jint)lpGtkContainer->need_resize);
+ (*env)->SetIntField(env, lpObject, lpGtkContainerFc->resize_mode, (jint)lpGtkContainer->resize_mode);
+ (*env)->SetIntField(env, lpObject, lpGtkContainerFc->resize_widgets, (jint)lpGtkContainer->resize_widgets);
+}
+
+void getGtkEditableFields(JNIEnv *env, jobject lpObject, GtkEditable *lpGtkEditable, GtkEditable_FID_CACHE *lpGtkEditableFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkWidgetFields(env, lpObject, &lpGtkEditable->widget, &PGLOB(GtkWidgetFc));
+ lpGtkEditable->current_pos = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->current_pos);
+ lpGtkEditable->selection_start_pos = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->selection_start_pos);
+ lpGtkEditable->selection_end_pos = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->selection_end_pos);
+ lpGtkEditable->has_selection = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->has_selection);
+ lpGtkEditable->editable = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->editable);
+ lpGtkEditable->visible = (*env)->GetIntField(env, lpObject, lpGtkEditableFc->visible);
+ lpGtkEditable->ic = (GdkIC*)(*env)->GetIntField(env, lpObject, lpGtkEditableFc->ic);
+ lpGtkEditable->ic_attr = (GdkICAttr*)(*env)->GetIntField(env, lpObject, lpGtkEditableFc->ic_attr);
+ lpGtkEditable->clipboard_text = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkEditableFc->clipboard_text);
+}
+
+void setGtkEditableFields(JNIEnv *env, jobject lpObject, GtkEditable *lpGtkEditable, GtkEditable_FID_CACHE *lpGtkEditableFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkWidgetFields(env, lpObject, &lpGtkEditable->widget, &PGLOB(GtkWidgetFc));
+ (*env)->SetIntField(env, lpObject, lpGtkEditableFc->current_pos, (jint)lpGtkEditable->current_pos);
+ (*env)->SetIntField(env, lpObject, lpGtkEditableFc->selection_start_pos, (jint)lpGtkEditable->selection_start_pos);
+ (*env)->SetIntField(env, lpObject, lpGtkEditableFc->selection_end_pos, (jint)lpGtkEditable->selection_end_pos);
+ (*env)->SetIntField(env, lpObject, lpGtkEditableFc->has_selection, (jint)lpGtkEditable->has_selection);
+ (*env)->SetIntField(env, lpObject, lpGtkEditableFc->editable, (jint)lpGtkEditable->editable);
+ (*env)->SetIntField(env, lpObject, lpGtkEditableFc->visible, (jint)lpGtkEditable->visible);
+ (*env)->SetIntField(env, lpObject, lpGtkEditableFc->ic, (jint)lpGtkEditable->ic);
+ (*env)->SetIntField(env, lpObject, lpGtkEditableFc->ic_attr, (jint)lpGtkEditable->ic_attr);
+ (*env)->SetIntField(env, lpObject, lpGtkEditableFc->clipboard_text, (jint)lpGtkEditable->clipboard_text);
+}
+
+void getGtkTextFields(JNIEnv *env, jobject lpObject, GtkText *lpGtkText, GtkText_FID_CACHE *lpGtkTextFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkEditableFields(env, lpObject, &lpGtkText->editable, &PGLOB(GtkEditableFc));
+
+ lpGtkText->first_line_start_index = (*env)->GetIntField(env, lpObject, lpGtkTextFc->first_line_start_index);
+ lpGtkText->first_onscreen_hor_pixel = (*env)->GetIntField(env, lpObject, lpGtkTextFc->first_onscreen_hor_pixel);
+ lpGtkText->first_onscreen_ver_pixel = (*env)->GetIntField(env, lpObject, lpGtkTextFc->first_onscreen_ver_pixel);
+ lpGtkText->default_tab_width = (*env)->GetIntField(env, lpObject, lpGtkTextFc->default_tab_width);
+ lpGtkText->cursor_pos_x = (*env)->GetIntField(env, lpObject, lpGtkTextFc->cursor_pos_x);
+ lpGtkText->cursor_pos_y = (*env)->GetIntField(env, lpObject, lpGtkTextFc->cursor_pos_y);
+ lpGtkText->cursor_virtual_x = (*env)->GetIntField(env, lpObject, lpGtkTextFc->cursor_virtual_x);
+}
+
+void setGtkTextFields(JNIEnv *env, jobject lpObject, GtkText *lpGtkText, GtkText_FID_CACHE *lpGtkTextFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkEditableFields(env, lpObject, &lpGtkText->editable, &PGLOB(GtkEditableFc));
+ (*env)->SetIntField(env, lpObject, lpGtkTextFc->first_line_start_index, (jint)lpGtkText->first_line_start_index);
+ (*env)->SetIntField(env, lpObject, lpGtkTextFc->first_onscreen_hor_pixel, (jint)lpGtkText->first_onscreen_hor_pixel);
+ (*env)->SetIntField(env, lpObject, lpGtkTextFc->first_onscreen_ver_pixel, (jint)lpGtkText->first_onscreen_ver_pixel);
+ (*env)->SetIntField(env, lpObject, lpGtkTextFc->default_tab_width, (jint)lpGtkText->default_tab_width);
+ (*env)->SetIntField(env, lpObject, lpGtkTextFc->cursor_pos_x, (jint)lpGtkText->cursor_pos_x);
+ (*env)->SetIntField(env, lpObject, lpGtkTextFc->cursor_pos_y, (jint)lpGtkText->cursor_pos_y);
+ (*env)->SetIntField(env, lpObject, lpGtkTextFc->cursor_virtual_x, (jint)lpGtkText->cursor_virtual_x);
+}
+
+void getGtkFileSelectionFields(JNIEnv *env, jobject lpObject, GtkFileSelection *lpGtkFileSelection, GtkFileSelection_FID_CACHE *lpGtkFileSelectionFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkWindowFields(env, lpObject, &lpGtkFileSelection->window, &PGLOB(GtkWindowFc));
+ lpGtkFileSelection->dir_list = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->dir_list);
+ lpGtkFileSelection->file_list = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->file_list);
+ lpGtkFileSelection->selection_entry = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->selection_entry);
+ lpGtkFileSelection->selection_text = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->selection_text);
+ lpGtkFileSelection->main_vbox = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->main_vbox);
+ lpGtkFileSelection->ok_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->ok_button);
+ lpGtkFileSelection->cancel_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->cancel_button);
+ lpGtkFileSelection->help_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->help_button);
+ lpGtkFileSelection->history_pulldown = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->history_pulldown);
+ lpGtkFileSelection->history_menu = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->history_menu);
+ lpGtkFileSelection->history_list = (GList*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->history_list);
+ lpGtkFileSelection->fileop_dialog = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_dialog);
+ lpGtkFileSelection->fileop_entry = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_entry);
+ lpGtkFileSelection->fileop_file = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_file);
+ lpGtkFileSelection->cmpl_state = (gpointer)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->cmpl_state);
+ lpGtkFileSelection->fileop_c_dir = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_c_dir);
+ lpGtkFileSelection->fileop_del_file = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_del_file);
+ lpGtkFileSelection->fileop_ren_file = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_ren_file);
+ lpGtkFileSelection->button_area = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->button_area);
+ lpGtkFileSelection->action_area = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFileSelectionFc->action_area);
+}
+
+void setGtkFileSelectionFields(JNIEnv *env, jobject lpObject, GtkFileSelection *lpGtkFileSelection, GtkFileSelection_FID_CACHE *lpGtkFileSelectionFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkWindowFields(env, lpObject, &lpGtkFileSelection->window, &PGLOB(GtkWindowFc));
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->dir_list, (jint)lpGtkFileSelection->dir_list);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->file_list, (jint)lpGtkFileSelection->file_list);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->selection_entry, (jint)lpGtkFileSelection->selection_entry);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->selection_text, (jint)lpGtkFileSelection->selection_text);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->main_vbox, (jint)lpGtkFileSelection->main_vbox);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->ok_button, (jint)lpGtkFileSelection->ok_button);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->cancel_button, (jint)lpGtkFileSelection->cancel_button);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->help_button, (jint)lpGtkFileSelection->help_button);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->history_pulldown, (jint)lpGtkFileSelection->history_pulldown);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->history_menu, (jint)lpGtkFileSelection->history_menu);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->history_list, (jint)lpGtkFileSelection->history_list);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_dialog, (jint)lpGtkFileSelection->fileop_dialog);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_entry, (jint)lpGtkFileSelection->fileop_entry);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_file, (jint)lpGtkFileSelection->fileop_file);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->cmpl_state, (jint)lpGtkFileSelection->cmpl_state);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_c_dir, (jint)lpGtkFileSelection->fileop_c_dir);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_del_file, (jint)lpGtkFileSelection->fileop_del_file);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->fileop_ren_file, (jint)lpGtkFileSelection->fileop_ren_file);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->button_area, (jint)lpGtkFileSelection->button_area);
+ (*env)->SetIntField(env, lpObject, lpGtkFileSelectionFc->action_area, (jint)lpGtkFileSelection->action_area);
+}
+
+void getGtkFontSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkFontSelectionDialog *lpGtkFontSelectionDialog, GtkFontSelectionDialog_FID_CACHE *lpGtkFontSelectionDialogFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkWindowFields(env, lpObject, &lpGtkFontSelectionDialog->window, &PGLOB(GtkWindowFc));
+ lpGtkFontSelectionDialog->fontsel = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->fontsel);
+ lpGtkFontSelectionDialog->main_vbox = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->main_vbox);
+ lpGtkFontSelectionDialog->action_area = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->action_area);
+ lpGtkFontSelectionDialog->ok_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->ok_button);
+ lpGtkFontSelectionDialog->apply_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->apply_button);
+ lpGtkFontSelectionDialog->cancel_button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->cancel_button);
+ lpGtkFontSelectionDialog->dialog_width = (*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->dialog_width);
+ lpGtkFontSelectionDialog->auto_resize = (*env)->GetIntField(env, lpObject, lpGtkFontSelectionDialogFc->auto_resize);
+}
+
+void setGtkFontSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkFontSelectionDialog *lpGtkFontSelectionDialog, GtkFontSelectionDialog_FID_CACHE *lpGtkFontSelectionDialogFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkWindowFields(env, lpObject, &lpGtkFontSelectionDialog->window, &PGLOB(GtkWindowFc));
+ (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->fontsel, (jint)lpGtkFontSelectionDialog->fontsel);
+ (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->main_vbox, (jint)lpGtkFontSelectionDialog->main_vbox);
+ (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->action_area, (jint)lpGtkFontSelectionDialog->action_area);
+ (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->ok_button, (jint)lpGtkFontSelectionDialog->ok_button);
+ (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->apply_button, (jint)lpGtkFontSelectionDialog->apply_button);
+ (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->cancel_button, (jint)lpGtkFontSelectionDialog->cancel_button);
+ (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->dialog_width, (jint)lpGtkFontSelectionDialog->dialog_width);
+ (*env)->SetIntField(env, lpObject, lpGtkFontSelectionDialogFc->auto_resize, (jint)lpGtkFontSelectionDialog->auto_resize);
+}
+
+void getGtkHBoxFields(JNIEnv *env, jobject lpObject, GtkHBox *lpGtkHBox, GtkHBox_FID_CACHE *lpGtkHBoxFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkBoxFields(env, lpObject, &lpGtkHBox->box, &PGLOB(GtkBoxFc));
+}
+
+void setGtkHBoxFields(JNIEnv *env, jobject lpObject, GtkHBox *lpGtkHBox, GtkHBox_FID_CACHE *lpGtkHBoxFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkBoxFields(env, lpObject, &lpGtkHBox->box, &PGLOB(GtkBoxFc));
+}
+
+void getGtkObjectFields(JNIEnv *env, jobject lpObject, GtkObject *lpGtkObject, GtkObject_FID_CACHE *lpGtkObjectFc)
+{
+ lpGtkObject->klass = (GtkObjectClass*)(*env)->GetIntField(env, lpObject, lpGtkObjectFc->klass);
+ lpGtkObject->flags = (*env)->GetIntField(env, lpObject, lpGtkObjectFc->flags);
+ lpGtkObject->ref_count = (*env)->GetIntField(env, lpObject, lpGtkObjectFc->ref_count);
+ lpGtkObject->object_data = (GData*)(*env)->GetIntField(env, lpObject, lpGtkObjectFc->object_data);
+}
+
+void setGtkObjectFields(JNIEnv *env, jobject lpObject, GtkObject *lpGtkObject, GtkObject_FID_CACHE *lpGtkObjectFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGtkObjectFc->klass, (jint)lpGtkObject->klass);
+ (*env)->SetIntField(env, lpObject, lpGtkObjectFc->flags, (jint)lpGtkObject->flags);
+ (*env)->SetIntField(env, lpObject, lpGtkObjectFc->ref_count, (jint)lpGtkObject->ref_count);
+ (*env)->SetIntField(env, lpObject, lpGtkObjectFc->object_data, (jint)lpGtkObject->object_data);
+}
+
+void getGtkProgressFields(JNIEnv *env, jobject lpObject, GtkProgress *lpGtkProgress, GtkProgress_FID_CACHE *lpGtkProgressFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkWidgetFields(env, lpObject, &lpGtkProgress->widget, &PGLOB(GtkWidgetFc));
+ lpGtkProgress->adjustment = (GtkAdjustment*)(*env)->GetIntField(env, lpObject, lpGtkProgressFc->adjustment);
+ lpGtkProgress->offscreen_pixmap = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkProgressFc->offscreen_pixmap);
+ lpGtkProgress->format = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkProgressFc->format);
+ lpGtkProgress->x_align = (*env)->GetFloatField(env, lpObject, lpGtkProgressFc->x_align);
+ lpGtkProgress->y_align = (*env)->GetFloatField(env, lpObject, lpGtkProgressFc->y_align);
+ lpGtkProgress->show_text = (*env)->GetIntField(env, lpObject, lpGtkProgressFc->show_text);
+ lpGtkProgress->activity_mode = (*env)->GetIntField(env, lpObject, lpGtkProgressFc->activity_mode);
+}
+
+void setGtkProgressFields(JNIEnv *env, jobject lpObject, GtkProgress *lpGtkProgress, GtkProgress_FID_CACHE *lpGtkProgressFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkWidgetFields(env, lpObject, &lpGtkProgress->widget, &PGLOB(GtkWidgetFc));
+ (*env)->SetIntField(env, lpObject, lpGtkProgressFc->adjustment, (jint)lpGtkProgress->adjustment);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressFc->offscreen_pixmap, (jint)lpGtkProgress->offscreen_pixmap);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressFc->format, (jint)lpGtkProgress->format);
+ (*env)->SetFloatField(env, lpObject, lpGtkProgressFc->x_align, (jfloat)lpGtkProgress->x_align);
+ (*env)->SetFloatField(env, lpObject, lpGtkProgressFc->y_align, (jfloat)lpGtkProgress->y_align);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressFc->show_text, (jint)lpGtkProgress->show_text);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressFc->activity_mode, (jint)lpGtkProgress->activity_mode);
+}
+
+void getGtkProgressBarFields(JNIEnv *env, jobject lpObject, GtkProgressBar *lpGtkProgressBar, GtkProgressBar_FID_CACHE *lpGtkProgressBarFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkProgressFields(env, lpObject, &lpGtkProgressBar->progress, &PGLOB(GtkProgressFc));
+ lpGtkProgressBar->bar_style = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->bar_style);
+ lpGtkProgressBar->orientation = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->orientation);
+ lpGtkProgressBar->blocks = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->blocks);
+ lpGtkProgressBar->in_block = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->in_block);
+ lpGtkProgressBar->activity_pos = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->activity_pos);
+ lpGtkProgressBar->activity_step = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->activity_step);
+ lpGtkProgressBar->activity_blocks = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->activity_blocks);
+ lpGtkProgressBar->activity_dir = (*env)->GetIntField(env, lpObject, lpGtkProgressBarFc->activity_dir);
+}
+
+void setGtkProgressBarFields(JNIEnv *env, jobject lpObject, GtkProgressBar *lpGtkProgressBar, GtkProgressBar_FID_CACHE *lpGtkProgressBarFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkProgressFields(env, lpObject, &lpGtkProgressBar->progress, &PGLOB(GtkProgressFc));
+ (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->bar_style, (jint)lpGtkProgressBar->bar_style);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->orientation, (jint)lpGtkProgressBar->orientation);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->blocks, (jint)lpGtkProgressBar->blocks);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->in_block, (jint)lpGtkProgressBar->in_block);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->activity_pos, (jint)lpGtkProgressBar->activity_pos);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->activity_step, (jint)lpGtkProgressBar->activity_step);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->activity_blocks, (jint)lpGtkProgressBar->activity_blocks);
+ (*env)->SetIntField(env, lpObject, lpGtkProgressBarFc->activity_dir, (jint)lpGtkProgressBar->activity_dir);
+}
+
+void getGtkRequisitionFields(JNIEnv *env, jobject lpObject, GtkRequisition *lpGtkRequisition, GtkRequisition_FID_CACHE *lpGtkRequisitionFc)
+{
+ lpGtkRequisition->width = (*env)->GetShortField(env, lpObject, lpGtkRequisitionFc->width);
+ lpGtkRequisition->height = (*env)->GetShortField(env, lpObject, lpGtkRequisitionFc->height);
+}
+
+void setGtkRequisitionFields(JNIEnv *env, jobject lpObject, GtkRequisition *lpGtkRequisition, GtkRequisition_FID_CACHE *lpGtkRequisitionFc)
+{
+ (*env)->SetShortField(env, lpObject, lpGtkRequisitionFc->width, lpGtkRequisition->width);
+ (*env)->SetShortField(env, lpObject, lpGtkRequisitionFc->height, lpGtkRequisition->height);
+}
+
+void getGtkStyleFields(JNIEnv *env, jobject lpObject, GtkStyle *lpGtkStyle, GtkStyle_FID_CACHE *lpGtkStyleFc)
+{
+ lpGtkStyle->klass = (GtkStyleClass*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->klass);
+ lpGtkStyle->fg[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg0_pixel);
+ lpGtkStyle->fg[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg0_red);
+ lpGtkStyle->fg[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg0_green);
+ lpGtkStyle->fg[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg0_blue);
+ lpGtkStyle->fg[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg1_pixel);
+ lpGtkStyle->fg[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg1_red);
+ lpGtkStyle->fg[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg1_green);
+ lpGtkStyle->fg[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg1_blue);
+ lpGtkStyle->fg[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg2_pixel);
+ lpGtkStyle->fg[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg2_red);
+ lpGtkStyle->fg[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg2_green);
+ lpGtkStyle->fg[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg2_blue);
+ lpGtkStyle->fg[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg3_pixel);
+ lpGtkStyle->fg[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg3_red);
+ lpGtkStyle->fg[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg3_green);
+ lpGtkStyle->fg[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg3_blue);
+ lpGtkStyle->fg[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg4_pixel);
+ lpGtkStyle->fg[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg4_red);
+ lpGtkStyle->fg[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg4_green);
+ lpGtkStyle->fg[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->fg4_blue);
+ lpGtkStyle->bg[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg0_pixel);
+ lpGtkStyle->bg[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg0_red);
+ lpGtkStyle->bg[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg0_green);
+ lpGtkStyle->bg[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg0_blue);
+ lpGtkStyle->bg[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg1_pixel);
+ lpGtkStyle->bg[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg1_red);
+ lpGtkStyle->bg[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg1_green);
+ lpGtkStyle->bg[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg1_blue);
+ lpGtkStyle->bg[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg2_pixel);
+ lpGtkStyle->bg[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg2_red);
+ lpGtkStyle->bg[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg2_green);
+ lpGtkStyle->bg[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg2_blue);
+ lpGtkStyle->bg[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg3_pixel);
+ lpGtkStyle->bg[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg3_red);
+ lpGtkStyle->bg[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg3_green);
+ lpGtkStyle->bg[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg3_blue);
+ lpGtkStyle->bg[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg4_pixel);
+ lpGtkStyle->bg[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg4_red);
+ lpGtkStyle->bg[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg4_green);
+ lpGtkStyle->bg[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->bg4_blue);
+ lpGtkStyle->light[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light0_pixel);
+ lpGtkStyle->light[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light0_red);
+ lpGtkStyle->light[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light0_green);
+ lpGtkStyle->light[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light0_blue);
+ lpGtkStyle->light[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light1_pixel);
+ lpGtkStyle->light[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light1_red);
+ lpGtkStyle->light[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light1_green);
+ lpGtkStyle->light[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light1_blue);
+ lpGtkStyle->light[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light2_pixel);
+ lpGtkStyle->light[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light2_red);
+ lpGtkStyle->light[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light2_green);
+ lpGtkStyle->light[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light2_blue);
+ lpGtkStyle->light[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light3_pixel);
+ lpGtkStyle->light[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light3_red);
+ lpGtkStyle->light[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light3_green);
+ lpGtkStyle->light[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light3_blue);
+ lpGtkStyle->light[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->light4_pixel);
+ lpGtkStyle->light[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light4_red);
+ lpGtkStyle->light[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light4_green);
+ lpGtkStyle->light[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->light4_blue);
+ lpGtkStyle->dark[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark0_pixel);
+ lpGtkStyle->dark[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark0_red);
+ lpGtkStyle->dark[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark0_green);
+ lpGtkStyle->dark[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark0_blue);
+ lpGtkStyle->dark[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark1_pixel);
+ lpGtkStyle->dark[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark1_red);
+ lpGtkStyle->dark[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark1_green);
+ lpGtkStyle->dark[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark1_blue);
+ lpGtkStyle->dark[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark2_pixel);
+ lpGtkStyle->dark[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark2_red);
+ lpGtkStyle->dark[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark2_green);
+ lpGtkStyle->dark[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark2_blue);
+ lpGtkStyle->dark[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark3_pixel);
+ lpGtkStyle->dark[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark3_red);
+ lpGtkStyle->dark[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark3_green);
+ lpGtkStyle->dark[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark3_blue);
+ lpGtkStyle->dark[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark4_pixel);
+ lpGtkStyle->dark[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark4_red);
+ lpGtkStyle->dark[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark4_green);
+ lpGtkStyle->dark[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->dark4_blue);
+ lpGtkStyle->mid[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid0_pixel);
+ lpGtkStyle->mid[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid0_red);
+ lpGtkStyle->mid[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid0_green);
+ lpGtkStyle->mid[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid0_blue);
+ lpGtkStyle->mid[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid1_pixel);
+ lpGtkStyle->mid[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid1_red);
+ lpGtkStyle->mid[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid1_green);
+ lpGtkStyle->mid[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid1_blue);
+ lpGtkStyle->mid[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid2_pixel);
+ lpGtkStyle->mid[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid2_red);
+ lpGtkStyle->mid[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid2_green);
+ lpGtkStyle->mid[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid2_blue);
+ lpGtkStyle->mid[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid3_pixel);
+ lpGtkStyle->mid[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid3_red);
+ lpGtkStyle->mid[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid3_green);
+ lpGtkStyle->mid[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid3_blue);
+ lpGtkStyle->mid[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid4_pixel);
+ lpGtkStyle->mid[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid4_red);
+ lpGtkStyle->mid[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid4_green);
+ lpGtkStyle->mid[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->mid4_blue);
+ lpGtkStyle->text[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text0_pixel);
+ lpGtkStyle->text[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text0_red);
+ lpGtkStyle->text[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text0_green);
+ lpGtkStyle->text[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text0_blue);
+ lpGtkStyle->text[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text1_pixel);
+ lpGtkStyle->text[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text1_red);
+ lpGtkStyle->text[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text1_green);
+ lpGtkStyle->text[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text1_blue);
+ lpGtkStyle->text[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text2_pixel);
+ lpGtkStyle->text[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text2_red);
+ lpGtkStyle->text[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text2_green);
+ lpGtkStyle->text[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text2_blue);
+ lpGtkStyle->text[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text3_pixel);
+ lpGtkStyle->text[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text3_red);
+ lpGtkStyle->text[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text3_green);
+ lpGtkStyle->text[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text3_blue);
+ lpGtkStyle->text[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->text4_pixel);
+ lpGtkStyle->text[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text4_red);
+ lpGtkStyle->text[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text4_green);
+ lpGtkStyle->text[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->text4_blue);
+ lpGtkStyle->base[0].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base0_pixel);
+ lpGtkStyle->base[0].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base0_red);
+ lpGtkStyle->base[0].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base0_green);
+ lpGtkStyle->base[0].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base0_blue);
+ lpGtkStyle->base[1].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base1_pixel);
+ lpGtkStyle->base[1].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base1_red);
+ lpGtkStyle->base[1].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base1_green);
+ lpGtkStyle->base[1].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base1_blue);
+ lpGtkStyle->base[2].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base2_pixel);
+ lpGtkStyle->base[2].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base2_red);
+ lpGtkStyle->base[2].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base2_green);
+ lpGtkStyle->base[2].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base2_blue);
+ lpGtkStyle->base[3].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base3_pixel);
+ lpGtkStyle->base[3].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base3_red);
+ lpGtkStyle->base[3].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base3_green);
+ lpGtkStyle->base[3].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base3_blue);
+ lpGtkStyle->base[4].pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->base4_pixel);
+ lpGtkStyle->base[4].red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base4_red);
+ lpGtkStyle->base[4].green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base4_green);
+ lpGtkStyle->base[4].blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->base4_blue);
+ lpGtkStyle->black.pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->black_pixel);
+ lpGtkStyle->black.red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->black_red);
+ lpGtkStyle->black.green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->black_green);
+ lpGtkStyle->black.blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->black_blue);
+ lpGtkStyle->white.pixel = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->white_pixel);
+ lpGtkStyle->white.red = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->white_red);
+ lpGtkStyle->white.green = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->white_green);
+ lpGtkStyle->white.blue = (*env)->GetShortField(env, lpObject, lpGtkStyleFc->white_blue);
+ lpGtkStyle->font = (GdkFont*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->font);
+ lpGtkStyle->fg_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc0);
+ lpGtkStyle->fg_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc1);
+ lpGtkStyle->fg_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc2);
+ lpGtkStyle->fg_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc3);
+ lpGtkStyle->fg_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->fg_gc4);
+ lpGtkStyle->bg_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc0);
+ lpGtkStyle->bg_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc1);
+ lpGtkStyle->bg_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc2);
+ lpGtkStyle->bg_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc3);
+ lpGtkStyle->bg_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_gc4);
+ lpGtkStyle->light_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc0);
+ lpGtkStyle->light_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc1);
+ lpGtkStyle->light_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc2);
+ lpGtkStyle->light_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc3);
+ lpGtkStyle->light_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->light_gc4);
+ lpGtkStyle->dark_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc0);
+ lpGtkStyle->dark_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc1);
+ lpGtkStyle->dark_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc2);
+ lpGtkStyle->dark_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc3);
+ lpGtkStyle->dark_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->dark_gc4);
+ lpGtkStyle->mid_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc0);
+ lpGtkStyle->mid_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc1);
+ lpGtkStyle->mid_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc2);
+ lpGtkStyle->mid_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc3);
+ lpGtkStyle->mid_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->mid_gc4);
+ lpGtkStyle->text_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc0);
+ lpGtkStyle->text_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc1);
+ lpGtkStyle->text_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc2);
+ lpGtkStyle->text_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc3);
+ lpGtkStyle->text_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->text_gc4);
+ lpGtkStyle->base_gc[0] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc0);
+ lpGtkStyle->base_gc[1] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc1);
+ lpGtkStyle->base_gc[2] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc2);
+ lpGtkStyle->base_gc[3] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc3);
+ lpGtkStyle->base_gc[4] = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->base_gc4);
+ lpGtkStyle->black_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->black_gc);
+ lpGtkStyle->white_gc = (GdkGC*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->white_gc);
+ lpGtkStyle->bg_pixmap[0] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap0);
+ lpGtkStyle->bg_pixmap[1] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap1);
+ lpGtkStyle->bg_pixmap[2] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap2);
+ lpGtkStyle->bg_pixmap[3] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap3);
+ lpGtkStyle->bg_pixmap[4] = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap4);
+ lpGtkStyle->ref_count = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->ref_count);
+ lpGtkStyle->attach_count = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->attach_count);
+ lpGtkStyle->depth = (*env)->GetIntField(env, lpObject, lpGtkStyleFc->depth);
+ lpGtkStyle->colormap = (GdkColormap*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->colormap);
+ lpGtkStyle->engine = (GtkThemeEngine*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->engine);
+ lpGtkStyle->engine_data = (gpointer)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->engine_data);
+ lpGtkStyle->rc_style = (GtkRcStyle*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->rc_style);
+ lpGtkStyle->styles = (GSList*)(*env)->GetIntField(env, lpObject, lpGtkStyleFc->styles);
+}
+
+void setGtkStyleFields(JNIEnv *env, jobject lpObject, GtkStyle *lpGtkStyle, GtkStyle_FID_CACHE *lpGtkStyleFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->klass, (jint)lpGtkStyle->klass);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg0_pixel, (jint)lpGtkStyle->fg[0].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg0_red, (jshort)lpGtkStyle->fg[0].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg0_green, (jshort)lpGtkStyle->fg[0].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg0_blue, (jshort)lpGtkStyle->fg[0].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg1_pixel, (jint)lpGtkStyle->fg[1].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg1_red, (jshort)lpGtkStyle->fg[1].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg1_green, (jshort)lpGtkStyle->fg[1].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg1_blue, (jshort)lpGtkStyle->fg[1].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg2_pixel, (jint)lpGtkStyle->fg[2].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg2_red, (jshort)lpGtkStyle->fg[2].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg2_green, (jshort)lpGtkStyle->fg[2].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg2_blue, (jshort)lpGtkStyle->fg[2].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg3_pixel, (jint)lpGtkStyle->fg[3].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg3_red, (jshort)lpGtkStyle->fg[3].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg3_green, (jshort)lpGtkStyle->fg[3].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg3_blue, (jshort)lpGtkStyle->fg[3].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg4_pixel, (jint)lpGtkStyle->fg[4].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg4_red, (jshort)lpGtkStyle->fg[4].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg4_green, (jshort)lpGtkStyle->fg[4].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->fg4_blue, (jshort)lpGtkStyle->fg[4].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg0_pixel, (jint)lpGtkStyle->bg[0].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg0_red, (jshort)lpGtkStyle->bg[0].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg0_green, (jshort)lpGtkStyle->bg[0].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg0_blue, (jshort)lpGtkStyle->bg[0].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg1_pixel, (jint)lpGtkStyle->bg[1].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg1_red, (jshort)lpGtkStyle->bg[1].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg1_green, (jshort)lpGtkStyle->bg[1].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg1_blue, (jshort)lpGtkStyle->bg[1].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg2_pixel, (jint)lpGtkStyle->bg[2].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg2_red, (jshort)lpGtkStyle->bg[2].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg2_green, (jshort)lpGtkStyle->bg[2].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg2_blue, (jshort)lpGtkStyle->bg[2].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg3_pixel, (jint)lpGtkStyle->bg[3].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg3_red, (jshort)lpGtkStyle->bg[3].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg3_green, (jshort)lpGtkStyle->bg[3].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg3_blue, (jshort)lpGtkStyle->bg[3].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg4_pixel, (jint)lpGtkStyle->bg[4].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg4_red, (jshort)lpGtkStyle->bg[4].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg4_green, (jshort)lpGtkStyle->bg[4].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->bg4_blue, (jshort)lpGtkStyle->bg[4].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light0_pixel, (jint)lpGtkStyle->light[0].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light0_red, (jshort)lpGtkStyle->light[0].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light0_green, (jshort)lpGtkStyle->light[0].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light0_blue, (jshort)lpGtkStyle->light[0].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light1_pixel, (jint)lpGtkStyle->light[1].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light1_red, (jshort)lpGtkStyle->light[1].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light1_green, (jshort)lpGtkStyle->light[1].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light1_blue, (jshort)lpGtkStyle->light[1].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light2_pixel, (jint)lpGtkStyle->light[2].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light2_red, (jshort)lpGtkStyle->light[2].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light2_green, (jshort)lpGtkStyle->light[2].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light2_blue, (jshort)lpGtkStyle->light[2].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light3_pixel, (jint)lpGtkStyle->light[3].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light3_red, (jshort)lpGtkStyle->light[3].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light3_green, (jshort)lpGtkStyle->light[3].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light3_blue, (jshort)lpGtkStyle->light[3].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light4_pixel, (jint)lpGtkStyle->light[4].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light4_red, (jshort)lpGtkStyle->light[4].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light4_green, (jshort)lpGtkStyle->light[4].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->light4_blue, (jshort)lpGtkStyle->light[4].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark0_pixel, (jint)lpGtkStyle->dark[0].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark0_red, (jshort)lpGtkStyle->dark[0].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark0_green, (jshort)lpGtkStyle->dark[0].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark0_blue, (jshort)lpGtkStyle->dark[0].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark1_pixel, (jint)lpGtkStyle->dark[1].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark1_red, (jshort)lpGtkStyle->dark[1].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark1_green, (jshort)lpGtkStyle->dark[1].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark1_blue, (jshort)lpGtkStyle->dark[1].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark2_pixel, (jint)lpGtkStyle->dark[2].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark2_red, (jshort)lpGtkStyle->dark[2].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark2_green, (jshort)lpGtkStyle->dark[2].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark2_blue, (jshort)lpGtkStyle->dark[2].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark3_pixel, (jint)lpGtkStyle->dark[3].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark3_red, (jshort)lpGtkStyle->dark[3].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark3_green, (jshort)lpGtkStyle->dark[3].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark3_blue, (jshort)lpGtkStyle->dark[3].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark4_pixel, (jint)lpGtkStyle->dark[4].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark4_red, (jshort)lpGtkStyle->dark[4].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark4_green, (jshort)lpGtkStyle->dark[4].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->dark4_blue, (jshort)lpGtkStyle->dark[4].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid0_pixel, (jint)lpGtkStyle->mid[0].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid0_red, (jshort)lpGtkStyle->mid[0].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid0_green, (jshort)lpGtkStyle->mid[0].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid0_blue, (jshort)lpGtkStyle->mid[0].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid1_pixel, (jint)lpGtkStyle->mid[1].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid1_red, (jshort)lpGtkStyle->mid[1].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid1_green, (jshort)lpGtkStyle->mid[1].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid1_blue, (jshort)lpGtkStyle->mid[1].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid2_pixel, (jint)lpGtkStyle->mid[2].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid2_red, (jshort)lpGtkStyle->mid[2].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid2_green, (jshort)lpGtkStyle->mid[2].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid2_blue, (jshort)lpGtkStyle->mid[2].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid3_pixel, (jint)lpGtkStyle->mid[3].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid3_red, (jshort)lpGtkStyle->mid[3].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid3_green, (jshort)lpGtkStyle->mid[3].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid3_blue, (jshort)lpGtkStyle->mid[3].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid4_pixel, (jint)lpGtkStyle->mid[4].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid4_red, (jshort)lpGtkStyle->mid[4].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid4_green, (jshort)lpGtkStyle->mid[4].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->mid4_blue, (jshort)lpGtkStyle->mid[4].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text0_pixel, (jint)lpGtkStyle->text[0].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text0_red, (jshort)lpGtkStyle->text[0].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text0_green, (jshort)lpGtkStyle->text[0].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text0_blue, (jshort)lpGtkStyle->text[0].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text1_pixel, (jint)lpGtkStyle->text[1].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text1_red, (jshort)lpGtkStyle->text[1].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text1_green, (jshort)lpGtkStyle->text[1].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text1_blue, (jshort)lpGtkStyle->text[1].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text2_pixel, (jint)lpGtkStyle->text[2].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text2_red, (jshort)lpGtkStyle->text[2].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text2_green, (jshort)lpGtkStyle->text[2].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text2_blue, (jshort)lpGtkStyle->text[2].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text3_pixel, (jint)lpGtkStyle->text[3].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text3_red, (jshort)lpGtkStyle->text[3].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text3_green, (jshort)lpGtkStyle->text[3].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text3_blue, (jshort)lpGtkStyle->text[3].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text4_pixel, (jint)lpGtkStyle->text[4].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text4_red, (jshort)lpGtkStyle->text[4].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text4_green, (jshort)lpGtkStyle->text[4].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->text4_blue, (jshort)lpGtkStyle->text[4].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base0_pixel, (jint)lpGtkStyle->base[0].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base0_red, (jshort)lpGtkStyle->base[0].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base0_green, (jshort)lpGtkStyle->base[0].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base0_blue, (jshort)lpGtkStyle->base[0].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base1_pixel, (jint)lpGtkStyle->base[1].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base1_red, (jshort)lpGtkStyle->base[1].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base1_green, (jshort)lpGtkStyle->base[1].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base1_blue, (jshort)lpGtkStyle->base[1].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base2_pixel, (jint)lpGtkStyle->base[2].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base2_red, (jshort)lpGtkStyle->base[2].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base2_green, (jshort)lpGtkStyle->base[2].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base2_blue, (jshort)lpGtkStyle->base[2].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base3_pixel, (jint)lpGtkStyle->base[3].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base3_red, (jshort)lpGtkStyle->base[3].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base3_green, (jshort)lpGtkStyle->base[3].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base3_blue, (jshort)lpGtkStyle->base[3].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base4_pixel, (jint)lpGtkStyle->base[4].pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base4_red, (jshort)lpGtkStyle->base[4].red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base4_green, (jshort)lpGtkStyle->base[4].green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->base4_blue, (jshort)lpGtkStyle->base[4].blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->black_pixel, (jint)lpGtkStyle->black.pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->black_red, (jshort)lpGtkStyle->black.red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->black_green, (jshort)lpGtkStyle->black.green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->black_blue, (jshort)lpGtkStyle->black.blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->white_pixel, (jint)lpGtkStyle->white.pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->white_red, (jshort)lpGtkStyle->white.red);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->white_green, (jshort)lpGtkStyle->white.green);
+ (*env)->SetShortField(env, lpObject, lpGtkStyleFc->white_blue, (jshort)lpGtkStyle->white.blue);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->font, (jint)lpGtkStyle->font);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc0, (jint)lpGtkStyle->fg_gc[0]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc1, (jint)lpGtkStyle->fg_gc[1]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc2, (jint)lpGtkStyle->fg_gc[2]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc3, (jint)lpGtkStyle->fg_gc[3]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->fg_gc4, (jint)lpGtkStyle->fg_gc[4]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc0, (jint)lpGtkStyle->bg_gc[0]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc1, (jint)lpGtkStyle->bg_gc[1]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc2, (jint)lpGtkStyle->bg_gc[2]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc3, (jint)lpGtkStyle->bg_gc[3]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_gc4, (jint)lpGtkStyle->bg_gc[4]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc0, (jint)lpGtkStyle->light_gc[0]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc1, (jint)lpGtkStyle->light_gc[1]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc2, (jint)lpGtkStyle->light_gc[2]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc3, (jint)lpGtkStyle->light_gc[3]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->light_gc4, (jint)lpGtkStyle->light_gc[4]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc0, (jint)lpGtkStyle->dark_gc[0]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc1, (jint)lpGtkStyle->dark_gc[1]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc2, (jint)lpGtkStyle->dark_gc[2]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc3, (jint)lpGtkStyle->dark_gc[3]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->dark_gc4, (jint)lpGtkStyle->dark_gc[4]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc0, (jint)lpGtkStyle->mid_gc[0]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc1, (jint)lpGtkStyle->mid_gc[1]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc2, (jint)lpGtkStyle->mid_gc[2]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc3, (jint)lpGtkStyle->mid_gc[3]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->mid_gc4, (jint)lpGtkStyle->mid_gc[4]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc0, (jint)lpGtkStyle->text_gc[0]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc1, (jint)lpGtkStyle->text_gc[1]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc2, (jint)lpGtkStyle->text_gc[2]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc3, (jint)lpGtkStyle->text_gc[3]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->text_gc4, (jint)lpGtkStyle->text_gc[4]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc0, (jint)lpGtkStyle->base_gc[0]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc1, (jint)lpGtkStyle->base_gc[1]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc2, (jint)lpGtkStyle->base_gc[2]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc3, (jint)lpGtkStyle->base_gc[3]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->base_gc4, (jint)lpGtkStyle->base_gc[4]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->black_gc, (jint)lpGtkStyle->black_gc);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->white_gc, (jint)lpGtkStyle->white_gc);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap0, (jint)lpGtkStyle->bg_pixmap[0]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap1, (jint)lpGtkStyle->bg_pixmap[1]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap2, (jint)lpGtkStyle->bg_pixmap[2]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap3, (jint)lpGtkStyle->bg_pixmap[3]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->bg_pixmap4, (jint)lpGtkStyle->bg_pixmap[4]);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->ref_count, (jint)lpGtkStyle->ref_count);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->attach_count, (jint)lpGtkStyle->attach_count);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->depth, (jint)lpGtkStyle->depth);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->colormap, (jint)lpGtkStyle->colormap);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->engine, (jint)lpGtkStyle->engine);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->engine_data, (jint)lpGtkStyle->engine_data);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->rc_style, (jint)lpGtkStyle->rc_style);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleFc->styles, (jint)lpGtkStyle->styles);
+}
+
+void getGtkStyleClassFields(JNIEnv *env, jobject lpObject, GtkStyleClass *lpGtkStyleClass, GtkStyleClass_FID_CACHE *lpGtkStyleClassFc)
+{
+ lpGtkStyleClass->xthickness = (*env)->GetIntField(env, lpObject, lpGtkStyleClassFc->xthickness);
+ lpGtkStyleClass->ythickness = (*env)->GetIntField(env, lpObject, lpGtkStyleClassFc->ythickness);
+}
+
+void setGtkStyleClassFields(JNIEnv *env, jobject lpObject, GtkStyleClass *lpGtkStyleClass, GtkStyleClass_FID_CACHE *lpGtkStyleClassFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGtkStyleClassFc->xthickness, (jint)lpGtkStyleClass->xthickness);
+ (*env)->SetIntField(env, lpObject, lpGtkStyleClassFc->ythickness, (jint)lpGtkStyleClass->ythickness);
+}
+
+void getGtkWidgetFields(JNIEnv *env, jobject lpObject, GtkWidget *lpGtkWidget, GtkWidget_FID_CACHE *lpGtkWidgetFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkObjectFields(env, lpObject, &lpGtkWidget->object, &PGLOB(GtkObjectFc));
+ lpGtkWidget->private_flags = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->private_flags);
+ lpGtkWidget->state = (*env)->GetByteField(env, lpObject, lpGtkWidgetFc->state);
+ lpGtkWidget->saved_state = (*env)->GetByteField(env, lpObject, lpGtkWidgetFc->saved_state);
+ lpGtkWidget->name = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkWidgetFc->name);
+ lpGtkWidget->style = (GtkStyle*)(*env)->GetIntField(env, lpObject, lpGtkWidgetFc->style);
+ lpGtkWidget->requisition.width = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->req_width);
+ lpGtkWidget->requisition.height = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->req_height);
+ lpGtkWidget->allocation.x = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->alloc_x);
+ lpGtkWidget->allocation.y = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->alloc_y);
+ lpGtkWidget->allocation.width = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->alloc_width);
+ lpGtkWidget->allocation.height = (*env)->GetShortField(env, lpObject, lpGtkWidgetFc->alloc_height);
+ lpGtkWidget->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGtkWidgetFc->window);
+ lpGtkWidget->parent = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkWidgetFc->parent);
+}
+
+void getGtkFrameFields(JNIEnv *env, jobject lpObject, GtkFrame *lpGtkFrame, GtkFrame_FID_CACHE *lpGtkFrameFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkBinFields(env, lpObject, &lpGtkFrame->bin, &PGLOB(GtkBinFc));
+ lpGtkFrame->label = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkFrameFc->label);
+ lpGtkFrame->shadow_type = (*env)->GetShortField(env, lpObject, lpGtkFrameFc->shadow_type);
+ lpGtkFrame->label_width = (*env)->GetShortField(env, lpObject, lpGtkFrameFc->label_width);
+ lpGtkFrame->label_height = (*env)->GetShortField(env, lpObject, lpGtkFrameFc->label_height);
+ lpGtkFrame->label_xalign = (*env)->GetFloatField(env, lpObject, lpGtkFrameFc->label_xalign);
+ lpGtkFrame->label_yalign = (*env)->GetFloatField(env, lpObject, lpGtkFrameFc->label_yalign);
+}
+
+void setGtkWidgetFields(JNIEnv *env, jobject lpObject, GtkWidget *lpGtkWidget, GtkWidget_FID_CACHE *lpGtkWidgetFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkObjectFields(env, lpObject, &lpGtkWidget->object, &PGLOB(GtkObjectFc));
+ (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->private_flags, (jshort)lpGtkWidget->private_flags);
+ (*env)->SetByteField(env, lpObject, lpGtkWidgetFc->state, (jbyte)lpGtkWidget->state);
+ (*env)->SetByteField(env, lpObject, lpGtkWidgetFc->saved_state, (jbyte)lpGtkWidget->saved_state);
+ (*env)->SetIntField(env, lpObject, lpGtkWidgetFc->name, (jint)lpGtkWidget->name);
+ (*env)->SetIntField(env, lpObject, lpGtkWidgetFc->style, (jint)lpGtkWidget->style);
+ (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->req_width, (jshort)lpGtkWidget->requisition.width);
+ (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->req_height, (jshort)lpGtkWidget->requisition.height);
+ (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->alloc_x, (jshort)lpGtkWidget->allocation.x);
+ (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->alloc_y, (jshort)lpGtkWidget->allocation.y);
+ (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->alloc_width, (jshort)lpGtkWidget->allocation.width);
+ (*env)->SetShortField(env, lpObject, lpGtkWidgetFc->alloc_height, (jshort)lpGtkWidget->allocation.height);
+ (*env)->SetIntField(env, lpObject, lpGtkWidgetFc->window, (jint)lpGtkWidget->window);
+ (*env)->SetIntField(env, lpObject, lpGtkWidgetFc->parent, (jint)lpGtkWidget->parent);
+}
+
+void setGtkFrameFields(JNIEnv *env, jobject lpObject, GtkFrame *lpGtkFrame, GtkFrame_FID_CACHE *lpGtkFrameFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkBinFields(env, lpObject, &lpGtkFrame->bin, &PGLOB(GtkBinFc));
+ (*env)->SetIntField (env, lpObject, lpGtkFrameFc->label, (jint)lpGtkFrame->label);
+ (*env)->SetShortField(env, lpObject, lpGtkFrameFc->label_width, (jshort)lpGtkFrame->label_width);
+ (*env)->SetShortField(env, lpObject, lpGtkFrameFc->label_height, (jshort)lpGtkFrame->label_height);
+ (*env)->SetFloatField(env, lpObject, lpGtkFrameFc->label_xalign, (jfloat)lpGtkFrame->label_xalign);
+ (*env)->SetFloatField(env, lpObject, lpGtkFrameFc->label_yalign, (jfloat)lpGtkFrame->label_yalign);
+}
+
+void getGtkWindowFields(JNIEnv *env, jobject lpObject, GtkWindow *lpGtkWindow, GtkWindow_FID_CACHE *lpGtkWindowFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkBinFields(env, lpObject, &lpGtkWindow->bin, &PGLOB(GtkBinFc));
+ lpGtkWindow->title = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->title);
+ lpGtkWindow->wmclass_name = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->wmclass_name);
+ lpGtkWindow->wmclass_class = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->wmclass_class);
+ lpGtkWindow->type = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->type);
+ lpGtkWindow->focus_widget = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->focus_widget);
+ lpGtkWindow->default_widget = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->default_widget);
+ lpGtkWindow->transient_parent = (GtkWindow*)(*env)->GetIntField(env, lpObject, lpGtkWindowFc->transient_parent);
+ lpGtkWindow->resize_count = (*env)->GetShortField(env, lpObject, lpGtkWindowFc->resize_count);
+ lpGtkWindow->allow_shrink = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->allow_shrink);
+ lpGtkWindow->allow_grow = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->allow_grow);
+ lpGtkWindow->auto_shrink = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->auto_shrink);
+ lpGtkWindow->handling_resize = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->handling_resize);
+ lpGtkWindow->position = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->position);
+ lpGtkWindow->use_uposition = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->use_uposition);
+ lpGtkWindow->modal = (*env)->GetIntField(env, lpObject, lpGtkWindowFc->title);
+}
+
+void setGtkWindowFields(JNIEnv *env, jobject lpObject, GtkWindow *lpGtkWindow, GtkWindow_FID_CACHE *lpGtkWindowFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkBinFields(env, lpObject, &lpGtkWindow->bin, &PGLOB(GtkBinFc));
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->title, (jint)lpGtkWindow->title);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->wmclass_name, (jint)lpGtkWindow->wmclass_name);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->wmclass_class, (jint)lpGtkWindow->wmclass_class);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->type, (jint)lpGtkWindow->type);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->focus_widget, (jint)lpGtkWindow->focus_widget);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->default_widget, (jint)lpGtkWindow->default_widget);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->transient_parent, (jint)lpGtkWindow->title);
+ (*env)->SetShortField(env, lpObject, lpGtkWindowFc->resize_count, (jshort)lpGtkWindow->resize_count);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->allow_shrink, (jint)lpGtkWindow->allow_shrink);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->allow_grow, (jint)lpGtkWindow->allow_grow);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->auto_shrink, (jint)lpGtkWindow->auto_shrink);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->handling_resize, (jint)lpGtkWindow->handling_resize);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->position, (jint)lpGtkWindow->position);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->use_uposition, (jint)lpGtkWindow->use_uposition);
+ (*env)->SetIntField(env, lpObject, lpGtkWindowFc->modal, (jint)lpGtkWindow->modal);
+}
+
+void getGtkMenuFields(JNIEnv *env, jobject lpObject, GtkMenu *lpGtkMenu, GtkMenu_FID_CACHE *lpGtkMenuFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkMenuShellFields(env, lpObject, &lpGtkMenu->menu_shell, &PGLOB(GtkMenuShellFc));
+ lpGtkMenu->parent_menu_item = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->parent_menu_item);
+ lpGtkMenu->old_active_menu_item = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->old_active_menu_item);
+ lpGtkMenu->accel_group = (GtkAccelGroup*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->accel_group);
+ lpGtkMenu->position_func = (GtkMenuPositionFunc)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->position_func);
+ lpGtkMenu->position_func_data = (gpointer)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->position_func_data);
+ lpGtkMenu->toplevel = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->toplevel);
+ lpGtkMenu->tearoff_window = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkMenuFc->tearoff_window);
+ lpGtkMenu->torn_off = (*env)->GetIntField(env, lpObject, lpGtkMenuFc->torn_off);
+}
+
+void setGtkMenuFields(JNIEnv *env, jobject lpObject, GtkMenu *lpGtkMenu, GtkMenu_FID_CACHE *lpGtkMenuFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkMenuShellFields(env, lpObject, &lpGtkMenu->menu_shell, &PGLOB(GtkMenuShellFc));
+ (*env)->SetIntField(env, lpObject, lpGtkMenuFc->parent_menu_item, (jint)lpGtkMenu->parent_menu_item);
+ (*env)->SetIntField(env, lpObject, lpGtkMenuFc->old_active_menu_item, (jint)lpGtkMenu->old_active_menu_item);
+ (*env)->SetIntField(env, lpObject, lpGtkMenuFc->accel_group, (jint)lpGtkMenu->accel_group);
+ (*env)->SetIntField(env, lpObject, lpGtkMenuFc->position_func, (jint)lpGtkMenu->position_func);
+ (*env)->SetIntField(env, lpObject, lpGtkMenuFc->position_func_data, (jint)lpGtkMenu->position_func_data);
+ (*env)->SetIntField(env, lpObject, lpGtkMenuFc->toplevel, (jint)lpGtkMenu->toplevel);
+ (*env)->SetIntField(env, lpObject, lpGtkMenuFc->tearoff_window, (jint)lpGtkMenu->tearoff_window);
+ (*env)->SetIntField(env, lpObject, lpGtkMenuFc->torn_off, (jint)lpGtkMenu->torn_off);
+}
+
+void getGtkMenuShellFields(JNIEnv *env, jobject lpObject, GtkMenuShell *lpGtkMenuShell, GtkMenuShell_FID_CACHE *lpGtkMenuShellFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkContainerFields(env, lpObject, &lpGtkMenuShell->container, &PGLOB(GtkContainerFc));
+ lpGtkMenuShell->active = (*env)->GetIntField(env, lpObject, lpGtkMenuShellFc->active);
+}
+
+void setGtkMenuShellFields(JNIEnv *env, jobject lpObject, GtkMenuShell *lpGtkMenuShell, GtkMenuShell_FID_CACHE *lpGtkMenuShellFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkContainerFields(env, lpObject, &lpGtkMenuShell->container, &PGLOB(GtkContainerFc));
+ (*env)->SetIntField(env, lpObject, lpGtkMenuShellFc->active, (jint)lpGtkMenuShell->active);
+}
+
+void getGtkItemFields(JNIEnv *env, jobject lpObject, GtkItem *lpGtkItem, GtkItem_FID_CACHE *lpGtkItemFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkBinFields(env, lpObject, &lpGtkItem->bin, &PGLOB(GtkBinFc));
+}
+
+void setGtkItemFields(JNIEnv *env, jobject lpObject, GtkItem *lpGtkItem, GtkItem_FID_CACHE *lpGtkItemFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkBinFields(env, lpObject, &lpGtkItem->bin, &PGLOB(GtkBinFc));
+}
+
+void getGtkMenuItemFields(JNIEnv *env, jobject lpObject, GtkMenuItem *lpGtkMenuItem, GtkMenuItem_FID_CACHE *lpGtkMenuItemFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkItemFields(env, lpObject, &lpGtkMenuItem->item, &PGLOB(GtkItemFc));
+}
+
+void setGtkMenuItemFields(JNIEnv *env, jobject lpObject, GtkMenuItem *lpGtkMenuItem, GtkMenuItem_FID_CACHE *lpGtkMenuItemFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkItemFields(env, lpObject, &lpGtkMenuItem->item, &PGLOB(GtkItemFc));
+}
+
+void getGtkCheckMenuItemFields(JNIEnv *env, jobject lpObject, GtkCheckMenuItem *lpGtkCheckMenuItem, GtkCheckMenuItem_FID_CACHE *lpGtkCheckMenuItemFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkMenuItemFields(env, lpObject, &lpGtkCheckMenuItem->menu_item, &PGLOB(GtkMenuItemFc));
+ lpGtkCheckMenuItem->active = (*env)->GetIntField(env, lpObject, lpGtkCheckMenuItemFc->active);
+ lpGtkCheckMenuItem->always_show_toggle = (*env)->GetIntField(env, lpObject, lpGtkCheckMenuItemFc->always_show_toggle);
+}
+
+void setGtkCheckMenuItemFields(JNIEnv *env, jobject lpObject, GtkCheckMenuItem *lpGtkCheckMenuItem, GtkCheckMenuItem_FID_CACHE *lpGtkCheckMenuItemFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkMenuItemFields(env, lpObject, &lpGtkCheckMenuItem->menu_item, &PGLOB(GtkMenuItemFc));
+ (*env)->SetIntField(env, lpObject, lpGtkCheckMenuItemFc->active, (jint)lpGtkCheckMenuItem->active);
+ (*env)->SetIntField(env, lpObject, lpGtkCheckMenuItemFc->always_show_toggle, (jint)lpGtkCheckMenuItem->always_show_toggle);
+}
+
+void getGtkDataFields(JNIEnv *env, jobject lpObject, GtkData *lpGtkData, GtkData_FID_CACHE *lpGtkDataFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkObjectFields(env, lpObject, &lpGtkData->object, &PGLOB(GtkObjectFc));
+}
+
+void setGtkDataFields(JNIEnv *env, jobject lpObject, GtkData *lpGtkData, GtkData_FID_CACHE *lpGtkDataFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkObjectFields(env, lpObject, &lpGtkData->object, &PGLOB(GtkObjectFc));
+}
+
+void getGtkAdjustmentFields(JNIEnv *env, jobject lpObject, GtkAdjustment *lpGtkAdjustment, GtkAdjustment_FID_CACHE *lpGtkAdjustmentFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkDataFields(env, lpObject, &lpGtkAdjustment->data, &PGLOB(GtkDataFc));
+ lpGtkAdjustment->lower = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->lower);
+ lpGtkAdjustment->upper = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->upper);
+ lpGtkAdjustment->value = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->value);
+ lpGtkAdjustment->step_increment = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->step_increment);
+ lpGtkAdjustment->page_increment = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->page_increment);
+ lpGtkAdjustment->page_size = (*env)->GetFloatField(env, lpObject, lpGtkAdjustmentFc->page_size);
+}
+
+void setGtkAdjustmentFields(JNIEnv *env, jobject lpObject, GtkAdjustment *lpGtkAdjustment, GtkAdjustment_FID_CACHE *lpGtkAdjustmentFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkDataFields(env, lpObject, &lpGtkAdjustment->data, &PGLOB(GtkDataFc));
+ (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->lower, (jfloat)lpGtkAdjustment->lower);
+ (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->upper, (jfloat)lpGtkAdjustment->upper);
+ (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->value, (jfloat)lpGtkAdjustment->value);
+ (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->step_increment, (jfloat)lpGtkAdjustment->step_increment);
+ (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->page_increment, (jfloat)lpGtkAdjustment->page_increment);
+ (*env)->SetFloatField(env, lpObject, lpGtkAdjustmentFc->page_size, (jfloat)lpGtkAdjustment->page_size);
+}
+
+void getGtkCListRowFields(JNIEnv *env, jobject lpObject, GtkCListRow *lpGtkCListRow, GtkCListRow_FID_CACHE *lpGtkCListRowFc)
+{
+ lpGtkCListRow->cell = (GtkCell*)(*env)->GetIntField(env, lpObject, lpGtkCListRowFc->cell);
+ lpGtkCListRow->state = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->state);
+ lpGtkCListRow->foreground.red = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->foreground_red);
+ lpGtkCListRow->foreground.green = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->foreground_green);
+ lpGtkCListRow->foreground.blue = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->foreground_blue);
+ lpGtkCListRow->foreground.pixel = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->foreground_pixel);
+ lpGtkCListRow->background.red = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->background_red);
+ lpGtkCListRow->background.green = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->background_green);
+ lpGtkCListRow->background.blue = (*env)->GetShortField(env, lpObject, lpGtkCListRowFc->background_blue);
+ lpGtkCListRow->background.pixel = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->background_pixel);
+ lpGtkCListRow->style = (GtkStyle*)(*env)->GetIntField(env, lpObject, lpGtkCListRowFc->style);
+ lpGtkCListRow->data = (gpointer)(*env)->GetIntField(env, lpObject, lpGtkCListRowFc->data);
+ lpGtkCListRow->destroy = (GtkDestroyNotify)(*env)->GetIntField(env, lpObject, lpGtkCListRowFc->destroy);
+ lpGtkCListRow->fg_set = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->fg_set);
+ lpGtkCListRow->bg_set = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->bg_set);
+ lpGtkCListRow->selectable = (*env)->GetIntField(env, lpObject, lpGtkCListRowFc->selectable);
+}
+
+void getGtkCListColumnFields(JNIEnv *env, jobject lpObject, GtkCListColumn *lpGtkCListColumn, GtkCListColumn_FID_CACHE *lpGtkCListColumnFc)
+{
+ lpGtkCListColumn->title = (gchar*)(*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->title);
+ lpGtkCListColumn->area.x = (*env)->GetShortField(env, lpObject, lpGtkCListColumnFc->area_x);
+ lpGtkCListColumn->area.y = (*env)->GetShortField(env, lpObject, lpGtkCListColumnFc->area_y);
+ lpGtkCListColumn->area.width = (*env)->GetShortField(env, lpObject, lpGtkCListColumnFc->area_width);
+ lpGtkCListColumn->area.height = (*env)->GetShortField(env, lpObject, lpGtkCListColumnFc->area_height);
+ lpGtkCListColumn->button = (GtkWidget*)(*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->button);
+ lpGtkCListColumn->window = (GdkWindow*)(*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->window);
+ lpGtkCListColumn->width = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->width);
+ lpGtkCListColumn->min_width = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->min_width);
+ lpGtkCListColumn->max_width = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->max_width);
+ lpGtkCListColumn->justification = (GtkJustification)(*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->justification);
+ lpGtkCListColumn->visible = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->visible);
+ lpGtkCListColumn->width_set = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->width_set);
+ lpGtkCListColumn->resizeable = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->resizeable);
+ lpGtkCListColumn->auto_resize = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->auto_resize);
+ lpGtkCListColumn->button_passive = (*env)->GetIntField(env, lpObject, lpGtkCListColumnFc->button_passive);
+}
+
+void setGtkCListRowFields(JNIEnv *env, jobject lpObject, GtkCListRow *lpGtkCListRow, GtkCListRow_FID_CACHE *lpGtkCListRowFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->cell, (jint)lpGtkCListRow->cell);
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->state, (jint)lpGtkCListRow->state);
+ (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->foreground_red, (jshort)lpGtkCListRow->foreground.red);
+ (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->foreground_green, (jshort)lpGtkCListRow->foreground.green);
+ (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->foreground_blue, (jshort)lpGtkCListRow->foreground.blue);
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->foreground_pixel, (jint)lpGtkCListRow->foreground.pixel);
+ (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->background_red, (jshort)lpGtkCListRow->background.red);
+ (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->background_green, (jshort)lpGtkCListRow->background.green);
+ (*env)->SetShortField(env, lpObject, lpGtkCListRowFc->background_blue, (jshort)lpGtkCListRow->background.blue);
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->background_pixel, (jint)lpGtkCListRow->background.pixel);
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->style, (jint)lpGtkCListRow->style);
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->data, (jint)lpGtkCListRow->data);
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->destroy, (jint)lpGtkCListRow->destroy);
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->fg_set, (jint)lpGtkCListRow->fg_set);
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->bg_set, (jint)lpGtkCListRow->bg_set);
+ (*env)->SetIntField(env, lpObject, lpGtkCListRowFc->selectable, (jint)lpGtkCListRow->selectable);
+}
+
+void setGtkCListColumnFields(JNIEnv *env, jobject lpObject, GtkCListColumn *lpGtkCListColumn, GtkCListColumn_FID_CACHE *lpGtkCListColumnFc)
+{
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->title, (jint)lpGtkCListColumn->title);
+ (*env)->SetShortField(env, lpObject, lpGtkCListColumnFc->area_x, (jshort)lpGtkCListColumn->area.x);
+ (*env)->SetShortField(env, lpObject, lpGtkCListColumnFc->area_y, (jshort)lpGtkCListColumn->area.y);
+ (*env)->SetShortField(env, lpObject, lpGtkCListColumnFc->area_width, (jshort)lpGtkCListColumn->area.width);
+ (*env)->SetShortField(env, lpObject, lpGtkCListColumnFc->area_height, (jshort)lpGtkCListColumn->area.height);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->button, (jint)lpGtkCListColumn->button);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->window, (jint)lpGtkCListColumn->window);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->width, (jshort)lpGtkCListColumn->width);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->min_width, (jint)lpGtkCListColumn->min_width);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->max_width, (jint)lpGtkCListColumn->max_width);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->justification, (jint)lpGtkCListColumn->justification);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->visible, (jint)lpGtkCListColumn->visible);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->width_set, (jint)lpGtkCListColumn->width_set);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->resizeable, (jint)lpGtkCListColumn->resizeable);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->auto_resize, (jint)lpGtkCListColumn->auto_resize);
+ (*env)->SetIntField(env, lpObject, lpGtkCListColumnFc->button_passive, (jint)lpGtkCListColumn->button_passive);
+}
+
+void getGtkCTreeFields(JNIEnv *env, jobject lpObject, GtkCTree *lpGtkCTree, GtkCTree_FID_CACHE *lpGtkCTreeFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkCListFields(env, lpObject, &lpGtkCTree->clist, &PGLOB(GtkCListFc));
+ lpGtkCTree->tree_indent = (*env)->GetIntField(env, lpObject, lpGtkCTreeFc->tree_indent);
+ lpGtkCTree->tree_column = (*env)->GetIntField(env, lpObject, lpGtkCTreeFc->tree_column);
+}
+
+void setGtkCTreeFields(JNIEnv *env, jobject lpObject, GtkCTree *lpGtkCTree, GtkCTree_FID_CACHE *lpGtkCTreeFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkCListFields(env, lpObject, &lpGtkCTree->clist, &PGLOB(GtkCListFc));
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeFc->tree_indent, (jint)lpGtkCTree->tree_indent);
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeFc->tree_column, (jint)lpGtkCTree->tree_column);
+}
+
+void getGtkCTreeRowFields(JNIEnv *env, jobject lpObject, GtkCTreeRow *lpGtkCTreeRow, GtkCTreeRow_FID_CACHE *lpGtkCTreeRowFc)
+{
+ DECL_GLOB(pGlob)
+ getGtkCListRowFields(env, lpObject, &lpGtkCTreeRow->row, &PGLOB(GtkCListRowFc));
+ lpGtkCTreeRow->parent = (GtkCTreeNode*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->parent);
+ lpGtkCTreeRow->sibling = (GtkCTreeNode*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->sibling);
+ lpGtkCTreeRow->children = (GtkCTreeNode*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->children);
+ lpGtkCTreeRow->pixmap_closed = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->pixmap_closed);
+ lpGtkCTreeRow->mask_closed = (GdkBitmap*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->mask_closed);
+ lpGtkCTreeRow->pixmap_opened = (GdkPixmap*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->pixmap_opened);
+ lpGtkCTreeRow->mask_opened = (GdkBitmap*)(*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->mask_opened);
+ lpGtkCTreeRow->level = (*env)->GetShortField(env, lpObject, lpGtkCTreeRowFc->level);
+ lpGtkCTreeRow->is_leaf = (*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->is_leaf);
+ lpGtkCTreeRow->expanded = (*env)->GetIntField(env, lpObject, lpGtkCTreeRowFc->expanded);
+}
+
+void setGtkCTreeRowFields(JNIEnv *env, jobject lpObject, GtkCTreeRow *lpGtkCTreeRow, GtkCTreeRow_FID_CACHE *lpGtkCTreeRowFc)
+{
+ DECL_GLOB(pGlob)
+ setGtkCListRowFields(env, lpObject, &lpGtkCTreeRow->row, &PGLOB(GtkCListRowFc));
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->parent, (jint)lpGtkCTreeRow->parent);
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->sibling, (jint)lpGtkCTreeRow->sibling);
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->children, (jint)lpGtkCTreeRow->children);
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->pixmap_closed, (jint)lpGtkCTreeRow->pixmap_closed);
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->mask_closed, (jint)lpGtkCTreeRow->mask_closed);
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->pixmap_opened, (jint)lpGtkCTreeRow->pixmap_opened);
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->mask_opened, (jint)lpGtkCTreeRow->mask_opened);
+ (*env)->SetShortField(env, lpObject, lpGtkCTreeRowFc->level, (jshort)lpGtkCTreeRow->level);
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->is_leaf, (jint)lpGtkCTreeRow->is_leaf);
+ (*env)->SetIntField(env, lpObject, lpGtkCTreeRowFc->expanded, (jint)lpGtkCTreeRow->expanded);
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/structs.h
new file mode 100644
index 0000000..605c117
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/structs.h
@@ -0,0 +1,580 @@
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+/**
+ * JNI SWT object field getters and setters declarations for GTK structs.
+ */
+
+#ifndef INC_structs_H
+#define INC_structs_H
+
+#include <gtk/gtk.h>
+#include <gdk/gdkx.h>
+
+/* ----------- fid and class caches ----------- */
+/**
+ * Used for Java objects passed into JNI that are
+ * declared like:
+ *
+ * nativeFunction (Rectangle p1, Rectangle p2, Rectangle p3)
+ *
+ * and not like this
+ *
+ * nativeFunction (Object p1, Object p2, Object p3)
+ *
+ *
+ */
+
+/* ----------- fid cache structures ----------- */
+
+typedef struct GdkColor_FID_CACHE {
+ int cached;
+ jclass GdkColorClass;
+ jfieldID pixel, red, green, blue;
+} GdkColor_FID_CACHE;
+
+typedef GdkColor_FID_CACHE *PGdkColor_FID_CACHE;
+
+typedef struct GdkEventKey_FID_CACHE {
+ int cached;
+ jclass GdkEventKeyClass;
+ jfieldID type, window, send_event, time, state, keyval, length, string;
+} GdkEventKey_FID_CACHE;
+
+typedef GdkEventKey_FID_CACHE *PGdkEventKey_FID_CACHE;
+
+typedef struct GdkEventButton_FID_CACHE {
+ int cached;
+ jclass GdkEventButtonClass;
+ jfieldID type, window, send_event, time, x, y, pressure, xtilt, ytilt, state, button, source, deviceid, x_root, y_root;
+} GdkEventButton_FID_CACHE;
+
+typedef GdkEventButton_FID_CACHE *PGdkEventButton_FID_CACHE;
+
+typedef struct GdkEventMotion_FID_CACHE {
+ int cached;
+ jclass GdkEventMotionClass;
+ jfieldID type, window, send_event, time, x, y, pressure, xtilt, ytilt, state, is_hint, source, deviceid, x_root, y_root;
+} GdkEventMotion_FID_CACHE;
+
+typedef GdkEventMotion_FID_CACHE *PGdkEventMotion_FID_CACHE;
+
+typedef struct GdkEventExpose_FID_CACHE {
+ int cached;
+ jclass GdkEventExposeClass;
+ jfieldID type, window, send_event, x, y, width, height, count;
+} GdkEventExpose_FID_CACHE;
+
+typedef GdkEventExpose_FID_CACHE *PGdkEventExpose_FID_CACHE;
+
+typedef struct GdkFont_FID_CACHE {
+ int cached;
+ jclass GdkFontClass;
+ jfieldID type, ascent, descent;
+} GdkFont_FID_CACHE;
+
+typedef GdkFont_FID_CACHE *PGdkFont_FID_CACHE;
+
+typedef struct GdkGCValues_FID_CACHE {
+ int cached;
+ jclass GdkGCValuesClass;
+ jfieldID foreground_pixel, foreground_red, foreground_green, foreground_blue, background_pixel, background_red, background_green, background_blue, font, function, fill, tile, stipple, clip_mask, subwindow_mode, ts_x_origin, ts_y_origin, clip_x_origin, clip_y_origin, graphics_exposures, line_width, line_style, cap_style, join_style;
+} GdkGCValues_FID_CACHE;
+
+typedef GdkGCValues_FID_CACHE *PGdkGCValues_FID_CACHE;
+
+typedef struct GdkImage_FID_CACHE {
+ int cached;
+ jclass GdkImageClass;
+ jfieldID type, visual, byte_order, width, height, depth, bpp, bpl, mem;
+} GdkImage_FID_CACHE;
+
+typedef GdkImage_FID_CACHE *PGdkImage_FID_CACHE;
+
+typedef struct GdkPoint_FID_CACHE {
+ int cached;
+ jclass GdkPointClass;
+ jfieldID x, y;
+} GdkPoint_FID_CACHE;
+
+typedef GdkPoint_FID_CACHE *PGdkPoint_FID_CACHE;
+
+typedef struct GdkRectangle_FID_CACHE {
+ int cached;
+ jclass GdkRectangleClass;
+ jfieldID x, y, width, height;
+} GdkRectangle_FID_CACHE;
+
+typedef GdkRectangle_FID_CACHE *PGdkRectangle_FID_CACHE;
+
+typedef struct GdkVisual_FID_CACHE {
+ int cached;
+ jclass GdkVisualClass;
+ jfieldID type, depth, byte_order, colormap_size, bits_per_rgb, red_mask, red_shift, red_prec, green_mask, green_shift, green_prec, blue_mask, blue_shift, blue_prec;
+} GdkVisual_FID_CACHE;
+
+typedef GdkVisual_FID_CACHE *PGdkVisual_FID_CACHE;
+
+typedef struct GtkObject_FID_CACHE {
+ int cached;
+ jclass GtkObjectClass;
+ jfieldID klass, flags, ref_count, object_data;
+} GtkObject_FID_CACHE;
+
+typedef GtkObject_FID_CACHE *PGtkObject_FID_CACHE;
+
+typedef struct GtkData_FID_CACHE {
+ int cached;
+ jclass GtkDataClass;
+} GtkData_FID_CACHE;
+
+typedef GtkData_FID_CACHE *PGtkData_FID_CACHE;
+
+typedef struct GtkAdjustment_FID_CACHE {
+ int cached;
+ jclass GtkAdjustmentClass;
+ jfieldID lower, upper, value, step_increment, page_increment, page_size;
+} GtkAdjustment_FID_CACHE;
+
+typedef GtkAdjustment_FID_CACHE *PGtkAdjustment_FID_CACHE;
+
+typedef struct GtkAllocation_FID_CACHE {
+ int cached;
+ jclass GtkAllocationClass;
+ jfieldID x, y, width, height;
+} GtkAllocation_FID_CACHE;
+
+typedef GtkAllocation_FID_CACHE *PGtkAllocation_FID_CACHE;
+
+typedef struct GtkWidget_FID_CACHE {
+ int cached;
+ jclass GtkWidgetClass;
+ jfieldID private_flags, state, saved_state, name, style, req_width, req_height, alloc_x, alloc_y, alloc_width, alloc_height, window, parent;
+} GtkWidget_FID_CACHE;
+
+typedef GtkWidget_FID_CACHE *PGtkWidget_FID_CACHE;
+
+typedef struct GtkContainer_FID_CACHE {
+ int cached;
+ jclass GtkContainerClass;
+ jfieldID focus_child, border_width, need_resize, resize_mode, resize_widgets;
+} GtkContainer_FID_CACHE;
+
+typedef GtkContainer_FID_CACHE *PGtkContainer_FID_CACHE;
+
+typedef struct GtkBin_FID_CACHE {
+ int cached;
+ jclass GtkBinClass;
+ jfieldID child;
+} GtkBin_FID_CACHE;
+
+typedef GtkBin_FID_CACHE *PGtkBin_FID_CACHE;
+
+typedef struct GtkFrame_FID_CACHE {
+ int cached;
+ jclass GtkFrameClass;
+ jfieldID label, shadow_type,
+ label_width, label_height,
+ label_xalign, label_yalign;
+} GtkFrame_FID_CACHE;
+
+typedef GtkFrame_FID_CACHE *PGtkFrame_FID_CACHE;
+
+typedef struct GtkMenu_FID_CACHE {
+ int cached;
+ jclass GtkMenuClass;
+ jfieldID parent_menu_item, old_active_menu_item, accel_group, position_func, position_func_data, toplevel, tearoff_window, torn_off;
+} GtkMenu_FID_CACHE;
+
+typedef GtkMenu_FID_CACHE *PGtkMenu_FID_CACHE;
+
+typedef struct GtkMenuShell_FID_CACHE {
+ int cached;
+ jclass GtkMenuShellClass;
+ jfieldID active;
+} GtkMenuShell_FID_CACHE;
+
+typedef GtkMenuShell_FID_CACHE *PGtkMenuShell_FID_CACHE;
+
+typedef struct GtkItem_FID_CACHE {
+ int cached;
+ jclass GtkItemClass;
+} GtkItem_FID_CACHE;
+
+typedef GtkItem_FID_CACHE *PGtkItem_FID_CACHE;
+
+typedef struct GtkMenuItem_FID_CACHE {
+ int cached;
+ jclass GtkMenuItemClass;
+ jfieldID submenu, accelerator_signal, toggle_size, accelerator_width, show_toggle_indicator, show_submenu_indicator, submenu_placement, submenu_direction, right_justify, timer;
+} GtkMenuItem_FID_CACHE;
+
+typedef GtkMenuItem_FID_CACHE *PGtkMenuItem_FID_CACHE;
+
+typedef struct GtkCheckMenuItem_FID_CACHE {
+ int cached;
+ jclass GtkCheckMenuItemClass;
+ jfieldID active, always_show_toggle;
+} GtkCheckMenuItem_FID_CACHE;
+
+typedef GtkCheckMenuItem_FID_CACHE *PGtkCheckMenuItem_FID_CACHE;
+
+typedef struct GtkWindow_FID_CACHE {
+ int cached;
+ jclass GtkWindowClass;
+ jfieldID title, wmclass_name, wmclass_class, type, focus_widget, default_widget, transient_parent, resize_count, allow_shrink, allow_grow, auto_shrink, handling_resize, position, use_uposition, modal;
+} GtkWindow_FID_CACHE;
+
+typedef GtkWindow_FID_CACHE *PGtkWindow_FID_CACHE;
+
+typedef struct GtkColorSelectionDialog_FID_CACHE {
+ int cached;
+ jclass GtkColorSelectionDialogClass;
+ jfieldID colorsel, main_vbox, ok_button, reset_button, cancel_button, help_button;
+} GtkColorSelectionDialog_FID_CACHE;
+
+typedef GtkColorSelectionDialog_FID_CACHE *PGtkColorSelectionDialog_FID_CACHE;
+
+typedef struct GtkBox_FID_CACHE {
+ int cached;
+ jclass GtkBoxClass;
+ jfieldID children, spacing, homogeneous;
+} GtkBox_FID_CACHE;
+
+typedef GtkBox_FID_CACHE *PGtkBox_FID_CACHE;
+
+typedef struct GtkHBox_FID_CACHE {
+ int cached;
+ jclass GtkHBoxClass;
+} GtkHBox_FID_CACHE;
+
+typedef GtkHBox_FID_CACHE *PGtkHBox_FID_CACHE;
+
+typedef struct GtkCombo_FID_CACHE {
+ int cached;
+ jclass GtkComboClass;
+ jfieldID entry, button, popup, popwin, list, entry_change_id, list_change_id, value_in_list, ok_if_empty, case_sensitive, use_arrows, use_arrows_always, current_button, activate_id;
+} GtkCombo_FID_CACHE;
+
+typedef GtkCombo_FID_CACHE *PGtkCombo_FID_CACHE;
+
+typedef struct GtkFileSelection_FID_CACHE {
+ int cached;
+ jclass GtkFileSelectionClass;
+ jfieldID dir_list, file_list, selection_entry, selection_text, main_vbox, ok_button, cancel_button, help_button, history_pulldown, history_menu, history_list, fileop_dialog, fileop_entry, fileop_file, cmpl_state, fileop_c_dir, fileop_del_file, fileop_ren_file, button_area, action_area;
+} GtkFileSelection_FID_CACHE;
+
+typedef GtkFileSelection_FID_CACHE *PGtkFileSelection_FID_CACHE;
+
+typedef struct GtkFontSelectionDialog_FID_CACHE {
+ int cached;
+ jclass GtkFontSelectionDialogClass;
+ jfieldID fontsel, main_vbox, action_area, ok_button, apply_button, cancel_button, dialog_width, auto_resize;
+} GtkFontSelectionDialog_FID_CACHE;
+
+typedef GtkFontSelectionDialog_FID_CACHE *PGtkFontSelectionDialog_FID_CACHE;
+
+typedef struct GtkCList_FID_CACHE {
+ int cached;
+ jclass GtkCListClass;
+ jfieldID clist_flags, row_mem_chunk, cell_mem_chunk, freeze_count, internal_allocation_x, internal_allocation_y, internal_allocation_width, internal_allocation_height, rows, row_center_offset, row_height, row_list, row_list_end, columns, column_title_area_x, column_title_area_y, column_title_area_width, column_title_area_height, title_window, column, clist_window, clist_window_width, clist_window_height, hoffset, voffset, shadow_type, selection_mode, selection, selection_end, undo_selection, undo_unselection, undo_anchor, button_actions0, button_actions1, button_actions2, button_actions3, button_actions4, drag_button, click_cell_row, click_cell_column, hadjustment, vadjustment, xor_gc, fg_gc, bg_gc, cursor_drag, x_drag, focus_row, anchor, anchor_state, drag_pos, htimer, vtimer, sort_type, compare, sort_column;
+} GtkCList_FID_CACHE;
+
+typedef GtkCList_FID_CACHE *PGtkCList_FID_CACHE;
+
+typedef struct GtkEditable_FID_CACHE {
+ int cached;
+ jclass GtkEditableClass;
+ jfieldID current_pos, selection_start_pos, selection_end_pos, has_selection, editable, visible, ic, ic_attr, clipboard_text;
+} GtkEditable_FID_CACHE;
+
+typedef GtkEditable_FID_CACHE *PGtkEditable_FID_CACHE;
+
+typedef struct GtkText_FID_CACHE {
+ int cached;
+ jclass GtkTextClass;
+ jfieldID first_line_start_index,first_onscreen_hor_pixel,first_onscreen_ver_pixel,default_tab_width,cursor_pos_x,cursor_pos_y,cursor_virtual_x;
+} GtkText_FID_CACHE;
+
+typedef GtkText_FID_CACHE *PGtkText_FID_CACHE;
+
+typedef struct GtkProgress_FID_CACHE {
+ int cached;
+ jclass GtkProgressClass;
+ jfieldID adjustment, offscreen_pixmap, format, x_align, y_align, show_text, activity_mode;
+} GtkProgress_FID_CACHE;
+
+typedef GtkProgress_FID_CACHE *PGtkProgress_FID_CACHE;
+
+typedef struct GtkProgressBar_FID_CACHE {
+ int cached;
+ jclass GtkProgressBarClass;
+ jfieldID bar_style, orientation, blocks, in_block, activity_pos, activity_step, activity_blocks, activity_dir;
+} GtkProgressBar_FID_CACHE;
+
+typedef GtkProgressBar_FID_CACHE *PGtkProgressBar_FID_CACHE;
+
+typedef struct GtkArg_FID_CACHE {
+ int cached;
+ jclass GtkArgClass;
+ jfieldID type, name, d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11;
+} GtkArg_FID_CACHE;
+
+typedef GtkArg_FID_CACHE *PGtkArg_FID_CACHE;
+
+typedef struct GtkRequisition_FID_CACHE {
+ int cached;
+ jclass GtkRequisitionClass;
+ jfieldID width, height;
+} GtkRequisition_FID_CACHE;
+
+typedef GtkRequisition_FID_CACHE *PGtkRequisition_FID_CACHE;
+
+typedef struct GtkStyle_FID_CACHE {
+ int cached;
+ jclass GtkStyleClazz;
+ jfieldID klass, fg0_pixel, fg0_red, fg0_green, fg0_blue, fg1_pixel, fg1_red, fg1_green, fg1_blue, fg2_pixel, fg2_red, fg2_green, fg2_blue, fg3_pixel, fg3_red, fg3_green, fg3_blue, fg4_pixel, fg4_red, fg4_green, fg4_blue, bg0_pixel, bg0_red, bg0_green, bg0_blue, bg1_pixel, bg1_red, bg1_green, bg1_blue, bg2_pixel, bg2_red, bg2_green, bg2_blue, bg3_pixel, bg3_red, bg3_green, bg3_blue, bg4_pixel, bg4_red, bg4_green, bg4_blue, light0_pixel, light0_red, light0_green, light0_blue, light1_pixel, light1_red, light1_green, light1_blue, light2_pixel, light2_red, light2_green, light2_blue, light3_pixel, light3_red, light3_green, light3_blue, light4_pixel, light4_red, light4_green, light4_blue, dark0_pixel, dark0_red, dark0_green, dark0_blue, dark1_pixel, dark1_red, dark1_green, dark1_blue, dark2_pixel, dark2_red, dark2_green, dark2_blue, dark3_pixel, dark3_red, dark3_green, dark3_blue, dark4_pixel, dark4_red, dark4_green, dark4_blue, mid0_pixel, mid0_red, mid0_green, mid0_blue, mid1_pixel, mid1_red, mid1_green, mid1_blue, mid2_pixel, mid2_red, mid2_green, mid2_blue, mid3_pixel, mid3_red, mid3_green, mid3_blue, mid4_pixel, mid4_red, mid4_green, mid4_blue, text0_pixel, text0_red, text0_green, text0_blue, text1_pixel, text1_red, text1_green, text1_blue, text2_pixel, text2_red, text2_green, text2_blue, text3_pixel, text3_red, text3_green, text3_blue, text4_pixel, text4_red, text4_green, text4_blue, base0_pixel, base0_red, base0_green, base0_blue, base1_pixel, base1_red, base1_green, base1_blue, base2_pixel, base2_red, base2_green, base2_blue, base3_pixel, base3_red, base3_green, base3_blue, base4_pixel, base4_red, base4_green, base4_blue, black_pixel, black_red, black_green, black_blue, white_pixel, white_red, white_green, white_blue, font, fg_gc0, fg_gc1, fg_gc2, fg_gc3, fg_gc4, bg_gc0, bg_gc1, bg_gc2, bg_gc3, bg_gc4, light_gc0, light_gc1, light_gc2, light_gc3, light_gc4, dark_gc0, dark_gc1, dark_gc2, dark_gc3, dark_gc4, mid_gc0, mid_gc1, mid_gc2, mid_gc3, mid_gc4, text_gc0, text_gc1, text_gc2, text_gc3, text_gc4, base_gc0, base_gc1, base_gc2, base_gc3, base_gc4, black_gc, white_gc, bg_pixmap0, bg_pixmap1, bg_pixmap2, bg_pixmap3, bg_pixmap4, bg_pixmap5;
+ jfieldID ref_count, attach_count, depth, colormap, engine, engine_data, rc_style, styles;
+} GtkStyle_FID_CACHE;
+
+typedef GtkStyle_FID_CACHE *PGtkStyle_FID_CACHE;
+
+typedef struct GtkStyleClass_FID_CACHE {
+ int cached;
+ jclass GtkStyleClassClazz;
+ jfieldID xthickness, ythickness;
+} GtkStyleClass_FID_CACHE;
+
+typedef GtkStyleClass_FID_CACHE *PGtkStyleClass_FID_CACHE;
+
+typedef struct GtkCListRow_FID_CACHE {
+ int cached;
+ jclass GtkCListRowClass;
+ jfieldID cell, state, foreground_red, foreground_green, foreground_blue, foreground_pixel, background_red, background_green, background_blue, background_pixel, style, data, destroy, fg_set, bg_set, selectable;
+} GtkCListRow_FID_CACHE;
+
+typedef GtkCListRow_FID_CACHE *PGtkCListRow_FID_CACHE;
+
+typedef struct GtkCListColumn_FID_CACHE {
+ int cached;
+ jclass GtkCListColumnClass;
+ jfieldID title, area_x, area_y, area_width, area_height, button, window, width, min_width, max_width, justification, visible, width_set, resizeable, auto_resize, button_passive;
+} GtkCListColumn_FID_CACHE;
+
+typedef GtkCListColumn_FID_CACHE *PGtkCListColumn_FID_CACHE;
+
+typedef struct GtkCTreeRow_FID_CACHE {
+ int cached;
+ jclass GtkCTreeRowClass;
+ jfieldID parent, sibling, children, pixmap_closed, mask_closed, pixmap_opened, mask_opened, level, is_leaf, expanded;
+} GtkCTreeRow_FID_CACHE;
+
+typedef GtkCTreeRow_FID_CACHE *PGtkCTreeRow_FID_CACHE;
+
+typedef struct GtkCTree_FID_CACHE {
+ int cached;
+ jclass GtkCTreeClass;
+ jfieldID tree_indent, tree_column;
+
+} GtkCTree_FID_CACHE;
+
+typedef GtkCTree_FID_CACHE *PGtkCTree_FID_CACHE;
+
+/* ----------- cache function prototypes ----------- */
+
+void cacheGdkColorFids(JNIEnv *env, jobject lpGdkColor, PGdkColor_FID_CACHE lpCache);
+void cacheGdkEventKeyFids(JNIEnv *env, jobject lpGdkEventKey, PGdkEventKey_FID_CACHE lpCache);
+void cacheGdkEventButtonFids(JNIEnv *env, jobject lpGdkEventButton, PGdkEventButton_FID_CACHE lpCache);
+void cacheGdkEventMotionFids(JNIEnv *env, jobject lpGdkEventMotion, PGdkEventMotion_FID_CACHE lpCache);
+void cacheGdkEventExposeFids(JNIEnv *env, jobject lpGdkEventExpose, PGdkEventExpose_FID_CACHE lpCache);
+void cacheGdkFontFids(JNIEnv *env, jobject lpGdkFont, PGdkFont_FID_CACHE lpCache);
+void cacheGdkGCValuesFids(JNIEnv *env, jobject lpGdkGCValues, PGdkGCValues_FID_CACHE lpCache);
+void cacheGdkImageFids(JNIEnv *env, jobject lpGdkImage, PGdkImage_FID_CACHE lpCache);
+void cacheGdkPointFids(JNIEnv *env, jobject lpGdkPoint, PGdkPoint_FID_CACHE lpCache);
+void cacheGdkRectangleFids(JNIEnv *env, jobject lpGdkRectangle, PGdkRectangle_FID_CACHE lpCache);
+void cacheGdkVisualFids(JNIEnv *env, jobject lpGdkVisual, PGdkVisual_FID_CACHE lpCache);
+
+void cacheGtkObjectFids(JNIEnv *env, jobject lpGtkObject, PGtkObject_FID_CACHE lpCache);
+void cacheGtkDataFids(JNIEnv *env, jobject lpGtkData, PGtkData_FID_CACHE lpCache);
+void cacheGtkAdjustmentFids(JNIEnv *env, jobject lpGtkAdjustment, PGtkAdjustment_FID_CACHE lpCache);
+void cacheGtkWidgetFids(JNIEnv *env, jobject lpGtkWidget, PGtkWidget_FID_CACHE lpCache);
+void cacheGtkContainerFids(JNIEnv *env, jobject lpGtkContainer, PGtkContainer_FID_CACHE lpCache);
+void cacheGtkBinFids(JNIEnv *env, jobject lpGtkBin, PGtkBin_FID_CACHE lpCache);
+void cacheGtkMenuFids(JNIEnv *env, jobject lpGtkMenu, PGtkMenu_FID_CACHE lpCache);
+void cacheGtkMenuShellFids(JNIEnv *env, jobject lpGtkMenuShell, PGtkMenuShell_FID_CACHE lpCache);
+void cacheGtkItemFids(JNIEnv *env, jobject lpGtkItem, PGtkItem_FID_CACHE lpCache);
+void cacheGtkMenuItemFids(JNIEnv *env, jobject lpGtkMenuItem, PGtkMenuItem_FID_CACHE lpCache);
+void cacheGtkCheckMenuItemFids(JNIEnv *env, jobject lpGtkCheckMenuItem, PGtkCheckMenuItem_FID_CACHE lpCache);
+void cacheGtkWindowFids(JNIEnv *env, jobject lpGtkWindow, PGtkWindow_FID_CACHE lpCache);
+void cacheGtkColorSelectionDialogFids(JNIEnv *env, jobject lpGtkColorSelectionDialog, PGtkColorSelectionDialog_FID_CACHE lpCache);
+void cacheGtkFileSelectionFids(JNIEnv *env, jobject lpGtkFileSelection, PGtkFileSelection_FID_CACHE lpCache);
+void cacheGtkFontSelectionDialogFids(JNIEnv *env, jobject lpGtkFontSelectionDialog, PGtkFontSelectionDialog_FID_CACHE lpCache);
+void cacheGtkBoxFids(JNIEnv *env, jobject lpGtkBox, PGtkBox_FID_CACHE lpCache);
+void cacheGtkHBoxFids(JNIEnv *env, jobject lpGtkHBox, PGtkHBox_FID_CACHE lpCache);
+void cacheGtkComboFids(JNIEnv *env, jobject lpGtkCombo, PGtkCombo_FID_CACHE lpCache);
+void cacheGtkCListFids(JNIEnv *env, jobject lpGtkCList, PGtkCList_FID_CACHE lpCache);
+void cacheGtkEditableFids(JNIEnv *env, jobject lpGtkEditable, PGtkEditable_FID_CACHE lpCache);
+void cacheGtkTextFids(JNIEnv *env, jobject lpGtkText, PGtkText_FID_CACHE lpCache);
+void cacheGtkProgressFids(JNIEnv *env, jobject lpGtkProgress, PGtkProgress_FID_CACHE lpCache);
+void cacheGtkProgressBarFids(JNIEnv *env, jobject lpGtkProgressBar, PGtkProgressBar_FID_CACHE lpCache);
+
+void cacheGtkAllocationFids(JNIEnv *env, jobject lpGtkAllocation, PGtkAllocation_FID_CACHE lpCache);
+void cacheGtkArgFids(JNIEnv *env, jobject lpGtkArg, PGtkArg_FID_CACHE lpCache);
+void cacheGtkRequisitionFids(JNIEnv *env, jobject lpGtkRequisition, PGtkRequisition_FID_CACHE lpCache);
+void cacheGtkStyleFids(JNIEnv *env, jobject lpGtkStyle, PGtkStyle_FID_CACHE lpCache);
+void cacheGtkStyleClassFids(JNIEnv *env, jobject lpGtkStyleClass, PGtkStyleClass_FID_CACHE lpCache);
+void cacheGtkCListColumnFids(JNIEnv *env, jobject lpGtkCListColumn, PGtkCListColumn_FID_CACHE lpCache);
+void cacheGtkCListRowFids(JNIEnv *env, jobject lpGtkCListRow, PGtkCListRow_FID_CACHE lpCache);
+void cacheGtkCTreeRowFids(JNIEnv *env, jobject lpGtkCTreeRow, PGtkCTreeRow_FID_CACHE lpCache);
+void cacheGtkCTreeFids(JNIEnv *env, jobject lpGtkCTree, PGtkCTree_FID_CACHE lpCache);
+
+/* ----------- swt getter and setter prototypes ----------- */
+/**
+ * These functions get or set object field ids assuming that the
+ * fids for these objects have already been cached.
+ *
+ * The header file just contains function prototypes
+ */
+void getGdkColorFields(JNIEnv *env, jobject lpObject, GdkColor *lpGdkColor, GdkColor_FID_CACHE *lpGdkColorFc);
+void setGdkColorFields(JNIEnv *env, jobject lpObject, GdkColor *lpGdkColor, GdkColor_FID_CACHE *lpGdkColorFc);
+void getGdkEventKeyFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventKey_FID_CACHE *lpGdkEventKeyFc);
+void setGdkEventKeyFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventKey_FID_CACHE *lpGdkEventKeyFc);
+void getGdkEventButtonFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventButton_FID_CACHE *lpGdkEventButtonFc);
+void setGdkEventButtonFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventButton_FID_CACHE *lpGdkEventButtonFc);
+void getGdkEventMotionFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventMotion_FID_CACHE *lpGdkEventMotionFc);
+void setGdkEventMotionFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventMotion_FID_CACHE *lpGdkEventMotionFc);
+void getGdkEventExposeFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventExpose_FID_CACHE *lpGdkEventExposeFc);
+void setGdkEventExposeFields(JNIEnv *env, jobject lpObject, GdkEvent *lpGdkEvent, GdkEventExpose_FID_CACHE *lpGdkEventExposeFc);
+void getGdkFontFields(JNIEnv *env, jobject lpObject, GdkFont *lpGdkFont, GdkFont_FID_CACHE *lpGdkFontFc);
+void setGdkFontFields(JNIEnv *env, jobject lpObject, GdkFont *lpGdkFont, GdkFont_FID_CACHE *lpGdkFontFc);
+void getGdkGCValuesFields(JNIEnv *env, jobject lpObject, GdkGCValues *lpGdkGCValues, GdkGCValues_FID_CACHE *lpGdkGCValuesFc);
+void setGdkGCValuesFields(JNIEnv *env, jobject lpObject, GdkGCValues *lpGdkGCValues, GdkGCValues_FID_CACHE *lpGdkGCValuesFc);
+void getGdkImageFields(JNIEnv *env, jobject lpObject, GdkImage *lpGdkImage, GdkImage_FID_CACHE *lpGdkImageFc);
+void setGdkImageFields(JNIEnv *env, jobject lpObject, GdkImage *lpGdkImage, GdkImage_FID_CACHE *lpGdkImageFc);
+void getGdkPointFields(JNIEnv *env, jobject lpObject, GdkPoint *lpGdkPoint, GdkPoint_FID_CACHE *lpGdkPointFc);
+void setGdkPointFields(JNIEnv *env, jobject lpObject, GdkPoint *lpGdkPoint, GdkPoint_FID_CACHE *lpGdkPointFc);
+void getGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpGdkRectangle, GdkRectangle_FID_CACHE *lpGdkRectangleFc);
+void setGdkRectangleFields(JNIEnv *env, jobject lpObject, GdkRectangle *lpGdkRectangle, GdkRectangle_FID_CACHE *lpGdkRectangleFc);
+void getGdkVisualFields(JNIEnv *env, jobject lpObject, GdkVisual *lpGdkVisual, GdkVisual_FID_CACHE *lpGdkVisualFc);
+void setGdkVisualFields(JNIEnv *env, jobject lpObject, GdkVisual *lpGdkVisual, GdkVisual_FID_CACHE *lpGdkVisualFc);
+void getGtkAllocationFields(JNIEnv *env, jobject lpObject, GtkAllocation *lpGtkAllocation, GtkAllocation_FID_CACHE *lpGtkAllocationFc);
+void setGtkAllocationFields(JNIEnv *env, jobject lpObject, GtkAllocation *lpGtkAllocation, GtkAllocation_FID_CACHE *lpGtkAllocationFc);
+void getGtkArgFields(JNIEnv *env, jobject lpObject, GtkArg *lpGtkArg, GtkArg_FID_CACHE *lpGtkArgFc);
+void setGtkArgFields(JNIEnv *env, jobject lpObject, GtkArg *lpGtkArg, GtkArg_FID_CACHE *lpGtkArgFc);
+void getGtkBinFields(JNIEnv *env, jobject lpObject, GtkBin *lpGtkBin, GtkBin_FID_CACHE *lpGtkBinFc);
+void setGtkBinFields(JNIEnv *env, jobject lpObject, GtkBin *lpGtkBin, GtkBin_FID_CACHE *lpGtkBinFc);
+void getGtkCListFields(JNIEnv *env, jobject lpObject, GtkCList *lpGtkCList, GtkCList_FID_CACHE *lpGtkCListFc);
+void setGtkCListFields(JNIEnv *env, jobject lpObject, GtkCList *lpGtkCList, GtkCList_FID_CACHE *lpGtkCListFc);
+void getGtkCListRowFields(JNIEnv *env, jobject lpObject, GtkCListRow *lpGtkCListRow, GtkCListRow_FID_CACHE *lpGtkCListRowFc);
+void setGtkCListRowFields(JNIEnv *env, jobject lpObject, GtkCListRow *lpGtkCListRow, GtkCListRow_FID_CACHE *lpGtkCListRowFc);
+void getGtkCListColumnFields(JNIEnv *env, jobject lpObject, GtkCListColumn *lpGtkCListColumn, GtkCListColumn_FID_CACHE *lpGtkCListColumnFc);
+void setGtkCListColumnFields(JNIEnv *env, jobject lpObject, GtkCListColumn *lpGtkCListColumn, GtkCListColumn_FID_CACHE *lpGtkCListColumnFc);
+void getGtkCTreeRowFields(JNIEnv *env, jobject lpObject, GtkCTreeRow *lpGtkCTreeRow, GtkCTreeRow_FID_CACHE *lpGtkCTreeRowFc);
+void setGtkCTreeRowFields(JNIEnv *env, jobject lpObject, GtkCTreeRow *lpGtkCTreeRow, GtkCTreeRow_FID_CACHE *lpGtkCTreeRowFc);
+void getGtkColorSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkColorSelectionDialog *lpGtkColorSelectionDialog, GtkColorSelectionDialog_FID_CACHE *lpGtkColorSelectionDialogFc);
+void setGtkColorSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkColorSelectionDialog *lpGtkColorSelectionDialog, GtkColorSelectionDialog_FID_CACHE *lpGtkColorSelectionDialogFc);
+void getGtkComboFields(JNIEnv *env, jobject lpObject, GtkCombo *lpGtkCombo, GtkCombo_FID_CACHE *lpGtkComboFc);
+void setGtkComboFields(JNIEnv *env, jobject lpObject, GtkCombo *lpGtkCombo, GtkCombo_FID_CACHE *lpGtkComboFc);
+void getGtkContainerFields(JNIEnv *env, jobject lpObject, GtkContainer *lpGtkContainer, GtkContainer_FID_CACHE *lpGtkContainerFc);
+void setGtkContainerFields(JNIEnv *env, jobject lpObject, GtkContainer *lpGtkContainer, GtkContainer_FID_CACHE *lpGtkContainerFc);
+void getGtkDataFields(JNIEnv *env, jobject lpObject, GtkData *lpGtkData, GtkData_FID_CACHE *lpGtkDataFc);
+void setGtkDataFields(JNIEnv *env, jobject lpObject, GtkData *lpGtkData, GtkData_FID_CACHE *lpGtkDataFc);
+void getGtkEditableFields(JNIEnv *env, jobject lpObject, GtkEditable *lpGtkEditable, GtkEditable_FID_CACHE *lpGtkEditableFc);
+void setGtkEditableFields(JNIEnv *env, jobject lpObject, GtkEditable *lpGtkEditable, GtkEditable_FID_CACHE *lpGtkEditableFc);
+void getGtkFrameFields(JNIEnv *env, jobject lpObject, GtkFrame *lpGtkFrame, GtkFrame_FID_CACHE *lpGtkFrameFc);
+void setGtkFrameFields(JNIEnv *env, jobject lpObject, GtkFrame *lpGtkFrame, GtkFrame_FID_CACHE *lpGtkFrameFc);
+void getGtkTextFields(JNIEnv *env, jobject lpObject, GtkText *lpGtkText, GtkText_FID_CACHE *lpGtkTextFc);
+void setGtkTextFields(JNIEnv *env, jobject lpObject, GtkText *lpGtkText, GtkText_FID_CACHE *lpGtkTextFc);
+void getGtkFileSelectionFields(JNIEnv *env, jobject lpObject, GtkFileSelection *lpGtkFileSelection, GtkFileSelection_FID_CACHE *lpGtkFileSelectionFc);
+void setGtkFileSelectionFields(JNIEnv *env, jobject lpObject, GtkFileSelection *lpGtkFileSelection, GtkFileSelection_FID_CACHE *lpGtkFileSelectionFc);
+void getGtkFontSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkFontSelectionDialog *lpGtkFontSelectionDialog, GtkFontSelectionDialog_FID_CACHE *lpGtkFontSelectionDialogFc);
+void setGtkFontSelectionDialogFields(JNIEnv *env, jobject lpObject, GtkFontSelectionDialog *lpGtkFontSelectionDialog, GtkFontSelectionDialog_FID_CACHE *lpGtkFontSelectionDialogFc);
+void getGtkObjectFields(JNIEnv *env, jobject lpObject, GtkObject *lpGtkObject, GtkObject_FID_CACHE *lpGtkObjectFc);
+void setGtkObjectFields(JNIEnv *env, jobject lpObject, GtkObject *lpGtkObject, GtkObject_FID_CACHE *lpGtkObjectFc);
+void getGtkProgressFields(JNIEnv *env, jobject lpObject, GtkProgress *lpGtkProgress, GtkProgress_FID_CACHE *lpGtkProgressFc);
+void setGtkProgressFields(JNIEnv *env, jobject lpObject, GtkProgress *lpGtkProgress, GtkProgress_FID_CACHE *lpGtkProgressFc);
+void getGtkProgressBarFields(JNIEnv *env, jobject lpObject, GtkProgressBar *lpGtkProgressBar, GtkProgressBar_FID_CACHE *lpGtkProgressBarFc);
+void setGtkProgressBarFields(JNIEnv *env, jobject lpObject, GtkProgressBar *lpGtkProgressBar, GtkProgressBar_FID_CACHE *lpGtkProgressBarFc);
+void getGtkRequisitionFields(JNIEnv *env, jobject lpObject, GtkRequisition *lpGtkRequisition, GtkRequisition_FID_CACHE *lpGtkRequisitionFc);
+void setGtkRequisitionFields(JNIEnv *env, jobject lpObject, GtkRequisition *lpGtkRequisition, GtkRequisition_FID_CACHE *lpGtkRequisitionFc);
+void getGtkStyleFields(JNIEnv *env, jobject lpObject, GtkStyle *lpGtkStyle, GtkStyle_FID_CACHE *lpGtkStyleFc);
+void setGtkStyleFields(JNIEnv *env, jobject lpObject, GtkStyle *lpGtkStyle, GtkStyle_FID_CACHE *lpGtkStyleFc);
+void getGtkStyleClassFields(JNIEnv *env, jobject lpObject, GtkStyleClass *lpGtkStyleClass, GtkStyleClass_FID_CACHE *lpGtkStyleClassFc);
+void setGtkStyleClassFields(JNIEnv *env, jobject lpObject, GtkStyleClass *lpGtkStyleClass, GtkStyleClass_FID_CACHE *lpGtkStyleClassFc);
+void getGtkWidgetFields(JNIEnv *env, jobject lpObject, GtkWidget *lpGtkWidget, GtkWidget_FID_CACHE *lpGtkWidgetFc);
+void setGtkWidgetFields(JNIEnv *env, jobject lpObject, GtkWidget *lpGtkWidget, GtkWidget_FID_CACHE *lpGtkWidgetFc);
+void getGtkWindowFields(JNIEnv *env, jobject lpObject, GtkWindow *lpGtkWindow, GtkWindow_FID_CACHE *lpGtkWindowFc);
+void setGtkWindowFields(JNIEnv *env, jobject lpObject, GtkWindow *lpGtkWindow, GtkWindow_FID_CACHE *lpGtkWindowFc);
+void getGtkCheckMenuItemFields(JNIEnv *env, jobject lpObject, GtkCheckMenuItem *lpGtkCheckMenuItem, GtkCheckMenuItem_FID_CACHE *lpGtkCheckMenuItemFc);
+void setGtkCheckMenuItemFields(JNIEnv *env, jobject lpObject, GtkCheckMenuItem *lpGtkCheckMenuItem, GtkCheckMenuItem_FID_CACHE *lpGtkCheckMenuItemFc);
+void getGtkAdjustmentFields(JNIEnv *env, jobject lpObject, GtkAdjustment *lpGtkAdjustment, GtkAdjustment_FID_CACHE *lpGtkAdjustmentFc);
+void setGtkAdjustmentFields(JNIEnv *env, jobject lpObject, GtkAdjustment *lpGtkAdjustment, GtkAdjustment_FID_CACHE *lpGtkAdjustmentFc);
+void getGtkBoxFields(JNIEnv *env, jobject lpObject, GtkBox *lpGtkBox, GtkBox_FID_CACHE *lpGtkBoxFc);
+void setGtkBoxFields(JNIEnv *env, jobject lpObject, GtkBox *lpGtkBox, GtkBox_FID_CACHE *lpGtkBoxFc);
+void getGtkHBoxFields(JNIEnv *env, jobject lpObject, GtkHBox *lpGtkHBox, GtkHBox_FID_CACHE *lpGtkHBoxFc);
+void setGtkHBoxFields(JNIEnv *env, jobject lpObject, GtkHBox *lpGtkHBox, GtkHBox_FID_CACHE *lpGtkHBoxFc);
+void getGtkMenuFields(JNIEnv *env, jobject lpObject, GtkMenu *lpGtkMenu, GtkMenu_FID_CACHE *lpGtkMenuFc);
+void setGtkMenuFields(JNIEnv *env, jobject lpObject, GtkMenu *lpGtkMenu, GtkMenu_FID_CACHE *lpGtkMenuFc);
+void getGtkMenuShellFields(JNIEnv *env, jobject lpObject, GtkMenuShell *lpGtkMenuShell, GtkMenuShell_FID_CACHE *lpGtkMenuShellFc);
+void setGtkMenuShellFields(JNIEnv *env, jobject lpObject, GtkMenuShell *lpGtkMenuShell, GtkMenuShell_FID_CACHE *lpGtkMenuShellFc);
+void getGtkMenuItemFields(JNIEnv *env, jobject lpObject, GtkMenuItem *lpGtkMenuItem, GtkMenuItem_FID_CACHE *lpGtkMenuItemFc);
+void setGtkMenuItemFields(JNIEnv *env, jobject lpObject, GtkMenuItem *lpGtkMenuItem, GtkMenuItem_FID_CACHE *lpGtkMenuItemFc);
+void getGtkCTreeFields(JNIEnv *env, jobject lpObject, GtkCTree *lpGtkCTree, GtkCTree_FID_CACHE *lpGtkCTreeFc);
+void setGtkCTreeFields(JNIEnv *env, jobject lpObject, GtkCTree *lpGtkCTree, GtkCTree_FID_CACHE *lpGtkCTreeFc);
+
+extern GdkColor_FID_CACHE GdkColorFc;
+extern GdkEventKey_FID_CACHE GdkEventKeyFc;
+extern GdkEventButton_FID_CACHE GdkEventButtonFc;
+extern GdkEventMotion_FID_CACHE GdkEventMotionFc;
+extern GdkEventExpose_FID_CACHE GdkEventExposeFc;
+extern GdkFont_FID_CACHE GdkFontFc;
+extern GdkGCValues_FID_CACHE GdkGCValuesFc;
+extern GdkImage_FID_CACHE GdkImageFc;
+extern GdkPoint_FID_CACHE GdkPointFc;
+extern GdkRectangle_FID_CACHE GdkRectangleFc;
+extern GdkVisual_FID_CACHE GdkVisualFc;
+extern GtkObject_FID_CACHE GtkObjectFc;
+extern GtkData_FID_CACHE GtkDataFc;
+extern GtkAdjustment_FID_CACHE GtkAdjustmentFc;
+extern GtkAllocation_FID_CACHE GtkAllocationFc;
+extern GtkWidget_FID_CACHE GtkWidgetFc;
+extern GtkContainer_FID_CACHE GtkContainerFc;
+extern GtkBin_FID_CACHE GtkBinFc;
+extern GtkMenu_FID_CACHE GtkMenuFc;
+extern GtkItem_FID_CACHE GtkItemFc;
+extern GtkMenuShell_FID_CACHE GtkMenuShellFc;
+extern GtkMenuItem_FID_CACHE GtkMenuItemFc;
+extern GtkCheckMenuItem_FID_CACHE GtkCheckMenuItemFc;
+extern GtkWindow_FID_CACHE GtkWindowFc;
+extern GtkColorSelectionDialog_FID_CACHE GtkColorSelectionDialogFc;\
+extern GtkBox_FID_CACHE GtkBoxFc;
+extern GtkHBox_FID_CACHE GtkHBoxFc;
+extern GtkCombo_FID_CACHE GtkComboFc;
+extern GtkFileSelection_FID_CACHE GtkFileSelectionFc;
+extern GtkFrame_FID_CACHE GtkFrameFc;
+extern GtkFontSelectionDialog_FID_CACHE GtkFontSelectionDialogFc;
+extern GtkCList_FID_CACHE GtkCListFc;
+extern GtkEditable_FID_CACHE GtkEditableFc;
+extern GtkText_FID_CACHE GtkTextFc;
+extern GtkProgress_FID_CACHE GtkProgressFc;
+extern GtkProgressBar_FID_CACHE GtkProgressBarFc;
+extern GtkArg_FID_CACHE GtkArgFc;
+extern GtkRequisition_FID_CACHE GtkRequisitionFc;
+extern GtkStyle_FID_CACHE GtkStyleFc;
+extern GtkStyleClass_FID_CACHE GtkStyleClassFc;
+extern GtkCListRow_FID_CACHE GtkCListRowFc;
+extern GtkCListColumn_FID_CACHE GtkCListColumnFc;
+extern GtkCTreeRow_FID_CACHE GtkCTreeRowFc;
+extern GtkCTree_FID_CACHE GtkCTreeFc;
+
+#endif // INC_structs_H
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/swt.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/swt.c
new file mode 100644
index 0000000..ea1b1f4
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/swt.c
@@ -0,0 +1,7647 @@
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+/**
+ * SWT OS natives implementation.
+ */
+
+/*#define PRINT_FAILED_RCODES*/
+#define NDEBUG
+
+#include "swt.h"
+#include "structs.h"
+
+#include <stdio.h>
+#include <assert.h>
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: GTK_WIDGET_TYPE
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1TYPE
+ (JNIEnv *env, jclass that, jint wid)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "GTK_WIDGET_TYPE");
+#endif
+
+ return GTK_WIDGET_TYPE((GtkWidget*)wid);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_label_get_type
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1get_1type
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_label_get_type");
+#endif
+
+ return gtk_label_get_type ();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_object_unref
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1unref
+ (JNIEnv *env, jclass that, jint object)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_object_unref");
+#endif
+
+ gtk_object_unref((GtkObject*)object);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_object_ref
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1destroy
+ (JNIEnv *env, jclass that, jint object)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_object_destroy");
+#endif
+
+ gtk_object_destroy((GtkObject*)object);
+}
+
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1get_1data_1by_1id
+ (JNIEnv *env, jclass that, jint object, jint data_id)
+{
+ jint result;
+
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_object_get_data_by_id");
+#endif
+ return (jint) gtk_object_get_data_by_id((GtkObject*)object, (GQuark) data_id);
+}
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1set_1data_1by_1id
+ (JNIEnv *env, jclass that, jint object, jint data_id, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_object_set_data_by_id");
+#endif
+
+ gtk_object_set_data_by_id ((GtkObject*)object, (GQuark) data_id, (gpointer) data);
+}
+
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1quark_1from_1string
+ (JNIEnv *env, jclass that, jbyteArray string)
+{
+ jint result;
+ jbyte *string1 = NULL;
+
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_quark_from_string");
+#endif
+
+ if (string) {
+ string1 = (*env)->GetByteArrayElements(env, string, NULL);
+ }
+ result = g_quark_from_string((gchar *) string1);
+ if (string) {
+ (*env)->ReleaseByteArrayElements(env, string, string1, 0);
+ }
+ return result;
+}
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1handler_1block_1by_1data
+ (JNIEnv *env, jclass that, jint object, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_signal_handler_block_by_data");
+#endif
+
+ gtk_signal_handler_block_by_data((GtkObject*)object, (gpointer) data);
+}
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1handler_1unblock_1by_1data
+ (JNIEnv *env, jclass that, jint object, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_signal_handler_unblock_by_data");
+#endif
+
+ gtk_signal_handler_unblock_by_data((GtkObject*)object, (gpointer) data);
+}
+
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1rgb_1init
+ (JNIEnv *env, jclass cl)
+{
+ gdk_rgb_init();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1FLAGS
+ (JNIEnv *env, jclass that, jint wid)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "GTK_WIDGET_FLAGS");
+#endif
+
+ return (jint) GTK_WIDGET_FLAGS((GtkWidget*)wid);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1SET_1FLAGS
+ (JNIEnv *env, jclass that, jint wid, jint flag)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "GTK_WIDGET_SET_FLAGS");
+#endif
+
+ GTK_WIDGET_SET_FLAGS((GtkWidget*)wid, flag);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1UNSET_1FLAGS
+ (JNIEnv *env, jclass that, jint wid, jint flag)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "GTK_WIDGET_UNSET_FLAGS");
+#endif
+
+ GTK_WIDGET_UNSET_FLAGS((GtkWidget*)wid, flag);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1NO_1WINDOW
+ (JNIEnv *env, jclass that, jint wid)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "GTK_WIDGET_NO_WINDOW");
+#endif
+
+ return (jboolean) GTK_WIDGET_NO_WINDOW((GtkWidget*)wid);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: GDK_ROOT_PARENT
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_GDK_1ROOT_1PARENT
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "GDK_ROOT_PARENT");
+#endif
+
+ return (jint) GDK_ROOT_PARENT();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1SENSITIVE
+ (JNIEnv *env, jclass that, jint wid)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "GTK_WIDGET_SENSITIVE");
+#endif
+
+ return (jboolean) GTK_WIDGET_SENSITIVE((GtkWidget*)wid);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_GTK_1WIDGET_1IS_1SENSITIVE
+ (JNIEnv *env, jclass that, jint wid)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "GTK_WIDGET_IS_SENSITIVE");
+#endif
+
+ return (jboolean) GTK_WIDGET_IS_SENSITIVE((GtkWidget*)wid);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_accel_group_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1accel_1group_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_accel_group_new");
+#endif
+
+ return (jint)gtk_accel_group_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_accel_group_unref
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1accel_1group_1unref
+ (JNIEnv *env, jclass that, jint accel_group)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_accel_group_unref");
+#endif
+
+ gtk_accel_group_unref((GtkAccelGroup*)accel_group);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_adjustment_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1adjustment_1new
+ (JNIEnv *env, jclass that, jfloat value, jfloat lower, jfloat upper, jfloat step_increment, jfloat page_increment, jfloat page_size)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_adjustment_new");
+#endif
+
+ return (jint)gtk_adjustment_new(value, lower, upper, step_increment, page_increment, page_size);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_adjustment_changed
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1adjustment_1changed
+ (JNIEnv *env, jclass that, jint adjustment)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_adjustment_changed");
+#endif
+
+ gtk_adjustment_changed((GtkAdjustment*)adjustment);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_adjustment_value_changed
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1adjustment_1value_1changed
+ (JNIEnv *env, jclass that, jint adjustment)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_adjustment_value_changed");
+#endif
+
+ gtk_adjustment_value_changed((GtkAdjustment*)adjustment);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_adjustment_set_value
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1adjustment_1set_1value
+ (JNIEnv *env, jclass that, jint adjustment, jfloat value)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_adjustment_set_value");
+#endif
+
+ gtk_adjustment_set_value((GtkAdjustment*)adjustment, value);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_arrow_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1arrow_1new
+ (JNIEnv *env, jclass that, jint arrow_type, jint shadow_type)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_arrow_new");
+#endif
+
+ return (jint)gtk_arrow_new((GtkArrowType)arrow_type, (GtkShadowType)shadow_type);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_arrow_set
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1arrow_1set
+ (JNIEnv *env, jclass that, jint arrow, jint arrow_type, jint shadow_type)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_arrow_set");
+#endif
+
+ gtk_arrow_set((GtkArrow*)arrow, (GtkArrowType)arrow_type, (GtkShadowType)shadow_type);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_box_pack_start
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1box_1pack_1start
+ (JNIEnv *env, jclass that, jint box, jint child, jboolean expand, jboolean fill, jint padding)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_box_pack_start");
+#endif
+
+ gtk_box_pack_start((GtkBox*)box, (GtkWidget*)child, (gboolean)expand, (gboolean)fill, padding);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_box_pack_end
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1box_1pack_1end
+ (JNIEnv *env, jclass that, jint box, jint child, jboolean expand, jboolean fill, jint padding)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_box_pack_end");
+#endif
+
+ gtk_box_pack_end((GtkBox*)box, (GtkWidget*)child, (gboolean)expand, (gboolean)fill, padding);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_button_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1button_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_button_new");
+#endif
+
+ return (jint)gtk_button_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_button_new_with_label
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1button_1new_1with_1label
+ (JNIEnv *env, jclass that, jbyteArray label)
+{
+ jint rc;
+ jbyte *label1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_button_new_with_label");
+#endif
+
+ if (label) {
+ label1 = (*env)->GetByteArrayElements(env, label, NULL);
+ }
+ rc = (jint)gtk_button_new_with_label((gchar*)label1);
+ if (label) {
+ (*env)->ReleaseByteArrayElements(env, label, label1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_check_button_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1button_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_check_button_new");
+#endif
+
+ return (jint)gtk_check_button_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_check_menu_item_new_with_label
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1menu_1item_1new_1with_1label
+ (JNIEnv *env, jclass that, jbyteArray label)
+{
+ jint rc;
+ jbyte *label1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_check_menu_item_new_with_label");
+#endif
+
+ if (label) {
+ label1 = (*env)->GetByteArrayElements(env, label, NULL);
+ }
+ rc = (jint)gtk_check_menu_item_new_with_label((gchar*)label1);
+ if (label) {
+ (*env)->ReleaseByteArrayElements(env, label, label1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_check_menu_item_set_active
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1menu_1item_1set_1active
+ (JNIEnv *env, jclass that, jint check_menu_item, jboolean is_active)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_check_menu_item_set_active");
+#endif
+
+ gtk_check_menu_item_set_active((GtkCheckMenuItem*)check_menu_item, (gboolean)is_active);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_check_menu_item_set_show_toggle
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1menu_1item_1set_1show_1toggle
+ (JNIEnv *env, jclass that, jint menu_item, jboolean always)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_check_menu_item_set_show_toggle");
+#endif
+
+ gtk_check_menu_item_set_show_toggle((GtkCheckMenuItem*)menu_item, (gboolean)always);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_color_selection_set_color
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1color_1selection_1set_1color
+ (JNIEnv *env, jclass that, jint colorsel, jdoubleArray color)
+{
+ jdouble *color1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_color_selection_set_color");
+#endif
+
+ if (color) {
+ color1 = (*env)->GetDoubleArrayElements(env, color, NULL);
+ }
+ gtk_color_selection_set_color((GtkColorSelection*)colorsel, (gdouble*)color1);
+ if (color) {
+ (*env)->ReleaseDoubleArrayElements(env, color, color1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_color_selection_get_color
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1color_1selection_1get_1color
+ (JNIEnv *env, jclass that, jint colorsel, jdoubleArray color)
+{
+ jdouble *color1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_color_selection_get_color");
+#endif
+
+ if (color) {
+ color1 = (*env)->GetDoubleArrayElements(env, color, NULL);
+ }
+ gtk_color_selection_get_color((GtkColorSelection*)colorsel, (gdouble*)color1);
+ if (color) {
+ (*env)->ReleaseDoubleArrayElements(env, color, color1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_color_selection_dialog_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1color_1selection_1dialog_1new
+ (JNIEnv *env, jclass that, jbyteArray title)
+{
+ jint rc;
+ jbyte *title1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_color_selection_dialog_new");
+#endif
+
+ if (title) {
+ title1 = (*env)->GetByteArrayElements(env, title, NULL);
+ }
+ rc = (jint)gtk_color_selection_dialog_new((gchar*)title1);
+ if (title) {
+ (*env)->ReleaseByteArrayElements(env, title, title1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_combo_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1combo_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_combo_new");
+#endif
+
+ return (jint)gtk_combo_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_combo_set_popdown_strings
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1combo_1set_1popdown_1strings
+ (JNIEnv *env, jclass that, jint combo, jint strings)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_combo_set_popdown_strings");
+#endif
+
+ gtk_combo_set_popdown_strings((GtkCombo*)combo, (GList*)strings);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_container_add
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1container_1add
+ (JNIEnv *env, jclass that, jint container, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_container_add");
+#endif
+
+ gtk_container_add((GtkContainer*)container, (GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_container_remove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1container_1remove
+ (JNIEnv *env, jclass that, jint container, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_container_remove");
+#endif
+
+ gtk_container_remove((GtkContainer*)container, (GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_container_children
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1container_1children
+ (JNIEnv *env, jclass that, jint container)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_container_children");
+#endif
+
+ return (jint)gtk_container_children((GtkContainer*)container);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1new
+ (JNIEnv *env, jclass that, jint columns, jint tree_column)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_new");
+#endif
+
+ return (jint)gtk_ctree_new((gint)columns, (gint)tree_column);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_insert_node
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1insert_1node
+ (JNIEnv *env, jclass that, jint ctree, jint parent, jint sibling, jintArray text, jbyte spacing, jint pixmap_closed, jint mask_closed, jint pixmap_opened, jint mask_opened, jboolean is_leaf, jboolean expanded)
+{
+ jint rc;
+ jint *text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_insert_node");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetIntArrayElements(env, text, NULL);
+ }
+ rc = (jint)gtk_ctree_insert_node((GtkCTree*)ctree, (GtkCTreeNode*)parent, (GtkCTreeNode*)sibling, (gchar**)text1, (guint8)spacing, (GdkPixmap*)pixmap_closed, (GdkBitmap*)mask_closed, (GdkPixmap*)pixmap_opened, (GdkBitmap*)mask_opened, (gboolean)is_leaf, (gboolean)expanded);
+ if (text) {
+ (*env)->ReleaseIntArrayElements(env, text, text1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_remove_node
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1remove_1node
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_remove_node");
+#endif
+
+ gtk_ctree_remove_node((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_post_recursive
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1post_1recursive
+ (JNIEnv *env, jclass that, jint ctree, jint node, jint func, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_post_recursive");
+#endif
+
+ gtk_ctree_post_recursive((GtkCTree*)ctree, (GtkCTreeNode*)node, (GtkCTreeFunc)func, (gpointer)data);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_is_viewable
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1is_1viewable
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_is_viewable");
+#endif
+
+ return (jboolean)gtk_ctree_is_viewable((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_node_nth
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1nth
+ (JNIEnv *env, jclass that, jint ctree, jint row)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_node_nth");
+#endif
+
+ return (jint)gtk_ctree_node_nth((GtkCTree*)ctree, row);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_is_hot_spot
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1is_1hot_1spot
+ (JNIEnv *env, jclass that, jint ctree, jint x, jint y)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_is_hot_spot");
+#endif
+
+ return (jboolean)gtk_ctree_is_hot_spot((GtkCTree*)ctree, (gint)x, (gint)y);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_expand
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1expand
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_expand");
+#endif
+
+ gtk_ctree_expand((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_collapse
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1collapse
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_collapse");
+#endif
+
+ gtk_ctree_collapse((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_select
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1select
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_select");
+#endif
+
+ gtk_ctree_select((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_select_recursive
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1select_1recursive
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_select_recursive");
+#endif
+
+ gtk_ctree_select_recursive((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_unselect_recursive
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1unselect_1recursive
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_unselect_recursive");
+#endif
+
+ gtk_ctree_unselect_recursive((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_set_node_info
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1set_1node_1info
+ (JNIEnv *env, jclass that, jint ctree, jint node, jbyteArray text, jbyte spacing, jint pixmap_closed, jint mask_closed, jint pixmap_opened, jint mask_opened, jboolean is_leaf, jboolean expanded)
+{
+ jbyte *text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_set_node_info");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetByteArrayElements(env, text, NULL);
+ }
+ gtk_ctree_set_node_info((GtkCTree*)ctree, (GtkCTreeNode*)node, (gchar*)text1, (guint8)spacing, (GdkPixmap*)pixmap_closed, (GdkBitmap*)mask_closed, (GdkPixmap*)pixmap_opened, (GdkBitmap*)mask_opened, (gboolean)is_leaf, (gboolean)expanded);
+ if (text) {
+ (*env)->ReleaseByteArrayElements(env, text, text1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_get_node_info
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1get_1node_1info
+ (JNIEnv *env, jclass that, jint ctree, jint node, jintArray text, jbyteArray spacing, jintArray pixmap_closed, jintArray mask_closed, jintArray pixmap_opened, jintArray mask_opened, jbooleanArray is_leaf, jbooleanArray expanded)
+{
+ jint rc;
+ jint *text1 = NULL;
+ jbyte *spacing1 = NULL;
+ jint *pixmap_closed1 = NULL;
+ jint *mask_closed1 = NULL;
+ jint *pixmap_opened1 = NULL;
+ jint *mask_opened1 = NULL;
+ jboolean *is_leaf1 = NULL;
+ jboolean *expanded1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_get_node_info");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetIntArrayElements(env, text, NULL);
+ }
+ if (spacing) {
+ spacing1 = (*env)->GetByteArrayElements(env, spacing, NULL);
+ }
+ if (pixmap_closed) {
+ pixmap_closed1 = (*env)->GetIntArrayElements(env, pixmap_closed, NULL);
+ }
+ if (mask_closed) {
+ mask_closed1 = (*env)->GetIntArrayElements(env, mask_closed, NULL);
+ }
+ if (pixmap_opened) {
+ pixmap_opened1 = (*env)->GetIntArrayElements(env, pixmap_opened, NULL);
+ }
+ if (mask_opened) {
+ mask_opened1 = (*env)->GetIntArrayElements(env, mask_opened, NULL);
+ }
+ if (is_leaf) {
+ is_leaf1 = (*env)->GetBooleanArrayElements(env, is_leaf, NULL);
+ }
+ if (expanded) {
+ expanded1 = (*env)->GetBooleanArrayElements(env, expanded, NULL);
+ }
+ rc = (jint)gtk_ctree_get_node_info((GtkCTree*)ctree, (GtkCTreeNode*)node, (gchar**)text1, (guint8*)spacing1, (GdkPixmap**)pixmap_closed1, (GdkBitmap**)mask_closed1, (GdkPixmap**)pixmap_opened1, (GdkBitmap**)mask_opened1, (gboolean*)is_leaf1, (gboolean*)expanded1);
+ if (text) {
+ (*env)->ReleaseIntArrayElements(env, text, text1, 0);
+ }
+ if (spacing) {
+ (*env)->ReleaseByteArrayElements(env, spacing, spacing1, 0);
+ }
+ if (pixmap_closed) {
+ (*env)->ReleaseIntArrayElements(env, pixmap_closed, pixmap_closed1, 0);
+ }
+ if (mask_closed) {
+ (*env)->ReleaseIntArrayElements(env, mask_closed, mask_closed1, 0);
+ }
+ if (pixmap_opened) {
+ (*env)->ReleaseIntArrayElements(env, pixmap_opened, pixmap_opened1, 0);
+ }
+ if (mask_opened) {
+ (*env)->ReleaseIntArrayElements(env, mask_opened, mask_opened1, 0);
+ }
+ if (is_leaf) {
+ (*env)->ReleaseBooleanArrayElements(env, is_leaf, is_leaf1, 0);
+ }
+ if (expanded) {
+ (*env)->ReleaseBooleanArrayElements(env, expanded, expanded1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_node_get_row_style
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1get_1row_1style
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_node_get_row_style");
+#endif
+
+ return (jint)gtk_ctree_node_get_row_style((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_node_set_row_data
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1set_1row_1data
+ (JNIEnv *env, jclass that, jint ctree, jint node, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_node_set_row_data");
+#endif
+
+ gtk_ctree_node_set_row_data((GtkCTree*)ctree, (GtkCTreeNode*)node, (gpointer)data);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_node_get_row_data
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1get_1row_1data
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_node_get_row_data");
+#endif
+
+ return (jint)gtk_ctree_node_get_row_data((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_node_moveto
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1moveto
+ (JNIEnv *env, jclass that, jint ctree, jint node, jint column, jfloat row_align, jfloat col_align)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_node_moveto");
+#endif
+
+ gtk_ctree_node_moveto((GtkCTree*)ctree, (GtkCTreeNode*)node, (gint)column, row_align, col_align);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_ctree_node_is_visible
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1ctree_1node_1is_1visible
+ (JNIEnv *env, jclass that, jint ctree, jint node)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_ctree_node_is_visible");
+#endif
+
+ return (jint)gtk_ctree_node_is_visible((GtkCTree*)ctree, (GtkCTreeNode*)node);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_dialog_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1dialog_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_dialog_new");
+#endif
+
+ return (jint)gtk_dialog_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_drawing_area_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1drawing_1area_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_drawing_area_new");
+#endif
+
+ return (jint)gtk_drawing_area_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_drawing_area_size
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1drawing_1area_1size
+ (JNIEnv *env, jclass that, jint darea, jint width, jint height)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_drawing_area_size");
+#endif
+
+ gtk_drawing_area_size((GtkDrawingArea*)darea, (gint)width, (gint)height);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_editable_select_region
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1select_1region
+ (JNIEnv *env, jclass that, jint editable, jint start, jint end)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_editable_select_region");
+#endif
+
+ gtk_editable_select_region((GtkEditable*)editable, (gint)start, (gint)end);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_editable_insert_text
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1insert_1text
+ (JNIEnv *env, jclass that, jint editable, jbyteArray new_text, jint new_text_length, jintArray position)
+{
+ jbyte *new_text1 = NULL;
+ jint *position1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_editable_insert_text");
+#endif
+
+ if (new_text) {
+ new_text1 = (*env)->GetByteArrayElements(env, new_text, NULL);
+ }
+ if (position) {
+ position1 = (*env)->GetIntArrayElements(env, position, NULL);
+ }
+ gtk_editable_insert_text((GtkEditable*)editable, (gchar*)new_text1, (gint)new_text_length, (gint*)position1);
+ if (new_text) {
+ (*env)->ReleaseByteArrayElements(env, new_text, new_text1, 0);
+ }
+ if (position) {
+ (*env)->ReleaseIntArrayElements(env, position, position1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_editable_delete_text
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1delete_1text
+ (JNIEnv *env, jclass that, jint editable, jint start_pos, jint end_pos)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_editable_delete_text");
+#endif
+
+ gtk_editable_delete_text((GtkEditable*)editable, (gint)start_pos, (gint)end_pos);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_editable_get_chars
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1get_1chars
+ (JNIEnv *env, jclass that, jint editable, jint start_pos, jint end_pos)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_editable_get_chars");
+#endif
+
+ return (jint)gtk_editable_get_chars((GtkEditable*)editable, (gint)start_pos, (gint)end_pos);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_editable_delete_selection
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1delete_1selection
+ (JNIEnv *env, jclass that, jint editable)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_editable_delete_selection");
+#endif
+
+ gtk_editable_delete_selection((GtkEditable*)editable);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_editable_set_position
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1set_1position
+ (JNIEnv *env, jclass that, jint editable, jint position)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_editable_set_position");
+#endif
+
+ gtk_editable_set_position((GtkEditable*)editable, (gint)position);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_editable_get_position
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1get_1position
+ (JNIEnv *env, jclass that, jint editable)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_editable_get_position");
+#endif
+
+ return (jint)gtk_editable_get_position((GtkEditable*)editable);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_editable_set_editable
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1editable_1set_1editable
+ (JNIEnv *env, jclass that, jint editable, jboolean is_editable)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_editable_set_editable");
+#endif
+
+ gtk_editable_set_editable((GtkEditable*)editable, (gboolean)is_editable);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_entry_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_entry_new");
+#endif
+
+ return (jint)gtk_entry_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_entry_set_text
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1set_1text
+ (JNIEnv *env, jclass that, jint entry, jbyteArray text)
+{
+ jbyte *text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_entry_set_text");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetByteArrayElements(env, text, NULL);
+ }
+ gtk_entry_set_text((GtkEntry*)entry, (gchar*)text1);
+ if (text) {
+ (*env)->ReleaseByteArrayElements(env, text, text1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_entry_append_text
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1append_1text
+ (JNIEnv *env, jclass that, jint entry, jbyteArray text)
+{
+ jbyte *text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_entry_append_text");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetByteArrayElements(env, text, NULL);
+ }
+ gtk_entry_append_text((GtkEntry*)entry, (gchar*)text1);
+ if (text) {
+ (*env)->ReleaseByteArrayElements(env, text, text1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_entry_get_text
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1get_1text
+ (JNIEnv *env, jclass that, jint entry)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_entry_get_text");
+#endif
+
+ return (jint)gtk_entry_get_text((GtkEntry*)entry);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_entry_set_visibility
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1set_1visibility
+ (JNIEnv *env, jclass that, jint entry, jboolean visible)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_entry_set_visibility");
+#endif
+
+ gtk_entry_set_visibility((GtkEntry*)entry, (gboolean)visible);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_entry_set_editable
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1set_1editable
+ (JNIEnv *env, jclass that, jint entry, jboolean editable)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_entry_set_editable");
+#endif
+
+ gtk_entry_set_editable((GtkEntry*)entry, (gboolean)editable);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_entry_set_max_length
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1entry_1set_1max_1length
+ (JNIEnv *env, jclass that, jint entry, jshort max)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_entry_set_max_length");
+#endif
+
+ gtk_entry_set_max_length((GtkEntry*)entry, (guint16)max);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_event_box_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1event_1box_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_event_box_new");
+#endif
+
+ return (jint)gtk_event_box_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_file_selection_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1file_1selection_1new
+ (JNIEnv *env, jclass that, jbyteArray title)
+{
+ jint rc;
+ jbyte *title1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_file_selection_new");
+#endif
+
+ if (title) {
+ title1 = (*env)->GetByteArrayElements(env, title, NULL);
+ }
+ rc = (jint)gtk_file_selection_new((gchar*)title1);
+ if (title) {
+ (*env)->ReleaseByteArrayElements(env, title, title1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_file_selection_set_filename
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1file_1selection_1set_1filename
+ (JNIEnv *env, jclass that, jint filesel, jbyteArray filename)
+{
+ jbyte *filename1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_file_selection_set_filename");
+#endif
+
+ if (filename) {
+ filename1 = (*env)->GetByteArrayElements(env, filename, NULL);
+ }
+ gtk_file_selection_set_filename((GtkFileSelection*)filesel, (gchar*)filename1);
+ if (filename) {
+ (*env)->ReleaseByteArrayElements(env, filename, filename1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_file_selection_get_filename
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1file_1selection_1get_1filename
+ (JNIEnv *env, jclass that, jint filesel)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_file_selection_get_filename");
+#endif
+
+ return (jint)gtk_file_selection_get_filename((GtkFileSelection*)filesel);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_file_selection_complete
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1file_1selection_1complete
+ (JNIEnv *env, jclass that, jint filesel, jbyteArray pattern)
+{
+ jbyte *pattern1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_file_selection_complete");
+#endif
+
+ if (pattern) {
+ pattern1 = (*env)->GetByteArrayElements(env, pattern, NULL);
+ }
+ gtk_file_selection_complete((GtkFileSelection*)filesel, (gchar*)pattern1);
+ if (pattern) {
+ (*env)->ReleaseByteArrayElements(env, pattern, pattern1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_fixed_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1fixed_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_fixed_new");
+#endif
+
+ return (jint)gtk_fixed_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_fixed_put
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1fixed_1put
+ (JNIEnv *env, jclass that, jint fixed, jint widget, jshort x, jshort y)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_fixed_put");
+#endif
+
+ gtk_fixed_put((GtkFixed*)fixed, (GtkWidget*)widget, (gint16)x, (gint16)y);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_fixed_move
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1fixed_1move
+ (JNIEnv *env, jclass that, jint fixed, jint widget, jshort x, jshort y)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_fixed_move");
+#endif
+
+ gtk_fixed_move((GtkFixed*)fixed, (GtkWidget*)widget, (gint16)x, (gint16)y);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_font_selection_set_font_name
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1font_1selection_1set_1font_1name
+ (JNIEnv *env, jclass that, jint fontsel, jbyteArray fontname)
+{
+ jboolean rc;
+ jbyte *fontname1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_font_selection_set_font_name");
+#endif
+
+ if (fontname) {
+ fontname1 = (*env)->GetByteArrayElements(env, fontname, NULL);
+ }
+ rc = (jboolean)gtk_font_selection_set_font_name((GtkFontSelection*)fontsel, (gchar*)fontname1);
+ if (fontname) {
+ (*env)->ReleaseByteArrayElements(env, fontname, fontname1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_font_selection_dialog_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1font_1selection_1dialog_1new
+ (JNIEnv *env, jclass that, jbyteArray title)
+{
+ jint rc;
+ jbyte *title1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_font_selection_dialog_new");
+#endif
+
+ if (title) {
+ title1 = (*env)->GetByteArrayElements(env, title, NULL);
+ }
+ rc = (jint)gtk_font_selection_dialog_new((gchar*)title1);
+ if (title) {
+ (*env)->ReleaseByteArrayElements(env, title, title1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_font_selection_dialog_get_font_name
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1font_1selection_1dialog_1get_1font_1name
+ (JNIEnv *env, jclass that, jint fsd)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_font_selection_dialog_get_font_name");
+#endif
+
+ return (jint)gtk_font_selection_dialog_get_font_name((GtkFontSelectionDialog*)fsd);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_font_selection_dialog_set_font_name
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1font_1selection_1dialog_1set_1font_1name
+ (JNIEnv *env, jclass that, jint fsd, jbyteArray fontname)
+{
+ jboolean rc;
+ jbyte *fontname1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_font_selection_dialog_set_font_name");
+#endif
+
+ if (fontname) {
+ fontname1 = (*env)->GetByteArrayElements(env, fontname, NULL);
+ }
+ rc = (jboolean)gtk_font_selection_dialog_set_font_name((GtkFontSelectionDialog*)fsd, (gchar*)fontname1);
+ if (fontname) {
+ (*env)->ReleaseByteArrayElements(env, fontname, fontname1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_frame_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1frame_1new
+ (JNIEnv *env, jclass that, jbyteArray label)
+{
+ jint rc;
+ jbyte *label1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_frame_new");
+#endif
+
+ if (label) {
+ label1 = (*env)->GetByteArrayElements(env, label, NULL);
+ }
+ rc = (jint)gtk_frame_new((gchar*)label1);
+ if (label) {
+ (*env)->ReleaseByteArrayElements(env, label, label1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_frame_set_label
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1frame_1set_1label
+ (JNIEnv *env, jclass that, jint frame, jbyteArray label)
+{
+ jbyte *label1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_frame_set_label");
+#endif
+
+ if (label) {
+ label1 = (*env)->GetByteArrayElements(env, label, NULL);
+ }
+ gtk_frame_set_label((GtkFrame*)frame, (gchar*)label1);
+ if (label) {
+ (*env)->ReleaseByteArrayElements(env, label, label1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_frame_set_shadow_type
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1frame_1set_1shadow_1type
+ (JNIEnv *env, jclass that, jint frame, jint type)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_frame_set_shadow_type");
+#endif
+
+ gtk_frame_set_shadow_type((GtkFrame*)frame, (GtkShadowType)type);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_hbox_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1hbox_1new
+ (JNIEnv *env, jclass that, jboolean homogeneous, jint spacing)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_hbox_new");
+#endif
+
+ return (jint)gtk_hbox_new((gboolean)homogeneous, (gint)spacing);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_hscale_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1hscale_1new
+ (JNIEnv *env, jclass that, jint adjustment)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_hscale_new");
+#endif
+
+ return (jint)gtk_hscale_new((GtkAdjustment*)adjustment);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_hscrollbar_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1hscrollbar_1new
+ (JNIEnv *env, jclass that, jint adjustment)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_hscrollbar_new");
+#endif
+
+ return (jint)gtk_hscrollbar_new((GtkAdjustment*)adjustment);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_hseparator_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1hseparator_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_hseparator_new");
+#endif
+
+ return (jint)gtk_hseparator_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_label_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1new
+ (JNIEnv *env, jclass that, jbyteArray str)
+{
+ jint rc;
+ jbyte *str1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_label_new");
+#endif
+
+ if (str) {
+ str1 = (*env)->GetByteArrayElements(env, str, NULL);
+ }
+ rc = (jint)gtk_label_new((gchar*)str1);
+ if (str) {
+ (*env)->ReleaseByteArrayElements(env, str, str1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_label_set_text
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1set_1text
+ (JNIEnv *env, jclass that, jint label, jbyteArray str)
+{
+ jbyte *str1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_label_set_text");
+#endif
+
+ if (str) {
+ str1 = (*env)->GetByteArrayElements(env, str, NULL);
+ }
+ gtk_label_set_text((GtkLabel*)label, (gchar*)str1);
+ if (str) {
+ (*env)->ReleaseByteArrayElements(env, str, str1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_label_set_justify
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1set_1justify
+ (JNIEnv *env, jclass that, jint label, jint jtype)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_label_set_justify");
+#endif
+
+ gtk_label_set_justify((GtkLabel*)label, (GtkJustification)jtype);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_label_set_pattern
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1set_1pattern
+ (JNIEnv *env, jclass that, jint label, jbyteArray pattern)
+{
+ jbyte *pattern1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_label_set_pattern");
+#endif
+
+ if (pattern) {
+ pattern1 = (*env)->GetByteArrayElements(env, pattern, NULL);
+ }
+ gtk_label_set_pattern((GtkLabel*)label, (gchar*)pattern1);
+ if (pattern) {
+ (*env)->ReleaseByteArrayElements(env, pattern, pattern1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_label_set_line_wrap
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1set_1line_1wrap
+ (JNIEnv *env, jclass that, jint label, jboolean wrap)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_label_set_line_wrap");
+#endif
+
+ gtk_label_set_line_wrap((GtkLabel*)label, (gboolean)wrap);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_label_parse_uline
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1label_1parse_1uline
+ (JNIEnv *env, jclass that, jint label, jbyteArray string)
+{
+ jint rc;
+ jbyte *string1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_label_parse_uline");
+#endif
+
+ if (string) {
+ string1 = (*env)->GetByteArrayElements(env, string, NULL);
+ }
+ rc = (jint)gtk_label_parse_uline((GtkLabel*)label, (gchar*)string1);
+ if (string) {
+ (*env)->ReleaseByteArrayElements(env, string, string1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_list_clear_items
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1list_1clear_1items
+ (JNIEnv *env, jclass that, jint list, jint start, jint end)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_list_clear_items");
+#endif
+
+ gtk_list_clear_items((GtkList*)list, (gint)start, (gint)end);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_list_select_item
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1list_1select_1item
+ (JNIEnv *env, jclass that, jint list, jint item)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_list_select_item");
+#endif
+
+ gtk_list_select_item((GtkList*)list, (gint)item);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_check_version
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1check_1version
+ (JNIEnv *env, jclass that, jint required_major, jint required_minor, jint required_micro)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_check_version");
+#endif
+
+ return (jint)gtk_check_version(required_major, required_minor, required_micro);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_init_check
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1init_1check
+ (JNIEnv *env, jclass that, jintArray argc, jintArray argv)
+{
+ jboolean rc;
+ jint *argc1 = NULL;
+ jint *argv1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_init_check");
+#endif
+
+ if (argc) {
+ argc1 = (*env)->GetIntArrayElements(env, argc, NULL);
+ }
+ if (argv) {
+ argv1 = (*env)->GetIntArrayElements(env, argv, NULL);
+ }
+ rc = (jboolean)gtk_init_check((int*)argc1, (char***)argv1);
+ if (argc) {
+ (*env)->ReleaseIntArrayElements(env, argc, argc1, 0);
+ }
+ if (argv) {
+ (*env)->ReleaseIntArrayElements(env, argv, argv1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_events_pending
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1events_1pending
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_events_pending");
+#endif
+
+ return (jint)gtk_events_pending();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_main
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1main
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_main");
+#endif
+
+ gtk_main();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_main_quit
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1main_1quit
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_main_quit");
+#endif
+
+ gtk_main_quit();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_main_iteration
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1main_1iteration
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_main_iteration");
+#endif
+
+ return (jint)gtk_main_iteration();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_grab_add
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1grab_1add
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_grab_add");
+#endif
+
+ gtk_grab_add((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_grab_get_current
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1grab_1get_1current
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_grab_get_current");
+#endif
+
+ return (jint)gtk_grab_get_current();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_grab_remove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1grab_1remove
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_grab_remove");
+#endif
+
+ gtk_grab_remove((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_timeout_add
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1timeout_1add
+ (JNIEnv *env, jclass that, jint interval, jint function, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_timeout_add");
+#endif
+
+ return (jint)gtk_timeout_add((guint32)interval, (GtkFunction)function, (gpointer)data);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_timeout_remove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1timeout_1remove
+ (JNIEnv *env, jclass that, jint timeout_handler_id)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_timeout_remove");
+#endif
+
+ gtk_timeout_remove(timeout_handler_id);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_new");
+#endif
+
+ return (jint)gtk_menu_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_insert
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1insert
+ (JNIEnv *env, jclass that, jint menu, jint child, jint position)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_insert");
+#endif
+
+ gtk_menu_insert((GtkMenu*)menu, (GtkWidget*)child, (gint)position);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_popup
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1popup
+ (JNIEnv *env, jclass that, jint menu, jint parent_menu_shell, jint parent_menu_item, jint func, jint data, jint button, jint activate_time)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_popup");
+#endif
+
+ gtk_menu_popup((GtkMenu*)menu, (GtkWidget*)parent_menu_shell, (GtkWidget*)parent_menu_item, (GtkMenuPositionFunc)func, (gpointer)data, button, (guint32)activate_time);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_popdown
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1popdown
+ (JNIEnv *env, jclass that, jint menu)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_popdown");
+#endif
+
+ gtk_menu_popdown((GtkMenu*)menu);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_bar_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1bar_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_bar_new");
+#endif
+
+ return (jint)gtk_menu_bar_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_bar_insert
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1bar_1insert
+ (JNIEnv *env, jclass that, jint menu_bar, jint child, jint position)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_bar_insert");
+#endif
+
+ gtk_menu_bar_insert((GtkMenuBar*)menu_bar, (GtkWidget*)child, (gint)position);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_item_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1item_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_item_new");
+#endif
+
+ return (jint)gtk_menu_item_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_item_new_with_label
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1item_1new_1with_1label
+ (JNIEnv *env, jclass that, jbyteArray label)
+{
+ jint rc;
+ jbyte *label1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_item_new_with_label");
+#endif
+
+ if (label) {
+ label1 = (*env)->GetByteArrayElements(env, label, NULL);
+ }
+ rc = (jint)gtk_menu_item_new_with_label((gchar*)label1);
+ if (label) {
+ (*env)->ReleaseByteArrayElements(env, label, label1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_item_set_submenu
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1item_1set_1submenu
+ (JNIEnv *env, jclass that, jint menu_item, jint submenu)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_item_set_submenu");
+#endif
+
+ gtk_menu_item_set_submenu((GtkMenuItem*)menu_item, (GtkWidget*)submenu);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_menu_item_remove_submenu
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1menu_1item_1remove_1submenu
+ (JNIEnv *env, jclass that, jint menu_item)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_menu_item_remove_submenu");
+#endif
+
+ gtk_menu_item_remove_submenu((GtkMenuItem*)menu_item);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_misc_set_alignment
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1misc_1set_1alignment
+ (JNIEnv *env, jclass that, jint misc, jfloat xalign, jfloat yalign)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_misc_set_alignment");
+#endif
+
+ gtk_misc_set_alignment((GtkMisc*)misc, xalign, yalign);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_notebook_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_notebook_new");
+#endif
+
+ return (jint)gtk_notebook_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_notebook_append_page
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1append_1page
+ (JNIEnv *env, jclass that, jint notebook, jint child, jint tab_label)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_notebook_append_page");
+#endif
+
+ gtk_notebook_append_page((GtkNotebook*)notebook, (GtkWidget*)child, (GtkWidget*)tab_label);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_notebook_remove_page
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1remove_1page
+ (JNIEnv *env, jclass that, jint notebook, jint page_num)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_notebook_remove_page");
+#endif
+
+ gtk_notebook_remove_page((GtkNotebook*)notebook, (gint)page_num);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_notebook_get_current_page
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1get_1current_1page
+ (JNIEnv *env, jclass that, jint notebook)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_notebook_get_current_page");
+#endif
+
+ return (jint)gtk_notebook_get_current_page((GtkNotebook*)notebook);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_notebook_set_page
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1set_1page
+ (JNIEnv *env, jclass that, jint notebook, jint page_num)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_notebook_set_page");
+#endif
+
+ gtk_notebook_set_page((GtkNotebook*)notebook, (gint)page_num);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_notebook_set_show_tabs
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1notebook_1set_1show_1tabs
+ (JNIEnv *env, jclass that, jint notebook, jboolean show_tabs)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_notebook_set_show_tabs");
+#endif
+
+ gtk_notebook_set_show_tabs((GtkNotebook*)notebook, (gboolean)show_tabs);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_object_ref
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1ref
+ (JNIEnv *env, jclass that, jint object)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_object_ref");
+#endif
+
+ gtk_object_ref((GtkObject*)object);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_object_set_user_data
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1set_1user_1data
+ (JNIEnv *env, jclass that, jint object, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_object_set_user_data");
+#endif
+
+ gtk_object_set_user_data((GtkObject*)object, (gpointer)data);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_object_get_user_data
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1object_1get_1user_1data
+ (JNIEnv *env, jclass that, jint object)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_object_get_user_data");
+#endif
+
+ return (jint)gtk_object_get_user_data((GtkObject*)object);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_pixmap_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1pixmap_1new
+ (JNIEnv *env, jclass that, jint pixmap, jint mask)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_pixmap_new");
+#endif
+
+ return (jint)gtk_pixmap_new((GdkPixmap*)pixmap, (GdkBitmap*)mask);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_pixmap_set
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1pixmap_1set
+ (JNIEnv *env, jclass that, jint pixmap, jint val, jint mask)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_pixmap_set");
+#endif
+
+ gtk_pixmap_set((GtkPixmap*)pixmap, (GdkPixmap*)val, (GdkBitmap*)mask);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_progress_configure
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1progress_1configure
+ (JNIEnv *env, jclass that, jint progress, jfloat value, jfloat min, jfloat max)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_progress_configure");
+#endif
+
+ gtk_progress_configure((GtkProgress*)progress, value, min, max);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_progress_bar_new_with_adjustment
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1progress_1bar_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_progress_bar_new");
+#endif
+
+ return (jint)gtk_progress_bar_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_progress_bar_set_bar_style
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1progress_1bar_1set_1bar_1style
+ (JNIEnv *env, jclass that, jint pbar, jint style)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_progress_bar_set_bar_style");
+#endif
+
+ gtk_progress_bar_set_bar_style((GtkProgressBar*)pbar, (GtkProgressBarStyle)style);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_progress_bar_set_orientation
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1progress_1bar_1set_1orientation
+ (JNIEnv *env, jclass that, jint pbar, jint orientation)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_progress_bar_set_orientation");
+#endif
+
+ gtk_progress_bar_set_orientation((GtkProgressBar*)pbar, (GtkProgressBarOrientation)orientation);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_radio_button_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1radio_1button_1new
+ (JNIEnv *env, jclass that, jint group)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_radio_button_new");
+#endif
+
+ return (jint)gtk_radio_button_new((GSList*)group);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_radio_button_group
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1radio_1button_1group
+ (JNIEnv *env, jclass that, jint radio_button)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_radio_button_group");
+#endif
+
+ return (jint)gtk_radio_button_group((GtkRadioButton*)radio_button);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_radio_menu_item_new_with_label
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1radio_1menu_1item_1new_1with_1label
+ (JNIEnv *env, jclass that, jint group, jbyteArray label)
+{
+ jint rc;
+ jbyte *label1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_radio_menu_item_new_with_label");
+#endif
+
+ if (label) {
+ label1 = (*env)->GetByteArrayElements(env, label, NULL);
+ }
+ rc = (jint)gtk_radio_menu_item_new_with_label((GSList*)group, (gchar*)label1);
+ if (label) {
+ (*env)->ReleaseByteArrayElements(env, label, label1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_range_get_adjustment
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1range_1get_1adjustment
+ (JNIEnv *env, jclass that, jint range)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_range_get_adjustment");
+#endif
+
+ return (jint)gtk_range_get_adjustment((GtkRange*)range);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_scale_set_digits
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scale_1set_1digits
+ (JNIEnv *env, jclass that, jint scale, jint digits)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_scale_set_digits");
+#endif
+
+ gtk_scale_set_digits((GtkScale*)scale, (gint)digits);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_scale_set_draw_value
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scale_1set_1draw_1value
+ (JNIEnv *env, jclass that, jint scale, jboolean draw_value)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_scale_set_draw_value");
+#endif
+
+ gtk_scale_set_draw_value((GtkScale*)scale, (gboolean)draw_value);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_scale_set_value_pos
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scale_1set_1value_1pos
+ (JNIEnv *env, jclass that, jint scale, jint pos)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_scale_set_value_pos");
+#endif
+
+ gtk_scale_set_value_pos((GtkScale*)scale, (GtkPositionType)pos);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_scrolled_window_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scrolled_1window_1new
+ (JNIEnv *env, jclass that, jint hadjustment, jint vadjustment)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_scrolled_window_new");
+#endif
+
+ return (jint)gtk_scrolled_window_new((GtkAdjustment*)hadjustment, (GtkAdjustment*)vadjustment);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_scrolled_window_get_hadjustment
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scrolled_1window_1get_1hadjustment
+ (JNIEnv *env, jclass that, jint scrolled_window)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_scrolled_window_get_hadjustment");
+#endif
+
+ return (jint)gtk_scrolled_window_get_hadjustment((GtkScrolledWindow*)scrolled_window);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_scrolled_window_get_vadjustment
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scrolled_1window_1get_1vadjustment
+ (JNIEnv *env, jclass that, jint scrolled_window)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_scrolled_window_get_vadjustment");
+#endif
+
+ return (jint)gtk_scrolled_window_get_vadjustment((GtkScrolledWindow*)scrolled_window);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_scrolled_window_set_policy
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1scrolled_1window_1set_1policy
+ (JNIEnv *env, jclass that, jint scrolled_window, jint hscrollbar_policy, jint vscrollbar_policy)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_scrolled_window_set_policy");
+#endif
+
+ gtk_scrolled_window_set_policy((GtkScrolledWindow*)scrolled_window, (GtkPolicyType)hscrollbar_policy, (GtkPolicyType)vscrollbar_policy);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_selection_owner_set
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1selection_1owner_1set
+ (JNIEnv *env, jclass that, jint widget, jint selection, jint time)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_selection_owner_set");
+#endif
+
+ return (jint)gtk_selection_owner_set((GtkWidget*)widget, (GdkAtom)selection, (guint32)time);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_selection_convert
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1selection_1convert
+ (JNIEnv *env, jclass that, jint widget, jint selection, jint target, jint time)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_selection_convert");
+#endif
+
+ return (jint)gtk_selection_convert((GtkWidget*)widget, (GdkAtom)selection, (GdkAtom)target, (guint32)time);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_signal_emit_stop_by_name
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1emit_1stop_1by_1name
+ (JNIEnv *env, jclass that, jint object, jbyteArray name)
+{
+ jbyte *name1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_signal_emit_stop_by_name");
+#endif
+
+ if (name) {
+ name1 = (*env)->GetByteArrayElements(env, name, NULL);
+ }
+ gtk_signal_emit_stop_by_name((GtkObject*)object, (gchar*)name1);
+ if (name) {
+ (*env)->ReleaseByteArrayElements(env, name, name1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_signal_connect
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1connect
+ (JNIEnv *env, jclass that, jint object, jbyteArray name, jint func, jint func_data)
+{
+ jint rc;
+ jbyte *name1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_signal_connect");
+#endif
+
+ if (name) {
+ name1 = (*env)->GetByteArrayElements(env, name, NULL);
+ }
+ rc = (jint)gtk_signal_connect((GtkObject*)object, (gchar*)name1, (GtkSignalFunc)func, (gpointer)func_data);
+ if (name) {
+ (*env)->ReleaseByteArrayElements(env, name, name1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_signal_connect_after
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1connect_1after
+ (JNIEnv *env, jclass that, jint object, jbyteArray name, jint func, jint func_data)
+{
+ jint rc;
+ jbyte *name1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_signal_connect_after");
+#endif
+
+ if (name) {
+ name1 = (*env)->GetByteArrayElements(env, name, NULL);
+ }
+ rc = (jint)gtk_signal_connect_after((GtkObject*)object, (gchar*)name1, (GtkSignalFunc)func, (gpointer)func_data);
+ if (name) {
+ (*env)->ReleaseByteArrayElements(env, name, name1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_signal_handler_block_by_func
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1handler_1block_1by_1func
+ (JNIEnv *env, jclass that, jint object, jint func, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_signal_handler_block_by_func");
+#endif
+
+ gtk_signal_handler_block_by_func((GtkObject*)object, (GtkSignalFunc)func, (gpointer)data);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_signal_handler_unblock_by_func
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1signal_1handler_1unblock_1by_1func
+ (JNIEnv *env, jclass that, jint object, jint func, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_signal_handler_unblock_by_func");
+#endif
+
+ gtk_signal_handler_unblock_by_func((GtkObject*)object, (GtkSignalFunc)func, (gpointer)data);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_style_copy
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1style_1copy
+ (JNIEnv *env, jclass that, jint style)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_style_copy");
+#endif
+
+ return (jint)gtk_style_copy((GtkStyle*)style);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_style_unref
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1style_1unref
+ (JNIEnv *env, jclass that, jint style)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_style_unref");
+#endif
+
+ gtk_style_unref((GtkStyle*)style);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_text_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1text_1new
+ (JNIEnv *env, jclass that, jint hadj, jint vadj)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_text_new");
+#endif
+
+ return (jint)gtk_text_new((GtkAdjustment*)hadj, (GtkAdjustment*)vadj);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_text_set_word_wrap
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1text_1set_1word_1wrap
+ (JNIEnv *env, jclass that, jint text, jint word_wrap)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_text_set_word_wrap");
+#endif
+
+ gtk_text_set_word_wrap((GtkText*)text, (gint)word_wrap);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_text_get_length
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1text_1get_1length
+ (JNIEnv *env, jclass that, jint text)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_text_get_length");
+#endif
+
+ return (jint)gtk_text_get_length((GtkText*)text);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_toggle_button_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toggle_1button_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_toggle_button_new");
+#endif
+
+ return (jint)gtk_toggle_button_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_toggle_button_set_active
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toggle_1button_1set_1active
+ (JNIEnv *env, jclass that, jint toggle_button, jboolean is_active)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_toggle_button_set_active");
+#endif
+
+ gtk_toggle_button_set_active((GtkToggleButton*)toggle_button, (gboolean)is_active);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_toggle_button_get_active
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toggle_1button_1get_1active
+ (JNIEnv *env, jclass that, jint toggle_button)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_toggle_button_get_active");
+#endif
+
+ return (jboolean)gtk_toggle_button_get_active((GtkToggleButton*)toggle_button);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_toolbar_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1new
+ (JNIEnv *env, jclass that, jint orientation, jint style)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_toolbar_new");
+#endif
+
+ return (jint)gtk_toolbar_new((GtkOrientation)orientation, (GtkToolbarStyle)style);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_toolbar_insert_element
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1insert_1element
+ (JNIEnv *env, jclass that, jint toolbar, jint type, jint widget, jbyteArray text, jbyteArray tooltip_text, jbyteArray tooltip_private_text, jint icon, jint callback, jint user_data, jint position)
+{
+ jint rc;
+ jbyte *text1 = NULL;
+ jbyte *tooltip_text1 = NULL;
+ jbyte *tooltip_private_text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_toolbar_insert_element");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetByteArrayElements(env, text, NULL);
+ }
+ if (tooltip_text) {
+ tooltip_text1 = (*env)->GetByteArrayElements(env, tooltip_text, NULL);
+ }
+ if (tooltip_private_text) {
+ tooltip_private_text1 = (*env)->GetByteArrayElements(env, tooltip_private_text, NULL);
+ }
+ rc = (jint)gtk_toolbar_insert_element((GtkToolbar*)toolbar, (GtkToolbarChildType)type, (GtkWidget*)widget, (char*)text1, (char*)tooltip_text1, (char*)tooltip_private_text1, (GtkWidget*)icon, (GtkSignalFunc)callback, (gpointer)user_data, (gint)position);
+ if (text) {
+ (*env)->ReleaseByteArrayElements(env, text, text1, 0);
+ }
+ if (tooltip_text) {
+ (*env)->ReleaseByteArrayElements(env, tooltip_text, tooltip_text1, 0);
+ }
+ if (tooltip_private_text) {
+ (*env)->ReleaseByteArrayElements(env, tooltip_private_text, tooltip_private_text1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_toolbar_insert_widget
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1insert_1widget
+ (JNIEnv *env, jclass that, jint toolbar, jint widget, jbyteArray tooltip_text, jbyteArray tooltip_private_text, jint position)
+{
+ jbyte *tooltip_text1 = NULL;
+ jbyte *tooltip_private_text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_toolbar_insert_widget");
+#endif
+
+ if (tooltip_text) {
+ tooltip_text1 = (*env)->GetByteArrayElements(env, tooltip_text, NULL);
+ }
+ if (tooltip_private_text) {
+ tooltip_private_text1 = (*env)->GetByteArrayElements(env, tooltip_private_text, NULL);
+ }
+ gtk_toolbar_insert_widget((GtkToolbar*)toolbar, (GtkWidget*)widget, (char*)tooltip_text1, (char*)tooltip_private_text1, (gint)position);
+ if (tooltip_text) {
+ (*env)->ReleaseByteArrayElements(env, tooltip_text, tooltip_text1, 0);
+ }
+ if (tooltip_private_text) {
+ (*env)->ReleaseByteArrayElements(env, tooltip_private_text, tooltip_private_text1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_toolbar_set_orientation
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1set_1orientation
+ (JNIEnv *env, jclass that, jint toolbar, jint orientation)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_toolbar_set_orientation");
+#endif
+
+ gtk_toolbar_set_orientation((GtkToolbar*)toolbar, (GtkOrientation)orientation);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_toolbar_set_button_relief
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1toolbar_1set_1button_1relief
+ (JNIEnv *env, jclass that, jint toolbar, jint relief)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_toolbar_set_button_relief");
+#endif
+
+ gtk_toolbar_set_button_relief((GtkToolbar*)toolbar, (GtkReliefStyle)relief);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_tooltips_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1tooltips_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_tooltips_new");
+#endif
+
+ return (jint)gtk_tooltips_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_tooltips_set_tip
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1tooltips_1set_1tip
+ (JNIEnv *env, jclass that, jint tooltips, jint widget, jbyteArray tip_text, jbyteArray tip_private)
+{
+ jbyte *tip_text1 = NULL;
+ jbyte *tip_private1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_tooltips_set_tip");
+#endif
+
+ if (tip_text) {
+ tip_text1 = (*env)->GetByteArrayElements(env, tip_text, NULL);
+ }
+ if (tip_private) {
+ tip_private1 = (*env)->GetByteArrayElements(env, tip_private, NULL);
+ }
+ gtk_tooltips_set_tip((GtkTooltips*)tooltips, (GtkWidget*)widget, (gchar*)tip_text1, (gchar*)tip_private1);
+ if (tip_text) {
+ (*env)->ReleaseByteArrayElements(env, tip_text, tip_text1, 0);
+ }
+ if (tip_private) {
+ (*env)->ReleaseByteArrayElements(env, tip_private, tip_private1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_vbox_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1vbox_1new
+ (JNIEnv *env, jclass that, jboolean homogeneous, jint spacing)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_vbox_new");
+#endif
+
+ return (jint)gtk_vbox_new((gboolean)homogeneous, (gint)spacing);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_vscale_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1vscale_1new
+ (JNIEnv *env, jclass that, jint adjustment)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_vscale_new");
+#endif
+
+ return (jint)gtk_vscale_new((GtkAdjustment*)adjustment);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_vscrollbar_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1vscrollbar_1new
+ (JNIEnv *env, jclass that, jint adjustment)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_vscrollbar_new");
+#endif
+
+ return (jint)gtk_vscrollbar_new((GtkAdjustment*)adjustment);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_vseparator_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1vseparator_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_vseparator_new");
+#endif
+
+ return (jint)gtk_vseparator_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_destroy
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1destroy
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_destroy");
+#endif
+
+ gtk_widget_destroy((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_show
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1show
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_show");
+#endif
+
+ gtk_widget_show((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_show_now
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1show_1now
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_show_now");
+#endif
+
+ gtk_widget_show_now((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_hide
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1hide
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_hide");
+#endif
+
+ gtk_widget_hide((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_realize
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1realize
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_realize");
+#endif
+
+ gtk_widget_realize((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_queue_draw
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1queue_1draw
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_queue_draw");
+#endif
+
+ gtk_widget_queue_draw((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_size_request
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1size_1request
+ (JNIEnv *env, jclass that, jint widget, jobject requisition)
+{
+ DECL_GLOB(pGlob)
+ GtkRequisition requisition_struct, *requisition1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_size_request");
+#endif
+
+ if (requisition) {
+ requisition1 = &requisition_struct;
+ cacheGtkRequisitionFids(env, requisition, &PGLOB(GtkRequisitionFc));
+ getGtkRequisitionFields(env, requisition, requisition1, &PGLOB(GtkRequisitionFc));
+ }
+ gtk_widget_size_request((GtkWidget*)widget, (GtkRequisition*)requisition1);
+ if (requisition) {
+ setGtkRequisitionFields(env, requisition, requisition1, &PGLOB(GtkRequisitionFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_size_allocate
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1size_1allocate
+ (JNIEnv *env, jclass that, jint widget, jobject allocation)
+{
+ DECL_GLOB(pGlob)
+ GtkAllocation allocation_struct, *allocation1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_size_allocate");
+#endif
+
+ if (allocation) {
+ allocation1 = &allocation_struct;
+ cacheGtkAllocationFids(env, allocation, &PGLOB(GtkAllocationFc));
+ getGtkAllocationFields(env, allocation, allocation1, &PGLOB(GtkAllocationFc));
+ }
+ gtk_widget_size_allocate((GtkWidget*)widget, (GtkAllocation*)allocation1);
+ if (allocation) {
+ setGtkAllocationFields(env, allocation, allocation1, &PGLOB(GtkAllocationFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_add_accelerator
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1add_1accelerator
+ (JNIEnv *env, jclass that, jint widget, jbyteArray accel_signal, jint accel_group, jint accel_key, jint accel_mods, jint accel_flags)
+{
+ jbyte *accel_signal1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_add_accelerator");
+#endif
+
+ if (accel_signal) {
+ accel_signal1 = (*env)->GetByteArrayElements(env, accel_signal, NULL);
+ }
+ gtk_widget_add_accelerator((GtkWidget*)widget, (gchar*)accel_signal1, (GtkAccelGroup*)accel_group, accel_key, accel_mods, (GtkAccelFlags)accel_flags);
+ if (accel_signal) {
+ (*env)->ReleaseByteArrayElements(env, accel_signal, accel_signal1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_remove_accelerator
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1remove_1accelerator
+ (JNIEnv *env, jclass that, jint widget, jint accel_group, jint accel_key, jint accel_mods)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_remove_accelerator");
+#endif
+
+ gtk_widget_remove_accelerator((GtkWidget*)widget, (GtkAccelGroup*)accel_group, accel_key, accel_mods);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_event
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1event
+ (JNIEnv *env, jclass that, jint widget, jint event)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_event");
+#endif
+
+ return (jint)gtk_widget_event((GtkWidget*)widget, (GdkEvent*)event);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_reparent
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1reparent
+ (JNIEnv *env, jclass that, jint widget, jint new_parent)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_reparent");
+#endif
+
+ gtk_widget_reparent((GtkWidget*)widget, (GtkWidget*)new_parent);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_grab_focus
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1grab_1focus
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_grab_focus");
+#endif
+
+ gtk_widget_grab_focus((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_set_state
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1state
+ (JNIEnv *env, jclass that, jint widget, jint state)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_set_state");
+#endif
+
+ gtk_widget_set_state((GtkWidget*)widget, (GtkStateType)state);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_set_sensitive
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1sensitive
+ (JNIEnv *env, jclass that, jint widget, jboolean sensitive)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_set_sensitive");
+#endif
+
+ gtk_widget_set_sensitive((GtkWidget*)widget, (gboolean)sensitive);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_set_parent
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1parent
+ (JNIEnv *env, jclass that, jint widget, jint parent)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_set_parent");
+#endif
+
+ gtk_widget_set_parent((GtkWidget*)widget, (GtkWidget*)parent);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_set_uposition
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1uposition
+ (JNIEnv *env, jclass that, jint widget, jint x, jint y)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_set_uposition");
+#endif
+
+ gtk_widget_set_uposition((GtkWidget*)widget, (gint)x, (gint)y);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_set_usize
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1usize
+ (JNIEnv *env, jclass that, jint widget, jint width, jint height)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_set_usize");
+#endif
+
+ gtk_widget_set_usize((GtkWidget*)widget, (gint)width, (gint)height);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_add_events
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1add_1events
+ (JNIEnv *env, jclass that, jint widget, jint events)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_add_events");
+#endif
+
+ gtk_widget_add_events((GtkWidget*)widget, (gint)events);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_set_style
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1set_1style
+ (JNIEnv *env, jclass that, jint widget, jint style)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_set_style");
+#endif
+
+ gtk_widget_set_style((GtkWidget*)widget, (GtkStyle*)style);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_ensure_style
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1ensure_1style
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_ensure_style");
+#endif
+
+ gtk_widget_ensure_style((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_get_style
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1get_1style
+ (JNIEnv *env, jclass that, jint widget)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_get_style");
+#endif
+
+ return (jint)gtk_widget_get_style((GtkWidget*)widget);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_widget_get_default_style
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1widget_1get_1default_1style
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_widget_get_default_style");
+#endif
+
+ return (jint)gtk_widget_get_default_style();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_window_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1new
+ (JNIEnv *env, jclass that, jint type)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_window_new");
+#endif
+
+ return (jint)gtk_window_new((GtkWindowType)type);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_window_set_title
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1set_1title
+ (JNIEnv *env, jclass that, jint window, jbyteArray title)
+{
+ jbyte *title1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_window_set_title");
+#endif
+
+ if (title) {
+ title1 = (*env)->GetByteArrayElements(env, title, NULL);
+ }
+ gtk_window_set_title((GtkWindow*)window, (gchar*)title1);
+ if (title) {
+ (*env)->ReleaseByteArrayElements(env, title, title1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_window_set_policy
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1set_1policy
+ (JNIEnv *env, jclass that, jint window, jint allow_shrink, jint allow_grow, jint auto_shrink)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_window_set_policy");
+#endif
+
+ gtk_window_set_policy((GtkWindow*)window, (gint)allow_shrink, (gint)allow_grow, (gint)auto_shrink);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_window_add_accel_group
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1window_1add_1accel_1group
+ (JNIEnv *env, jclass that, jint window, jint accel_group)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_window_add_accel_group");
+#endif
+
+ gtk_window_add_accel_group((GtkWindow*)window, (GtkAccelGroup*)accel_group);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_event_get
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1event_1get
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_event_get");
+#endif
+
+ return (jint)gdk_event_get();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_event_get_graphics_expose
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1event_1get_1graphics_1expose
+ (JNIEnv *env, jclass that, jint window)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_event_get_graphics_expose");
+#endif
+
+ return (jint)gdk_event_get_graphics_expose((GdkWindow*)window);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_event_free
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1event_1free
+ (JNIEnv *env, jclass that, jint event)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_event_free");
+#endif
+
+ gdk_event_free((GdkEvent*)event);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_time_get
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1time_1get
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_time_get");
+#endif
+
+ return (jint)gdk_time_get();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_screen_width
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1screen_1width
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_screen_width");
+#endif
+
+ return (jint)gdk_screen_width();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_screen_height
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1screen_1height
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_screen_height");
+#endif
+
+ return (jint)gdk_screen_height();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_screen_width_mm
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1screen_1width_1mm
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_screen_width_mm");
+#endif
+
+ return (jint)gdk_screen_width_mm();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_flush
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1flush
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_flush");
+#endif
+
+ gdk_flush();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_beep
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1beep
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_beep");
+#endif
+
+ gdk_beep();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_visual_get_system
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1visual_1get_1system
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_visual_get_system");
+#endif
+
+ return (jint)gdk_visual_get_system();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_at_pointer
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1at_1pointer
+ (JNIEnv *env, jclass that, jintArray win_x, jintArray win_y)
+{
+ jint rc;
+ jint *win_x1 = NULL;
+ jint *win_y1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_at_pointer");
+#endif
+
+ if (win_x) {
+ win_x1 = (*env)->GetIntArrayElements(env, win_x, NULL);
+ }
+ if (win_y) {
+ win_y1 = (*env)->GetIntArrayElements(env, win_y, NULL);
+ }
+ rc = (jint)gdk_window_at_pointer((gint*)win_x1, (gint*)win_y1);
+ if (win_x) {
+ (*env)->ReleaseIntArrayElements(env, win_x, win_x1, 0);
+ }
+ if (win_y) {
+ (*env)->ReleaseIntArrayElements(env, win_y, win_y1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_clear_area
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1clear_1area
+ (JNIEnv *env, jclass that, jint window, jint x, jint y, jint width, jint height)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_clear_area");
+#endif
+
+ gdk_window_clear_area((GdkWindow*)window, (gint)x, (gint)y, (gint)width, (gint)height);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_clear_area_e
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1clear_1area_1e
+ (JNIEnv *env, jclass that, jint window, jint x, jint y, jint width, jint height)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_clear_area_e");
+#endif
+
+ gdk_window_clear_area_e((GdkWindow*)window, (gint)x, (gint)y, (gint)width, (gint)height);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_copy_area
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1copy_1area
+ (JNIEnv *env, jclass that, jint window, jint gc, jint x, jint y, jint source_window, jint source_x, jint source_y, jint width, jint height)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_copy_area");
+#endif
+
+ gdk_window_copy_area((GdkWindow*)window, (GdkGC*)gc, (gint)x, (gint)y, (GdkWindow*)source_window, (gint)source_x, (gint)source_y, (gint)width, (gint)height);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_raise
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1raise
+ (JNIEnv *env, jclass that, jint window)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_raise");
+#endif
+
+ gdk_window_raise((GdkWindow*)window);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_lower
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1lower
+ (JNIEnv *env, jclass that, jint window)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_lower");
+#endif
+
+ gdk_window_lower((GdkWindow*)window);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_set_user_data
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1set_1user_1data
+ (JNIEnv *env, jclass that, jint window, jint user_data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_set_user_data");
+#endif
+
+ gdk_window_set_user_data((GdkWindow*)window, (gpointer)user_data);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_set_cursor
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1set_1cursor
+ (JNIEnv *env, jclass that, jint window, jint cursor)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_set_cursor");
+#endif
+
+ gdk_window_set_cursor((GdkWindow*)window, (GdkCursor*)cursor);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_get_user_data
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1get_1user_1data
+ (JNIEnv *env, jclass that, jint window, jintArray data)
+{
+ jint *data1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_get_user_data");
+#endif
+
+ if (data) {
+ data1 = (*env)->GetIntArrayElements(env, data, NULL);
+ }
+ gdk_window_get_user_data((GdkWindow*)window, (gpointer*)data1);
+ if (data) {
+ (*env)->ReleaseIntArrayElements(env, data, data1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_get_geometry
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1get_1geometry
+ (JNIEnv *env, jclass that, jint window, jintArray x, jintArray y, jintArray width, jintArray height, jintArray depth)
+{
+ jint *x1 = NULL;
+ jint *y1 = NULL;
+ jint *width1 = NULL;
+ jint *height1 = NULL;
+ jint *depth1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_get_geometry");
+#endif
+
+ if (x) {
+ x1 = (*env)->GetIntArrayElements(env, x, NULL);
+ }
+ if (y) {
+ y1 = (*env)->GetIntArrayElements(env, y, NULL);
+ }
+ if (width) {
+ width1 = (*env)->GetIntArrayElements(env, width, NULL);
+ }
+ if (height) {
+ height1 = (*env)->GetIntArrayElements(env, height, NULL);
+ }
+ if (depth) {
+ depth1 = (*env)->GetIntArrayElements(env, depth, NULL);
+ }
+ gdk_window_get_geometry((GdkWindow*)window, (gint*)x1, (gint*)y1, (gint*)width1, (gint*)height1, (gint*)depth1);
+ if (x) {
+ (*env)->ReleaseIntArrayElements(env, x, x1, 0);
+ }
+ if (y) {
+ (*env)->ReleaseIntArrayElements(env, y, y1, 0);
+ }
+ if (width) {
+ (*env)->ReleaseIntArrayElements(env, width, width1, 0);
+ }
+ if (height) {
+ (*env)->ReleaseIntArrayElements(env, height, height1, 0);
+ }
+ if (depth) {
+ (*env)->ReleaseIntArrayElements(env, depth, depth1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_get_origin
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1get_1origin
+ (JNIEnv *env, jclass that, jint window, jintArray x, jintArray y)
+{
+ jint rc;
+ jint *x1 = NULL;
+ jint *y1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_get_origin");
+#endif
+
+ if (x) {
+ x1 = (*env)->GetIntArrayElements(env, x, NULL);
+ }
+ if (y) {
+ y1 = (*env)->GetIntArrayElements(env, y, NULL);
+ }
+ rc = (jint)gdk_window_get_origin((GdkWindow*)window, (gint*)x1, (gint*)y1);
+ if (x) {
+ (*env)->ReleaseIntArrayElements(env, x, x1, 0);
+ }
+ if (y) {
+ (*env)->ReleaseIntArrayElements(env, y, y1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_get_pointer
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1get_1pointer
+ (JNIEnv *env, jclass that, jint window, jintArray x, jintArray y, jint mask)
+{
+ jint rc;
+ jint *x1 = NULL;
+ jint *y1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_get_pointer");
+#endif
+
+ if (x) {
+ x1 = (*env)->GetIntArrayElements(env, x, NULL);
+ }
+ if (y) {
+ y1 = (*env)->GetIntArrayElements(env, y, NULL);
+ }
+ rc = (jint)gdk_window_get_pointer((GdkWindow*)window, (gint*)x1, (gint*)y1, (GdkModifierType*)mask);
+ if (x) {
+ (*env)->ReleaseIntArrayElements(env, x, x1, 0);
+ }
+ if (y) {
+ (*env)->ReleaseIntArrayElements(env, y, y1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_set_icon
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1set_1icon
+ (JNIEnv *env, jclass that, jint window, jint icon_window, jint pixmap, jint mask)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_set_icon");
+#endif
+
+ gdk_window_set_icon((GdkWindow*)window, (GdkWindow*)icon_window, (GdkPixmap*)pixmap, (GdkBitmap*)mask);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_window_set_decorations
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1set_1decorations
+ (JNIEnv *env, jclass that, jint window, jint decorations)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_window_set_decorations");
+#endif
+
+ gdk_window_set_decorations((GdkWindow*)window, (GdkWMDecoration)decorations);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_cursor_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1cursor_1new
+ (JNIEnv *env, jclass that, jint cursor_type)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_cursor_new");
+#endif
+
+ return (jint)gdk_cursor_new((GdkCursorType)cursor_type);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_cursor_new_from_pixmap
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1cursor_1new_1from_1pixmap
+ (JNIEnv *env, jclass that, jint source, jint mask, jobject fg, jobject bg, jint x, jint y)
+{
+ DECL_GLOB(pGlob)
+ jint rc;
+ GdkColor fg_struct, *fg1 = NULL;
+ GdkColor bg_struct, *bg1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_cursor_new_from_pixmap");
+#endif
+
+ if (fg) {
+ fg1 = &fg_struct;
+ cacheGdkColorFids(env, fg, &PGLOB(GdkColorFc));
+ getGdkColorFields(env, fg, fg1, &PGLOB(GdkColorFc));
+ }
+ if (bg) {
+ bg1 = &bg_struct;
+ cacheGdkColorFids(env, bg, &PGLOB(GdkColorFc));
+ getGdkColorFields(env, bg, bg1, &PGLOB(GdkColorFc));
+ }
+ rc = (jint)gdk_cursor_new_from_pixmap((GdkPixmap*)source, (GdkPixmap*)mask, (GdkColor*)fg1, (GdkColor*)bg1, (gint)x, (gint)y);
+ if (fg) {
+ setGdkColorFields(env, fg, fg1, &PGLOB(GdkColorFc));
+ }
+ if (bg) {
+ setGdkColorFields(env, bg, bg1, &PGLOB(GdkColorFc));
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_cursor_destroy
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1cursor_1destroy
+ (JNIEnv *env, jclass that, jint cursor)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_cursor_destroy");
+#endif
+
+ gdk_cursor_destroy((GdkCursor*)cursor);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1new
+ (JNIEnv *env, jclass that, jint window)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_new");
+#endif
+
+ return (jint)gdk_gc_new((GdkWindow*)window);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_unref
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1unref
+ (JNIEnv *env, jclass that, jint gc)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_unref");
+#endif
+
+ gdk_gc_unref((GdkGC*)gc);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_destroy
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1destroy
+ (JNIEnv *env, jclass that, jint gc)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_destroy");
+#endif
+
+ gdk_gc_destroy((GdkGC*)gc);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_get_values
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1get_1values
+ (JNIEnv *env, jclass that, jint gc, jobject values)
+{
+ DECL_GLOB(pGlob)
+ GdkGCValues values_struct, *values1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_get_values");
+#endif
+
+ if (values) {
+ values1 = &values_struct;
+ cacheGdkGCValuesFids(env, values, &PGLOB(GdkGCValuesFc));
+ getGdkGCValuesFields(env, values, values1, &PGLOB(GdkGCValuesFc));
+ }
+ gdk_gc_get_values((GdkGC*)gc, (GdkGCValues*)values1);
+ if (values) {
+ setGdkGCValuesFields(env, values, values1, &PGLOB(GdkGCValuesFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_foreground
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1foreground
+ (JNIEnv *env, jclass that, jint gc, jobject color)
+{
+ DECL_GLOB(pGlob)
+ GdkColor color_struct, *color1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_foreground");
+#endif
+
+ if (color) {
+ color1 = &color_struct;
+ cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
+ getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+ gdk_gc_set_foreground((GdkGC*)gc, (GdkColor*)color1);
+ if (color) {
+ setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_background
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1background
+ (JNIEnv *env, jclass that, jint gc, jobject color)
+{
+ DECL_GLOB(pGlob)
+ GdkColor color_struct, *color1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_background");
+#endif
+
+ if (color) {
+ color1 = &color_struct;
+ cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
+ getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+ gdk_gc_set_background((GdkGC*)gc, (GdkColor*)color1);
+ if (color) {
+ setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_font
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1font
+ (JNIEnv *env, jclass that, jint gc, jint font)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_font");
+#endif
+
+ gdk_gc_set_font((GdkGC*)gc, (GdkFont*)font);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_function
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1function
+ (JNIEnv *env, jclass that, jint gc, jint function)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_function");
+#endif
+
+ gdk_gc_set_function((GdkGC*)gc, (GdkFunction)function);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_fill
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1fill
+ (JNIEnv *env, jclass that, jint gc, jint fill)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_fill");
+#endif
+
+ gdk_gc_set_fill((GdkGC*)gc, (GdkFill)fill);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_stipple
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1stipple
+ (JNIEnv *env, jclass that, jint gc, jint stipple)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_stipple");
+#endif
+
+ gdk_gc_set_stipple((GdkGC*)gc, (GdkPixmap*)stipple);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_clip_mask
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1clip_1mask
+ (JNIEnv *env, jclass that, jint gc, jint mask)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_clip_mask");
+#endif
+
+ gdk_gc_set_clip_mask((GdkGC*)gc, (GdkBitmap*)mask);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_clip_rectangle
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1clip_1rectangle
+ (JNIEnv *env, jclass that, jint gc, jobject rectangle)
+{
+ DECL_GLOB(pGlob)
+ GdkRectangle rectangle_struct, *rectangle1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_clip_rectangle");
+#endif
+
+ if (rectangle) {
+ rectangle1 = &rectangle_struct;
+ cacheGdkRectangleFids(env, rectangle, &PGLOB(GdkRectangleFc));
+ getGdkRectangleFields(env, rectangle, rectangle1, &PGLOB(GdkRectangleFc));
+ }
+ gdk_gc_set_clip_rectangle((GdkGC*)gc, (GdkRectangle*)rectangle1);
+ if (rectangle) {
+ setGdkRectangleFields(env, rectangle, rectangle1, &PGLOB(GdkRectangleFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_clip_region
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1clip_1region
+ (JNIEnv *env, jclass that, jint gc, jint region)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_clip_region");
+#endif
+
+ gdk_gc_set_clip_region((GdkGC*)gc, (GdkRegion*)region);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_subwindow
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1subwindow
+ (JNIEnv *env, jclass that, jint gc, jint mode)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_subwindow");
+#endif
+
+ gdk_gc_set_subwindow((GdkGC*)gc, (GdkSubwindowMode)mode);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_exposures
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1exposures
+ (JNIEnv *env, jclass that, jint gc, jboolean exposures)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_exposures");
+#endif
+
+ gdk_gc_set_exposures((GdkGC*)gc, (gboolean)exposures);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_line_attributes
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1line_1attributes
+ (JNIEnv *env, jclass that, jint gc, jint line_width, jint line_style, jint cap_style, jint join_style)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_line_attributes");
+#endif
+
+ gdk_gc_set_line_attributes((GdkGC*)gc, (gint)line_width, (GdkLineStyle)line_style, (GdkCapStyle)cap_style, (GdkJoinStyle)join_style);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_gc_set_dashes
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1gc_1set_1dashes
+ (JNIEnv *env, jclass that, jint gc, jint dash_offset, jbyteArray dash_list, jint n)
+{
+ jbyte *dash_list1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_gc_set_dashes");
+#endif
+
+ if (dash_list) {
+ dash_list1 = (*env)->GetByteArrayElements(env, dash_list, NULL);
+ }
+ gdk_gc_set_dashes((GdkGC*)gc, (gint)dash_offset, (gint8*)dash_list1, (gint)n);
+ if (dash_list) {
+ (*env)->ReleaseByteArrayElements(env, dash_list, dash_list1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_pixmap_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1pixmap_1new
+ (JNIEnv *env, jclass that, jint window, jint width, jint height, jint depth)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_pixmap_new");
+#endif
+
+ return (jint)gdk_pixmap_new((GdkWindow*)window, (gint)width, (gint)height, (gint)depth);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_bitmap_create_from_data
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1bitmap_1create_1from_1data
+ (JNIEnv *env, jclass that, jint window, jbyteArray data, jint width, jint height)
+{
+ jint rc;
+ jbyte *data1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_bitmap_create_from_data");
+#endif
+
+ if (data) {
+ data1 = (*env)->GetByteArrayElements(env, data, NULL);
+ }
+ rc = (jint)gdk_bitmap_create_from_data((GdkWindow*)window, (gchar*)data1, (gint)width, (gint)height);
+ if (data) {
+ (*env)->ReleaseByteArrayElements(env, data, data1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_pixmap_unref
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1pixmap_1unref
+ (JNIEnv *env, jclass that, jint pixmap)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_pixmap_unref");
+#endif
+
+ gdk_pixmap_unref((GdkPixmap*)pixmap);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_bitmap_unref
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1bitmap_1unref
+ (JNIEnv *env, jclass that, jint pixmap)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_bitmap_unref");
+#endif
+
+ gdk_bitmap_unref((GdkBitmap*)pixmap);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_image_get
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1image_1get
+ (JNIEnv *env, jclass that, jint window, jint x, jint y, jint width, jint height)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_image_get");
+#endif
+
+ return (jint)gdk_image_get((GdkWindow*)window, (gint)x, (gint)y, (gint)width, (gint)height);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_image_get_pixel
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1image_1get_1pixel
+ (JNIEnv *env, jclass that, jint image, jint x, jint y)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_image_get_pixel");
+#endif
+
+ return (jint)gdk_image_get_pixel((GdkImage*)image, (gint)x, (gint)y);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_colormap_get_system
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1colormap_1get_1system
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_colormap_get_system");
+#endif
+
+ return (jint)gdk_colormap_get_system();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_color_free
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1color_1free
+ (JNIEnv *env, jclass that, jobject color)
+{
+ DECL_GLOB(pGlob)
+ GdkColor color_struct, *color1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_color_free");
+#endif
+
+ if (color) {
+ color1 = &color_struct;
+ cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
+ getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+ gdk_color_free((GdkColor*)color1);
+ if (color) {
+ setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_colors_free
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1colors_1free
+ (JNIEnv *env, jclass that, jint colormap, jintArray pixels, jint npixels, jint planes)
+{
+ jint *pixels1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_colors_free");
+#endif
+
+ if (pixels) {
+ pixels1 = (*env)->GetIntArrayElements(env, pixels, NULL);
+ }
+ gdk_colors_free((GdkColormap*)colormap, (gulong*)pixels1, (gint)npixels, (gulong)planes);
+ if (pixels) {
+ (*env)->ReleaseIntArrayElements(env, pixels, pixels1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_color_white
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1color_1white
+ (JNIEnv *env, jclass that, jint colormap, jobject color)
+{
+ DECL_GLOB(pGlob)
+ jboolean rc;
+ GdkColor color_struct, *color1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_color_white");
+#endif
+
+ if (color) {
+ color1 = &color_struct;
+ cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
+ getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+ rc = (jboolean)gdk_color_white((GdkColormap*)colormap, (GdkColor*)color1);
+ if (color) {
+ setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_color_alloc
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1color_1alloc
+ (JNIEnv *env, jclass that, jint colormap, jobject color)
+{
+ DECL_GLOB(pGlob)
+ jboolean rc;
+ GdkColor color_struct, *color1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_color_alloc");
+#endif
+
+ if (color) {
+ color1 = &color_struct;
+ cacheGdkColorFids(env, color, &PGLOB(GdkColorFc));
+ getGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+ rc = (jboolean)gdk_color_alloc((GdkColormap*)colormap, (GdkColor*)color1);
+ if (color) {
+ setGdkColorFields(env, color, color1, &PGLOB(GdkColorFc));
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_font_load
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1font_1load
+ (JNIEnv *env, jclass that, jbyteArray font_name)
+{
+ jint rc;
+ jbyte *font_name1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_font_load");
+#endif
+
+ if (font_name) {
+ font_name1 = (*env)->GetByteArrayElements(env, font_name, NULL);
+ }
+ rc = (jint)gdk_font_load((gchar*)font_name1);
+ if (font_name) {
+ (*env)->ReleaseByteArrayElements(env, font_name, font_name1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_font_ref
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1font_1ref
+ (JNIEnv *env, jclass that, jint font)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_font_ref");
+#endif
+
+ return (jint)gdk_font_ref((GdkFont*)font);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_font_unref
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1font_1unref
+ (JNIEnv *env, jclass that, jint font)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_font_unref");
+#endif
+
+ gdk_font_unref((GdkFont*)font);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_font_equal
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1font_1equal
+ (JNIEnv *env, jclass that, jint fonta, jint fontb)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_font_equal");
+#endif
+
+ return (jboolean)gdk_font_equal((GdkFont*)fonta, (GdkFont*)fontb);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_string_width
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1string_1width
+ (JNIEnv *env, jclass that, jint font, jbyteArray string)
+{
+ jint rc;
+ jbyte *string1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_string_width");
+#endif
+
+ if (string) {
+ string1 = (*env)->GetByteArrayElements(env, string, NULL);
+ }
+ rc = (jint)gdk_string_width((GdkFont*)font, (gchar*)string1);
+ if (string) {
+ (*env)->ReleaseByteArrayElements(env, string, string1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_char_width
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1char_1width
+ (JNIEnv *env, jclass that, jint font, jbyte character)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_char_width");
+#endif
+
+ return (jint)gdk_char_width((GdkFont*)font, (gchar)character);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_string_height
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1string_1height
+ (JNIEnv *env, jclass that, jint font, jbyteArray string)
+{
+ jint rc;
+ jbyte *string1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_string_height");
+#endif
+
+ if (string) {
+ string1 = (*env)->GetByteArrayElements(env, string, NULL);
+ }
+ rc = (jint)gdk_string_height((GdkFont*)font, (gchar*)string1);
+ if (string) {
+ (*env)->ReleaseByteArrayElements(env, string, string1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_string_extents
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1string_1extents
+ (JNIEnv *env, jclass that, jint font, jbyteArray string, jintArray lbearing, jintArray rbearing, jintArray width, jintArray ascent, jintArray descent)
+{
+ jbyte *string1 = NULL;
+ jint *lbearing1 = NULL;
+ jint *rbearing1 = NULL;
+ jint *width1 = NULL;
+ jint *ascent1 = NULL;
+ jint *descent1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_string_extents");
+#endif
+
+ if (string) {
+ string1 = (*env)->GetByteArrayElements(env, string, NULL);
+ }
+ if (lbearing) {
+ lbearing1 = (*env)->GetIntArrayElements(env, lbearing, NULL);
+ }
+ if (rbearing) {
+ rbearing1 = (*env)->GetIntArrayElements(env, rbearing, NULL);
+ }
+ if (width) {
+ width1 = (*env)->GetIntArrayElements(env, width, NULL);
+ }
+ if (ascent) {
+ ascent1 = (*env)->GetIntArrayElements(env, ascent, NULL);
+ }
+ if (descent) {
+ descent1 = (*env)->GetIntArrayElements(env, descent, NULL);
+ }
+ gdk_string_extents((GdkFont*)font, (gchar*)string1, (gint*)lbearing1, (gint*)rbearing1, (gint*)width1, (gint*)ascent1, (gint*)descent1);
+ if (string) {
+ (*env)->ReleaseByteArrayElements(env, string, string1, 0);
+ }
+ if (lbearing) {
+ (*env)->ReleaseIntArrayElements(env, lbearing, lbearing1, 0);
+ }
+ if (rbearing) {
+ (*env)->ReleaseIntArrayElements(env, rbearing, rbearing1, 0);
+ }
+ if (width) {
+ (*env)->ReleaseIntArrayElements(env, width, width1, 0);
+ }
+ if (ascent) {
+ (*env)->ReleaseIntArrayElements(env, ascent, ascent1, 0);
+ }
+ if (descent) {
+ (*env)->ReleaseIntArrayElements(env, descent, descent1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_draw_line
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1line
+ (JNIEnv *env, jclass that, jint drawable, jint gc, jint x1, jint y1, jint x2, jint y2)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_draw_line");
+#endif
+
+ gdk_draw_line((GdkDrawable*)drawable, (GdkGC*)gc, (gint)x1, (gint)y1, (gint)x2, (gint)y2);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_draw_rectangle
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1rectangle
+ (JNIEnv *env, jclass that, jint drawable, jint gc, jint filled, jint x, jint y, jint width, jint height)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_draw_rectangle");
+#endif
+
+ gdk_draw_rectangle((GdkDrawable*)drawable, (GdkGC*)gc, (gint)filled, (gint)x, (gint)y, (gint)width, (gint)height);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_draw_arc
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1arc
+ (JNIEnv *env, jclass that, jint drawable, jint gc, jint filled, jint x, jint y, jint width, jint height, jint angle1, jint angle2)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_draw_arc");
+#endif
+
+ gdk_draw_arc((GdkDrawable*)drawable, (GdkGC*)gc, (gint)filled, (gint)x, (gint)y, (gint)width, (gint)height, (gint)angle1, (gint)angle2);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_draw_polygon
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1polygon
+ (JNIEnv *env, jclass that, jint drawable, jint gc, jint filled, jshortArray points, jint npoints)
+{
+ jshort *points1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_draw_polygon");
+#endif
+
+ if (points) {
+ points1 = (*env)->GetShortArrayElements(env, points, NULL);
+ }
+ gdk_draw_polygon((GdkDrawable*)drawable, (GdkGC*)gc, (gint)filled, (GdkPoint*)points1, (gint)npoints);
+ if (points) {
+ (*env)->ReleaseShortArrayElements(env, points, points1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_draw_string
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1string
+ (JNIEnv *env, jclass that, jint drawable, jint font, jint gc, jint x, jint y, jbyteArray string)
+{
+ jbyte *string1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_draw_string");
+#endif
+
+ if (string) {
+ string1 = (*env)->GetByteArrayElements(env, string, NULL);
+ }
+ gdk_draw_string((GdkDrawable*)drawable, (GdkFont*)font, (GdkGC*)gc, (gint)x, (gint)y, (gchar*)string1);
+ if (string) {
+ (*env)->ReleaseByteArrayElements(env, string, string1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_draw_pixmap
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1pixmap
+ (JNIEnv *env, jclass that, jint drawable, jint gc, jint src, jint xsrc, jint ysrc, jint xdest, jint ydest, jint width, jint height)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_draw_pixmap");
+#endif
+
+ gdk_draw_pixmap((GdkDrawable*)drawable, (GdkGC*)gc, (GdkDrawable*)src, (gint)xsrc, (gint)ysrc, (gint)xdest, (gint)ydest, (gint)width, (gint)height);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_draw_lines
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1draw_1lines
+ (JNIEnv *env, jclass that, jint drawable, jint gc, jshortArray points, jint npoints)
+{
+ jshort *points1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_draw_lines");
+#endif
+
+ if (points) {
+ points1 = (*env)->GetShortArrayElements(env, points, NULL);
+ }
+ gdk_draw_lines((GdkDrawable*)drawable, (GdkGC*)gc, (GdkPoint*)points1, (gint)npoints);
+ if (points) {
+ (*env)->ReleaseShortArrayElements(env, points, points1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_atom_intern
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1atom_1intern
+ (JNIEnv *env, jclass that, jbyteArray atom_name, jint only_if_exists)
+{
+ jint rc;
+ jbyte *atom_name1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_atom_intern");
+#endif
+
+ if (atom_name) {
+ atom_name1 = (*env)->GetByteArrayElements(env, atom_name, NULL);
+ }
+ rc = (jint)gdk_atom_intern((gchar*)atom_name1, (gint)only_if_exists);
+ if (atom_name) {
+ (*env)->ReleaseByteArrayElements(env, atom_name, atom_name1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_region_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1new
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_region_new");
+#endif
+
+ return (jint)gdk_region_new();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_region_destroy
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1destroy
+ (JNIEnv *env, jclass that, jint region)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_region_destroy");
+#endif
+
+ gdk_region_destroy((GdkRegion*)region);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_region_get_clipbox
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1get_1clipbox
+ (JNIEnv *env, jclass that, jint region, jobject rectangle)
+{
+ DECL_GLOB(pGlob)
+ GdkRectangle rectangle_struct, *rectangle1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_region_get_clipbox");
+#endif
+
+ if (rectangle) {
+ rectangle1 = &rectangle_struct;
+ cacheGdkRectangleFids(env, rectangle, &PGLOB(GdkRectangleFc));
+ getGdkRectangleFields(env, rectangle, rectangle1, &PGLOB(GdkRectangleFc));
+ }
+ gdk_region_get_clipbox((GdkRegion*)region, (GdkRectangle*)rectangle1);
+ if (rectangle) {
+ setGdkRectangleFields(env, rectangle, rectangle1, &PGLOB(GdkRectangleFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_region_empty
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1empty
+ (JNIEnv *env, jclass that, jint region)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_region_empty");
+#endif
+
+ return (jboolean)gdk_region_empty((GdkRegion*)region);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_region_equal
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1equal
+ (JNIEnv *env, jclass that, jint region1, jint region2)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_region_equal");
+#endif
+
+ return (jboolean)gdk_region_equal((GdkRegion*)region1, (GdkRegion*)region2);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_region_point_in
+ * Signature:
+ */
+JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1point_1in
+ (JNIEnv *env, jclass that, jint region, jint x, jint y)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_region_point_in");
+#endif
+
+ return (jboolean)gdk_region_point_in((GdkRegion*)region, (int)x, (int)y);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_region_rect_in
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1rect_1in
+ (JNIEnv *env, jclass that, jint region, jobject rect)
+{
+ DECL_GLOB(pGlob)
+ jint rc;
+ GdkRectangle rect_struct, *rect1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_region_rect_in");
+#endif
+
+ if (rect) {
+ rect1 = &rect_struct;
+ cacheGdkRectangleFids(env, rect, &PGLOB(GdkRectangleFc));
+ getGdkRectangleFields(env, rect, rect1, &PGLOB(GdkRectangleFc));
+ }
+ rc = (jint)gdk_region_rect_in((GdkRegion*)region, (GdkRectangle*)rect1);
+ if (rect) {
+ setGdkRectangleFields(env, rect, rect1, &PGLOB(GdkRectangleFc));
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_region_union_with_rect
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1region_1union_1with_1rect
+ (JNIEnv *env, jclass that, jint region, jobject rect)
+{
+ DECL_GLOB(pGlob)
+ jint rc;
+ GdkRectangle rect_struct, *rect1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_region_union_with_rect");
+#endif
+
+ if (rect) {
+ rect1 = &rect_struct;
+ cacheGdkRectangleFids(env, rect, &PGLOB(GdkRectangleFc));
+ getGdkRectangleFields(env, rect, rect1, &PGLOB(GdkRectangleFc));
+ }
+ rc = (jint)gdk_region_union_with_rect((GdkRegion*)region, (GdkRectangle*)rect1);
+ if (rect) {
+ setGdkRectangleFields(env, rect, rect1, &PGLOB(GdkRectangleFc));
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_regions_union
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1regions_1union
+ (JNIEnv *env, jclass that, jint source1, jint source2)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_regions_union");
+#endif
+
+ return (jint)gdk_regions_union((GdkRegion*)source1, (GdkRegion*)source2);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gdk_regions_subtract
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1regions_1subtract
+ (JNIEnv *env, jclass that, jint source1, jint source2)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gdk_regions_subtract");
+#endif
+
+ return (jint)gdk_regions_subtract((GdkRegion*)source1, (GdkRegion*)source2);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_list_free
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1free
+ (JNIEnv *env, jclass that, jint list)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_list_free");
+#endif
+
+ g_list_free((GList*)list);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_list_append
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1append
+ (JNIEnv *env, jclass that, jint list, jint data)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_list_append");
+#endif
+
+ return (jint)g_list_append((GList*)list, (gpointer)data);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_list_nth
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1nth
+ (JNIEnv *env, jclass that, jint list, jint n)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_list_nth");
+#endif
+
+ return (jint)g_list_nth((GList*)list, n);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_list_length
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1length
+ (JNIEnv *env, jclass that, jint list)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_list_length");
+#endif
+
+ return (jint)g_list_length((GList*)list);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_list_nth_data
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1list_1nth_1data
+ (JNIEnv *env, jclass that, jint list, jint n)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_list_nth_data");
+#endif
+
+ return (jint)g_list_nth_data((GList*)list, n);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_slist_nth
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1slist_1nth
+ (JNIEnv *env, jclass that, jint list, jint n)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_slist_nth");
+#endif
+
+ return (jint)g_slist_nth((GSList*)list, n);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_slist_length
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1slist_1length
+ (JNIEnv *env, jclass that, jint list)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_slist_length");
+#endif
+
+ return (jint)g_slist_length((GSList*)list);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_slist_nth_data
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1slist_1nth_1data
+ (JNIEnv *env, jclass that, jint list, jint n)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_slist_nth_data");
+#endif
+
+ return (jint)g_slist_nth_data((GSList*)list, n);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_malloc
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1malloc
+ (JNIEnv *env, jclass that, jint size)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_malloc");
+#endif
+
+ return (jint)g_malloc((gulong)size);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_free
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1free
+ (JNIEnv *env, jclass that, jint mem)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_free");
+#endif
+
+ g_free((gpointer)mem);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_strdup
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1strdup
+ (JNIEnv *env, jclass that, jbyteArray str)
+{
+ jint rc;
+ jbyte *str1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_strdup");
+#endif
+
+ if (str) {
+ str1 = (*env)->GetByteArrayElements(env, str, NULL);
+ }
+ rc = (jint)g_strdup((gchar*)str1);
+ if (str) {
+ (*env)->ReleaseByteArrayElements(env, str, str1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: g_get_home_dir
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_g_1get_1home_1dir
+ (JNIEnv *env, jclass that)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "g_get_home_dir");
+#endif
+
+ return (jint)g_get_home_dir();
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_new
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1new
+ (JNIEnv *env, jclass that, jint columns)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_new");
+#endif
+
+ return (jint)gtk_clist_new((gint)columns);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_shadow_type
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1shadow_1type
+ (JNIEnv *env, jclass that, jint clist, jint type)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_shadow_type");
+#endif
+
+ gtk_clist_set_shadow_type((GtkCList*)clist, (GtkShadowType)type);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_selection_mode
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1selection_1mode
+ (JNIEnv *env, jclass that, jint clist, jint mode)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_selection_mode");
+#endif
+
+ gtk_clist_set_selection_mode((GtkCList*)clist, (GtkSelectionMode)mode);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_freeze
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1freeze
+ (JNIEnv *env, jclass that, jint clist)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_freeze");
+#endif
+
+ gtk_clist_freeze((GtkCList*)clist);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_thaw
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1thaw
+ (JNIEnv *env, jclass that, jint clist)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_thaw");
+#endif
+
+ gtk_clist_thaw((GtkCList*)clist);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_column_titles_show
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1column_1titles_1show
+ (JNIEnv *env, jclass that, jint clist)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_column_titles_show");
+#endif
+
+ gtk_clist_column_titles_show((GtkCList*)clist);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_column_titles_hide
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1column_1titles_1hide
+ (JNIEnv *env, jclass that, jint clist)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_column_titles_hide");
+#endif
+
+ gtk_clist_column_titles_hide((GtkCList*)clist);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_column_title_passive
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1column_1title_1passive
+ (JNIEnv *env, jclass that, jint clist, jint column)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_column_title_passive");
+#endif
+
+ gtk_clist_column_title_passive((GtkCList*)clist, (gint)column);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_column_titles_passive
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1column_1titles_1passive
+ (JNIEnv *env, jclass that, jint clist)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_column_titles_passive");
+#endif
+
+ gtk_clist_column_titles_passive((GtkCList*)clist);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_column_title
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1title
+ (JNIEnv *env, jclass that, jint clist, jint column, jbyteArray title)
+{
+ jbyte *title1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_column_title");
+#endif
+
+ if (title) {
+ title1 = (*env)->GetByteArrayElements(env, title, NULL);
+ }
+ gtk_clist_set_column_title((GtkCList*)clist, (gint)column, (gchar*)title1);
+ if (title) {
+ (*env)->ReleaseByteArrayElements(env, title, title1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_column_justification
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1justification
+ (JNIEnv *env, jclass that, jint clist, jint column, jint justification)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_column_justification");
+#endif
+
+ gtk_clist_set_column_justification((GtkCList*)clist, (gint)column, (GtkJustification)justification);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_column_visibility
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1visibility
+ (JNIEnv *env, jclass that, jint clist, jint column, jboolean visible)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_column_visibility");
+#endif
+
+ gtk_clist_set_column_visibility((GtkCList*)clist, (gint)column, (gboolean)visible);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_column_resizeable
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1resizeable
+ (JNIEnv *env, jclass that, jint clist, jint column, jboolean resizeable)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_column_resizeable");
+#endif
+
+ gtk_clist_set_column_resizeable((GtkCList*)clist, (gint)column, (gboolean)resizeable);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_column_width
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1column_1width
+ (JNIEnv *env, jclass that, jint clist, jint column, jint width)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_column_width");
+#endif
+
+ gtk_clist_set_column_width((GtkCList*)clist, (gint)column, (gint)width);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_moveto
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1moveto
+ (JNIEnv *env, jclass that, jint clist, jint row, jint column, jfloat row_align, jfloat col_align)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_moveto");
+#endif
+
+ gtk_clist_moveto((GtkCList*)clist, (gint)row, (gint)column, row_align, col_align);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_text
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1text
+ (JNIEnv *env, jclass that, jint clist, jint row, jint column, jbyteArray text)
+{
+ jbyte *text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_text");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetByteArrayElements(env, text, NULL);
+ }
+ gtk_clist_set_text((GtkCList*)clist, (gint)row, (gint)column, (gchar*)text1);
+ if (text) {
+ (*env)->ReleaseByteArrayElements(env, text, text1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_get_text
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1get_1text
+ (JNIEnv *env, jclass that, jint clist, jint row, jint column, jintArray text)
+{
+ jint rc;
+ jint *text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_get_text");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetIntArrayElements(env, text, NULL);
+ }
+ rc = (jint)gtk_clist_get_text((GtkCList*)clist, (gint)row, (gint)column, (gchar**)text1);
+ if (text) {
+ (*env)->ReleaseIntArrayElements(env, text, text1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_pixmap
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1pixmap
+ (JNIEnv *env, jclass that, jint clist, jint row, jint column, jint pixmap, jint mask)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_pixmap");
+#endif
+
+ gtk_clist_set_pixmap((GtkCList*)clist, (gint)row, (gint)column, (GdkPixmap*)pixmap, (GdkBitmap*)mask);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_set_pixtext
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1set_1pixtext
+ (JNIEnv *env, jclass that, jint clist, jint row, jint column, jbyteArray text, jbyte spacing, jint pixmap, jint mask)
+{
+ jbyte *text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_set_pixtext");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetByteArrayElements(env, text, NULL);
+ }
+ gtk_clist_set_pixtext((GtkCList*)clist, (gint)row, (gint)column, (gchar*)text1, (guint8)spacing, (GdkPixmap*)pixmap, (GdkBitmap*)mask);
+ if (text) {
+ (*env)->ReleaseByteArrayElements(env, text, text1, 0);
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_append
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1append
+ (JNIEnv *env, jclass that, jint clist, jintArray text)
+{
+ jint rc;
+ jint *text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_append");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetIntArrayElements(env, text, NULL);
+ }
+ rc = (jint)gtk_clist_append((GtkCList*)clist, (gchar**)text1);
+ if (text) {
+ (*env)->ReleaseIntArrayElements(env, text, text1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_insert
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1insert
+ (JNIEnv *env, jclass that, jint clist, jint row, jintArray text)
+{
+ jint rc;
+ jint *text1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_insert");
+#endif
+
+ if (text) {
+ text1 = (*env)->GetIntArrayElements(env, text, NULL);
+ }
+ rc = (jint)gtk_clist_insert((GtkCList*)clist, (gint)row, (gchar**)text1);
+ if (text) {
+ (*env)->ReleaseIntArrayElements(env, text, text1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_remove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1remove
+ (JNIEnv *env, jclass that, jint clist, jint row)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_remove");
+#endif
+
+ gtk_clist_remove((GtkCList*)clist, (gint)row);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_select_row
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1select_1row
+ (JNIEnv *env, jclass that, jint clist, jint row, jint column)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_select_row");
+#endif
+
+ gtk_clist_select_row((GtkCList*)clist, (gint)row, (gint)column);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_unselect_row
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1unselect_1row
+ (JNIEnv *env, jclass that, jint clist, jint row, jint column)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_unselect_row");
+#endif
+
+ gtk_clist_unselect_row((GtkCList*)clist, (gint)row, (gint)column);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_clear
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1clear
+ (JNIEnv *env, jclass that, jint clist)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_clear");
+#endif
+
+ gtk_clist_clear((GtkCList*)clist);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_get_selection_info
+ * Signature:
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1get_1selection_1info
+ (JNIEnv *env, jclass that, jint clist, jint x, jint y, jintArray row, jintArray column)
+{
+ jint rc;
+ jint *row1 = NULL;
+ jint *column1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_get_selection_info");
+#endif
+
+ if (row) {
+ row1 = (*env)->GetIntArrayElements(env, row, NULL);
+ }
+ if (column) {
+ column1 = (*env)->GetIntArrayElements(env, column, NULL);
+ }
+ rc = (jint)gtk_clist_get_selection_info((GtkCList*)clist, (gint)x, (gint)y, (gint*)row1, (gint*)column1);
+ if (row) {
+ (*env)->ReleaseIntArrayElements(env, row, row1, 0);
+ }
+ if (column) {
+ (*env)->ReleaseIntArrayElements(env, column, column1, 0);
+ }
+ return rc;
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_select_all
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1select_1all
+ (JNIEnv *env, jclass that, jint clist)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_select_all");
+#endif
+
+ gtk_clist_select_all((GtkCList*)clist);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_clist_unselect_all
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_1clist_1unselect_1all
+ (JNIEnv *env, jclass that, jint clist)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "gtk_clist_unselect_all");
+#endif
+
+ gtk_clist_unselect_all((GtkCList*)clist);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkColor_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkColor src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkColorFids(env, src, &PGLOB(GdkColorFc));
+ getGdkColorFields(env, src, src1, &PGLOB(GdkColorFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkColor_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkColor_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkColor dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkColor_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkColorFids(env, dest, &PGLOB(GdkColorFc));
+ setGdkColorFields(env, dest, dest1, &PGLOB(GdkColorFc));
+ }
+}
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkStyleClass_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkStyleClass dest_struct, *dest1 = NULL;
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkStyleClassFids(env, dest, &PGLOB(GtkStyleClassFc));
+ setGtkStyleClassFields(env, dest, dest1, &PGLOB(GtkStyleClassFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventKey_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkEvent src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkEventKeyFids(env, src, &PGLOB(GdkEventKeyFc));
+ getGdkEventKeyFields(env, src, src1, &PGLOB(GdkEventKeyFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkEventKey_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventKey_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkEvent dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventKey_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkEventKeyFids(env, dest, &PGLOB(GdkEventKeyFc));
+ setGdkEventKeyFields(env, dest, dest1, &PGLOB(GdkEventKeyFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventButton_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkEvent src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkEventButtonFids(env, src, &PGLOB(GdkEventButtonFc));
+ getGdkEventButtonFields(env, src, src1, &PGLOB(GdkEventButtonFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkEventButton_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventButton_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkEvent dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventButton_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkEventButtonFids(env, dest, &PGLOB(GdkEventButtonFc));
+ setGdkEventButtonFields(env, dest, dest1, &PGLOB(GdkEventButtonFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventMotion_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkEvent src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkEventMotionFids(env, src, &PGLOB(GdkEventMotionFc));
+ getGdkEventMotionFields(env, src, src1, &PGLOB(GdkEventMotionFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkEventMotion_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventMotion_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkEvent dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventMotion_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkEventMotionFids(env, dest, &PGLOB(GdkEventMotionFc));
+ setGdkEventMotionFields(env, dest, dest1, &PGLOB(GdkEventMotionFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventExpose_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkEvent src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkEventExposeFids(env, src, &PGLOB(GdkEventExposeFc));
+ getGdkEventExposeFields(env, src, src1, &PGLOB(GdkEventExposeFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkEventExpose_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventExpose_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkEvent dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventExpose_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkEventExposeFids(env, dest, &PGLOB(GdkEventExposeFc));
+ setGdkEventExposeFields(env, dest, dest1, &PGLOB(GdkEventExposeFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkFont_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkFont src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkFontFids(env, src, &PGLOB(GdkFontFc));
+ getGdkFontFields(env, src, src1, &PGLOB(GdkFontFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkFont_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkFont_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkFont dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkFont_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkFontFids(env, dest, &PGLOB(GdkFontFc));
+ setGdkFontFields(env, dest, dest1, &PGLOB(GdkFontFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkGCValues_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkGCValues src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkGCValuesFids(env, src, &PGLOB(GdkGCValuesFc));
+ getGdkGCValuesFields(env, src, src1, &PGLOB(GdkGCValuesFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkGCValues_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkGCValues_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkGCValues dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkGCValues_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkGCValuesFids(env, dest, &PGLOB(GdkGCValuesFc));
+ setGdkGCValuesFields(env, dest, dest1, &PGLOB(GdkGCValuesFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkImage_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkImage src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkImageFids(env, src, &PGLOB(GdkImageFc));
+ getGdkImageFields(env, src, src1, &PGLOB(GdkImageFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkImage_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkImage_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkImage dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkImage_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkImageFids(env, dest, &PGLOB(GdkImageFc));
+ setGdkImageFields(env, dest, dest1, &PGLOB(GdkImageFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkPoint_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkPoint src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkPointFids(env, src, &PGLOB(GdkPointFc));
+ getGdkPointFields(env, src, src1, &PGLOB(GdkPointFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkPoint_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkPoint_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkPoint dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkPoint_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkPointFids(env, dest, &PGLOB(GdkPointFc));
+ setGdkPointFields(env, dest, dest1, &PGLOB(GdkPointFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkRectangle_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkRectangle src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkRectangleFids(env, src, &PGLOB(GdkRectangleFc));
+ getGdkRectangleFields(env, src, src1, &PGLOB(GdkRectangleFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkRectangle_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkRectangle_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkRectangle dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkRectangle_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkRectangleFids(env, dest, &PGLOB(GdkRectangleFc));
+ setGdkRectangleFields(env, dest, dest1, &PGLOB(GdkRectangleFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GdkVisual_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkVisual src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGdkVisualFids(env, src, &PGLOB(GdkVisualFc));
+ getGdkVisualFields(env, src, src1, &PGLOB(GdkVisualFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GdkVisual_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GdkVisual_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GdkVisual dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GdkVisual_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGdkVisualFids(env, dest, &PGLOB(GdkVisualFc));
+ setGdkVisualFields(env, dest, dest1, &PGLOB(GdkVisualFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkAllocation src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkAllocationFids(env, src, &PGLOB(GtkAllocationFc));
+ getGtkAllocationFields(env, src, src1, &PGLOB(GtkAllocationFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkAllocation_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkAllocation_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkAllocation dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkAllocation_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkAllocationFids(env, dest, &PGLOB(GtkAllocationFc));
+ setGtkAllocationFields(env, dest, dest1, &PGLOB(GtkAllocationFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkArg_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkArg src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkArgFids(env, src, &PGLOB(GtkArgFc));
+ getGtkArgFields(env, src, src1, &PGLOB(GtkArgFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkArg_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkArg_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkArg dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkArg_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkArgFids(env, dest, &PGLOB(GtkArgFc));
+ setGtkArgFields(env, dest, dest1, &PGLOB(GtkArgFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkBin_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkBin src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkBinFids(env, src, &PGLOB(GtkBinFc));
+ getGtkBinFields(env, src, src1, &PGLOB(GtkBinFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkBin_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkBin_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkBin dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkBin_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkBinFids(env, dest, &PGLOB(GtkBinFc));
+ setGtkBinFields(env, dest, dest1, &PGLOB(GtkBinFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCList_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCList src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkCListFids(env, src, &PGLOB(GtkCListFc));
+ getGtkCListFields(env, src, src1, &PGLOB(GtkCListFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCList_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCList_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCList dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCList_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkCListFids(env, dest, &PGLOB(GtkCListFc));
+ setGtkCListFields(env, dest, dest1, &PGLOB(GtkCListFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkMenu_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkMenu src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkMenuFids(env, src, &PGLOB(GtkMenuFc));
+ getGtkMenuFields(env, src, src1, &PGLOB(GtkMenuFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkMenu_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkMenu_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkMenu dest_struct={0}, *dest1 = NULL;
+
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkMenu_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkMenuFids(env, dest, &PGLOB(GtkMenuFc));
+ setGtkMenuFields(env, dest, dest1, &PGLOB(GtkMenuFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCTree_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCTree src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkCTreeFids(env, src, &PGLOB(GtkCTreeFc));
+ getGtkCTreeFields(env, src, src1, &PGLOB(GtkCTreeFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCTree_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCTree_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCTree dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCTree_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkCTreeFids(env, dest, &PGLOB(GtkCTreeFc));
+ setGtkCTreeFields(env, dest, dest1, &PGLOB(GtkCTreeFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkColorSelectionDialog_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkColorSelectionDialog src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkColorSelectionDialogFids(env, src, &PGLOB(GtkColorSelectionDialogFc));
+ getGtkColorSelectionDialogFields(env, src, src1, &PGLOB(GtkColorSelectionDialogFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkColorSelectionDialog_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkColorSelectionDialog_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkColorSelectionDialog dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkColorSelectionDialog_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkColorSelectionDialogFids(env, dest, &PGLOB(GtkColorSelectionDialogFc));
+ setGtkColorSelectionDialogFields(env, dest, dest1, &PGLOB(GtkColorSelectionDialogFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCombo_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCombo src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkComboFids(env, src, &PGLOB(GtkComboFc));
+ getGtkComboFields(env, src, src1, &PGLOB(GtkComboFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCombo_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCombo_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCombo dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCombo_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkComboFids(env, dest, &PGLOB(GtkComboFc));
+ setGtkComboFields(env, dest, dest1, &PGLOB(GtkComboFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkContainer_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkContainer src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkContainerFids(env, src, &PGLOB(GtkContainerFc));
+ getGtkContainerFields(env, src, src1, &PGLOB(GtkContainerFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkContainer_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkContainer_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkContainer dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkContainer_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkContainerFids(env, dest, &PGLOB(GtkContainerFc));
+ setGtkContainerFields(env, dest, dest1, &PGLOB(GtkContainerFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkData_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkData src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkDataFids(env, src, &PGLOB(GtkDataFc));
+ getGtkDataFields(env, src, src1, &PGLOB(GtkDataFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkData_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkData_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkData dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkData_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkDataFids(env, dest, &PGLOB(GtkDataFc));
+ setGtkDataFields(env, dest, dest1, &PGLOB(GtkDataFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkEditable_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkEditable src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkEditableFids(env, src, &PGLOB(GtkEditableFc));
+ getGtkEditableFields(env, src, src1, &PGLOB(GtkEditableFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkEditable_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkEditable_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkEditable dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkEditable_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkEditableFids(env, dest, &PGLOB(GtkEditableFc));
+ setGtkEditableFields(env, dest, dest1, &PGLOB(GtkEditableFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkText_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkText src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkTextFids(env, src, &PGLOB(GtkTextFc));
+ getGtkTextFields(env, src, src1, &PGLOB(GtkTextFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkText_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkText_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkText dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkText_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkTextFids(env, dest, &PGLOB(GtkTextFc));
+ setGtkTextFields(env, dest, dest1, &PGLOB(GtkTextFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: gtk_text_inquiry
+ * Signature:
+ * Not implemented yet;
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gtk_text_inquiry__Lorg_eclipse_swt_internal_gtk_GtkText_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkFileSelection_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkFileSelection src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkFileSelectionFids(env, src, &PGLOB(GtkFileSelectionFc));
+ getGtkFileSelectionFields(env, src, src1, &PGLOB(GtkFileSelectionFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkFileSelection_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkFileSelection_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkFileSelection dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkFileSelection_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkFileSelectionFids(env, dest, &PGLOB(GtkFileSelectionFc));
+ setGtkFileSelectionFields(env, dest, dest1, &PGLOB(GtkFileSelectionFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkFontSelectionDialog_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkFontSelectionDialog src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkFontSelectionDialogFids(env, src, &PGLOB(GtkFontSelectionDialogFc));
+ getGtkFontSelectionDialogFields(env, src, src1, &PGLOB(GtkFontSelectionDialogFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkFontSelectionDialog_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkFontSelectionDialog_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkFontSelectionDialog dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkFontSelectionDialog_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkFontSelectionDialogFids(env, dest, &PGLOB(GtkFontSelectionDialogFc));
+ setGtkFontSelectionDialogFields(env, dest, dest1, &PGLOB(GtkFontSelectionDialogFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkObject_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkObject src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkObjectFids(env, src, &PGLOB(GtkObjectFc));
+ getGtkObjectFields(env, src, src1, &PGLOB(GtkObjectFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkObject_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkObject_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkObject dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkObject_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkObjectFids(env, dest, &PGLOB(GtkObjectFc));
+ setGtkObjectFields(env, dest, dest1, &PGLOB(GtkObjectFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkProgress_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkProgress src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkProgressFids(env, src, &PGLOB(GtkProgressFc));
+ getGtkProgressFields(env, src, src1, &PGLOB(GtkProgressFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkProgress_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkProgress_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkProgress dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkProgress_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkProgressFids(env, dest, &PGLOB(GtkProgressFc));
+ setGtkProgressFields(env, dest, dest1, &PGLOB(GtkProgressFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkProgressBar_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkProgressBar src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkProgressBarFids(env, src, &PGLOB(GtkProgressBarFc));
+ getGtkProgressBarFields(env, src, src1, &PGLOB(GtkProgressBarFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkProgressBar_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkProgressBar_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkProgressBar dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkProgressBar_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkProgressBarFids(env, dest, &PGLOB(GtkProgressBarFc));
+ setGtkProgressBarFields(env, dest, dest1, &PGLOB(GtkProgressBarFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkRequisition_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkRequisition src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkRequisitionFids(env, src, &PGLOB(GtkRequisitionFc));
+ getGtkRequisitionFields(env, src, src1, &PGLOB(GtkRequisitionFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkRequisition_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkRequisition_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkRequisition dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkRequisition_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkRequisitionFids(env, dest, &PGLOB(GtkRequisitionFc));
+ setGtkRequisitionFields(env, dest, dest1, &PGLOB(GtkRequisitionFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkStyle_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkStyle src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkStyleFids(env, src, &PGLOB(GtkStyleFc));
+ getGtkStyleFields(env, src, src1, &PGLOB(GtkStyleFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkStyle_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkStyle_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkStyle dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkStyle_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkStyleFids(env, dest, &PGLOB(GtkStyleFc));
+ setGtkStyleFields(env, dest, dest1, &PGLOB(GtkStyleFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkWidget_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkWidget src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkWidgetFids(env, src, &PGLOB(GtkWidgetFc));
+ getGtkWidgetFields(env, src, src1, &PGLOB(GtkWidgetFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkWidget_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkWidget_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkWidget dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkWidget_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkWidgetFids(env, dest, &PGLOB(GtkWidgetFc));
+ setGtkWidgetFields(env, dest, dest1, &PGLOB(GtkWidgetFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkFrame_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkFrame src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkFrameFids(env, src, &PGLOB(GtkFrameFc));
+ getGtkFrameFields(env, src, src1, &PGLOB(GtkFrameFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkFrame_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkFrame_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkFrame dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkFrame_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkFrameFids(env, dest, &PGLOB(GtkFrameFc));
+ setGtkFrameFields(env, dest, dest1, &PGLOB(GtkFrameFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkWindow_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkWindow src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkWindowFids(env, src, &PGLOB(GtkWindowFc));
+ getGtkWindowFields(env, src, src1, &PGLOB(GtkWindowFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkWindow_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkWindow_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkWindow dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkWindow_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkWindowFids(env, dest, &PGLOB(GtkWindowFc));
+ setGtkWindowFields(env, dest, dest1, &PGLOB(GtkWindowFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCheckMenuItem_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCheckMenuItem src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkCheckMenuItemFids(env, src, &PGLOB(GtkCheckMenuItemFc));
+ getGtkCheckMenuItemFields(env, src, src1, &PGLOB(GtkCheckMenuItemFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCheckMenuItem_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCheckMenuItem_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCheckMenuItem dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCheckMenuItem_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkCheckMenuItemFids(env, dest, &PGLOB(GtkCheckMenuItemFc));
+ setGtkCheckMenuItemFields(env, dest, dest1, &PGLOB(GtkCheckMenuItemFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkAdjustment_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkAdjustment src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkAdjustmentFids(env, src, &PGLOB(GtkAdjustmentFc));
+ getGtkAdjustmentFields(env, src, src1, &PGLOB(GtkAdjustmentFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkAdjustment_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkAdjustment_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkAdjustment dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkAdjustment_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkAdjustmentFids(env, dest, &PGLOB(GtkAdjustmentFc));
+ setGtkAdjustmentFields(env, dest, dest1, &PGLOB(GtkAdjustmentFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkBox_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkBox src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkBoxFids(env, src, &PGLOB(GtkBoxFc));
+ getGtkBoxFields(env, src, src1, &PGLOB(GtkBoxFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkBox_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkBox_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkBox dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkBox_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkBoxFids(env, dest, &PGLOB(GtkBoxFc));
+ setGtkBoxFields(env, dest, dest1, &PGLOB(GtkBoxFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkHBox_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkHBox src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkHBoxFids(env, src, &PGLOB(GtkHBoxFc));
+ getGtkHBoxFields(env, src, src1, &PGLOB(GtkHBoxFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkHBox_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkHBox_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkHBox dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkHBox_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkHBoxFids(env, dest, &PGLOB(GtkHBoxFc));
+ setGtkHBoxFields(env, dest, dest1, &PGLOB(GtkHBoxFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkMenuItem_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkMenuItem src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkMenuItemFids(env, src, &PGLOB(GtkMenuItemFc));
+ getGtkMenuItemFields(env, src, src1, &PGLOB(GtkMenuItemFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkMenuItem_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkMenuItem_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkMenuItem dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkMenuItem_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkMenuItemFids(env, dest, &PGLOB(GtkMenuItemFc));
+ setGtkMenuItemFields(env, dest, dest1, &PGLOB(GtkMenuItemFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCListRow_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCListRow src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkCListRowFids(env, src, &PGLOB(GtkCListRowFc));
+ getGtkCListRowFields(env, src, src1, &PGLOB(GtkCListRowFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCListRow_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCListRow_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCListRow dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCListRow_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkCListRowFids(env, dest, &PGLOB(GtkCListRowFc));
+ setGtkCListRowFields(env, dest, dest1, &PGLOB(GtkCListRowFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCListColumn_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCListColumn src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkCListColumnFids(env, src, &PGLOB(GtkCListColumnFc));
+ getGtkCListColumnFields(env, src, src1, &PGLOB(GtkCListColumnFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCListColumn_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCListColumn_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCListColumn dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCListColumn_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkCListColumnFids(env, dest, &PGLOB(GtkCListColumnFc));
+ setGtkCListColumnFields(env, dest, dest1, &PGLOB(GtkCListColumnFc));
+ }
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__ILorg_eclipse_swt_internal_gtk_GtkCTreeRow_2I
+ (JNIEnv *env, jclass that, jint dest, jobject src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCTreeRow src_struct={0}, *src1 = NULL;
+ if (src) {
+ src1 = &src_struct;
+ cacheGtkCTreeRowFids(env, src, &PGLOB(GtkCTreeRowFc));
+ getGtkCTreeRowFields(env, src, src1, &PGLOB(GtkCTreeRowFc));
+ }
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__ILorg_eclipse_swt_internal_gtk_GtkCTreeRow_2I\n");
+#endif
+
+ memmove((void*)dest, (void*)src1, count);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: memmove
+ * Signature:
+ */
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__Lorg_eclipse_swt_internal_gtk_GtkCTreeRow_2II
+ (JNIEnv *env, jclass that, jobject dest, jint src, jint count)
+{
+ DECL_GLOB(pGlob)
+ GtkCTreeRow dest_struct={0}, *dest1 = NULL;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__Lorg_eclipse_swt_internal_gtk_GtkCTreeRow_2II\n");
+#endif
+
+ memmove((void*)&dest_struct, (void*)src, count);
+ if (dest) {
+ dest1 = &dest_struct;
+ cacheGtkCTreeRowFids(env, dest, &PGLOB(GtkCTreeRowFc));
+ setGtkCTreeRowFields(env, dest, dest1, &PGLOB(GtkCTreeRowFc));
+ }
+}
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__I_3BI
+ (JNIEnv *env, jclass that, jint dest, jbyteArray src, jint count)
+{
+ jbyte *src1;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__I_3BI\n");
+#endif
+
+ if (src) {
+ src1 = (*env)->GetByteArrayElements(env, src, NULL);
+ memmove((void*)dest, (void*)src1, count);
+ (*env)->ReleaseByteArrayElements(env, src, src1, 0);
+ }
+}
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove__I_3II
+ (JNIEnv *env, jclass that, jint dest, jintArray src, jint count)
+{
+ jint *src1;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__I_3II\n");
+#endif
+
+ if (src) {
+ src1 = (*env)->GetIntArrayElements(env, src, NULL);
+ memmove((void*)dest, (void*)src1, count);
+ (*env)->ReleaseIntArrayElements(env, src, src1, 0);
+ }
+}
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove___3III
+ (JNIEnv *env, jclass that, jintArray dest, jint src, jint count)
+{
+ jint *dest1;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove__III\n");
+#endif
+
+ if (dest) {
+ dest1 = (*env)->GetIntArrayElements(env, dest, NULL);
+ memmove((void*)dest1, (void*)src, count);
+ (*env)->ReleaseIntArrayElements(env, dest, dest1, 0);
+ }
+}
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove___3BII
+ (JNIEnv *env, jclass that, jbyteArray dest, jint src, jint count)
+{
+ jbyte *dest1;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove___3BII\n");
+#endif
+
+ if (dest) {
+ dest1 = (*env)->GetByteArrayElements(env, dest, NULL);
+ memmove((void*)dest1, (void*)src, count);
+ (*env)->ReleaseByteArrayElements(env, dest, dest1, 0);
+ }
+}
+
+JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_memmove___3I_3BI
+ (JNIEnv *env, jclass that, jintArray dest, jbyteArray src, jint count)
+{
+ jint *dest1;
+ jbyte *src1;
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "memmove___3I_3BI\n");
+#endif
+
+ if (src && dest) {
+ dest1 = (*env)->GetIntArrayElements(env, dest, NULL);
+ src1 = (*env)->GetByteArrayElements(env, dest, NULL);
+ memmove((void*)dest1, (void*)src1, count);
+ (*env)->ReleaseIntArrayElements(env, dest, dest1, 0);
+ (*env)->ReleaseByteArrayElements(env, src, src1, 0);
+ }
+}
+
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_strlen
+ (JNIEnv *env, jclass that, jint string)
+{
+#ifdef DEBUG_CALL_PRINTS
+ fprintf(stderr, "strlen\n");
+#endif
+
+ return (jint)strlen((char*)string);
+}
+
+/*
+ * Class: org_eclipse_swt_internal_gtk_OS
+ * Method: XListFonts
+ * Signature: ([BI[I)I
+ */
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_XListFonts
+ (JNIEnv *env, jclass that, jbyteArray pattern, jint maxnames, jintArray actual_count_return)
+{
+ jbyte *pattern1 = NULL;
+ jint *actual_count_return1=NULL;
+ jint rc;
+
+ if (pattern)
+ pattern1 = (*env)->GetByteArrayElements(env, pattern, NULL);
+ if (actual_count_return)
+ actual_count_return1 = (*env)->GetIntArrayElements(env, actual_count_return, NULL);
+
+ rc = (jint) XListFonts(GDK_DISPLAY(), (char *)pattern1, maxnames, (int *)actual_count_return1);
+
+ if (pattern)
+ (*env)->ReleaseByteArrayElements(env, pattern, pattern1, 0);
+ if (actual_count_return)
+ (*env)->ReleaseIntArrayElements(env, actual_count_return, actual_count_return1, 0);
+ return rc;
+}
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GDKPIXBUF.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GDKPIXBUF.java
new file mode 100644
index 0000000..713ba8d
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GDKPIXBUF.java
@@ -0,0 +1,225 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+import org.eclipse.swt.internal.Library;
+
+public class GDKPIXBUF extends OS {
+
+ /* GdkColorspace enumeration */
+ /* R/G/B additive color space */
+ public final static int GDK_COLORSPACE_RGB = 0;
+
+ /* GIF-like animation overlay modes for frames */
+ public final static int GDK_PIXBUF_FRAME_RETAIN = 0;
+ public final static int GDK_PIXBUF_FRAME_DISPOSE = 1;
+ public final static int GDK_PIXBUF_FRAME_REVERT = 2;
+
+ /* Alpha compositing mode */
+ public final static int GDK_PIXBUF_ALPHA_BILEVEL = 0;
+ public final static int GDK_PIXBUF_ALPHA_FULL = 1;
+
+ /* Interpolation modes */
+ public final static int GDK_INTERP_NEAREST = 0;
+ public final static int GDK_INTERP_TILES = 1;
+ public final static int GDK_INTERP_BILINEAR = 2;
+ public final static int GDK_INTERP_HYPER = 3;
+
+
+/*
+ * NATIVES
+ */
+
+/* GdkPixbuf accessors */
+
+/**
+ * Returns the colorspace of the pixbuf argument
+ */
+public static final native int gdk_pixbuf_get_colorspace (int pixbuf);
+
+/**
+ * Returns the number of channels in the pixbuf argument
+ */
+public static final native int gdk_pixbuf_get_n_channels (int pixbuf);
+
+/**
+ * Returns true if the pixbuf specified by the argument has an alpha channel
+ * (opacity information), and false otherwise.
+ */
+public static final native boolean gdk_pixbuf_get_has_alpha (int pixbuf);
+
+/**
+ * Returns the number of bits per pixel in each channel.
+ * Normally 8.
+ */
+public static final native int gdk_pixbuf_get_bits_per_sample (int pixbuf);
+
+/**
+ * Returns the address of the actual image data in the OS memory.
+ */
+public static final native int gdk_pixbuf_get_pixels (int pixbuf);
+
+/**
+ * Returns the width of the pixbuf specified by the argument.
+ */
+public static final native int gdk_pixbuf_get_width (int pixbuf);
+
+/**
+ * Returns the height of the pixbuf specified by the argument.
+ */
+public static final native int gdk_pixbuf_get_height (int pixbuf);
+
+/**
+ * Returns the rowstride of the pixbuf specified by the argument.
+ */
+public static final native int gdk_pixbuf_get_rowstride (int pixbuf);
+
+
+/* PIXBUF CREATION FROM DATA IN MEMORY */
+
+/**
+ * Create a blank pixbuf with an optimal rowstride and a new buffer
+ */
+public static final native int gdk_pixbuf_new (
+ int colorspace,
+ boolean has_alpha,
+ int bits_per_sample,
+ int width,
+ int height);
+
+public static final native int gdk_pixbuf_copy(int source);
+
+public static final native int gdk_pixbuf_new_from_data (
+ byte[] data,
+ int colorspace,
+ boolean has_alpha,
+ int bits_per_sample,
+ int width,
+ int height,
+ int rowstride,
+ int destroy_fn,
+ int destroy_fn_data);
+
+public static final native int gdk_pixbuf_new_from_xpm_data (int pdata);
+
+
+/* PIXBUF CREATION - FILE LOADING */
+
+public static final native int gdk_pixbuf_new_from_file (byte[] filename);
+
+
+
+/* RENDERING TO A DRAWABLE */
+
+
+public static final native void gdk_pixbuf_render_to_drawable_alpha (int pixbuf,
+ int drawable,
+ int src_x, int src_y,
+ int dest_x, int dest_y,
+ int width, int height,
+ int alpha_mode,
+ int alpha_threshold,
+ int dither,
+ int x_dither, int y_dither);
+
+public static final native void gdk_pixbuf_render_to_drawable (int pixbuf,
+ int drawable,
+ int gc,
+ int src_x, int src_y,
+ int dest_x, int dest_y,
+ int width, int height,
+ int dither,
+ int x_dither, int y_dither);
+
+/* SCALING */
+
+public static final native void gdk_pixbuf_scale (
+ int src, int dest,
+ int dest_x,
+ int dest_y,
+ int dest_width,
+ int dest_height,
+ double offset_x,
+ double offset_y,
+ double scale_x,
+ double scale_y,
+ int interp_type);
+
+public static final native void gdk_pixbuf_composite (
+ int src, int dest,
+ int dest_x,
+ int dest_y,
+ int dest_width,
+ int dest_height,
+ double offset_x,
+ double offset_y,
+ double scale_x,
+ double scale_y,
+ int interp_type,
+ int overall_alpha);
+
+public static final native void gdk_pixbuf_composite_color (
+ int src,
+ int dest,
+ int dest_x,
+ int dest_y,
+ int dest_width,
+ int dest_height,
+ double offset_x,
+ double offset_y,
+ double scale_x,double scale_y,
+ int interp_type,
+ int overall_alpha,
+ int check_x,
+ int check_y,
+ int check_size,
+ int color1,
+ int color2);
+
+public static final native int gdk_pixbuf_scale_simple (
+ int src,
+ int dest_width,
+ int dest_height,
+ int interp_type);
+
+public static final native int gdk_pixbuf_composite_color_simple (
+ int src,int dest_width,
+ int dest_height,
+ int interp_type,
+ int overall_alpha,
+ int check_size,
+ int color1,
+ int color2);
+
+
+
+public static final native int gdk_pixbuf_get_from_drawable (
+ int dest,
+ int src,
+ int cmap,
+ int src_x,
+ int src_y,
+ int dest_x,
+ int dest_y,
+ int width,
+ int height);
+
+
+
+/* LOAD THE DLL */
+
+static {
+ Library.loadLibrary ("swt-pixbuf");
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkColor.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkColor.java
new file mode 100644
index 0000000..1db777f
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkColor.java
@@ -0,0 +1,22 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkColor {
+ public int pixel;
+ public short red;
+ public short green;
+ public short blue;
+ public static final int sizeof = 10;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEvent.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEvent.java
new file mode 100644
index 0000000..6da6571
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEvent.java
@@ -0,0 +1,21 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkEvent {
+ public int type;
+ public int window;
+ public byte send_event;
+ public static final int sizeof = 88;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventButton.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventButton.java
new file mode 100644
index 0000000..17d1feb
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventButton.java
@@ -0,0 +1,29 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkEventButton extends GdkEvent {
+ public int time;
+ public long x;
+ public long y;
+ public long pressure;
+ public long xtilt;
+ public long ytilt;
+ public int state;
+ public int button;
+ public int source;
+ public int deviceid;
+ public long x_root;
+ public long y_root;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventExpose.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventExpose.java
new file mode 100644
index 0000000..6fd9920
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventExpose.java
@@ -0,0 +1,22 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkEventExpose extends GdkEvent {
+ public short x;
+ public short y;
+ public short width;
+ public short height;
+ public int count;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventKey.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventKey.java
new file mode 100644
index 0000000..6e4acde
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventKey.java
@@ -0,0 +1,22 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkEventKey extends GdkEvent {
+ public int time;
+ public int state;
+ public int keyval;
+ public int length;
+ public int string;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventMotion.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventMotion.java
new file mode 100644
index 0000000..5a8d5b9
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkEventMotion.java
@@ -0,0 +1,29 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkEventMotion extends GdkEvent {
+ public int time;
+ public long x;
+ public long y;
+ public long pressure;
+ public long xtilt;
+ public long ytilt;
+ public int state;
+ public int is_hint;
+ public int source;
+ public int deviceid;
+ public long x_root;
+ public long y_root;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkFont.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkFont.java
new file mode 100644
index 0000000..6d7df17
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkFont.java
@@ -0,0 +1,21 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkFont {
+ public int type;
+ public int ascent;
+ public int descent;
+ public static final int sizeof = 12;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkGCValues.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkGCValues.java
new file mode 100644
index 0000000..df0b4d5
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkGCValues.java
@@ -0,0 +1,42 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkGCValues {
+ public int foreground_pixel;
+ public short foreground_red;
+ public short foreground_green;
+ public short foreground_blue;
+ public int background_pixel;
+ public short background_red;
+ public short background_green;
+ public short background_blue;
+ public int font;
+ public int function;
+ public int fill;
+ public int tile;
+ public int stipple;
+ public int clip_mask;
+ public int subwindow_mode;
+ public int ts_x_origin;
+ public int ts_y_origin;
+ public int clip_x_origin;
+ public int clip_y_origin;
+ public int graphics_exposures;
+ public int line_width;
+ public int line_style;
+ public int cap_style;
+ public int join_style;
+ public static final int sizeof = 84;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkRectangle.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkRectangle.java
new file mode 100644
index 0000000..1dad9e7
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkRectangle.java
@@ -0,0 +1,22 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkRectangle {
+ public short x;
+ public short y;
+ public short width;
+ public short height;
+ public static final int sizeof = 8;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkVisual.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkVisual.java
new file mode 100644
index 0000000..3b0630a
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GdkVisual.java
@@ -0,0 +1,32 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GdkVisual {
+ public int type;
+ public int depth;
+ public int byte_order;
+ public int colormap_size;
+ public int bits_per_rgb;
+ public int red_mask;
+ public int red_shift;
+ public int red_prec;
+ public int green_mask;
+ public int green_shift;
+ public int green_prec;
+ public int blue_mask;
+ public int blue_shift;
+ public int blue_prec;
+ public static final int sizeof = 56;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkAdjustment.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkAdjustment.java
new file mode 100644
index 0000000..b1a5598
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkAdjustment.java
@@ -0,0 +1,24 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkAdjustment extends GtkObject {
+ public float lower;
+ public float upper;
+ public float value;
+ public float step_increment;
+ public float page_increment;
+ public float page_size;
+ public static final int sizeof = 40;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkAllocation.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkAllocation.java
new file mode 100644
index 0000000..fc264d9
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkAllocation.java
@@ -0,0 +1,22 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkAllocation {
+ public short x;
+ public short y;
+ public short width;
+ public short height;
+ public static final int sizeof = 8;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkBin.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkBin.java
new file mode 100644
index 0000000..d408fc5
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkBin.java
@@ -0,0 +1,19 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkBin extends GtkContainer {
+ public int child;
+ public static final int sizeof = 64;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkBox.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkBox.java
new file mode 100644
index 0000000..f948c7e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkBox.java
@@ -0,0 +1,21 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkBox extends GtkContainer {
+ public int children;
+ public short spacing;
+ public int homogeneous;
+ public static final int sizeof = 68;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCList.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCList.java
new file mode 100644
index 0000000..cb4843b
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCList.java
@@ -0,0 +1,74 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkCList extends GtkContainer {
+ public short clist_flags;
+ public int row_mem_chunk;
+ public int cell_mem_chunk;
+ public int freeze_count;
+ public short internal_allocation_x;
+ public short internal_allocation_y;
+ public short internal_allocation_width;
+ public short internal_allocation_height;
+ public int rows;
+ public int row_center_offset;
+ public int row_height;
+ public int row_list;
+ public int row_list_end;
+ public int columns;
+ public short column_title_area_x;
+ public short column_title_area_y;
+ public short column_title_area_width;
+ public short column_title_area_height;
+ public int title_window;
+ public int column;
+ public int clist_window;
+ public int clist_window_width;
+ public int clist_window_height;
+ public int hoffset;
+ public int voffset;
+ public int shadow_type;
+ public int selection_mode;
+ public int selection;
+ public int selection_end;
+ public int undo_selection;
+ public int undo_unselection;
+ public int undo_anchor;
+ public byte button_actions0;
+ public byte button_actions1;
+ public byte button_actions2;
+ public byte button_actions3;
+ public byte button_actions4;
+ public byte drag_button;
+ public int click_cell_row;
+ public int click_cell_column;
+ public int hadjustment;
+ public int vadjustment;
+ public int xor_gc;
+ public int fg_gc;
+ public int bg_gc;
+ public int cursor_drag;
+ public int x_drag;
+ public int focus_row;
+ public int anchor;
+ public int anchor_state;
+ public int drag_pos;
+ public int htimer;
+ public int vtimer;
+ public int sort_type;
+ public int compare;
+ public int sort_column;
+ public static final int sizeof = 252;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCListColumn.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCListColumn.java
new file mode 100644
index 0000000..818924d
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCListColumn.java
@@ -0,0 +1,34 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkCListColumn {
+ public int title;
+ public short area_x;
+ public short area_y;
+ public short area_width;
+ public short area_height;
+ public int button;
+ public int window;
+ public int width;
+ public int min_width;
+ public int max_width;
+ public int justification;
+ public int visible;
+ public int width_set;
+ public int resizeable;
+ public int auto_resize;
+ public int button_passive;
+ public static final int sizeof = 40;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCListRow.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCListRow.java
new file mode 100644
index 0000000..73c9063
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCListRow.java
@@ -0,0 +1,34 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkCListRow {
+ public int cell;
+ public int state;
+ public short foreground_red;
+ public short foreground_green;
+ public short foreground_blue;
+ public int foreground_pixel;
+ public short background_red;
+ public short background_green;
+ public short background_blue;
+ public int background_pixel;
+ public int style;
+ public int data;
+ public int destroy; // bitfield: 1
+ public int fg_set; // bitfield: 1
+ public int bg_set; // bitfield: 1
+ public int selectable; // bitfield: 1
+ public static final int sizeof = 48;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCTree.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCTree.java
new file mode 100644
index 0000000..7f6bb8e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCTree.java
@@ -0,0 +1,20 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkCTree extends GtkCList {
+ public int tree_indent;
+ public int tree_column;
+ public static final int sizeof = 276;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCTreeRow.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCTreeRow.java
new file mode 100644
index 0000000..ce9e4d6
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCTreeRow.java
@@ -0,0 +1,28 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkCTreeRow extends GtkCListRow {
+ public int parent;
+ public int sibling;
+ public int children;
+ public int pixmap_closed;
+ public int mask_closed;
+ public int pixmap_opened;
+ public int mask_opened;
+ public short level;
+ public int is_leaf; // bitfield: 1
+ public int expanded; // bitfield: 1
+ public static final int sizeof = 80;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCheckMenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCheckMenuItem.java
new file mode 100644
index 0000000..ce3c4db
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCheckMenuItem.java
@@ -0,0 +1,20 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkCheckMenuItem extends GtkMenuItem {
+ public int active;
+ public int always_show_toggle;
+ public static final int sizeof = 88;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkColorSelectionDialog.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkColorSelectionDialog.java
new file mode 100644
index 0000000..b677e23
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkColorSelectionDialog.java
@@ -0,0 +1,24 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkColorSelectionDialog extends GtkWindow {
+ public int colorsel;
+ public int main_vbox;
+ public int ok_button;
+ public int reset_button;
+ public int cancel_button;
+ public int help_button;
+ public static final int sizeof = 120;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCombo.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCombo.java
new file mode 100644
index 0000000..2b44b57
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkCombo.java
@@ -0,0 +1,32 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkCombo extends GtkHBox {
+ public int entry;
+ public int button;
+ public int popup;
+ public int popwin;
+ public int list;
+ public int entry_change_id;
+ public int list_change_id;
+ public int value_in_list; // bitfield : 1
+ public int ok_if_empty; // bitfield : 1
+ public int case_sensitive; // bitfield : 1
+ public int use_arrows; // bitfield : 1
+ public int use_arrows_always; // bitfield : 1
+ public short current_button;
+ public int activate_id;
+ public static final int sizeof = 104;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkContainer.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkContainer.java
new file mode 100644
index 0000000..52cb47a
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkContainer.java
@@ -0,0 +1,23 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkContainer extends GtkWidget {
+ public int focus_child;
+ public int border_width;
+ public int need_resize;
+ public int resize_mode;
+ public int resize_widgets;
+ public static final int sizeof = 60;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkDialog.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkDialog.java
new file mode 100644
index 0000000..d4f2ddf
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkDialog.java
@@ -0,0 +1,21 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkDialog extends GtkWindow {
+ public int vbox;
+ public int action_area;
+ public static final int sizeof = 104;
+}
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkEditable.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkEditable.java
new file mode 100644
index 0000000..8f2b772
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkEditable.java
@@ -0,0 +1,27 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkEditable extends GtkWidget {
+ public int current_pos;
+ public int selection_start_pos;
+ public int selection_end_pos;
+ public int has_selection; // bitfield : 1
+ public int editable; // bitfield : 1
+ public int visible; // bitfield : 1
+ public int ic;
+ public int ic_attr;
+ public int clipboard_text;
+ public static final int sizeof = 76;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFileSelection.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFileSelection.java
new file mode 100644
index 0000000..ebaf37d
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFileSelection.java
@@ -0,0 +1,38 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkFileSelection extends GtkWindow {
+ public int dir_list;
+ public int file_list;
+ public int selection_entry;
+ public int selection_text;
+ public int main_vbox;
+ public int ok_button;
+ public int cancel_button;
+ public int help_button;
+ public int history_pulldown;
+ public int history_menu;
+ public int history_list;
+ public int fileop_dialog;
+ public int fileop_entry;
+ public int fileop_file;
+ public int cmpl_state;
+ public int fileop_c_dir;
+ public int fileop_del_file;
+ public int fileop_ren_file;
+ public int button_area;
+ public int action_area;
+ public static final int sizeof = 176;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFontSelectionDialog.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFontSelectionDialog.java
new file mode 100644
index 0000000..09ee759
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFontSelectionDialog.java
@@ -0,0 +1,26 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkFontSelectionDialog extends GtkWindow {
+ public int fontsel;
+ public int main_vbox;
+ public int action_area;
+ public int ok_button;
+ public int apply_button;
+ public int cancel_button;
+ public int dialog_width;
+ public int auto_resize;
+ public static final int sizeof = 132;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFrame.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFrame.java
new file mode 100644
index 0000000..0541461
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkFrame.java
@@ -0,0 +1,24 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkFrame extends GtkBin {
+ public int label;
+ public short shadow_type;
+ public short label_width;
+ public short label_height;
+ public float label_xalign;
+ public float label_yalign;
+ public static final int sizeof = 84;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkHBox.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkHBox.java
new file mode 100644
index 0000000..6566014
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkHBox.java
@@ -0,0 +1,18 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkHBox extends GtkBox {
+ public static final int sizeof = 68;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkItem.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkItem.java
new file mode 100644
index 0000000..80db35e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkItem.java
@@ -0,0 +1,18 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkItem extends GtkBin {
+ public static final int sizeof = 64;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkMenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkMenuItem.java
new file mode 100644
index 0000000..ed45420
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkMenuItem.java
@@ -0,0 +1,28 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkMenuItem extends GtkItem {
+ public int submenu;
+ public int accelerator_signal;
+ public int toggle_size;
+ public int accelerator_width;
+ public int show_toggle_indicator;
+ public int show_submenu_indicator;
+ public int submenu_placement;
+ public int submenu_direction;
+ public int right_justify;
+ public int timer;
+ public static final int sizeof = 84;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkObject.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkObject.java
new file mode 100644
index 0000000..226d4a7
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkObject.java
@@ -0,0 +1,22 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkObject {
+ public int klass;
+ public int flags;
+ public int ref_count;
+ public int object_data;
+ public static final int sizeof = 16;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkRequisition.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkRequisition.java
new file mode 100644
index 0000000..0c12fe4
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkRequisition.java
@@ -0,0 +1,20 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkRequisition {
+ public short width;
+ public short height;
+ public static final int sizeof = 4;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkStyle.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkStyle.java
new file mode 100644
index 0000000..a070672
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkStyle.java
@@ -0,0 +1,112 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkStyle {
+ public int klass;
+ public int fg0_pixel;
+ public short fg0_red, fg0_green, fg0_blue;
+ public int fg1_pixel;
+ public short fg1_red, fg1_green, fg1_blue;
+ public int fg2_pixel;
+ public short fg2_red, fg2_green, fg2_blue;
+ public int fg3_pixel;
+ public short fg3_red, fg3_green, fg3_blue;
+ public int fg4_pixel;
+ public short fg4_red, fg4_green, fg4_blue;
+ public int bg0_pixel;
+ public short bg0_red, bg0_green, bg0_blue;
+ public int bg1_pixel;
+ public short bg1_red, bg1_green, bg1_blue;
+ public int bg2_pixel;
+ public short bg2_red, bg2_green, bg2_blue;
+ public int bg3_pixel;
+ public short bg3_red, bg3_green, bg3_blue;
+ public int bg4_pixel;
+ public short bg4_red, bg4_green, bg4_blue;
+ public int light0_pixel;
+ public short light0_red, light0_green, light0_blue;
+ public int light1_pixel;
+ public short light1_red, light1_green, light1_blue;
+ public int light2_pixel;
+ public short light2_red, light2_green, light2_blue;
+ public int light3_pixel;
+ public short light3_red, light3_green, light3_blue;
+ public int light4_pixel;
+ public short light4_red, light4_green, light4_blue;
+ public int dark0_pixel;
+ public short dark0_red, dark0_green, dark0_blue;
+ public int dark1_pixel;
+ public short dark1_red, dark1_green, dark1_blue;
+ public int dark2_pixel;
+ public short dark2_red, dark2_green, dark2_blue;
+ public int dark3_pixel;
+ public short dark3_red, dark3_green, dark3_blue;
+ public int dark4_pixel;
+ public short dark4_red, dark4_green, dark4_blue;
+ public int mid0_pixel;
+ public short mid0_red, mid0_green, mid0_blue;
+ public int mid1_pixel;
+ public short mid1_red, mid1_green, mid1_blue;
+ public int mid2_pixel;
+ public short mid2_red, mid2_green, mid2_blue;
+ public int mid3_pixel;
+ public short mid3_red, mid3_green, mid3_blue;
+ public int mid4_pixel;
+ public short mid4_red, mid4_green, mid4_blue;
+ public int text0_pixel;
+ public short text0_red, text0_green, text0_blue;
+ public int text1_pixel;
+ public short text1_red, text1_green, text1_blue;
+ public int text2_pixel;
+ public short text2_red, text2_green, text2_blue;
+ public int text3_pixel;
+ public short text3_red, text3_green, text3_blue;
+ public int text4_pixel;
+ public short text4_red, text4_green, text4_blue;
+ public int base0_pixel;
+ public short base0_red, base0_green, base0_blue;
+ public int base1_pixel;
+ public short base1_red, base1_green, base1_blue;
+ public int base2_pixel;
+ public short base2_red, base2_green, base2_blue;
+ public int base3_pixel;
+ public short base3_red, base3_green, base3_blue;
+ public int base4_pixel;
+ public short base4_red, base4_green, base4_blue;
+ public int black_pixel;
+ public short black_red, black_green, black_blue;
+ public int white_pixel;
+ public short white_red, white_green, white_blue;
+ public int font;
+ public int fg_gc0, fg_gc1, fg_gc2, fg_gc3, fg_gc4;
+ public int bg_gc0, bg_gc1, bg_gc2, bg_gc3, bg_gc4;
+ public int light_gc0, light_gc1, light_gc2, light_gc3, light_gc4;
+ public int dark_gc0, dark_gc1, dark_gc2, dark_gc3, dark_gc4;
+ public int mid_gc0, mid_gc1, mid_gc2, mid_gc3, mid_gc4;
+ public int text_gc0, text_gc1, text_gc2, text_gc3, text_gc4;
+ public int base_gc0, base_gc1, base_gc2, base_gc3, base_gc4;
+ public int black_gc;
+ public int white_gc;
+ public int bg_pixmap0, bg_pixmap1, bg_pixmap2, bg_pixmap3, bg_pixmap4, bg_pixmap5;
+ public int ref_count;
+ public int attach_count;
+ public int depth;
+ public int colormap;
+ public int engine;
+ public int engine_data;
+ public int rc_style;
+ public int styles;
+ public static final int sizeof = 652;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkStyleClass.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkStyleClass.java
new file mode 100644
index 0000000..a086ab4
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkStyleClass.java
@@ -0,0 +1,20 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkStyleClass {
+ public int xthickness;
+ public int ythickness;
+ public static final int sizeof = 8;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkText.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkText.java
new file mode 100644
index 0000000..fda4196
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkText.java
@@ -0,0 +1,25 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkText extends GtkEditable {
+ public int first_line_start_index;
+ public int first_onscreen_hor_pixel;
+ public int first_onscreen_ver_pixel;
+ public int default_tab_width;
+ public int cursor_pos_x;
+ public int cursor_pos_y;
+ public int cursor_virtual_x;
+ public static final int sizeof = 244;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkWidget.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkWidget.java
new file mode 100644
index 0000000..405fbeb
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkWidget.java
@@ -0,0 +1,31 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkWidget extends GtkObject {
+ public short private_flags;
+ public byte state;
+ public byte saved_state;
+ public int name;
+ public int style;
+ public short req_width;
+ public short req_height;
+ public short alloc_x;
+ public short alloc_y;
+ public short alloc_width;
+ public short alloc_height;
+ public int window;
+ public int parent;
+ public static final int sizeof = 48;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkWindow.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkWindow.java
new file mode 100644
index 0000000..152dc72
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/GtkWindow.java
@@ -0,0 +1,33 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+public class GtkWindow extends GtkBin {
+ public int title;
+ public int wmclass_name;
+ public int wmclass_class;
+ public int type;
+ public int focus_widget;
+ public int default_widget;
+ public int transient_parent;
+ public short resize_count;
+ public int allow_shrink;
+ public int allow_grow;
+ public int auto_shrink;
+ public int handling_resize;
+ public int position;
+ public int use_uposition;
+ public int modal;
+ public static final int sizeof = 96;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/OS.java
new file mode 100644
index 0000000..467ae53
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/org/eclipse/swt/internal/gtk/OS.java
@@ -0,0 +1,637 @@
+package org.eclipse.swt.internal.gtk;
+
+/*
+ * Copyright (c) IBM Corp. 2000, 2001. All rights reserved.
+ *
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ */
+
+import org.eclipse.swt.internal.Library;
+
+public class OS {
+ static {
+ Library.loadLibrary("swt-pi");
+ }
+
+
+ public static final int GDK_NONE = 0;
+
+ /* For Display.KeyTable: */
+ /* Keyboard and mouse masks */
+ public static final int GDK_Alt_L = 0xFFE9;
+ public static final int GDK_Alt_R = 0xFFEA;
+ public static final int GDK_Shift_L = 0xFFE1;
+ public static final int GDK_Shift_R = 0xFFE2;
+ public static final int GDK_Control_L = 0xFFE3;
+ public static final int GDK_Control_R = 0xFFE4;
+ /* Non-numeric keypad constants */
+ public static final int GDK_Up = 0xFF52;
+ public static final int GDK_Down = 0xFF54;
+ public static final int GDK_Left = 0xFF51;
+ public static final int GDK_Right = 0xFF53;
+ public static final int GDK_Page_Up = 0xFF55;
+ public static final int GDK_Page_Down = 0xFF56;
+ public static final int GDK_Home = 0xFF50;
+ public static final int GDK_End = 0xFF57;
+ public static final int GDK_Insert = 0xFF63;
+ public static final int GDK_Delete = 0xFFFF;
+ /* Functions Keys */
+ public static final int GDK_F1 = 0xFFBE;
+ public static final int GDK_F2 = 0xFFBF;
+ public static final int GDK_F3 = 0xFFC0;
+ public static final int GDK_F4 = 0xFFC1;
+ public static final int GDK_F5 = 0xFFC2;
+ public static final int GDK_F6 = 0xFFC3;
+ public static final int GDK_F7 = 0xFFC4;
+ public static final int GDK_F8 = 0xFFC5;
+ public static final int GDK_F9 = 0xFFC6;
+ public static final int GDK_F10 = 0xFFC7;
+ public static final int GDK_F11 = 0xFFC8;
+ public static final int GDK_F12 = 0xFFC9;
+ public static final int GDK_Return = 0xFF0D;
+ /* Numeric Keypad */
+ public static final int GDK_KP_Add = 0xFFAB;
+ public static final int GDK_KP_Subtract = 0xFFAD;
+ public static final int GDK_KP_Multiply = 0xFFAA;
+ public static final int GDK_KP_Divide = 0xFFAF;
+ public static final int GDK_KP_Enter = 0xFF8D;
+ public static final int GDK_KP_Decimal = 0xFFAE;
+ public static final int GDK_KP_0 = 0xFFB0;
+ public static final int GDK_KP_1 = 0xFFB1;
+ public static final int GDK_KP_2 = 0xFFB2;
+ public static final int GDK_KP_3 = 0xFFB3;
+ public static final int GDK_KP_4 = 0xFFB4;
+ public static final int GDK_KP_5 = 0xFFB5;
+ public static final int GDK_KP_6 = 0xFFB6;
+ public static final int GDK_KP_7 = 0xFFB7;
+ public static final int GDK_KP_8 = 0xFFB8;
+ public static final int GDK_KP_9 = 0xFFB9;
+
+ public static final int GDK_FONT_FONT = 0;
+ public static final int GDK_FONT_FONTSET = 1;
+ public static final int GDK_COPY = 0;
+ public static final int GDK_INVERT = 1;
+ public static final int GDK_XOR = 2;
+ public static final int GDK_STIPPLED = 2;
+ public static final int GDK_LINE_SOLID = 0;
+ public static final int GDK_LINE_ON_OFF_DASH = 1;
+ public static final int GDK_LINE_DOUBLE_DASH = 2;
+ public static final int GDK_CAP_BUTT = 1;
+ public static final int GDK_JOIN_MITER = 0;
+ public static final int GDK_X_CURSOR = 0;
+ public static final int GDK_BOTTOM_LEFT_CORNER = 12;
+ public static final int GDK_BOTTOM_RIGHT_CORNER = 14;
+ public static final int GDK_BOTTOM_SIDE = 16;
+ public static final int GDK_CROSS = 30;
+ public static final int GDK_DIAMOND_CROSS = 36;
+ public static final int GDK_DOUBLE_ARROW = 42;
+ public static final int GDK_HAND1 = 58;
+ public static final int GDK_LEFT_PTR = 68;
+ public static final int GDK_LEFT_SIDE = 70;
+ public static final int GDK_QUESTION_ARROW = 92;
+ public static final int GDK_RIGHT_PTR = 94;
+ public static final int GDK_RIGHT_SIDE = 96;
+ public static final int GDK_SB_H_DOUBLE_ARROW = 108;
+ public static final int GDK_SB_UP_ARROW = 114;
+ public static final int GDK_SB_V_DOUBLE_ARROW = 116;
+ public static final int GDK_SIZING = 120;
+ public static final int GDK_TOP_LEFT_CORNER = 134;
+ public static final int GDK_TOP_RIGHT_CORNER = 136;
+ public static final int GDK_TOP_SIDE = 138;
+ public static final int GDK_WATCH = 150;
+ public static final int GDK_XTERM = 152;
+ public static final int GDK_CURSOR_IS_PIXMAP = -1;
+ public static final int GDK_MOTION_NOTIFY = 3;
+ public static final int GDK_BUTTON_PRESS = 4;
+ public static final int GDK_2BUTTON_PRESS = 5;
+ public static final int GDK_3BUTTON_PRESS = 6;
+ public static final int GDK_BUTTON_RELEASE = 7;
+ public static final int GDK_KEY_PRESS = 8;
+ public static final int GDK_KEY_RELEASE = 9;
+ public static final int GDK_NO_EXPOSE = 30;
+ public static final int GDK_EXPOSURE_MASK = 1 << 1;
+ public static final int GDK_POINTER_MOTION_MASK = 1 << 2;
+ public static final int GDK_POINTER_MOTION_HINT_MASK = 1 << 3;
+ public static final int GDK_BUTTON_MOTION_MASK = 1 << 4;
+ public static final int GDK_BUTTON1_MOTION_MASK = 1 << 5;
+ public static final int GDK_BUTTON2_MOTION_MASK = 1 << 6;
+ public static final int GDK_BUTTON3_MOTION_MASK = 1 << 7;
+ public static final int GDK_BUTTON_PRESS_MASK = 1 << 8;
+ public static final int GDK_BUTTON_RELEASE_MASK = 1 << 9;
+ public static final int GDK_KEY_PRESS_MASK = 1 << 10;
+ public static final int GDK_KEY_RELEASE_MASK = 1 << 11;
+ public static final int GDK_ENTER_NOTIFY_MASK = 1 << 12;
+ public static final int GDK_LEAVE_NOTIFY_MASK = 1 << 13;
+ public static final int GDK_FOCUS_CHANGE_MASK = 1 << 14;
+ public static final int GDK_SHIFT_MASK = 1 << 0;
+ public static final int GDK_LOCK_MASK = 1 << 1;
+ public static final int GDK_CONTROL_MASK = 1 << 2;
+ public static final int GDK_MOD1_MASK = 1 << 3;
+ public static final int GDK_BUTTON1_MASK = 1 << 8;
+ public static final int GDK_BUTTON2_MASK = 1 << 9;
+ public static final int GDK_BUTTON3_MASK = 1 << 10;
+ public static final int GDK_RELEASE_MASK = 1 << 13;
+ public static final int GDK_MODIFIER_MASK = 0x3fff;
+ public static final int GDK_INCLUDE_INFERIORS = 1;
+ public static final int GDK_DECOR_ALL = 1 << 0;
+ public static final int GDK_DECOR_BORDER = 1 << 1;
+ public static final int GDK_DECOR_RESIZEH = 1 << 2;
+ public static final int GDK_DECOR_TITLE = 1 << 3;
+ public static final int GDK_DECOR_MENU = 1 << 4;
+ public static final int GDK_DECOR_MINIMIZE = 1 << 5;
+ public static final int GDK_DECOR_MAXIMIZE = 1 << 6;
+ public static final int GDK_OVERLAP_RECTANGLE_IN = 0;
+ public static final int GDK_OVERLAP_RECTANGLE_OUT = 1;
+ public static final int GDK_OVERLAP_RECTANGLE_PART = 2;
+ public static final int GDK_RGB_DITHER_NONE = 0;
+ public static final int GDK_RGB_DITHER_NORMAL = 1;
+ public static final int GDK_RGB_DITHER_MAX = 2;
+ public static final int GTK_ARROW_UP = 0;
+ public static final int GTK_ARROW_DOWN = 1;
+ public static final int GTK_ARROW_LEFT = 2;
+ public static final int GTK_ARROW_RIGHT = 3;
+ public static final int GTK_JUSTIFY_LEFT = 0;
+ public static final int GTK_JUSTIFY_RIGHT = 1;
+ public static final int GTK_JUSTIFY_CENTER = 2;
+ public static final int GTK_JUSTIFY_FILL = 3;
+ public static final int GTK_ORIENTATION_HORIZONTAL = 0;
+ public static final int GTK_ORIENTATION_VERTICAL = 1;
+ public static final int GTK_POLICY_ALWAYS = 0;
+ public static final int GTK_POLICY_AUTOMATIC = 1; // can't fix now
+ public static final int GTK_POLICY_NEVER = 2;
+ public static final int GTK_RELIEF_NORMAL = 0;
+// public static final int GTK_RELIEF_HALF = 1;
+ public static final int GTK_RELIEF_NONE = 2;
+ public static final int GTK_SELECTION_SINGLE = 0; // extra code in Table, can't fix now
+ public static final int GTK_SELECTION_BROWSE = 1;
+ public static final int GTK_SELECTION_MULTIPLE = 2;
+ public static final int GTK_SELECTION_EXTENDED = 3;
+ public static final int GTK_SHADOW_NONE = 0;
+ public static final int GTK_SHADOW_IN = 1;
+ public static final int GTK_SHADOW_OUT = 2;
+ public static final int GTK_SHADOW_ETCHED_IN = 3;
+ public static final int GTK_SHADOW_ETCHED_OUT = 4;
+ public static final int GTK_STATE_NORMAL = 0;
+ public static final int GTK_STATE_ACTIVE = 1;
+ public static final int GTK_STATE_PRELIGHT = 2;
+ public static final int GTK_STATE_SELECTED = 3;
+ public static final int GTK_STATE_INSENSITIVE = 4;
+ public static final int GTK_TOP_BOTTOM = 0;
+ public static final int GTK_LEFT_RIGHT = 1;
+ public static final int GTK_TOOLBAR_ICONS = 0;
+ public static final int GTK_TOOLBAR_TEXT = 1;
+ public static final int GTK_TOOLBAR_BOTH = 2;
+ public static final int GTK_VISIBILITY_NONE = 0;
+ public static final int GTK_VISIBILITY_PARTIAL = 1;
+ public static final int GTK_VISIBILITY_FULL = 2;
+ public static final int GTK_WINDOW_TOPLEVEL = 0;
+ public static final int GTK_WINDOW_DIALOG = 1;
+ public static final int GTK_WINDOW_POPUP = 2;
+ public static final int GTK_ACCEL_VISIBLE = 1 << 0;
+ public static final int GTK_NO_WINDOW = 1 << 5;
+ public static final int GTK_MAPPED = 1 << 7;
+ public static final int GTK_VISIBLE = 1 << 8;
+ public static final int GTK_SENSITIVE = 1 << 9;
+ public static final int GTK_CAN_FOCUS = 1 << 11;
+ public static final int GTK_HAS_FOCUS = 1 << 12;
+ public static final int GTK_CLIST_SHOW_TITLES = 1 << 2;
+ public static final int GTK_PROGRESS_CONTINUOUS = 0;
+ public static final int GTK_PROGRESS_DISCRETE = 1;
+ public static final int GTK_PROGRESS_LEFT_TO_RIGHT = 0;
+ public static final int GTK_PROGRESS_RIGHT_TO_LEFT = 1;
+ public static final int GTK_PROGRESS_BOTTOM_TO_TOP = 2;
+ public static final int GTK_PROGRESS_TOP_TO_BOTTOM = 3;
+ public static final int GTK_TOOLBAR_CHILD_SPACE = 0;
+ public static final int GTK_TOOLBAR_CHILD_BUTTON = 1;
+ public static final int GTK_TOOLBAR_CHILD_TOGGLEBUTTON = 2;
+ public static final int GTK_TOOLBAR_CHILD_RADIOBUTTON = 3;
+ public static final int GTK_TOOLBAR_CHILD_WIDGET = 4;
+
+public static final native int GTK_WIDGET_FLAGS(int wid);
+public static final native void GTK_WIDGET_SET_FLAGS(int wid,int flag);
+public static final native void GTK_WIDGET_UNSET_FLAGS(int wid,int flag);
+public static final native boolean GTK_WIDGET_NO_WINDOW(int wid);
+public static final native void gdk_rgb_init();
+public static final native boolean GTK_WIDGET_SENSITIVE(int wid);
+public static final native boolean GTK_WIDGET_IS_SENSITIVE(int wid);
+public static final native void memmove(GtkStyleClass dest, int src, int size);
+public static final native void gtk_signal_handler_block_by_data(int object, int data);
+public static final native void gtk_signal_handler_unblock_by_data(int object, int data);
+public static final native int gtk_object_get_data_by_id(int object, int data_id);
+public static final native void gtk_object_set_data_by_id(int object, int data_id, int data);
+public static final native int g_quark_from_string(byte [] string);
+public static final native void gtk_object_unref(int object);
+public static final native void gtk_object_destroy(int object);
+public static final native int GTK_WIDGET_TYPE(int wid);
+public static final native int gtk_label_get_type();
+
+public static final native void g_free(int mem);
+public static final native int g_get_home_dir();
+public static final native int g_list_length(int list);
+public static final native int g_list_nth(int list, int n);
+public static final native int g_list_nth_data(int list, int n);
+public static final native void g_list_free(int list);
+public static final native int g_malloc(int size);
+public static final native int g_list_append(int list, int data);
+public static final native int g_slist_length(int list);
+public static final native int g_slist_nth(int list, int n);
+public static final native int g_slist_nth_data(int list, int n);
+public static final native int g_strdup(byte[] str);
+public static final native int gdk_colormap_get_system();
+public static final native void gdk_colors_free(int colormap, int[] pixels, int npixels, int planes);
+public static final native boolean gdk_color_alloc(int colormap, GdkColor color);
+public static final native int gdk_cursor_new(int cursor_type);
+public static final native int gdk_bitmap_create_from_data(int window, byte[] data, int width, int height);
+public static final native int gdk_cursor_new_from_pixmap(int source, int mask, GdkColor fg, GdkColor bg, int x, int y);
+public static final native void gdk_cursor_destroy(int cursor);
+public static final native int gdk_font_load(byte[] font_name);
+public static final native int gdk_font_ref(int font);
+public static final native void gdk_font_unref(int font);
+public static final native boolean gdk_font_equal(int fonta, int fontb);
+public static final native int gdk_char_width(int font, byte character);
+public static final native void gdk_gc_get_values(int gc, GdkGCValues values);
+public static final native void gdk_gc_set_font(int gc, int font);
+public static final native void gdk_gc_set_foreground(int gc, GdkColor color);
+public static final native void gdk_gc_set_background(int gc, GdkColor color);
+public static final native void gdk_gc_set_clip_mask(int gc, int mask);
+public static final native void gdk_gc_set_clip_rectangle(int gc, GdkRectangle rectangle);
+public static final native void gdk_gc_set_clip_region(int gc, int region);
+public static final native void gdk_gc_set_line_attributes(int gc, int line_width, int line_style, int cap_style, int join_style);
+public static final native void gdk_gc_set_dashes(int gc, int dash_offset, byte[] dash_list, int n);
+public static final native void gdk_gc_set_function(int gc, int function);
+public static final native void gdk_draw_line(int drawable, int gc, int x1, int y1, int x2, int y2);
+public static final native void gdk_draw_arc(int drawable, int gc, int filled, int x, int y, int width, int height, int angle1, int angle2);
+public static final native void gdk_draw_rectangle(int drawable, int gc, int filled, int x, int y, int width, int height);
+public static final native void gdk_draw_pixmap(int drawable, int gc, int src, int xsrc, int ysrc, int xdest, int ydest, int width, int height);
+public static final native void gdk_draw_lines(int drawable, int gc, short[] points, int npoints);
+public static final native void gdk_draw_polygon(int drawable, int gc, int filled, short[] points, int npoints);
+public static final native void gdk_draw_string(int drawable, int font, int gc, int x, int y, byte[] string);
+public static final native void gdk_gc_unref(int gc);
+public static final native int gdk_gc_new(int window);
+public static final native void gdk_gc_destroy(int gc);
+public static final native void gdk_bitmap_unref(int pixmap);
+public static final native boolean gdk_color_white(int colormap, GdkColor color);
+public static final native int gdk_image_get(int window, int x, int y, int width, int height);
+public static final native int gdk_image_get_pixel(int image, int x, int y);
+public static final native void gdk_gc_set_exposures(int gc, boolean exposures);
+public static final native int gdk_event_get_graphics_expose(int window);
+public static final native void gdk_event_free(int event);
+public static final native void gdk_flush();
+public static final native void gdk_beep();
+public static final native void gdk_color_free(GdkColor color);
+public static final native int GDK_ROOT_PARENT();
+public static final native void gdk_gc_set_stipple(int gc, int stipple);
+public static final native void gdk_gc_set_subwindow(int gc, int mode);
+public static final native void gdk_gc_set_fill(int gc, int fill);
+public static final native int gdk_atom_intern(byte[] atom_name, int only_if_exists);
+public static final native int gdk_event_get();
+public static final native void gdk_pixmap_unref(int pixmap);
+public static final native void gdk_region_get_clipbox(int region, GdkRectangle rectangle);
+public static final native int gdk_region_new();
+public static final native int gdk_region_union_with_rect(int region, GdkRectangle rect);
+public static final native int gdk_regions_subtract(int source1, int source2);
+public static final native int gdk_regions_union(int source1, int source2);
+public static final native void gdk_region_destroy(int region);
+public static final native int gdk_pixmap_new(int window, int width, int height, int depth);
+public static final native boolean gdk_region_point_in(int region, int x, int y);
+public static final native boolean gdk_region_empty(int region);
+public static final native boolean gdk_region_equal(int region1, int region2);
+public static final native int gdk_screen_height();
+public static final native int gdk_screen_width();
+public static final native int gdk_region_rect_in(int region, GdkRectangle rect);
+public static final native int gdk_visual_get_system();
+public static final native void gdk_string_extents(int font, byte[] string, int[] lbearing, int[] rbearing, int[] width, int[] ascent, int[] descent);
+public static final native int gdk_string_height(int font, byte[] string);
+public static final native int gdk_string_width(int font, byte[] string);
+public static final native void gdk_window_copy_area(int window, int gc, int x, int y, int source_window, int source_x, int source_y, int width, int height);
+public static final native void gdk_window_clear_area(int window, int x, int y, int width, int height);
+public static final native void gdk_window_clear_area_e(int window, int x, int y, int width, int height);
+public static final native int gdk_window_at_pointer(int[] win_x, int[] win_y);
+public static final native int gdk_time_get();
+public static final native int gdk_screen_width_mm();
+public static final native void gdk_window_get_geometry(int window, int[] x, int[] y, int[] width, int[] height, int[] depth);
+public static final native void gdk_window_raise(int window);
+public static final native void gdk_window_lower(int window);
+public static final native int gdk_window_get_origin(int window, int[] x, int[] y);
+public static final native int gdk_window_get_pointer(int window, int[] x, int[] y, int mask);
+public static final native void gdk_window_set_cursor(int window, int cursor);
+public static final native void gdk_window_set_icon(int window, int icon_window, int pixmap, int mask);
+public static final native void gdk_window_set_user_data(int window, int user_data);
+public static final native void gdk_window_get_user_data(int window, int[] data);
+public static final native void gdk_window_set_decorations(int window, int decorations);
+public static final native int gtk_adjustment_new(float value, float lower, float upper, float step_increment, float page_increment, float page_size);
+public static final native void gtk_adjustment_changed(int adjustment);
+public static final native void gtk_adjustment_set_value(int adjustment, float value);
+public static final native void gtk_adjustment_value_changed(int adjustment);
+public static final native int gtk_accel_group_new();
+public static final native void gtk_accel_group_unref(int accel_group);
+public static final native int gtk_arrow_new(int arrow_type, int shadow_type);
+public static final native void gtk_arrow_set(int arrow, int arrow_type, int shadow_type);
+public static final native void gtk_box_pack_start(int box, int child, boolean expand, boolean fill, int padding);
+public static final native void gtk_box_pack_end(int box, int child, boolean expand, boolean fill, int padding);
+public static final native int gtk_button_new();
+public static final native int gtk_check_button_new();
+public static final native int gtk_check_version(int required_major, int required_minor, int required_micro);
+public static final native int gtk_clist_append(int clist, int[] text);
+public static final native void gtk_clist_clear(int clist);
+public static final native int gtk_check_menu_item_new_with_label(byte[] label);
+public static final native int gtk_button_new_with_label(byte[] label);
+public static final native void gtk_clist_column_title_passive(int clist, int column);
+public static final native void gtk_clist_column_titles_show(int clist);
+public static final native void gtk_clist_column_titles_hide(int clist);
+public static final native void gtk_clist_freeze(int clist);
+public static final native void gtk_check_menu_item_set_show_toggle(int menu_item, boolean always);
+public static final native void gtk_clist_column_titles_passive(int clist);
+public static final native void gtk_check_menu_item_set_active(int check_menu_item, boolean is_active);
+public static final native int gtk_clist_insert(int clist, int row, int[] text);
+public static final native int gtk_clist_new(int columns);
+public static final native void gtk_clist_set_selection_mode(int clist, int mode);
+public static final native int gtk_clist_get_text(int clist, int row, int column, int[] text);
+public static final native void gtk_clist_remove(int clist, int row);
+public static final native void gtk_clist_select_row(int clist, int row, int column);
+public static final native void gtk_clist_select_all(int clist);
+public static final native void gtk_clist_moveto(int clist, int row, int column, float row_align, float col_align);
+public static final native void gtk_clist_set_column_title(int clist, int column, byte[] title);
+public static final native void gtk_clist_set_column_visibility(int clist, int column, boolean visible);
+public static final native int gtk_clist_get_selection_info(int clist, int x, int y, int[] row, int[] column);
+public static final native void gtk_clist_set_column_justification(int clist, int column, int justification);
+public static final native void gtk_clist_set_column_resizeable(int clist, int column, boolean resizeable);
+public static final native void gtk_clist_set_column_width(int clist, int column, int width);
+public static final native void gtk_clist_set_pixtext(int clist, int row, int column, byte[] text, byte spacing, int pixmap, int mask);
+public static final native void gtk_clist_set_pixmap(int clist, int row, int column, int pixmap, int mask);
+public static final native void gtk_container_add(int container, int widget);
+public static final native int gtk_container_children(int container);
+public static final native int gtk_color_selection_dialog_new(byte[] title);
+public static final native void gtk_color_selection_get_color(int colorsel, double[] color);
+public static final native void gtk_color_selection_set_color(int colorsel, double[] color);
+public static final native int gtk_combo_new();
+public static final native void gtk_combo_set_popdown_strings(int combo, int strings);
+public static final native void gtk_clist_set_shadow_type(int clist, int type);
+public static final native void gtk_clist_unselect_row(int clist, int row, int column);
+public static final native void gtk_clist_unselect_all(int clist);
+public static final native void gtk_clist_set_text(int clist, int row, int column, byte[] text);
+public static final native void gtk_clist_thaw(int clist);
+public static final native void gtk_container_remove(int container, int widget);
+public static final native int gtk_ctree_new(int columns, int tree_column);
+public static final native int gtk_ctree_insert_node(int ctree, int parent, int sibling, int[] text, byte spacing, int pixmap_closed, int mask_closed, int pixmap_opened, int mask_opened, boolean is_leaf, boolean expanded);
+public static final native int gtk_ctree_node_get_row_data(int ctree, int node);
+public static final native void gtk_ctree_expand(int ctree, int node);
+public static final native boolean gtk_ctree_is_hot_spot(int ctree, int x, int y);
+public static final native boolean gtk_ctree_is_viewable(int ctree, int node);
+public static final native int gtk_ctree_node_get_row_style(int ctree, int node);
+public static final native void gtk_ctree_collapse(int ctree, int node);
+public static final native int gtk_ctree_get_node_info(int ctree, int node, int[] text, byte[] spacing, int[] pixmap_closed, int[] mask_closed, int[] pixmap_opened, int[] mask_opened, boolean[] is_leaf, boolean[] expanded);
+public static final native void gtk_ctree_node_set_row_data(int ctree, int node, int data);
+public static final native void gtk_ctree_select(int ctree, int node);
+public static final native int gtk_ctree_node_nth(int ctree, int row);
+public static final native void gtk_ctree_select_recursive(int ctree, int node);
+public static final native void gtk_ctree_unselect_recursive(int ctree, int node);
+public static final native void gtk_ctree_post_recursive(int ctree, int node, int func, int data);
+public static final native void gtk_ctree_remove_node(int ctree, int node);
+public static final native int gtk_ctree_node_is_visible(int ctree, int node);
+public static final native void gtk_ctree_node_moveto(int ctree, int node, int column, float row_align, float col_align);
+public static final native void gtk_ctree_set_node_info(int ctree, int node, byte[] text, byte spacing, int pixmap_closed, int mask_closed, int pixmap_opened, int mask_opened, boolean is_leaf, boolean expanded);
+public static final native int gtk_drawing_area_new();
+public static final native int gtk_dialog_new();
+public static final native int gtk_event_box_new();
+public static final native int gtk_editable_get_position(int editable);
+public static final native void gtk_editable_set_position(int editable, int position);
+public static final native int gtk_fixed_new();
+public static final native void gtk_entry_set_editable(int entry, boolean editable);
+public static final native void gtk_fixed_put(int fixed, int widget, short x, short y);
+public static final native int gtk_entry_get_text(int entry);
+public static final native void gtk_entry_set_text(int entry, byte[] text);
+public static final native void gtk_editable_select_region(int editable, int start, int end);
+public static final native void gtk_editable_delete_text(int editable, int start_pos, int end_pos);
+public static final native void gtk_editable_insert_text(int editable, byte[] new_text, int new_text_length, int[] position);
+public static final native void gtk_drawing_area_size(int darea, int width, int height);
+public static final native int gtk_events_pending();
+public static final native int gtk_file_selection_get_filename(int filesel);
+public static final native int gtk_file_selection_new(byte[] title);
+public static final native void gtk_file_selection_set_filename(int filesel, byte[] filename);
+public static final native void gtk_file_selection_complete(int filesel, byte[] pattern);
+public static final native int gtk_font_selection_dialog_get_font_name(int fsd);
+public static final native int gtk_font_selection_dialog_new(byte[] title);
+public static final native boolean gtk_font_selection_dialog_set_font_name(int fsd, byte[] fontname);
+public static final native void gtk_editable_set_editable(int editable, boolean is_editable);
+public static final native boolean gtk_font_selection_set_font_name(int fontsel, byte[] fontname);
+public static final native int gtk_entry_new();
+public static final native void gtk_entry_append_text(int entry, byte[] text);
+public static final native void gtk_editable_delete_selection(int editable);
+public static final native int gtk_editable_get_chars(int editable, int start_pos, int end_pos);
+public static final native void gtk_entry_set_visibility(int entry, boolean visible);
+public static final native void gtk_entry_set_max_length(int entry, short max);
+public static final native void gtk_fixed_move(int fixed, int widget, short x, short y);
+public static final native boolean gtk_init_check(int[] argc, int[] argv);
+public static final native int gtk_frame_new(byte[] label);
+public static final native void gtk_frame_set_shadow_type(int frame, int type);
+public static final native void gtk_frame_set_label(int frame, byte[] label);
+public static final native int gtk_hseparator_new();
+public static final native int gtk_hbox_new(boolean homogeneous, int spacing);
+public static final native void gtk_grab_add(int widget);
+public static final native int gtk_grab_get_current();
+public static final native void gtk_grab_remove(int widget);
+public static final native int gtk_hscale_new(int adjustment);
+public static final native int gtk_hscrollbar_new(int adjustment);
+public static final native void gtk_label_set_justify(int label, int jtype);
+public static final native int gtk_label_new(byte[] str);
+public static final native void gtk_label_set_pattern(int label, byte[] pattern);
+public static final native void gtk_main_quit();
+public static final native void gtk_main();
+public static final native void gtk_list_clear_items(int list, int start, int end);
+public static final native void gtk_list_select_item(int list, int item);
+public static final native int gtk_main_iteration();
+public static final native void gtk_label_set_line_wrap(int label, boolean wrap);
+public static final native int gtk_label_parse_uline(int label, byte[] string);
+public static final native void gtk_label_set_text(int label, byte[] str);
+public static final native void gtk_misc_set_alignment(int misc, float xalign, float yalign);
+public static final native int gtk_menu_bar_new();
+public static final native int gtk_menu_new();
+public static final native void gtk_menu_popdown(int menu);
+public static final native void gtk_menu_popup(int menu, int parent_menu_shell, int parent_menu_item, int func, int data, int button, int activate_time);
+public static final native int gtk_menu_item_new();
+public static final native int gtk_menu_item_new_with_label(byte[] label);
+public static final native void gtk_menu_bar_insert(int menu_bar, int child, int position);
+public static final native void gtk_menu_insert(int menu, int child, int position);
+public static final native void gtk_menu_item_set_submenu(int menu_item, int submenu);
+public static final native void gtk_menu_item_remove_submenu(int menu_item);
+public static final native int gtk_notebook_new();
+public static final native void gtk_notebook_append_page(int notebook, int child, int tab_label);
+public static final native int gtk_notebook_get_current_page(int notebook);
+public static final native void gtk_object_ref(int object);
+public static final native void gtk_notebook_set_show_tabs(int notebook, boolean show_tabs);
+public static final native void gtk_notebook_remove_page(int notebook, int page_num);
+public static final native void gtk_notebook_set_page(int notebook, int page_num);
+public static final native void gtk_object_set_user_data(int object, int data);
+public static final native int gtk_object_get_user_data(int object);
+public static final native int gtk_pixmap_new(int pixmap, int mask);
+public static final native int gtk_progress_bar_new();
+public static final native void gtk_progress_bar_set_orientation(int pbar, int orientation);
+public static final native void gtk_progress_bar_set_bar_style(int pbar, int style);
+public static final native void gtk_progress_configure(int progress, float value, float min, float max);
+public static final native void gtk_pixmap_set(int pixmap, int val, int mask);
+public static final native int gtk_radio_button_new(int group);
+public static final native int gtk_radio_button_group(int radio_button);
+public static final native int gtk_radio_menu_item_new_with_label(int group, byte[] label);
+public static final native int gtk_range_get_adjustment(int range);
+public static final native int gtk_scrolled_window_new(int hadjustment, int vadjustment);
+public static final native void gtk_scale_set_digits(int scale, int digits);
+public static final native void gtk_scale_set_draw_value(int scale, boolean draw_value);
+public static final native void gtk_scale_set_value_pos(int scale, int pos);
+public static final native int gtk_scrolled_window_get_hadjustment(int scrolled_window);
+public static final native void gtk_scrolled_window_set_policy(int scrolled_window, int hscrollbar_policy, int vscrollbar_policy);
+public static final native int gtk_scrolled_window_get_vadjustment(int scrolled_window);
+public static final native int gtk_selection_convert(int widget, int selection, int target, int time);
+public static final native int gtk_signal_connect(int object, byte[] name, int func, int func_data);
+public static final native int gtk_selection_owner_set(int widget, int selection, int time);
+public static final native void gtk_signal_emit_stop_by_name(int object, byte[] name);
+public static final native void gtk_signal_handler_block_by_func(int object, int func, int data);
+public static final native void gtk_signal_handler_unblock_by_func(int object, int func, int data);
+public static final native int gtk_signal_connect_after(int object, byte[] name, int func, int func_data);
+public static final native int gtk_style_copy(int style);
+public static final native void gtk_style_unref(int style);
+public static final native int gtk_toggle_button_new();
+public static final native void gtk_toggle_button_set_active(int toggle_button, boolean is_active);
+public static final native boolean gtk_toggle_button_get_active(int toggle_button);
+public static final native int gtk_timeout_add(int interval, int function, int data);
+public static final native void gtk_timeout_remove(int timeout_handler_id);
+public static final native int gtk_text_new(int hadj, int vadj);
+public static final native void gtk_text_set_word_wrap(int text, int word_wrap);
+public static final native int gtk_text_get_length(int text);
+public static final native int gtk_toolbar_new(int orientation, int style);
+public static final native void gtk_toolbar_set_button_relief(int toolbar, int relief);
+public static final native void gtk_toolbar_insert_widget(int toolbar, int widget, byte[] tooltip_text, byte[] tooltip_private_text, int position);
+public static final native void gtk_toolbar_set_orientation(int toolbar, int orientation);
+public static final native int gtk_toolbar_insert_element(int toolbar, int type, int widget, byte[] text, byte[] tooltip_text, byte[] tooltip_private_text, int icon, int callback, int user_data, int position);
+public static final native int gtk_tooltips_new();
+public static final native int gtk_vseparator_new();
+public static final native int gtk_vbox_new(boolean homogeneous, int spacing);
+public static final native int gtk_vscale_new(int adjustment);
+public static final native int gtk_vscrollbar_new(int adjustment);
+public static final native void gtk_tooltips_set_tip(int tooltips, int widget, byte[] tip_text, byte[] tip_private);
+public static final native int gtk_widget_get_default_style();
+public static final native void gtk_widget_add_events(int widget, int events);
+public static final native void gtk_widget_destroy(int widget);
+public static final native int gtk_widget_event(int widget, int event);
+public static final native void gtk_widget_hide(int widget);
+public static final native void gtk_widget_grab_focus(int widget);
+public static final native int gtk_widget_get_style(int widget);
+public static final native void gtk_widget_add_accelerator(int widget, byte[] accel_signal, int accel_group, int accel_key, int accel_mods, int accel_flags);
+public static final native void gtk_widget_ensure_style(int widget);
+public static final native void gtk_widget_show(int widget);
+public static final native void gtk_widget_realize(int widget);
+static int malloc(String name) {
+ int length = name.length();
+ char [] unicode = new char [length];
+ name.getChars (0, length, unicode, 0);
+ byte[] buffer = new byte [length + 1];
+ for (int i = 0; i < length; i++) {
+ buffer[i] = (byte) unicode[i];
+ }
+ return OS.g_strdup (buffer);
+}
+public static final native void gtk_widget_show_now(int widget);
+public static final native void gtk_widget_queue_draw(int widget);
+public static final native void gtk_widget_set_style(int widget, int style);
+public static final native void gtk_widget_set_sensitive(int widget, boolean sensitive);
+public static final native void gtk_widget_set_state(int widget, int state);
+public static final native int gtk_window_new(int type);
+public static final native void gtk_widget_size_request(int widget, GtkRequisition requisition);
+public static final native void gtk_widget_set_uposition(int widget, int x, int y);
+public static final native void gtk_widget_set_usize(int widget, int width, int height);
+public static final native void gtk_widget_remove_accelerator(int widget, int accel_group, int accel_key, int accel_mods);
+public static final native void gtk_widget_set_parent(int widget, int parent);
+public static final native void gtk_window_add_accel_group(int window, int accel_group);
+public static final native void gtk_window_set_policy(int window, int allow_shrink, int allow_grow, int auto_shrink);
+public static final native void gtk_window_set_title(int window, byte[] title);
+public static final native void gtk_widget_reparent(int widget, int new_parent);
+public static final native void gtk_widget_size_allocate(int widget, GtkAllocation allocation);
+public static final native int XListFonts(byte[] pattern, int maxFonts, int[] pnum_fonts);
+public static final native void memmove(int[] dest, int src, int size);
+public static final native int strlen (int str);
+
+/* NEW MEMMOVES - doesn't work because of inheritance of natives */
+public static final native void memmove(byte[] dest, int src, int size);
+public static final native void memmove(int dest, GtkStyle src, int size);
+public static final native void memmove(GdkFont dest, int src, int size);
+public static final native void memmove(GtkStyle dest, int src, int size);
+public static final native void memmove(int[] dest, byte[] src, int size);
+public static final native void memmove(int dest, byte[] src, int size);
+public static final native void memmove(GdkColor dest, int src, int size);
+public static final native void memmove(GdkEventButton dest, int src, int size);
+public static final native void memmove(GdkEventExpose dest, int src, int size);
+public static final native void memmove(GdkEventKey dest, int src, int size);
+public static final native void memmove(GdkEventMotion dest, int src, int size);
+public static final native void memmove(int dest, int[] src, int size);
+public static final native void memmove(GdkVisual dest, int src, int size);
+public static final native void memmove(GtkAdjustment dest, int src, int size);
+public static final native void memmove(GtkBin dest, int src, int size);
+public static final native void memmove(GtkCList dest, int src, int size);
+public static final native void memmove(GtkCombo dest, int src, int size);
+public static final native void memmove(GtkContainer dest, int src, int size);
+public static final native void memmove(GtkCTreeRow dest, int src, int size);
+public static final native void memmove(GtkEditable dest, int src, int size);
+public static final native void memmove(GtkObject dest, int src, int size);
+public static final native void memmove(GtkWidget dest, int src, int size);
+public static final native void memmove(int dest, GtkAdjustment src, int size);
+public static final native void memmove(int dest, GtkBin src, int size);
+public static final native void memmove(int dest, GtkCListColumn src, int size);
+public static final native void memmove(GtkCListRow dest, int src, int size);
+public static final native void memmove(GtkCListColumn dest, int src, int size);
+public static final native void memmove(int dest, GtkEditable src, int size);
+public static final native void memmove(int dest, GtkText src, int size);
+public static final native void memmove(int dest, GtkObject src, int size);
+
+/* OLD MEMMOVES - these need to be pruned */
+public static final native void memmove(int dest, GdkColor src, int size);
+public static final native void memmove(int dest, GdkEventButton src, int size);
+public static final native void memmove(int dest, GdkEventExpose src, int size);
+public static final native void memmove(int dest, GdkEventKey src, int size);
+public static final native void memmove(int dest, GdkEventMotion src, int size);
+public static final native void memmove(int dest, GdkGCValues src, int size);
+public static final native void memmove(int dest, GdkRectangle src, int size);
+public static final native void memmove(int dest, GdkVisual src, int size);
+public static final native void memmove(int dest, GtkAllocation src, int size);
+//public static final native void memmove(int dest, GtkArg src, int size);
+public static final native void memmove(int dest, GtkBox src, int size);
+public static final native void memmove(int dest, GtkCList src, int size);
+public static final native void memmove(int dest, GtkCListRow src, int size);
+public static final native void memmove(int dest, GtkCTreeRow src, int size);
+public static final native void memmove(int dest, GtkCheckMenuItem src, int size);
+public static final native void memmove(int dest, GtkColorSelectionDialog src, int size);
+public static final native void memmove(int dest, GtkCombo src, int size);
+public static final native void memmove(int dest, GtkContainer src, int size);
+//public static final native void memmove(int dest, GtkData src, int size);
+public static final native void memmove(int dest, GtkFileSelection src, int size);
+public static final native void memmove(int dest, GtkFontSelectionDialog src, int size);
+public static final native void memmove(int dest, GtkHBox src, int size);
+public static final native void memmove(int dest, GtkMenuItem src, int size);
+public static final native void memmove(int dest, GtkRequisition src, int size);
+public static final native void memmove(int dest, GtkWidget src, int size);
+public static final native void memmove(int dest, GtkWindow src, int size);
+public static final native void memmove(int dest, GtkCTree src, int size);
+public static final native void memmove(GdkGCValues dest, int src, int size);
+public static final native void memmove(GdkRectangle dest, int src, int size);
+public static final native void memmove(GtkAllocation dest, int src, int size);
+//public static final native void memmove(GtkArg dest, int src, int size);
+public static final native void memmove(GtkBox dest, int src, int size);
+public static final native void memmove(GtkCheckMenuItem dest, int src, int size);
+public static final native void memmove(GtkColorSelectionDialog dest, int src, int size);
+//public static final native void memmove(GtkData dest, int src, int size);
+public static final native void memmove(GtkFrame dest, int src, int size);
+public static final native void memmove(GtkFileSelection dest, int src, int size);
+public static final native void memmove(GtkFontSelectionDialog dest, int src, int size);
+public static final native void memmove(GtkHBox dest, int src, int size);
+public static final native void memmove(GtkMenuItem dest, int src, int size);
+public static final native void memmove(GtkRequisition dest, int src, int size);
+public static final native void memmove(GtkText dest, int src, int size);
+public static final native void memmove(GtkWindow dest, int src, int size);
+public static final native void memmove(GtkCTree dest, int src, int size);
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/PrintDialog.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/PrintDialog.java
new file mode 100644
index 0000000..c742f29
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/PrintDialog.java
@@ -0,0 +1,193 @@
+package org.eclipse.swt.printing;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ * Instances of this class allow the user to select
+ * a printer and various print-related parameters
+ * prior to starting a print job.
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+public class PrintDialog extends Dialog {
+ int scope = PrinterData.ALL_PAGES;
+ int startPage = -1, endPage = -1;
+ boolean printToFile = false;
+
+/**
+ * Constructs a new instance of this class given only its parent.
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public PrintDialog (Shell parent) {
+ this (parent, SWT.PRIMARY_MODAL);
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public PrintDialog (Shell parent, int style) {
+ super (parent, style);
+}
+/**
+ * Makes the receiver visible and brings it to the front
+ * of the display.
+ *
+ * @return a printer data object describing the desired print job parameters
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public PrinterData open() {
+ /* Return the first printer in the list */
+ PrinterData[] printers = Printer.getPrinterList();
+ if (printers.length > 0) return printers[0];
+ return null;
+}
+/**
+ * Returns the print job scope that the user selected
+ * before pressing OK in the dialog. This will be one
+ * of the following values:
+ * <dl>
+ * <dt><code>ALL_PAGES</code></dt>
+ * <dd>Print all pages in the current document</dd>
+ * <dt><code>PAGE_RANGE</code></dt>
+ * <dd>Print the range of pages specified by startPage and endPage</dd>
+ * <dt><code>SELECTION</code></dt>
+ * <dd>Print the current selection</dd>
+ * </dl>
+ *
+ * @return the scope setting that the user selected
+ */
+public int getScope() {
+ return scope;
+}
+/**
+ * Sets the scope of the print job. The user will see this
+ * setting when the dialog is opened. This can have one of
+ * the following values:
+ * <dl>
+ * <dt><code>ALL_PAGES</code></dt>
+ * <dd>Print all pages in the current document</dd>
+ * <dt><code>PAGE_RANGE</code></dt>
+ * <dd>Print the range of pages specified by startPage and endPage</dd>
+ * <dt><code>SELECTION</code></dt>
+ * <dd>Print the current selection</dd>
+ * </dl>
+ *
+ * @param int the scope setting when the dialog is opened
+ */
+public void setScope(int scope) {
+ this.scope = scope;
+}
+/**
+ * Returns the start page setting that the user selected
+ * before pressing OK in the dialog.
+ * <p>
+ * Note that this value is only valid if the scope is <code>PAGE_RANGE</code>.
+ * </p>
+ *
+ * @return the start page setting that the user selected
+ */
+public int getStartPage() {
+ return startPage;
+}
+/**
+ * Sets the start page that the user will see when the dialog
+ * is opened.
+ *
+ * @param int the startPage setting when the dialog is opened
+ */
+public void setStartPage(int startPage) {
+ this.startPage = startPage;
+}
+/**
+ * Returns the end page setting that the user selected
+ * before pressing OK in the dialog.
+ * <p>
+ * Note that this value is only valid if the scope is <code>PAGE_RANGE</code>.
+ * </p>
+ *
+ * @return the end page setting that the user selected
+ */
+public int getEndPage() {
+ return endPage;
+}
+/**
+ * Sets the end page that the user will see when the dialog
+ * is opened.
+ *
+ * @param int the end page setting when the dialog is opened
+ */
+public void setEndPage(int endPage) {
+ this.endPage = endPage;
+}
+/**
+ * Returns the 'Print to file' setting that the user selected
+ * before pressing OK in the dialog.
+ *
+ * @return the 'Print to file' setting that the user selected
+ */
+public boolean getPrintToFile() {
+ return printToFile;
+}
+/**
+ * Sets the 'Print to file' setting that the user will see
+ * when the dialog is opened.
+ *
+ * @param boolean the 'Print to file' setting when the dialog is opened
+ */
+public void setPrintToFile(boolean printToFile) {
+ this.printToFile = printToFile;
+}
+protected void checkSubclass() {
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/Printer.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/Printer.java
new file mode 100644
index 0000000..e203c1a
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing/Printer.java
@@ -0,0 +1,308 @@
+package org.eclipse.swt.printing;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ * Instances of this class are used to print to a printer.
+ * Applications create a GC on a printer using <code>new GC(printer)</code>
+ * and then draw on the printer GC using the usual graphics calls.
+ * <p>
+ * A <code>Printer</code> object may be constructed by providing
+ * a <code>PrinterData</code> object which identifies the printer.
+ * A <code>PrintDialog</code> presents a print dialog to the user
+ * and returns an initialized instance of <code>PrinterData</code>.
+ * Alternatively, calling <code>new Printer()</code> will construct a
+ * printer object for the user's default printer.
+ * </p><p>
+ * Application code must explicitly invoke the <code>Printer.dispose()</code>
+ * method to release the operating system resources managed by each instance
+ * when those instances are no longer required.
+ * </p>
+ *
+ * @see PrinterData
+ * @see PrintDialog
+ */
+public final class Printer extends Device {
+ PrinterData data;
+ int printContext, xScreen, xDrawable;
+ int defaultFontList;
+
+/**
+ * Returns an array of <code>PrinterData</code> objects
+ * representing all available printers.
+ *
+ * @return the list of available printers
+ */
+public static PrinterData[] getPrinterList() {
+ PrinterData printerList[] = new PrinterData[0];
+ return printerList;
+}
+
+static PrinterData getDefaultPrinterData() {
+ /* Use the first printer in the list as the default */
+ PrinterData[] list = getPrinterList();
+ if (list.length == 0) {
+ /* no printers */
+ SWT.error(SWT.ERROR_NO_HANDLES);
+ }
+ return list[0];
+}
+
+/**
+ * Constructs a new printer representing the default printer.
+ * <p>
+ * You must dispose the printer when it is no longer required.
+ * </p>
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_UNSPECIFIED - if there are no valid printers
+ * </ul>
+ *
+ * @see #dispose
+ */
+public Printer() {
+ this(getDefaultPrinterData());
+}
+
+/**
+ * Constructs a new printer given a <code>PrinterData</code>
+ * object representing the desired printer.
+ * <p>
+ * You must dispose the printer when it is no longer required.
+ * </p>
+ *
+ * @param data the printer data for the specified printer
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the specified printer data does not represent a valid printer
+ * <li>ERROR_UNSPECIFIED - if there are no valid printers
+ * </ul>
+ *
+ * @see #dispose
+ */
+public Printer(PrinterData data) {
+ super(data);
+}
+
+
+/**
+ * Invokes platform specific functionality to allocate a new GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Printer</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param data the platform specific GC data
+ * @return the platform specific GC handle
+ *
+ * @private
+ */
+public int internal_new_GC(GCData data) {
+ return 0;
+}
+
+/**
+ * Invokes platform specific functionality to dispose a GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Printer</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param handle the platform specific GC handle
+ * @param data the platform specific GC data
+ *
+ * @private
+ */
+public void internal_dispose_GC(int xGC, GCData data) {
+}
+
+/**
+ * Starts a print job and returns true if the job started successfully
+ * and false otherwise.
+ * <p>
+ * This must be the first method called to initiate a print job,
+ * followed by any number of startPage/endPage calls, followed by
+ * endJob. Calling startPage, endPage, or endJob before startJob
+ * will result in undefined behavior.
+ * </p>
+ *
+ * @return true if the job started successfully and false otherwise.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #startPage
+ * @see #endPage
+ * @see #endJob
+ */
+public boolean startJob(String jobName) {
+ return true;
+}
+
+/**
+ * Ends the current print job.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #startJob
+ * @see #startPage
+ * @see #endPage
+ */
+public void endJob() {
+}
+
+/**
+ * Cancels a print job in progress.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void cancelJob() {
+}
+
+/**
+ * Starts a page and returns true if the page started successfully
+ * and false otherwise.
+ * <p>
+ * After calling startJob, this method may be called any number of times
+ * along with a matching endPage.
+ * </p>
+ *
+ * @return true if the page started successfully and false otherwise.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #endPage
+ * @see #startJob
+ * @see #endJob
+ */
+public boolean startPage() {
+ return true;
+}
+
+/**
+ * Ends the current page.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #startPage
+ * @see #startJob
+ * @see #endJob
+ */
+public void endPage() {
+}
+
+/**
+ * Returns a point whose x coordinate is the horizontal
+ * dots per inch of the printer, and whose y coordinate
+ * is the vertical dots per inch of the printer.
+ *
+ * @return the horizontal and vertical DPI
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Point getDPI() {
+ return new Point(0, 0);
+}
+
+/**
+ * Returns a rectangle describing the receiver's size and location.
+ * For a printer, this is the size of a page, in pixels.
+ *
+ * @return the bounding rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #getClientArea
+ * @see #computeTrim
+ */
+public Rectangle getBounds() {
+ return null;
+}
+
+/**
+ * Returns a rectangle which describes the area of the
+ * receiver which is capable of displaying data.
+ * For a printer, this is the size of the printable area
+ * of a page, in pixels.
+ *
+ * @return the client area
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #getBounds
+ * @see #computeTrim
+ */
+public Rectangle getClientArea() {
+ return null;
+}
+
+/**
+ * Given a desired <em>client area</em> for the receiver
+ * (as described by the arguments), returns the bounding
+ * rectangle which would be required to produce that client
+ * area.
+ * <p>
+ * In other words, it returns a rectangle such that, if the
+ * receiver's bounds were set to that rectangle, the area
+ * of the receiver which is capable of displaying data
+ * (that is, not covered by the "trimmings") would be the
+ * rectangle described by the arguments (relative to the
+ * receiver's parent).
+ * </p>
+ * Note that there is no setBounds for a printer. This method
+ * is usually used by passing in the client area (the 'printable
+ * area') of the printer. It can also be useful to pass in 0, 0, 0, 0.
+ *
+ * @return the required bounds to produce the given client area
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #getBounds
+ * @see #getClientArea
+ */
+public Rectangle computeTrim(int x, int y, int width, int height) {
+ return new Rectangle(0,0,0,0);
+}
+
+/**
+ * Returns a <code>PrinterData</code> object representing the
+ * target printer for this print job.
+ *
+ * @return a PrinterData object describing the receiver
+ */
+public PrinterData getPrinterData() {
+ return data;
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk1x/org/eclipse/swt/printing/PrintDialog.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk1x/org/eclipse/swt/printing/PrintDialog.java
new file mode 100644
index 0000000..c742f29
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk1x/org/eclipse/swt/printing/PrintDialog.java
@@ -0,0 +1,193 @@
+package org.eclipse.swt.printing;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ * Instances of this class allow the user to select
+ * a printer and various print-related parameters
+ * prior to starting a print job.
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+public class PrintDialog extends Dialog {
+ int scope = PrinterData.ALL_PAGES;
+ int startPage = -1, endPage = -1;
+ boolean printToFile = false;
+
+/**
+ * Constructs a new instance of this class given only its parent.
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public PrintDialog (Shell parent) {
+ this (parent, SWT.PRIMARY_MODAL);
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public PrintDialog (Shell parent, int style) {
+ super (parent, style);
+}
+/**
+ * Makes the receiver visible and brings it to the front
+ * of the display.
+ *
+ * @return a printer data object describing the desired print job parameters
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public PrinterData open() {
+ /* Return the first printer in the list */
+ PrinterData[] printers = Printer.getPrinterList();
+ if (printers.length > 0) return printers[0];
+ return null;
+}
+/**
+ * Returns the print job scope that the user selected
+ * before pressing OK in the dialog. This will be one
+ * of the following values:
+ * <dl>
+ * <dt><code>ALL_PAGES</code></dt>
+ * <dd>Print all pages in the current document</dd>
+ * <dt><code>PAGE_RANGE</code></dt>
+ * <dd>Print the range of pages specified by startPage and endPage</dd>
+ * <dt><code>SELECTION</code></dt>
+ * <dd>Print the current selection</dd>
+ * </dl>
+ *
+ * @return the scope setting that the user selected
+ */
+public int getScope() {
+ return scope;
+}
+/**
+ * Sets the scope of the print job. The user will see this
+ * setting when the dialog is opened. This can have one of
+ * the following values:
+ * <dl>
+ * <dt><code>ALL_PAGES</code></dt>
+ * <dd>Print all pages in the current document</dd>
+ * <dt><code>PAGE_RANGE</code></dt>
+ * <dd>Print the range of pages specified by startPage and endPage</dd>
+ * <dt><code>SELECTION</code></dt>
+ * <dd>Print the current selection</dd>
+ * </dl>
+ *
+ * @param int the scope setting when the dialog is opened
+ */
+public void setScope(int scope) {
+ this.scope = scope;
+}
+/**
+ * Returns the start page setting that the user selected
+ * before pressing OK in the dialog.
+ * <p>
+ * Note that this value is only valid if the scope is <code>PAGE_RANGE</code>.
+ * </p>
+ *
+ * @return the start page setting that the user selected
+ */
+public int getStartPage() {
+ return startPage;
+}
+/**
+ * Sets the start page that the user will see when the dialog
+ * is opened.
+ *
+ * @param int the startPage setting when the dialog is opened
+ */
+public void setStartPage(int startPage) {
+ this.startPage = startPage;
+}
+/**
+ * Returns the end page setting that the user selected
+ * before pressing OK in the dialog.
+ * <p>
+ * Note that this value is only valid if the scope is <code>PAGE_RANGE</code>.
+ * </p>
+ *
+ * @return the end page setting that the user selected
+ */
+public int getEndPage() {
+ return endPage;
+}
+/**
+ * Sets the end page that the user will see when the dialog
+ * is opened.
+ *
+ * @param int the end page setting when the dialog is opened
+ */
+public void setEndPage(int endPage) {
+ this.endPage = endPage;
+}
+/**
+ * Returns the 'Print to file' setting that the user selected
+ * before pressing OK in the dialog.
+ *
+ * @return the 'Print to file' setting that the user selected
+ */
+public boolean getPrintToFile() {
+ return printToFile;
+}
+/**
+ * Sets the 'Print to file' setting that the user will see
+ * when the dialog is opened.
+ *
+ * @param boolean the 'Print to file' setting when the dialog is opened
+ */
+public void setPrintToFile(boolean printToFile) {
+ this.printToFile = printToFile;
+}
+protected void checkSubclass() {
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk1x/org/eclipse/swt/printing/Printer.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk1x/org/eclipse/swt/printing/Printer.java
new file mode 100644
index 0000000..e203c1a
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/gtk1x/org/eclipse/swt/printing/Printer.java
@@ -0,0 +1,308 @@
+package org.eclipse.swt.printing;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ * Instances of this class are used to print to a printer.
+ * Applications create a GC on a printer using <code>new GC(printer)</code>
+ * and then draw on the printer GC using the usual graphics calls.
+ * <p>
+ * A <code>Printer</code> object may be constructed by providing
+ * a <code>PrinterData</code> object which identifies the printer.
+ * A <code>PrintDialog</code> presents a print dialog to the user
+ * and returns an initialized instance of <code>PrinterData</code>.
+ * Alternatively, calling <code>new Printer()</code> will construct a
+ * printer object for the user's default printer.
+ * </p><p>
+ * Application code must explicitly invoke the <code>Printer.dispose()</code>
+ * method to release the operating system resources managed by each instance
+ * when those instances are no longer required.
+ * </p>
+ *
+ * @see PrinterData
+ * @see PrintDialog
+ */
+public final class Printer extends Device {
+ PrinterData data;
+ int printContext, xScreen, xDrawable;
+ int defaultFontList;
+
+/**
+ * Returns an array of <code>PrinterData</code> objects
+ * representing all available printers.
+ *
+ * @return the list of available printers
+ */
+public static PrinterData[] getPrinterList() {
+ PrinterData printerList[] = new PrinterData[0];
+ return printerList;
+}
+
+static PrinterData getDefaultPrinterData() {
+ /* Use the first printer in the list as the default */
+ PrinterData[] list = getPrinterList();
+ if (list.length == 0) {
+ /* no printers */
+ SWT.error(SWT.ERROR_NO_HANDLES);
+ }
+ return list[0];
+}
+
+/**
+ * Constructs a new printer representing the default printer.
+ * <p>
+ * You must dispose the printer when it is no longer required.
+ * </p>
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_UNSPECIFIED - if there are no valid printers
+ * </ul>
+ *
+ * @see #dispose
+ */
+public Printer() {
+ this(getDefaultPrinterData());
+}
+
+/**
+ * Constructs a new printer given a <code>PrinterData</code>
+ * object representing the desired printer.
+ * <p>
+ * You must dispose the printer when it is no longer required.
+ * </p>
+ *
+ * @param data the printer data for the specified printer
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the specified printer data does not represent a valid printer
+ * <li>ERROR_UNSPECIFIED - if there are no valid printers
+ * </ul>
+ *
+ * @see #dispose
+ */
+public Printer(PrinterData data) {
+ super(data);
+}
+
+
+/**
+ * Invokes platform specific functionality to allocate a new GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Printer</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param data the platform specific GC data
+ * @return the platform specific GC handle
+ *
+ * @private
+ */
+public int internal_new_GC(GCData data) {
+ return 0;
+}
+
+/**
+ * Invokes platform specific functionality to dispose a GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Printer</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param handle the platform specific GC handle
+ * @param data the platform specific GC data
+ *
+ * @private
+ */
+public void internal_dispose_GC(int xGC, GCData data) {
+}
+
+/**
+ * Starts a print job and returns true if the job started successfully
+ * and false otherwise.
+ * <p>
+ * This must be the first method called to initiate a print job,
+ * followed by any number of startPage/endPage calls, followed by
+ * endJob. Calling startPage, endPage, or endJob before startJob
+ * will result in undefined behavior.
+ * </p>
+ *
+ * @return true if the job started successfully and false otherwise.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #startPage
+ * @see #endPage
+ * @see #endJob
+ */
+public boolean startJob(String jobName) {
+ return true;
+}
+
+/**
+ * Ends the current print job.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #startJob
+ * @see #startPage
+ * @see #endPage
+ */
+public void endJob() {
+}
+
+/**
+ * Cancels a print job in progress.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void cancelJob() {
+}
+
+/**
+ * Starts a page and returns true if the page started successfully
+ * and false otherwise.
+ * <p>
+ * After calling startJob, this method may be called any number of times
+ * along with a matching endPage.
+ * </p>
+ *
+ * @return true if the page started successfully and false otherwise.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #endPage
+ * @see #startJob
+ * @see #endJob
+ */
+public boolean startPage() {
+ return true;
+}
+
+/**
+ * Ends the current page.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #startPage
+ * @see #startJob
+ * @see #endJob
+ */
+public void endPage() {
+}
+
+/**
+ * Returns a point whose x coordinate is the horizontal
+ * dots per inch of the printer, and whose y coordinate
+ * is the vertical dots per inch of the printer.
+ *
+ * @return the horizontal and vertical DPI
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Point getDPI() {
+ return new Point(0, 0);
+}
+
+/**
+ * Returns a rectangle describing the receiver's size and location.
+ * For a printer, this is the size of a page, in pixels.
+ *
+ * @return the bounding rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #getClientArea
+ * @see #computeTrim
+ */
+public Rectangle getBounds() {
+ return null;
+}
+
+/**
+ * Returns a rectangle which describes the area of the
+ * receiver which is capable of displaying data.
+ * For a printer, this is the size of the printable area
+ * of a page, in pixels.
+ *
+ * @return the client area
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #getBounds
+ * @see #computeTrim
+ */
+public Rectangle getClientArea() {
+ return null;
+}
+
+/**
+ * Given a desired <em>client area</em> for the receiver
+ * (as described by the arguments), returns the bounding
+ * rectangle which would be required to produce that client
+ * area.
+ * <p>
+ * In other words, it returns a rectangle such that, if the
+ * receiver's bounds were set to that rectangle, the area
+ * of the receiver which is capable of displaying data
+ * (that is, not covered by the "trimmings") would be the
+ * rectangle described by the arguments (relative to the
+ * receiver's parent).
+ * </p>
+ * Note that there is no setBounds for a printer. This method
+ * is usually used by passing in the client area (the 'printable
+ * area') of the printer. It can also be useful to pass in 0, 0, 0, 0.
+ *
+ * @return the required bounds to produce the given client area
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #getBounds
+ * @see #getClientArea
+ */
+public Rectangle computeTrim(int x, int y, int width, int height) {
+ return new Rectangle(0,0,0,0);
+}
+
+/**
+ * Returns a <code>PrinterData</code> object representing the
+ * target printer for this print job.
+ *
+ * @return a PrinterData object describing the receiver
+ */
+public PrinterData getPrinterData() {
+ return data;
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java
new file mode 100644
index 0000000..04cf611
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java
@@ -0,0 +1,145 @@
+package org.eclipse.swt.program;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.graphics.*;
+
+import java.io.IOException;
+
+/**
+ * Instances of this class represent programs and
+ * their assoicated file extensions in the operating
+ * system.
+ */
+public final class Program {
+ String name = "", extension = "", command = "";
+
+/**
+ * Finds the program that is associated with an extension.
+ * The extension may or may not begin with a '.'.
+ *
+ * @param extension the program extension
+ * @return the program or nil
+ *
+ * @exception SWTError <ul>
+ * <li>ERROR_NULL_ARGUMENT when extension is null</li>
+ * </ul>
+ */
+public static Program findProgram (String extension) {
+ if (extension == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ if (extension.length () == 0) return null;
+ return null;
+}
+
+/**
+ * Answer all program extensions in the operating system.
+ *
+ * @return an array of extensions
+ */
+public static String [] getExtensions () {
+ return new String [0];
+}
+
+/**
+ * Answers all available programs in the operating system.
+ *
+ * @return an array of programs
+ */
+public static Program [] getPrograms () {
+ return new Program [0];
+}
+
+/**
+ * Launches the executable associated with the file in
+ * the operating system. If the file is an executable,
+ * then the executable is launched.
+ *
+ * @param fileName the file or program name
+ * @return <code>true</code> if the file is launched, otherwise <code>false</code>
+ *
+ * @exception SWTError <ul>
+ * <li>ERROR_NULL_ARGUMENT when fileName is null</li>
+ * </ul>
+ */
+public static boolean launch (String fileName) {
+ if (fileName == null) SWT.error( SWT.ERROR_NULL_ARGUMENT );
+
+ return false;
+}
+
+/**
+ * Executes the program with the file as the single argument
+ * in the operating system. It is the responsibility of the
+ * programmer to ensure that the file contains valid data for
+ * this program.
+ *
+ * @param fileName the file or program name
+ * @return <code>true</code> if the file is launched, otherwise <code>false</code>
+ *
+ * @exception SWTError <ul>
+ * <li>ERROR_NULL_ARGUMENT when fileName is null</li>
+ * </ul>
+ */
+public boolean execute (String fileName) {
+ if (fileName == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+
+ return false;
+}
+
+/**
+ * Returns the receiver's image data. This is the icon
+ * that is associated with the reciever in the operating
+ * system.
+ *
+ * @return the image data for the program, may be null
+ */
+public ImageData getImageData () {
+ return null;
+}
+
+/**
+ * Returns the receiver's name. This is as short and
+ * descriptive a name as possible for the program. If
+ * the program has no descriptive name, this string may
+ * be the executable name, path or empty.
+ *
+ * @return an the name of the program
+ */
+public String getName () {
+ return name;
+}
+
+/**
+ * Returns true if the receiver and the argument represent
+ * the same program.
+ *
+ * @return true if the programs are the same
+ */
+public boolean equals(Object other) {
+ if (this == other) return true;
+ if (other instanceof Program) {
+ final Program program = (Program) other;
+ return extension.equals(program.extension) && name.equals(program.name)
+ && command.equals(program.command);
+ }
+ return false;
+}
+
+/**
+ * Returns a hash code suitable for this object.
+ *
+ * @return a hash code
+ */
+public int hashCode() {
+ return extension.hashCode() ^ name.hashCode() ^ command.hashCode();
+}
+
+public String toString () {
+ return "Program {" + name + "}";
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gtk1x/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/gtk1x/org/eclipse/swt/program/Program.java
new file mode 100644
index 0000000..04cf611
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT Program/gtk1x/org/eclipse/swt/program/Program.java
@@ -0,0 +1,145 @@
+package org.eclipse.swt.program;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.graphics.*;
+
+import java.io.IOException;
+
+/**
+ * Instances of this class represent programs and
+ * their assoicated file extensions in the operating
+ * system.
+ */
+public final class Program {
+ String name = "", extension = "", command = "";
+
+/**
+ * Finds the program that is associated with an extension.
+ * The extension may or may not begin with a '.'.
+ *
+ * @param extension the program extension
+ * @return the program or nil
+ *
+ * @exception SWTError <ul>
+ * <li>ERROR_NULL_ARGUMENT when extension is null</li>
+ * </ul>
+ */
+public static Program findProgram (String extension) {
+ if (extension == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ if (extension.length () == 0) return null;
+ return null;
+}
+
+/**
+ * Answer all program extensions in the operating system.
+ *
+ * @return an array of extensions
+ */
+public static String [] getExtensions () {
+ return new String [0];
+}
+
+/**
+ * Answers all available programs in the operating system.
+ *
+ * @return an array of programs
+ */
+public static Program [] getPrograms () {
+ return new Program [0];
+}
+
+/**
+ * Launches the executable associated with the file in
+ * the operating system. If the file is an executable,
+ * then the executable is launched.
+ *
+ * @param fileName the file or program name
+ * @return <code>true</code> if the file is launched, otherwise <code>false</code>
+ *
+ * @exception SWTError <ul>
+ * <li>ERROR_NULL_ARGUMENT when fileName is null</li>
+ * </ul>
+ */
+public static boolean launch (String fileName) {
+ if (fileName == null) SWT.error( SWT.ERROR_NULL_ARGUMENT );
+
+ return false;
+}
+
+/**
+ * Executes the program with the file as the single argument
+ * in the operating system. It is the responsibility of the
+ * programmer to ensure that the file contains valid data for
+ * this program.
+ *
+ * @param fileName the file or program name
+ * @return <code>true</code> if the file is launched, otherwise <code>false</code>
+ *
+ * @exception SWTError <ul>
+ * <li>ERROR_NULL_ARGUMENT when fileName is null</li>
+ * </ul>
+ */
+public boolean execute (String fileName) {
+ if (fileName == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+
+ return false;
+}
+
+/**
+ * Returns the receiver's image data. This is the icon
+ * that is associated with the reciever in the operating
+ * system.
+ *
+ * @return the image data for the program, may be null
+ */
+public ImageData getImageData () {
+ return null;
+}
+
+/**
+ * Returns the receiver's name. This is as short and
+ * descriptive a name as possible for the program. If
+ * the program has no descriptive name, this string may
+ * be the executable name, path or empty.
+ *
+ * @return an the name of the program
+ */
+public String getName () {
+ return name;
+}
+
+/**
+ * Returns true if the receiver and the argument represent
+ * the same program.
+ *
+ * @return true if the programs are the same
+ */
+public boolean equals(Object other) {
+ if (this == other) return true;
+ if (other instanceof Program) {
+ final Program program = (Program) other;
+ return extension.equals(program.extension) && name.equals(program.name)
+ && command.equals(program.command);
+ }
+ return false;
+}
+
+/**
+ * Returns a hash code suitable for this object.
+ *
+ * @return a hash code
+ */
+public int hashCode() {
+ return extension.hashCode() ^ name.hashCode() ^ command.hashCode();
+}
+
+public String toString () {
+ return "Program {" + name + "}";
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Color.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Color.java
new file mode 100644
index 0000000..e796d21
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Color.java
@@ -0,0 +1,257 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ * Instances of this class manage the operating system resources that
+ * implement SWT's RGB color model. To create a color you can either
+ * specify the individual color components as integers in the range
+ * 0 to 255 or provide an instance of an <code>RGB</code>.
+ * <p>
+ * Application code must explicitly invoke the <code>Color.dispose()</code>
+ * method to release the operating system resources managed by each instance
+ * when those instances are no longer required.
+ * </p>
+ *
+ * @see RGB
+ */
+public final class Color {
+ /**
+ * the handle to the OS color resource
+ * (Warning: This field is platform dependent)
+ */
+ public GdkColor handle;
+ Device display;
+Color() {
+}
+/**
+ * Constructs a new instance of this class given a device and the
+ * desired red, green and blue values expressed as ints in the range
+ * 0 to 255 (where 0 is black and 255 is full brightness). On limited
+ * color devices, the color instance created by this call may not have
+ * the same RGB values as the ones specified by the arguments. The
+ * RGB values on the returned instance will be the color values of
+ * the operating system color.
+ * <p>
+ * You must dispose the color when it is no longer required.
+ * </p>
+ *
+ * @param device the device on which to allocate the color
+ * @param red the amount of red in the color
+ * @param green the amount of green in the color
+ * @param blue the amount of blue in the color
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the red, green or blue argument is not between 0 and 255</li>
+ * </ul>
+ *
+ * @see #dispose
+ */
+public Color(Device display, int red, int green, int blue) {
+ init(display, red, green, blue);
+}
+/**
+ * Constructs a new instance of this class given a device and an
+ * <code>RGB</code> describing the desired red, green and blue values.
+ * On limited color devices, the color instance created by this call
+ * may not have the same RGB values as the ones specified by the
+ * argument. The RGB values on the returned instance will be the color
+ * values of the operating system color.
+ * <p>
+ * You must dispose the color when it is no longer required.
+ * </p>
+ *
+ * @param device the device on which to allocate the color
+ * @param RGB the RGB values of the desired color
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the red, green or blue components of the argument are not between 0 and 255</li>
+ * <li>ERROR_NULL_ARGUMENT - if the rgb argument is null</li>
+ * </ul>
+ *
+ * @see #dispose
+ */
+public Color(Device display, RGB rgb) {
+ if (rgb == null) error(SWT.ERROR_NULL_ARGUMENT);
+ init(display, rgb.red, rgb.green, rgb.blue);
+}
+/**
+ * Disposes of the operating system resources associated with
+ * the color. Applications must dispose of all colors which
+ * they allocate.
+ */
+public void dispose() {
+ /**
+ * If this is a palette-based display,
+ * Decrease the reference count for this color.
+ * If the reference count reaches 0, the slot may
+ * be reused when another color is allocated.
+ */
+ if (display.colorRefCount != null) {
+ if (--display.colorRefCount[handle.pixel] == 0) {
+ display.gdkColors[handle.pixel] = null;
+ }
+ }
+ int colormap = OS.gdk_colormap_get_system();
+ OS.gdk_colors_free(colormap, new int[] { handle.pixel }, 1, 0);
+ this.display = null;
+ this.handle = null;
+}
+/**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the <em>same</em> object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
+ *
+ * @see #hashCode
+ */
+public boolean equals(Object object) {
+ if (object == this) return true;
+ if (!(object instanceof Color)) return false;
+ Color color = (Color)object;
+ GdkColor xColor = color.handle;
+ return (handle.pixel == xColor.pixel)&&(handle.red == xColor.red) && (handle.green == xColor.green) && (handle.blue == xColor.blue) && (this.display == color.display);
+}
+void error(int code) {
+ throw new SWTError(code);
+}
+/**
+ * Returns the amount of blue in the color, from 0 to 255.
+ *
+ * @return the blue component of the color
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public int getBlue() {
+ return (handle.blue >> 8) & 0xFF;
+}
+/**
+ * Returns the amount of green in the color, from 0 to 255.
+ *
+ * @return the green component of the color
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public int getGreen() {
+ return (handle.green >> 8) & 0xFF;
+}
+/**
+ * Returns the amount of red in the color, from 0 to 255.
+ *
+ * @return the red component of the color
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public int getRed() {
+ return (handle.red >> 8) & 0xFF;
+}
+
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects which return <code>true</code> when passed to
+ * <code>equals</code> must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals
+ */
+public int hashCode() {
+ return handle.red ^ handle.green ^ handle.blue;
+}
+/**
+ * Returns an <code>RGB</code> representing the receiver.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public RGB getRGB () {
+ return new RGB(getRed(), getGreen(), getBlue());
+}
+
+void init(Device display, int red, int green, int blue) {
+ if (display == null) display = Display.getDefault();
+ this.display = display;
+ handle = new GdkColor();
+ handle.red = (short)((red & 0xFF) | ((red & 0xFF) << 8));
+ handle.green = (short)((green & 0xFF) | ((green & 0xFF) << 8));
+ handle.blue = (short)((blue & 0xFF) | ((blue & 0xFF) << 8));
+ int colormap = OS.gdk_colormap_get_system();
+ OS.gdk_color_alloc(colormap, handle);
+ if (display.colorRefCount != null) {
+ // Make a copy of the color to put in the colors array
+ GdkColor colorCopy = new GdkColor();
+ colorCopy.red = handle.red;
+ colorCopy.green = handle.green;
+ colorCopy.blue = handle.blue;
+ colorCopy.pixel = handle.pixel;
+ display.gdkColors[colorCopy.pixel] = colorCopy;
+ display.colorRefCount[colorCopy.pixel]++;
+ }
+}
+/**
+ * Returns <code>true</code> if the color has been disposed,
+ * and <code>false</code> otherwise.
+ * <p>
+ * This method gets the dispose state for the color.
+ * When a color has been disposed, it is an error to
+ * invoke any other method using the color.
+ *
+ * @return <code>true</code> when the color is disposed and <code>false</code> otherwise
+ */
+public boolean isDisposed() {
+ return handle == null;
+}
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the receiver
+ */
+public String toString () {
+ return "Color {" + getRed() + ", " + getGreen() + ", " + getBlue() + "}";
+}
+
+public static Color gtk_new(GdkColor gdkColor) {
+ Color color = new Color(null, gtk_getRGBIntensities(gdkColor));
+ return color;
+}
+
+static RGB gtk_getRGBIntensities(GdkColor gdkColor) {
+ boolean intensitiesAreZero = (gdkColor.red==0) && (gdkColor.green==0) && (gdkColor.blue==0);
+ if (!intensitiesAreZero) return new RGB ((gdkColor.red&0xFF00)>>8,
+ (gdkColor.green&0xFF00)>>8,
+ (gdkColor.blue&0xFF00)>>8 );
+ GdkVisual visual = new GdkVisual();
+ OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
+
+ int r = (gdkColor.pixel&visual.red_mask) >> visual.red_shift;
+ if (visual.red_prec<8) r = r << (8 - visual.red_prec);
+ else r = r >> (visual.red_prec - 8);
+ int g = (gdkColor.pixel&visual.green_mask) >> visual.green_shift;
+ if (visual.green_prec<8) g = g << (8 - visual.green_prec);
+ else g = g >> (visual.green_prec - 8);
+ int b = (gdkColor.pixel&visual.blue_mask) >> visual.blue_shift;
+ if (visual.blue_prec<8) b = b << (8 - visual.blue_prec);
+ else b = b >> (visual.blue_prec - 8);
+
+ return new RGB(r, g, b);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Cursor.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Cursor.java
new file mode 100644
index 0000000..216957b
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Cursor.java
@@ -0,0 +1,291 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.internal.image.*;
+
+/**
+ * Instances of this class manage operating system resources that
+ * specify the appearance of the on-screen pointer. To create a
+ * cursor you specify the device and either a simple cursor style
+ * describing one of the standard operating system provided cursors
+ * or the image and mask data for the desired appearance.
+ * <p>
+ * Application code must explicitly invoke the <code>Cursor.dispose()</code>
+ * method to release the operating system resources managed by each instance
+ * when those instances are no longer required.
+ * </p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>
+ * CURSOR_ARROW, CURSOR_WAIT, CURSOR_CROSS, CURSOR_APPSTARTING, CURSOR_HELP,
+ * CURSOR_SIZEALL, CURSOR_SIZENESW, CURSOR_SIZENS, CURSOR_SIZENWSE, CURSOR_SIZEWE,
+ * CURSOR_SIZEN, CURSOR_SIZES, CURSOR_SIZEE, CURSOR_SIZEW, CURSOR_SIZENE, CURSOR_SIZESE,
+ * CURSOR_SIZESW, CURSOR_SIZENW, CURSOR_UPARROW, CURSOR_IBEAM, CURSOR_NO, CURSOR_HAND
+ * </dd>
+ * </dl>
+ */
+public final class Cursor {
+ /**
+ * the handle to the OS cursor resource
+ * (Warning: This field is platform dependent)
+ */
+ public int handle;
+Cursor () {
+}
+/**
+ * Constructs a new cursor given a device and a style
+ * constant describing the desired cursor appearance.
+ * <p>
+ * You must dispose the cursor when it is no longer required.
+ * </p>
+ *
+ * @param device the device on which to allocate the cursor
+ * @param style the style of cursor to allocate
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - when an unknown style is specified</li>
+ * </ul>
+ *
+ * @see Cursor for the supported style values
+ */
+public Cursor(Device display, int style) {
+ int osFlag = 0;
+ switch (style) {
+ case SWT.CURSOR_ARROW:
+ osFlag = OS.GDK_LEFT_PTR;
+ break;
+ case SWT.CURSOR_WAIT:
+ osFlag = OS.GDK_WATCH;
+ break;
+ case SWT.CURSOR_CROSS:
+ osFlag = OS.GDK_CROSS;
+ break;
+ case SWT.CURSOR_APPSTARTING:
+ osFlag = OS.GDK_WATCH;
+ break;
+ case SWT.CURSOR_HAND:
+ osFlag = OS.GDK_HAND1;
+ break;
+ case SWT.CURSOR_HELP:
+ osFlag = OS.GDK_QUESTION_ARROW;
+ break;
+ case SWT.CURSOR_SIZEALL:
+ osFlag = OS.GDK_DIAMOND_CROSS;
+ break;
+ case SWT.CURSOR_SIZENESW:
+ osFlag = OS.GDK_SIZING;
+ break;
+ case SWT.CURSOR_SIZENS:
+ osFlag = OS.GDK_DOUBLE_ARROW;
+ break;
+ case SWT.CURSOR_SIZENWSE:
+ osFlag = OS.GDK_SIZING;
+ break;
+ case SWT.CURSOR_SIZEWE:
+ osFlag = OS.GDK_SB_H_DOUBLE_ARROW;
+ break;
+ case SWT.CURSOR_SIZEN:
+ osFlag = OS.GDK_TOP_SIDE;
+ break;
+ case SWT.CURSOR_SIZES:
+ osFlag = OS.GDK_BOTTOM_SIDE;
+ break;
+ case SWT.CURSOR_SIZEE:
+ osFlag = OS.GDK_RIGHT_SIDE;
+ break;
+ case SWT.CURSOR_SIZEW:
+ osFlag = OS.GDK_LEFT_SIDE;
+ break;
+ case SWT.CURSOR_SIZENE:
+ osFlag = OS.GDK_TOP_RIGHT_CORNER;
+ break;
+ case SWT.CURSOR_SIZESE:
+ osFlag = OS.GDK_BOTTOM_RIGHT_CORNER;
+ break;
+ case SWT.CURSOR_SIZESW:
+ osFlag = OS.GDK_BOTTOM_LEFT_CORNER;
+ break;
+ case SWT.CURSOR_SIZENW:
+ osFlag = OS.GDK_TOP_LEFT_CORNER;
+ break;
+ case SWT.CURSOR_UPARROW:
+ osFlag = OS.GDK_SB_UP_ARROW;
+ break;
+ case SWT.CURSOR_IBEAM:
+ osFlag = OS.GDK_XTERM;
+ break;
+ case SWT.CURSOR_NO:
+ osFlag = OS.GDK_X_CURSOR;
+ break;
+ default:
+ error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ this.handle = OS.gdk_cursor_new(osFlag);
+}
+/**
+ * Constructs a new cursor given a device, image and mask
+ * data describing the desired cursor appearance, and the x
+ * and y co-ordinates of the <em>hotspot</em> (that is, the point
+ * within the area covered by the cursor which is considered
+ * to be where the on-screen pointer is "pointing").
+ * <p>
+ * The mask data is allowed to be null, but in this case the source
+ * must be an ImageData representing an icon that specifies both
+ * color data and mask data.
+ * <p>
+ * You must dispose the cursor when it is no longer required.
+ * </p>
+ *
+ * @param device the device on which to allocate the cursor
+ * @param source the color data for the cursor
+ * @param mask the mask data for the cursor (or null)
+ * @param hotspotX the x coordinate of the cursor's hotspot
+ * @param hotspotY the y coordinate of the cursor's hotspot
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - when a null argument is passed that is not allowed</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the source and the mask are not the same
+ * size, or either is not of depth one, or if the hotspot is outside
+ * the bounds of the image</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_NO_HANDLES - if an error occurred constructing the cursor</li>
+ * </ul>
+ */
+public Cursor(Device display, ImageData source, ImageData mask, int hotspotX, int hotspotY) {
+ if (source == null) error(SWT.ERROR_NULL_ARGUMENT);
+ if (mask == null) {
+ if (!(source.getTransparencyType() == SWT.TRANSPARENCY_MASK)) error(SWT.ERROR_NULL_ARGUMENT);
+ mask = source.getTransparencyMask();
+ }
+ /* Check the bounds. Mask must be the same size as source */
+ if (mask.width != source.width || mask.height != source.height) {
+ error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ /* Check depths */
+ if (mask.depth != 1) error(SWT.ERROR_INVALID_ARGUMENT);
+ if (source.depth != 1) error(SWT.ERROR_INVALID_ARGUMENT);
+ /* Check the hotspots */
+ if (hotspotX >= source.width || hotspotX < 0 ||
+ hotspotY >= source.height || hotspotY < 0) {
+ error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+
+ /* Swap the bits if necessary */
+ byte[] sourceData = new byte[source.data.length];
+ byte[] maskData = new byte[mask.data.length];
+ /* Swap the bits in each byte */
+ byte[] data = source.data;
+ for (int i = 0; i < data.length; i++) {
+ byte s = data[i];
+ sourceData[i] = (byte)(((s & 0x80) >> 7) |
+ ((s & 0x40) >> 5) |
+ ((s & 0x20) >> 3) |
+ ((s & 0x10) >> 1) |
+ ((s & 0x08) << 1) |
+ ((s & 0x04) << 3) |
+ ((s & 0x02) << 5) |
+ ((s & 0x01) << 7));
+ sourceData[i] = (byte) ~sourceData[i];
+ }
+ data = mask.data;
+ for (int i = 0; i < data.length; i++) {
+ byte s = data[i];
+ maskData[i] = (byte)(((s & 0x80) >> 7) |
+ ((s & 0x40) >> 5) |
+ ((s & 0x20) >> 3) |
+ ((s & 0x10) >> 1) |
+ ((s & 0x08) << 1) |
+ ((s & 0x04) << 3) |
+ ((s & 0x02) << 5) |
+ ((s & 0x01) << 7));
+ maskData[i] = (byte) ~maskData[i];
+ }
+
+ int sourcePixmap = OS.gdk_bitmap_create_from_data(0, sourceData, source.width, source.height);
+ if (sourcePixmap==0) SWT.error(SWT.ERROR_NO_HANDLES);
+ int maskPixmap = OS.gdk_bitmap_create_from_data(0, maskData, source.width, source.height);
+ if (maskPixmap==0) SWT.error(SWT.ERROR_NO_HANDLES);
+
+ /* Get the colors */
+ GdkColor foreground = new GdkColor();
+ foreground.red = 0;
+ foreground.green = 0;
+ foreground.blue = 0;
+ GdkColor background = new GdkColor();
+ background.red = (short)65535;
+ background.green = (short)65535;
+ background.blue = (short)65535;
+
+ /* Create the cursor */
+ /* For some reason, mask and source take reverse roles, both here and on Motif */
+ handle = OS.gdk_cursor_new_from_pixmap (maskPixmap, sourcePixmap, foreground, background, hotspotX, hotspotY);
+ /* Dispose the pixmaps */
+ OS.gdk_pixmap_unref (sourcePixmap);
+ OS.gdk_pixmap_unref (maskPixmap);
+ if (handle == 0) error(SWT.ERROR_NO_HANDLES);
+}
+/**
+ * Disposes of the operating system resources associated with
+ * the cursor. Applications must dispose of all cursors which
+ * they allocate.
+ */
+public void dispose() {
+ if (handle != 0) OS.gdk_cursor_destroy(handle);
+ handle = 0;
+}
+/**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the <em>same</em> object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
+ *
+ * @see #hashCode
+ */
+public boolean equals(Object object) {
+ return (object == this) || ((object instanceof Cursor) && (handle == ((Cursor)object).handle));
+}
+void error(int code) {
+ throw new SWTError(code);
+}
+public static Cursor gtk_new(int handle) {
+ Cursor cursor = new Cursor();
+ cursor.handle = handle;
+ return cursor;
+}
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects which return <code>true</code> when passed to
+ * <code>equals</code> must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals
+ */
+public int hashCode() {
+ return handle;
+}
+/**
+ * Returns <code>true</code> if the cursor has been disposed,
+ * and <code>false</code> otherwise.
+ * <p>
+ * This method gets the dispose state for the cursor.
+ * When a cursor has been disposed, it is an error to
+ * invoke any other method using the cursor.
+ *
+ * @return <code>true</code> when the cursor is disposed and <code>false</code> otherwise
+ */
+public boolean isDisposed() {
+ return handle == 0;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/DefaultGtkStyle.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/DefaultGtkStyle.java
new file mode 100644
index 0000000..952fa9d
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/DefaultGtkStyle.java
@@ -0,0 +1,116 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.gtk.*;
+
+class DefaultGtkStyle {
+
+ private static DefaultGtkStyle instance = null;
+ private GtkStyle style = null;
+ private int defaultFont;
+
+ public Color foregroundColorNORMAL() {
+ return new Color(null,
+ ((short)0xFF00 & style.fg0_red)>>8,
+ ((short)0xFF00 & style.fg0_green)>>8,
+ ((short)0xFF00 & style.fg0_blue)>>8);
+ }
+
+ public Color backgroundColorNORMAL() {
+ return new Color(null,
+ ((short)0xFF00 & style.bg0_red)>>8,
+ ((short)0xFF00 & style.bg0_green)>>8,
+ ((short)0xFF00 & style.bg0_blue)>>8);
+ }
+
+ public Color foregroundColorACTIVE() {
+ return new Color(null,
+ ((short)0xFF00 & style.fg1_red)>>8,
+ ((short)0xFF00 & style.fg1_green)>>8,
+ ((short)0xFF00 & style.fg1_blue)>>8);
+ }
+
+ public Color backgroundColorACTIVE() {
+ return new Color(null,
+ ((short)0xFF00 & style.bg1_red)>>8,
+ ((short)0xFF00 & style.bg1_green)>>8,
+ ((short)0xFF00 & style.bg1_blue)>>8);
+ }
+
+ public Color foregroundColorPRELIGHT() {
+ return new Color(null,
+ ((short)0xFF00 & style.fg2_red)>>8,
+ ((short)0xFF00 & style.fg2_green)>>8,
+ ((short)0xFF00 & style.fg2_blue)>>8);
+ }
+
+ public Color backgroundColorPRELIGHT() {
+ return new Color(null,
+ ((short)0xFF00 & style.bg2_red)>>8,
+ ((short)0xFF00 & style.bg2_green)>>8,
+ ((short)0xFF00 & style.bg2_blue)>>8);
+ }
+
+ public Color foregroundColorSELECTED() {
+ return new Color(null,
+ ((short)0xFF00 & style.fg3_red)>>8,
+ ((short)0xFF00 & style.fg3_green)>>8,
+ ((short)0xFF00 & style.fg3_blue)>>8);
+ }
+
+ public Color backgroundColorSELECTED() {
+ return new Color(null,
+ ((short)0xFF00 & style.bg3_red)>>8,
+ ((short)0xFF00 & style.bg3_green)>>8,
+ ((short)0xFF00 & style.bg3_blue)>>8);
+ }
+
+ public Color foregroundColorINSENSITIVE() {
+ return new Color(null,
+ ((short)0xFF00 & style.fg4_red)>>8,
+ ((short)0xFF00 & style.fg4_green)>>8,
+ ((short)0xFF00 & style.fg4_blue)>>8);
+ }
+
+ public Color backgroundColorINSENSITIVE() {
+ return new Color(null,
+ ((short)0xFF00 & style.bg4_red)>>8,
+ ((short)0xFF00 & style.bg4_green)>>8,
+ ((short)0xFF00 & style.bg4_blue)>>8);
+ }
+
+ public int loadDefaultFont() {
+ if (defaultFont == 0) {
+ int fnames = Font.getFontNameList(style.font);
+ int slength = OS.g_slist_length(fnames);
+ if (slength < 1) SWT.error(SWT.ERROR_UNSPECIFIED);
+ int name1 = OS.g_slist_nth_data(fnames, 0);
+ int length = OS.strlen(name1);
+ byte [] buffer1 = new byte[length];
+ OS.memmove(buffer1, name1, length);
+ defaultFont = OS.gdk_font_load(buffer1);
+ if (defaultFont==0) SWT.error(SWT.ERROR_UNSPECIFIED);
+ GdkFont gdkFont = new GdkFont();
+ OS.memmove(gdkFont, defaultFont, GdkFont.sizeof);
+ if (gdkFont.type != OS.GDK_FONT_FONT) SWT.error(SWT.ERROR_UNSPECIFIED);
+ }
+ return defaultFont;
+ }
+
+ public static DefaultGtkStyle instance() {
+ if (instance==null) instance = new DefaultGtkStyle();
+ return instance;
+ }
+
+ private DefaultGtkStyle() {
+ style = new GtkStyle();
+ OS.memmove(style, OS.gtk_widget_get_default_style(), GtkStyle.sizeof);
+ }
+
+}
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
new file mode 100644
index 0000000..f98cf11
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
@@ -0,0 +1,482 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+
+public abstract class Device implements Drawable {
+
+ /* Debugging */
+ public static boolean DEBUG;
+ boolean debug = DEBUG;
+ boolean tracking = DEBUG;
+ Error [] errors;
+ Object [] objects;
+
+ /* Colormap and reference count */
+ GdkColor [] gdkColors;
+ int [] colorRefCount;
+
+ /* Disposed flag */
+ boolean disposed;
+
+ /*
+ * The following colors are listed in the Windows
+ * Programmer's Reference as the colors in the default
+ * palette.
+ */
+ Color COLOR_BLACK, COLOR_DARK_RED, COLOR_DARK_GREEN, COLOR_DARK_YELLOW, COLOR_DARK_BLUE;
+ Color COLOR_DARK_MAGENTA, COLOR_DARK_CYAN, COLOR_GRAY, COLOR_DARK_GRAY, COLOR_RED;
+ Color COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE;
+
+ /*
+ * TEMPORARY CODE. When a graphics object is
+ * created and the device parameter is null,
+ * the current Display is used. This presents
+ * a problem because SWT graphics does not
+ * reference classes in SWT widgets. The correct
+ * fix is to remove this feature. Unfortunately,
+ * too many application programs rely on this
+ * feature.
+ *
+ * This code will be removed in the future.
+ */
+ protected static Device CurrentDevice;
+ protected static Runnable DeviceFinder;
+ static {
+ try {
+ Class.forName ("org.eclipse.swt.widgets.Display");
+ } catch (Throwable e) {}
+ }
+
+/*
+* TEMPORARY CODE.
+*/
+static Device getDevice () {
+ if (DeviceFinder != null) DeviceFinder.run();
+ Device device = CurrentDevice;
+ CurrentDevice = null;
+ return device;
+}
+
+/**
+ * Constructs a new instance of this class.
+ * <p>
+ * You must dispose the device when it is no longer required.
+ * </p>
+ *
+ * @param data the DeviceData which describes the receiver
+ *
+ * @see #create
+ * @see #init
+ * @see DeviceData
+ */
+public Device(DeviceData data) {
+ if (data != null) {
+ debug = data.debug;
+ tracking = data.tracking;
+ }
+ create (data);
+ init ();
+ if (tracking) {
+ errors = new Error [128];
+ objects = new Object [128];
+ }
+}
+
+protected void checkDevice () {
+ if (disposed) SWT.error(SWT.ERROR_DEVICE_DISPOSED);
+}
+
+protected void create (DeviceData data) {
+}
+
+/**
+ * Disposes of the operating system resources associated with
+ * the receiver. After this method has been invoked, the receiver
+ * will answer <code>true</code> when sent the message
+ * <code>isDisposed()</code>.
+ *
+ * @see #release
+ * @see #destroy
+ * @see #checkDevice
+ */
+public void dispose () {
+ if (isDisposed()) return;
+ checkDevice ();
+ release ();
+ destroy ();
+ disposed = true;
+ if (tracking) {
+ objects = null;
+ errors = null;
+ }
+}
+
+void dispose_Object (Object object) {
+ for (int i=0; i<objects.length; i++) {
+ if (objects [i] == object) {
+ objects [i] = null;
+ errors [i] = null;
+ return;
+ }
+ }
+}
+
+protected void destroy () {
+}
+
+/**
+ * Returns a rectangle describing the receiver's size and location.
+ *
+ * @return the bounding rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Rectangle getBounds () {
+ checkDevice ();
+ SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
+ return new Rectangle(0, 0, 0, 0);
+}
+
+/**
+ * Returns a <code>DeviceData</code> based on the receiver.
+ * Modifications made to this <code>DeviceData</code> will not
+ * affect the receiver.
+ *
+ * @return a <code>DeviceData</code> containing the device's data and attributes
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see DeviceData
+ */
+public DeviceData getDeviceData () {
+ checkDevice();
+ DeviceData data = new DeviceData ();
+ data.debug = debug;
+ data.tracking = tracking;
+ int count = 0, length = 0;
+ if (tracking) length = objects.length;
+ for (int i=0; i<length; i++) {
+ if (objects [i] != null) count++;
+ }
+ int index = 0;
+ data.objects = new Object [count];
+ data.errors = new Error [count];
+ for (int i=0; i<length; i++) {
+ if (objects [i] != null) {
+ data.objects [index] = objects [i];
+ data.errors [index] = errors [i];
+ index++;
+ }
+ }
+ return data;
+}
+
+/**
+ * Returns a rectangle which describes the area of the
+ * receiver which is capable of displaying data.
+ *
+ * @return the client area
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #getBounds
+ */
+public Rectangle getClientArea () {
+ checkDevice ();
+ return getBounds ();
+}
+
+/**
+ * Returns the bit depth of the screen, which is the number of
+ * bits it takes to represent the number of unique colors that
+ * the screen is currently capable of displaying. This number
+ * will typically be one of 1, 8, 15, 16, 24 or 32.
+ *
+ * @return the depth of the screen
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public int getDepth () {
+ checkDevice ();
+ SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
+ return 0;
+}
+
+/**
+ * Returns a point whose x coordinate is the horizontal
+ * dots per inch of the display, and whose y coordinate
+ * is the vertical dots per inch of the display.
+ *
+ * @return the horizontal and vertical DPI
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Point getDPI () {
+ checkDevice ();
+ SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
+ return new Point (72, 72);
+}
+
+/**
+ * Returns <code>FontData</code> objects which describe
+ * the fonts which match the given arguments. If the
+ * <code>faceName</code> is null, all fonts will be returned.
+ *
+ * @param faceName the name of the font to look for, or null
+ * @param scalable true if scalable fonts should be returned.
+ * @return the matching font data
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public FontData [] getFontList (String faceName, boolean scalable) {
+ checkDevice ();
+ String xlfd;
+ if (faceName == null) {
+ xlfd = "-*";
+ } else {
+ int dashIndex = faceName.indexOf('-');
+ if (dashIndex < 0) {
+ xlfd = "-*-" + faceName + "-*";
+ } else {
+ xlfd = "-" + faceName + "-*";
+ }
+ }
+ /* Use the character encoding for the default locale */
+ byte [] buffer1 = Converter.wcsToMbcs (null, xlfd, true);
+ int [] ret = new int [1];
+ int listPtr = OS.XListFonts (buffer1, 65535, ret);
+ int ptr = listPtr;
+ int [] intBuf = new int [1];
+ FontData [] fd = new FontData [ret [0]];
+ int fdIndex = 0;
+ for (int i = 0; i < ret [0]; i++) {
+ OS.memmove (intBuf, ptr, 4);
+ int charPtr = intBuf [0];
+ int length = OS.strlen (charPtr);
+ byte [] buffer2 = new byte [length];
+ OS.memmove (buffer2, charPtr, length);
+ /* Use the character encoding for the default locale */
+ char [] chars = Converter.mbcsToWcs (null, buffer2);
+ FontData data = FontData.gtk_new (new String (chars));
+ boolean isScalable = data.averageWidth == 0 && data.pixels == 0 && data.points == 0;
+ if (isScalable == scalable) {
+ fd [fdIndex++] = data;
+ }
+ ptr += 4;
+ }
+ // FIXME, leaking font list
+// OS.XFreeFontNames (listPtr);
+ if (fdIndex == ret [0]) return fd;
+ FontData [] result = new FontData [fdIndex];
+ System.arraycopy (fd, 0, result, 0, fdIndex);
+ return result;
+}
+
+/**
+ * Returns the matching standard color for the given
+ * constant, which should be one of the color constants
+ * specified in class <code>SWT</code>. Any value other
+ * than one of the SWT color constants which is passed
+ * in will result in the color black. This color should
+ * not be free'd because it was allocated by the system,
+ * not the application.
+ *
+ * @param id the color constant
+ * @return the matching color
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see SWT
+ */
+public Color getSystemColor (int id) {
+ checkDevice ();
+ switch (id) {
+ case SWT.COLOR_BLACK: return COLOR_BLACK;
+ case SWT.COLOR_DARK_RED: return COLOR_DARK_RED;
+ case SWT.COLOR_DARK_GREEN: return COLOR_DARK_GREEN;
+ case SWT.COLOR_DARK_YELLOW: return COLOR_DARK_YELLOW;
+ case SWT.COLOR_DARK_BLUE: return COLOR_DARK_BLUE;
+ case SWT.COLOR_DARK_MAGENTA: return COLOR_DARK_MAGENTA;
+ case SWT.COLOR_DARK_CYAN: return COLOR_DARK_CYAN;
+ case SWT.COLOR_GRAY: return COLOR_GRAY;
+ case SWT.COLOR_DARK_GRAY: return COLOR_DARK_GRAY;
+ case SWT.COLOR_RED: return COLOR_RED;
+ case SWT.COLOR_GREEN: return COLOR_GREEN;
+ case SWT.COLOR_YELLOW: return COLOR_YELLOW;
+ case SWT.COLOR_BLUE: return COLOR_BLUE;
+ case SWT.COLOR_MAGENTA: return COLOR_MAGENTA;
+ case SWT.COLOR_CYAN: return COLOR_CYAN;
+ case SWT.COLOR_WHITE: return COLOR_WHITE;
+ }
+ return COLOR_BLACK;
+}
+
+/**
+ * Returns a reasonable font for applications to use.
+ * On some platforms, this will match the "default font"
+ * or "system font" if such can be found. This font
+ * should not be free'd because it was allocated by the
+ * system, not the application.
+ * <p>
+ * Typically, applications which want the default look
+ * should simply not set the font on the widgets they
+ * create. Widgets are always created with the correct
+ * default font for the class of user-interface component
+ * they represent.
+ * </p>
+ *
+ * @return a font
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Font getSystemFont () {
+ checkDevice ();
+ return null;
+}
+
+protected void init () {
+ COLOR_BLACK = new Color (this, 0,0,0);
+ COLOR_DARK_RED = new Color (this, 0x80,0,0);
+ COLOR_DARK_GREEN = new Color (this, 0,0x80,0);
+ COLOR_DARK_YELLOW = new Color (this, 0x80,0x80,0);
+ COLOR_DARK_BLUE = new Color (this, 0,0,0x80);
+ COLOR_DARK_MAGENTA = new Color (this, 0x80,0,0x80);
+ COLOR_DARK_CYAN = new Color (this, 0,0x80,0x80);
+ COLOR_GRAY = new Color (this, 0xC0,0xC0,0xC0);
+ COLOR_DARK_GRAY = new Color (this, 0x80,0x80,0x80);
+ COLOR_RED = new Color (this, 0xFF,0,0);
+ COLOR_GREEN = new Color (this, 0,0xFF,0);
+ COLOR_YELLOW = new Color (this, 0xFF,0xFF,0);
+ COLOR_BLUE = new Color (this, 0,0,0xFF);
+ COLOR_MAGENTA = new Color (this, 0xFF,0,0xFF);
+ COLOR_CYAN = new Color (this, 0,0xFF,0xFF);
+ COLOR_WHITE = new Color (this, 0xFF,0xFF,0xFF);
+}
+
+/**
+ * Invokes platform specific functionality to allocate a new GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Device</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param data the platform specific GC data
+ * @return the platform specific GC handle
+ *
+ * @private
+ */
+public abstract int internal_new_GC (GCData data);
+
+/**
+ * Invokes platform specific functionality to dispose a GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Device</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param handle the platform specific GC handle
+ * @param data the platform specific GC data
+ *
+ * @private
+ */
+public abstract void internal_dispose_GC (int handle, GCData data);
+
+/**
+ * Returns <code>true</code> if the device has been disposed,
+ * and <code>false</code> otherwise.
+ * <p>
+ * This method gets the dispose state for the device.
+ * When a device has been disposed, it is an error to
+ * invoke any other method using the device.
+ *
+ * @return <code>true</code> when the device is disposed and <code>false</code> otherwise
+ */
+public boolean isDisposed () {
+ return disposed;
+}
+
+void new_Object (Object object) {
+ for (int i=0; i<objects.length; i++) {
+ if (objects [i] == null) {
+ objects [i] = object;
+ errors [i] = new Error ();
+ return;
+ }
+ }
+ Object [] newObjects = new Object [objects.length + 128];
+ System.arraycopy (objects, 0, newObjects, 0, objects.length);
+ newObjects [objects.length] = object;
+ objects = newObjects;
+ Error [] newErrors = new Error [errors.length + 128];
+ System.arraycopy (errors, 0, newErrors, 0, errors.length);
+ newErrors [errors.length] = new Error ();
+ errors = newErrors;
+}
+
+protected void release () {
+ if (gdkColors != null) {
+ int colormap = OS.gdk_colormap_get_system();
+ int [] pixel = new int [1];
+ for (int i = 0; i < gdkColors.length; i++) {
+ GdkColor color = gdkColors [i];
+ if (color != null) {
+ while (colorRefCount [i] > 0) {
+ OS.gdk_color_free(color);
+ --colorRefCount [i];
+ }
+ }
+ }
+ }
+ gdkColors = null;
+ colorRefCount = null;
+ COLOR_BLACK = COLOR_DARK_RED = COLOR_DARK_GREEN = COLOR_DARK_YELLOW = COLOR_DARK_BLUE =
+ COLOR_DARK_MAGENTA = COLOR_DARK_CYAN = COLOR_GRAY = COLOR_DARK_GRAY = COLOR_RED =
+ COLOR_GREEN = COLOR_YELLOW = COLOR_BLUE = COLOR_MAGENTA = COLOR_CYAN = COLOR_WHITE = null;
+}
+
+/**
+ * If the underlying window system supports printing warning messages
+ * to the console, setting warnings to <code>true</code> prevents these
+ * messages from being printed. If the argument is <code>false</code>
+ * message printing is not blocked.
+ *
+ * @param warnings <code>true</code>if warnings should be handled, and <code>false</code> otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setWarnings (boolean warnings) {
+ checkDevice ();
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/DeviceData.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/DeviceData.java
new file mode 100644
index 0000000..4ed07eb
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/DeviceData.java
@@ -0,0 +1,24 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+public class DeviceData {
+ /*
+ * Motif only fields.
+ */
+ public String display_name;
+ public String application_name;
+ public String application_class;
+
+ /*
+ * Debug fields - may not be honoured
+ * on some SWT platforms.
+ */
+ public boolean debug;
+ public boolean tracking;
+ public Error [] errors;
+ public Object [] objects;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Font.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Font.java
new file mode 100644
index 0000000..89d6132
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Font.java
@@ -0,0 +1,209 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Instances of this class manage operating system resources that
+ * define how text looks when it is displayed. Fonts may be constructed
+ * by providing a device and either name, size and style information
+ * or a <code>FontData</code> object which encapsulates this data.
+ * <p>
+ * Application code must explicitly invoke the <code>Font.dispose()</code>
+ * method to release the operating system resources managed by each instance
+ * when those instances are no longer required.
+ * </p>
+ *
+ * @see FontData
+ */
+public final class Font {
+ /**
+ * the handle to the OS font resource
+ * (Warning: This field is platform dependent)
+ */
+ public int handle;
+Font() {
+}
+/**
+ * Constructs a new font given a device and font data
+ * which describes the desired font's appearance.
+ * <p>
+ * You must dispose the font when it is no longer required.
+ * </p>
+ *
+ * @param device the device to create the font on
+ * @param fd the FontData that describes the desired font (must not be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the fd argument is null</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_NO_HANDLES - if a font could not be created from the given font data</li>
+ * </ul>
+ */
+public Font(Device display, FontData fd) {
+ if (fd == null) error(SWT.ERROR_NULL_ARGUMENT);
+
+ String xlfd = fd.getXlfd();
+ byte[] buffer = Converter.wcsToMbcs(null, xlfd, true);
+ handle = OS.gdk_font_load(buffer);
+ if (handle == 0) {
+ int hStyle = OS.gtk_widget_get_default_style();
+ GtkStyle gtkStyle = new GtkStyle();
+ OS.memmove(gtkStyle, hStyle, GtkStyle.sizeof);
+ handle = OS.gdk_font_ref(gtkStyle.font);
+ }
+}
+/**
+ * Constructs a new font given a device, a font name,
+ * the height of the desired font in points, and a font
+ * style.
+ * <p>
+ * You must dispose the font when it is no longer required.
+ * </p>
+ *
+ * @param device the device to create the font on
+ * @param name the name of the font (must not be null)
+ * @param height the font height in points
+ * @param style a bit or combination of NORMAL, BOLD, ITALIC
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the name argument is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_NO_HANDLES - if a font could not be created from the given arguments</li>
+ * </ul>
+ */
+public Font(Device display, String fontFamily, int height, int style) {
+ if (fontFamily == null) error(SWT.ERROR_NULL_ARGUMENT);
+ FontData fd = new FontData(fontFamily, height, style);
+ byte[] buffer = Converter.wcsToMbcs(null, fd.getXlfd(), true);
+ handle = OS.gdk_font_load(buffer);
+ if (handle == 0) {
+ int hStyle = OS.gtk_widget_get_default_style();
+ GtkStyle gtkStyle = new GtkStyle();
+ OS.memmove(gtkStyle, hStyle, GtkStyle.sizeof);
+ handle = OS.gdk_font_ref(gtkStyle.font);
+ }
+}
+/**
+ * Disposes of the operating system resources associated with
+ * the font. Applications must dispose of all fonts which
+ * they allocate.
+ */
+public void dispose() {
+ if (handle != 0) OS.gdk_font_unref(handle);
+ handle = 0;
+}
+/**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the <em>same</em> object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
+ *
+ * @see #hashCode
+ */
+public boolean equals(Object object) {
+ if (object == this) return true;
+ if (!(object instanceof Font)) return false;
+ return OS.gdk_font_equal(handle, ((Font)object).handle);
+}
+void error(int code) {
+ throw new SWTError (code);
+}
+
+/**
+ * Returns an array of <code>FontData</code>s representing the receiver.
+ * On Windows, only one FontData will be returned per font. On X however,
+ * a <code>Font</code> object <em>may</em> be composed of multiple X
+ * fonts. To support this case, we return an array of font data objects.
+ *
+ * @return an array of font data objects describing the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public FontData[] getFontData() {
+ int index=0;
+ int fnames = getFontNameList(handle);
+ int nfonts = OS.g_slist_length(fnames);
+ FontData[] answer = new FontData[nfonts];
+ for (int i=0; i<nfonts; i++) {
+ FontData data = new FontData();
+
+ int name = OS.g_slist_nth_data(fnames, index);
+ int length = OS.strlen(name);
+ byte [] buffer1 = new byte[length];
+ OS.memmove(buffer1, name, length);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ String fontname = new String (buffer2, 0, buffer2.length);
+ data.setXlfd(fontname);
+
+ // Wild guess, 'a' looks average enough
+ data.averageWidth = OS.gdk_char_width(handle, (byte)'a');
+
+ // Wild guess, a progressive font should probably have A wider than l
+ int widthA = OS.gdk_char_width(handle, (byte)'A');
+ int widthl = OS.gdk_char_width(handle, (byte)'l');
+ if (widthA == widthl) data.spacing = "m";
+ else data.spacing = "p";
+
+ answer[i] = data;
+ }
+ return answer;
+}
+static int getFontNameList(int handle) {
+ int[] mem = new int[7];
+ OS.memmove(mem, handle, 7*4);
+ int type = mem[0];
+ int ascent = mem[1];
+ int descent = mem[2];
+ int xfont =mem [3];
+ int xdisplay = mem[4];
+ int ref_count = mem[5];
+ int names = mem[6];
+ return names;
+}
+public static Font gtk_new(int handle) {
+ Font font = new Font();
+ font.handle = handle;
+ return font;
+}
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects which return <code>true</code> when passed to
+ * <code>equals</code> must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals
+ */
+public int hashCode() {
+ return handle;
+}
+/**
+ * Returns <code>true</code> if the font has been disposed,
+ * and <code>false</code> otherwise.
+ * <p>
+ * This method gets the dispose state for the font.
+ * When a font has been disposed, it is an error to
+ * invoke any other method using the font.
+ *
+ * @return <code>true</code> when the font is disposed and <code>false</code> otherwise
+ */
+public boolean isDisposed() {
+ return handle == 0;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontData.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontData.java
new file mode 100644
index 0000000..f179499
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontData.java
@@ -0,0 +1,546 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+
+/**
+ * Instances of this class describe operating system fonts.
+ * Only the public API of this type is platform independent.
+ * <p>
+ * For platform-independent behaviour, use the get and set methods
+ * corresponding to the following properties:
+ * <dl>
+ * <dt>height</dt><dd>the height of the font in points</dd>
+ * <dt>name</dt><dd>the face name of the font, which may include the foundry</dd>
+ * <dt>style</dt><dd>A bitwise combination of NORMAL, ITALIC and BOLD</dd>
+ * </dl>
+ * If extra, platform-dependent functionality is required:
+ * <ul>
+ * <li>On <em>Windows</em>, the data member of the <code>FontData</code>
+ * corresponds to a Windows <code>LOGFONT</code> structure whose fields
+ * may be retrieved and modified.</li>
+ * <li>On <em>X</em>, the fields of the <code>FontData</code> correspond
+ * to the entries in the font's XLFD name and may be retrieved and modified.
+ * </ul>
+ * Application code does <em>not</em> need to explicitly release the
+ * resources managed by each instance when those instances are no longer
+ * required, and thus no <code>dispose()</code> method is provided.
+ *
+ * @see Font
+ */
+public final class FontData {
+ /**
+ * The company that produced the font
+ * Warning: This field is platform dependent.
+ */
+ public String foundry;
+ /**
+ * The common name of the font
+ * Warning: This field is platform dependent.
+ */
+ public String fontFamily;
+ /**
+ * The weight ("normal", "bold")
+ * Warning: This field is platform dependent.
+ */
+ public String weight;
+ /**
+ * The slant ("o" for oblique, "i" for italic)
+ * Warning: This field is platform dependent.
+ */
+ public String slant;
+ /**
+ * The set width of the font
+ * Warning: This field is platform dependent.
+ */
+ public String setWidth;
+ /**
+ * Additional font styles
+ * Warning: This field is platform dependent.
+ */
+ public String addStyle;
+ /**
+ * The height of the font in pixels
+ * Warning: This field is platform dependent.
+ */
+ public int pixels;
+ /**
+ * The height of the font in tenths of a point
+ * Warning: This field is platform dependent.
+ */
+ public int points;
+ /**
+ * The horizontal screen resolution for which the font was designed
+ * Warning: This field is platform dependent.
+ */
+ public int horizontalResolution;
+ /**
+ * The vertical screen resolution for which the font was designed
+ * Warning: This field is platform dependent.
+ */
+ public int verticalResolution;
+ /**
+ * The font spacing ("m" for monospace, "p" for proportional)
+ * Warning: This field is platform dependent.
+ */
+ public String spacing;
+ /**
+ * The average character width for the font
+ * Warning: This field is platform dependent.
+ */
+ public int averageWidth;
+ /**
+ * The ISO character set registry
+ * Warning: This field is platform dependent.
+ */
+ public String characterSetRegistry;
+ /**
+ * The ISO character set name
+ * Warning: This field is platform dependent.
+ */
+ public String characterSetName;
+ /**
+ * The locales of the font
+ * (Warning: These fields are platform dependent)
+ */
+ String lang, country, variant;
+
+/**
+ * Constructs a new un-initialized font data.
+ */
+public FontData () {
+}
+/**
+ * Constructs a new FontData given a string representation
+ * in the form generated by the <code>FontData.toString</code>
+ * method.
+ * <p>
+ * Note that the representation varies between platforms,
+ * and a FontData can only be created from a string that was
+ * generated on the same platform.
+ * </p>
+ *
+ * @param string the string representation of a <code>FontData</code> (must not be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the argument does not represent a valid description</li>
+ * </ul>
+ *
+ * @see #toString
+ */
+public FontData(String string) {
+ if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
+ int start = 0;
+ int end = string.indexOf('|');
+ if (end == -1) error(SWT.ERROR_NULL_ARGUMENT);
+ String version1 = string.substring(start, end);
+
+ start = end + 1;
+ end = string.indexOf('|', start);
+ if (end == -1) error(SWT.ERROR_NULL_ARGUMENT);
+ String name = string.substring(start, end);
+
+ start = end + 1;
+ end = string.indexOf('|', start);
+ if (end == -1) error(SWT.ERROR_NULL_ARGUMENT);
+ int height = 0;
+ try {
+ height = Integer.parseInt(string.substring(start, end));
+ } catch (NumberFormatException e) {
+ error(SWT.ERROR_NULL_ARGUMENT);
+ }
+
+ start = end + 1;
+ end = string.indexOf('|', start);
+ if (end == -1) error(SWT.ERROR_NULL_ARGUMENT);
+ int style = 0;
+ try {
+ style = Integer.parseInt(string.substring(start, end));
+ } catch (NumberFormatException e) {
+ error(SWT.ERROR_NULL_ARGUMENT);
+ }
+
+ start = end + 1;
+ end = string.indexOf('|', start);
+ if (end == -1) {
+ setName(name);
+ setHeight(height);
+ setStyle(style);
+ return;
+ }
+ String platform = string.substring(start, end);
+
+ start = end + 1;
+ end = string.indexOf('|', start);
+ if (end == -1) {
+ setName(name);
+ setHeight(height);
+ setStyle(style);
+ return;
+ }
+ String version2 = string.substring(start, end);
+
+ if (platform.equals("MOTIF") && version2.equals("1")) {
+ start = end + 1;
+ end = string.length();
+ if (end == -1) {
+ setName(name);
+ setHeight(height);
+ setStyle(style);
+ return;
+ }
+ String xlfd = string.substring(start, end);
+ setXlfd(xlfd);
+ return;
+ }
+ setName(name);
+ setHeight(height);
+ setStyle(style);
+}
+/**
+ * Constructs a new font data given a font name,
+ * the height of the desired font in points,
+ * and a font style.
+ *
+ * @param name the name of the font (must not be null)
+ * @param height the font height in points
+ * @param style a bit or combination of NORMAL, BOLD, ITALIC
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - when the font name is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
+ * </ul>
+ */
+public FontData(String name, int height, int style) {
+ if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (height < 0) error(SWT.ERROR_INVALID_ARGUMENT);
+ int dash = name.indexOf('-');
+ if (dash != -1) {
+ foundry = name.substring(0, dash);
+ fontFamily = name.substring(dash + 1);
+ } else {
+ fontFamily = name;
+ }
+ points = height * 10;
+ if ((style & SWT.BOLD) != 0) {
+ weight = "bold";
+ } else {
+ weight = "medium";
+ }
+ if ((style & SWT.ITALIC) != 0) {
+ slant = "i";
+ } else {
+ slant = "r";
+ }
+}
+
+
+
+/*
+ * Public getters
+ */
+
+/**
+ * Returns the height of the receiver in points.
+ *
+ * @return the height of this FontData
+ *
+ * @see #setHeight
+ */
+public int getHeight() {
+ return points / 10;
+}
+
+/**
+ * Returns the name of the receiver.
+ * On platforms that support font foundries, the return value will
+ * be the foundry followed by a dash ("-") followed by the face name.
+ *
+ * @return the name of this <code>FontData</code>
+ *
+ * @see #setName
+ */
+public String getName() {
+ StringBuffer buffer = new StringBuffer();
+ if (foundry != null) {
+ buffer.append(foundry);
+ buffer.append("-");
+ }
+ if (fontFamily != null) buffer.append(fontFamily);
+ return buffer.toString();
+}
+
+/**
+ * Returns the style of the receiver which is a bitwise OR of
+ * one or more of the <code>SWT</code> constants NORMAL, BOLD
+ * and ITALIC.
+ *
+ * @return the style of this <code>FontData</code>
+ *
+ * @see #setStyle
+ */
+public int getStyle() {
+ int style = 0;
+ if (weight.equals("bold"))
+ style |= SWT.BOLD;
+ if (slant.equals("i"))
+ style |= SWT.ITALIC;
+ return style;
+}
+
+/**
+ * WARNING: This method is only public on GTK.
+ * We need this in FontDialog, so we can't just get rid of it or make it private.
+ */
+public String getXlfd() {
+ String s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
+ s1 = s2 = s3 = s4 = s5 = s6 = s7 = s8 = s9 = s10 = s11 = s12 = s13 = s14 = "*";
+
+ if (foundry != null) s1 = foundry;
+ if (fontFamily != null) s2 = fontFamily;
+ if (weight != null) s3 = weight;
+ if (slant != null) s4 = slant;
+ if (setWidth != null) s5 = setWidth;
+ if (addStyle != null) s6 = addStyle;
+ if (pixels != 0) s7 = Integer.toString(pixels);
+ if (points != 0) s8 = Integer.toString(points);
+ if (horizontalResolution != 0) s9 = Integer.toString(horizontalResolution);
+ if (verticalResolution != 0) s10 = Integer.toString(verticalResolution);
+ if (spacing != null) s11 = spacing;
+// The following line has been intentionally commented.
+// we don not know the exact average width as in the font definition,
+// so if someone tries to get a similar font, they'd get something weird
+// if (averageWidth != 0) s12 = Integer.toString(averageWidth);
+ if (characterSetRegistry != null) s13 = characterSetRegistry;
+ if (characterSetName != null) s14 = characterSetName;
+
+ String xlfd = "-" + s1+ "-" + s2 + "-" + s3 + "-" + s4 + "-" + s5 + "-" + s6 + "-" + s7 + "-" + s8 + "-"
+ + s9 + "-" + s10 + "-" + s11 + "-" + s12 + "-" + s13 + "-" + s14;
+ return xlfd;
+}
+public static FontData gtk_new(String xlfd) {
+ FontData fontData = new FontData();
+ fontData.setXlfd(xlfd);
+ return fontData;
+}
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects which return <code>true</code> when passed to
+ * <code>equals</code> must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals
+ */
+public int hashCode () {
+ return getXlfd().hashCode();
+}
+/**
+ * Sets the height of the receiver. The parameter is
+ * specified in terms of points, where a point is one
+ * seventy-second of an inch.
+ *
+ * @param height the height of the <code>FontData</code>
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
+ * </ul>
+ *
+ * @see #getHeight
+ */
+public void setHeight(int height) {
+ if (height < 0) error(SWT.ERROR_INVALID_ARGUMENT);
+ points = height * 10;
+}
+
+/**
+ * Sets the locale of the receiver.
+ * <p>
+ * The locale determines which platform character set this
+ * font is going to use. Widgets and graphics operations that
+ * use this font will convert UNICODE strings to the platform
+ * character set of the specified locale.
+ * </p>
+ * <p>
+ * On platforms which there are multiple character sets for a
+ * given language/country locale, the variant portion of the
+ * locale will determine the character set.
+ * </p>
+ *
+ * @param locale the <code>String</code> representing a Locale object
+ * @see java.util.Locale#toString
+ */
+public void setLocale(String locale) {
+ lang = country = variant = null;
+ if (locale != null) {
+ char sep = '_';
+ int length = locale.length();
+ int firstSep, secondSep;
+
+ firstSep = locale.indexOf(sep);
+ if (firstSep == -1) {
+ firstSep = secondSep = length;
+ } else {
+ secondSep = locale.indexOf(sep, firstSep + 1);
+ if (secondSep == -1) secondSep = length;
+ }
+ if (firstSep > 0) lang = locale.substring(0, firstSep);
+ if (secondSep > firstSep + 1) country = locale.substring(firstSep + 1, secondSep);
+ if (length > secondSep + 1) variant = locale.substring(secondSep + 1);
+ }
+}
+/**
+ * Sets the name of the receiver.
+ * <p>
+ * Some platforms support font foundries. On these platforms, the name
+ * of the font specified in setName() may have one of the following forms:
+ * <ol>
+ * <li>a face name (for example, "courier")</li>
+ * <li>a foundry followed by a dash ("-") followed by a face name (for example, "adobe-courier")</li>
+ * </ol>
+ * In either case, the name returned from getName() will include the
+ * foundry.
+ * </p>
+ * <p>
+ * On platforms that do not support font foundries, only the face name
+ * (for example, "courier") is used in <code>setName()</code> and
+ * <code>getName()</code>.
+ * </p>
+ *
+ * @param name the name of the font data (must not be null)
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - when the font name is null</li>
+ * </ul>
+ *
+ * @see #getName
+ */
+public void setName(String name) {
+ if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ int dash = name.indexOf('-');
+ if (dash != -1) {
+ foundry = name.substring(0, dash);
+ fontFamily = name.substring(dash + 1);
+ } else {
+ fontFamily = name;
+ }
+}
+/**
+ * Sets the style of the receiver to the argument which must
+ * be a bitwise OR of one or more of the <code>SWT</code>
+ * constants NORMAL, BOLD and ITALIC.
+ *
+ * @param style the new style for this <code>FontData</code>
+ *
+ * @see #getStyle
+ */
+public void setStyle(int style) {
+ if ((style & SWT.BOLD) == SWT.BOLD)
+ weight = "bold";
+ else
+ weight = "medium";
+ if ((style & SWT.ITALIC) == SWT.ITALIC)
+ slant = "i";
+ else
+ slant = "r";
+}
+void setXlfd(String xlfd) {
+ int start, stop;
+ start = 1;
+ stop = xlfd.indexOf ("-", start);
+ foundry = xlfd.substring(start, stop);
+ if (foundry.equals("*")) foundry = null;
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ fontFamily = xlfd.substring(start, stop);
+ if (fontFamily.equals("*")) fontFamily = null;
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ weight = xlfd.substring(start, stop);
+ if (weight.equals("*")) weight = null;
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ slant = xlfd.substring(start, stop);
+ if (slant.equals("*")) slant = null;
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ setWidth = xlfd.substring(start, stop);
+ if (setWidth.equals("*")) setWidth = null;
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ addStyle = xlfd.substring(start, stop);
+ if (addStyle.equals("*")) addStyle = null;
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ String s = xlfd.substring(start, stop);
+ if (!s.equals("") && !s.equals("*"))
+ pixels = Integer.parseInt(s);
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ s = xlfd.substring(start, stop);
+ if (!s.equals("") && !s.equals("*"))
+ points = Integer.parseInt(s);
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ s = xlfd.substring(start, stop);
+ if (!s.equals("") && !s.equals("*"))
+ horizontalResolution = Integer.parseInt(s);
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ s = xlfd.substring(start, stop);
+ if (!s.equals("") && !s.equals("*"))
+ verticalResolution = Integer.parseInt(s);
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ spacing = xlfd.substring(start, stop);
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ s = xlfd.substring(start, stop);
+ if (!s.equals("") && !s.equals("*"))
+ averageWidth = Integer.parseInt(s);
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ characterSetRegistry = xlfd.substring(start, stop);
+ if (characterSetRegistry.equals("*")) characterSetRegistry = null;
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ characterSetName = xlfd.substring(start);
+ if (characterSetName.equals("*")) characterSetName = null;
+}
+/**
+ * Returns a string representation of the receiver which is suitable
+ * for constructing an equivalent instance using the
+ * <code>FontData(String)</code> constructor.
+ *
+ * @return a string representation of the FontData
+ *
+ * @see FontData
+ */
+public String toString() {
+ return "1|" + fontFamily + "|" + getHeight() + "|" + getStyle() + "|" +
+ "GTK|1|" + getXlfd();
+}
+
+/**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the <em>same</em> object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
+ *
+ * @see #hashCode
+ */
+public boolean equals (Object object) {
+ return (object == this) || ((object instanceof FontData) &&
+ getXlfd().equals(((FontData)object).getXlfd()));
+}
+void error(int code) {
+ throw new SWTError(code);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontMetrics.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontMetrics.java
new file mode 100644
index 0000000..b1bd432
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontMetrics.java
@@ -0,0 +1,122 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ * Instances of this class provide measurement information
+ * about fonts including ascent, descent, height, leading
+ * space between rows, and average character width.
+ * <code>FontMetrics</code> are obtained from <code>GC</code>s
+ * using the <code>getFontMetrics()</code> method.
+ *
+ * @see GC#getFontMetrics
+ */
+
+public final class FontMetrics {
+ int ascent, descent, averageCharWidth, leading, height;
+FontMetrics() {
+}
+/**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the <em>same</em> object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
+ *
+ * @see #hashCode
+ */
+public boolean equals (Object object) {
+ if (object == this) return true;
+ if (!(object instanceof FontMetrics)) return false;
+ FontMetrics metrics = (FontMetrics)object;
+ return ascent == metrics.ascent && descent == metrics.descent &&
+ averageCharWidth == metrics.averageCharWidth && leading == metrics.leading &&
+ height == metrics.height;
+}
+/**
+ * Returns the ascent of the font described by the receiver. A
+ * font's <em>ascent</em> is the distance from the baseline to the
+ * top of actual characters, not including any of the leading area,
+ * measured in pixels.
+ *
+ * @return the ascent of the font
+ */
+public int getAscent() {
+ return ascent;
+}
+/**
+ * Returns the average character width, measured in pixels,
+ * of the font described by the receiver.
+ *
+ * @return the average character width of the font
+ */
+public int getAverageCharWidth() {
+ return averageCharWidth;
+}
+/**
+ * Returns the descent of the font described by the receiver. A
+ * font's <em>descent</em> is the distance from the baseline to the
+ * bottom of actual characters, not including any of the leading area,
+ * measured in pixels.
+ *
+ * @return the descent of the font
+ */
+public int getDescent() {
+ return descent;
+}
+/**
+ * Returns the height of the font described by the receiver,
+ * measured in pixels. A font's <em>height</em> is the sum of
+ * its ascent, descent and leading area.
+ *
+ * @return the height of the font
+ *
+ * @see #getAscent
+ * @see #getDescent
+ * @see #getLeading
+ */
+public int getHeight() {
+ return height;
+}
+/**
+ * Returns the leading area of the font described by the
+ * receiver. A font's <em>leading area</em> is the space
+ * above its ascent which may include accents or other marks.
+ *
+ * @return the leading space of the font
+ */
+public int getLeading() {
+ return leading;
+}
+public static FontMetrics gtk_new(int fontHandle) {
+ GdkFont f = new GdkFont();
+ OS.memmove (f, fontHandle, GdkFont.sizeof);
+
+ FontMetrics fontMetrics = new FontMetrics();
+ fontMetrics.ascent = f.ascent;
+ fontMetrics.descent = f.descent;
+ fontMetrics.averageCharWidth = OS.gdk_char_width(fontHandle, (byte)'a');
+ fontMetrics.leading = 3;
+ fontMetrics.height = fontMetrics.ascent+fontMetrics.descent+3;
+ return fontMetrics;
+}
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects which return <code>true</code> when passed to
+ * <code>equals</code> must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals
+ */
+public int hashCode() {
+ return ascent ^ descent ^ averageCharWidth ^ leading ^ height;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
new file mode 100644
index 0000000..6b9b89e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
@@ -0,0 +1,1697 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.*;
+
+
+/**
+ * Class <code>GC</code> is where all of the drawing capabilities that are
+ * supported by SWT are located. Instances are used to draw on either an
+ * <code>Image</code>, a <code>Control</code>, or directly on a <code>Display</code>.
+ * <p>
+ * Application code must explicitly invoke the <code>GC.dispose()</code>
+ * method to release the operating system resources managed by each instance
+ * when those instances are no longer required. This is <em>particularly</em>
+ * important on Windows95 and Windows98 where the operating system has a limited
+ * number of device contexts available.
+ * </p>
+ *
+ * @see org.eclipse.swt.events.PaintEvent
+ */
+public final class GC {
+ /**
+ * the handle to the OS device context
+ * (Warning: This field is platform dependent)
+ */
+ public int handle;
+ Drawable drawable;
+ GCData data;
+
+
+/*
+ * === Constructors ===
+ */
+
+GC() {
+}
+
+/**
+ * Constructs a new instance of this class which has been
+ * configured to draw on the specified drawable. Sets the
+ * foreground and background color in the GC to match those
+ * in the drawable.
+ * <p>
+ * You must dispose the graphics context when it is no longer required.
+ * </p>
+ * @param drawable the drawable to draw on
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the drawable is null</li>
+ * <li>ERROR_INVALID_ARGUMENT
+ * - if the drawable is an image that is not a bitmap or an icon
+ * - if the drawable is an image or printer that is already selected
+ * into another graphics context</li>
+ * </ul>
+ */
+public GC(Drawable drawable) {
+ if (drawable == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+
+ data = new GCData();
+ handle = drawable.internal_new_GC(data);
+ this.drawable = drawable;
+
+ // The colors we get from the widget are not always right.
+ // Get the default GTK_STATE_NORMAL colors
+ setBackground( DefaultGtkStyle.instance().backgroundColorNORMAL() );
+ setForeground( DefaultGtkStyle.instance().foregroundColorNORMAL() );
+
+
+ // Feature in GDK.
+ // Sometimes, gdk_gc_new() doesn't get the font from the control,
+ // and also, some controls don't contain a font; so when the GC
+ // was created in internal_new_gc(), the font might or might not
+ // be set; if the font isn't there, just fall back to default.
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ if (values.font == 0) {
+ OS.gdk_gc_set_font(handle, DefaultGtkStyle.instance().loadDefaultFont() );
+ }
+
+ if (data.image != null) {
+ data.image.memGC = this;
+ /*
+ * The transparent pixel mask might change when drawing on
+ * the image. Destroy it so that it is regenerated when
+ * necessary.
+ */
+ //if (image.transparentPixel != -1) image.destroyMask();
+ }
+
+}
+
+
+
+/**
+ * Returns the background color.
+ *
+ * @return the receiver's background color
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+/*
+ * === Access - Get/Set ===
+ */
+
+public Color getBackground() {
+ if (handle == 0) error(SWT.ERROR_WIDGET_DISPOSED);
+ GdkColor gdkColor = _getBackgroundGdkColor();
+ return Color.gtk_new(gdkColor);
+}
+/**
+ * Sets the background color. The background color is used
+ * for fill operations and as the background color when text
+ * is drawn.
+ *
+ * @param color the new background color for the receiver
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setBackground(Color color) {
+ if (color == null) error(SWT.ERROR_NULL_ARGUMENT);
+ if (color.handle == null) error(SWT.ERROR_NULL_ARGUMENT);
+ if (handle == 0) error(SWT.ERROR_WIDGET_DISPOSED);
+ OS.gdk_gc_set_background(handle, color.handle);
+}
+
+/**
+ * Returns the receiver's foreground color.
+ *
+ * @return the color used for drawing foreground things
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Color getForeground() {
+ if (handle == 0) error(SWT.ERROR_WIDGET_DISPOSED);
+ GdkColor gdkColor = _getForegroundGdkColor();
+ return Color.gtk_new(gdkColor);
+}
+
+/**
+ * Sets the foreground color. The foreground color is used
+ * for drawing operations including when text is drawn.
+ *
+ * @param color the new foreground color for the receiver
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setForeground(Color color) {
+ if (handle == 0) error(SWT.ERROR_WIDGET_DISPOSED);
+ if (color == null) error(SWT.ERROR_NULL_ARGUMENT);
+ if (color.handle == null) error(SWT.ERROR_NULL_ARGUMENT);
+ OS.gdk_gc_set_foreground(handle, color.handle);
+}
+
+
+
+
+
+
+
+/**
+ * Returns the <em>advance width</em> of the specified character in
+ * the font which is currently selected into the receiver.
+ * <p>
+ * The advance width is defined as the horizontal distance the cursor
+ * should move after printing the character in the selected font.
+ * </p>
+ *
+ * @param ch the character to measure
+ * @return the distance in the x direction to move past the character before painting the next
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+/*
+ * === Access - Get - Calculated ===
+ */
+
+public int getAdvanceWidth(char ch) {
+ byte[] charBuffer = Converter.wcsToMbcs(null, new char[] { ch });
+ return OS.gdk_char_width(_getGCFont(), charBuffer[0]);
+}
+/**
+ * Returns the width of the specified character in the font
+ * selected into the receiver.
+ * <p>
+ * The width is defined as the space taken up by the actual
+ * character, not including the leading and tailing whitespace
+ * or overhang.
+ * </p>
+ *
+ * @param ch the character to measure
+ * @return the width of the character
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public int getCharWidth(char ch) {
+ byte[] charBuffer = Converter.wcsToMbcs(null, new char[] { ch });
+ int[] lbearing = new int[1];
+ int[] rbearing = new int[1];
+ int[] unused = new int[1];
+ OS.gdk_string_extents(_getGCFont(), charBuffer, lbearing, rbearing, unused, unused, unused);
+ return rbearing[0] - lbearing[0];
+}
+/**
+ * Returns the bounding rectangle of the receiver's clipping
+ * region. If no clipping region is set, the return value
+ * will be a rectangle which covers the entire bounds of the
+ * object the receiver is drawing on.
+ *
+ * @return the bounding rectangle of the clipping region
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Rectangle getClipping() {
+ if (data.clipRgn == 0) {
+ int[] width = new int[1]; int[] height = new int[1];
+ int[] unused = new int[1];
+ OS.gdk_window_get_geometry(data.drawable, unused, unused, width, height, unused);
+ return new Rectangle(0, 0, width[0], height[0]);
+ }
+ GdkRectangle rect = new GdkRectangle();
+ OS.gdk_region_get_clipbox(data.clipRgn, rect);
+ return new Rectangle(rect.x, rect.y, rect.width, rect.height);
+}
+/**
+ * Sets the region managed by the argument to the current
+ * clipping region of the receiver.
+ *
+ * @param region the region to fill with the clipping region
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the region is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void getClipping(Region region) {
+ if (region == null) error(SWT.ERROR_NULL_ARGUMENT);
+ int hRegion = region.handle;
+ if (data.clipRgn == 0) {
+ int[] width = new int[1]; int[] height = new int[1];
+ int[] unused = new int[1];
+ OS.gdk_window_get_geometry(data.drawable, unused, unused, width, height, unused);
+ hRegion = OS.gdk_region_new();
+ GdkRectangle rect = new GdkRectangle();
+ rect.x = 0; rect.y = 0;
+ rect.width = (short)width[0]; rect.height = (short)height[0];
+ region.handle = OS.gdk_region_union_with_rect(hRegion, rect);
+ return;
+ }
+ hRegion = OS.gdk_region_new();
+ region.handle = OS.gdk_regions_union(data.clipRgn, hRegion);
+}
+/**
+ * Returns the font currently being used by the receiver
+ * to draw and measure text.
+ *
+ * @return the receiver's font
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Font getFont() {
+ return Font.gtk_new(_getGCFont());
+}
+/**
+ * Returns a FontMetrics which contains information
+ * about the font currently being used by the receiver
+ * to draw and measure text.
+ *
+ * @return font metrics for the receiver's font
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+// Not done
+public FontMetrics getFontMetrics() {
+ int fontHandle = _getGCFont();
+ if (fontHandle==0) {
+ error(SWT.ERROR_UNSPECIFIED);
+ }
+ GdkFont gdkFont = new GdkFont();
+ OS.memmove(gdkFont, fontHandle, GdkFont.sizeof);
+ byte [] w = Converter.wcsToMbcs (null, "w", true);
+ return FontMetrics.gtk_new(fontHandle);
+}
+
+/**
+ * Returns the receiver's line style, which will be one
+ * of the constants <code>SWT.LINE_SOLID</code>, <code>SWT.LINE_DASH</code>,
+ * <code>SWT.LINE_DOT</code>, <code>SWT.LINE_DASHDOT</code> or
+ * <code>SWT.LINE_DASHDOTDOT</code>.
+ *
+ * @return the style used for drawing lines
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public int getLineStyle() {
+ return data.lineStyle;
+}
+/**
+ * Returns the width that will be used when drawing lines
+ * for all of the figure drawing operations (that is,
+ * <code>drawLine</code>, <code>drawRectangle</code>,
+ * <code>drawPolyline</code>, and so forth.
+ *
+ * @return the receiver's line width
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public int getLineWidth() {
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ return values.line_width;
+}
+/**
+ * Returns <code>true</code> if this GC is drawing in the mode
+ * where the resulting color in the destination is the
+ * <em>exclusive or</em> of the color values in the source
+ * and the destination, and <code>false</code> if it is
+ * drawing in the mode where the destination color is being
+ * replaced with the source color value.
+ *
+ * @return <code>true</code> true if the receiver is in XOR mode, and false otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public boolean getXORMode() {
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ return values.function == OS.GDK_XOR;
+}
+/**
+ * Returns <code>true</code> if the receiver has a clipping
+ * region set into it, and <code>false</code> otherwise.
+ * If this method returns false, the receiver will draw on all
+ * available space in the destination. If it returns true,
+ * it will draw only in the area that is covered by the region
+ * that can be accessed with <code>getClipping(region)</code>.
+ *
+ * @return <code>true</code> if the GC has a clipping region, and <code>false</code> otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public boolean isClipped() {
+ return data.clipRgn != 0;
+}
+
+
+/**
+ * Sets the area of the receiver which can be changed
+ * by drawing operations to the rectangular area specified
+ * by the arguments.
+ *
+ * @param x the x coordinate of the clipping rectangle
+ * @param y the y coordinate of the clipping rectangle
+ * @param width the width of the clipping rectangle
+ * @param height the height of the clipping rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setClipping(int x, int y, int width, int height) {
+ if (data.clipRgn == 0) data.clipRgn = OS.gdk_region_new();
+ GdkRectangle rect = new GdkRectangle();
+ rect.x = (short)x; rect.y = (short)y;
+ rect.width = (short)width; rect.height = (short)height;
+ OS.gdk_gc_set_clip_rectangle(handle, rect);
+ data.clipRgn = OS.gdk_regions_subtract(data.clipRgn, data.clipRgn);
+ data.clipRgn = OS.gdk_region_union_with_rect(data.clipRgn, rect);
+}
+/**
+ * Sets the area of the receiver which can be changed
+ * by drawing operations to the rectangular area specified
+ * by the argument.
+ *
+ * @param rect the clipping rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setClipping(Rectangle rect) {
+ if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
+ setClipping (rect.x, rect.y, rect.width, rect.height);
+}
+/**
+ * Sets the area of the receiver which can be changed
+ * by drawing operations to the region specified
+ * by the argument.
+ *
+ * @param rect the clipping region.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setClipping(Region region) {
+ if (data.clipRgn == 0) data.clipRgn = OS.gdk_region_new();
+ if (region == null) {
+ data.clipRgn = OS.gdk_regions_subtract(data.clipRgn, data.clipRgn);
+ OS.gdk_gc_set_clip_mask(handle, OS.GDK_NONE);
+ } else {
+ data.clipRgn = OS.gdk_regions_subtract(data.clipRgn, data.clipRgn);
+ data.clipRgn = OS.gdk_regions_union(region.handle, data.clipRgn);
+ OS.gdk_gc_set_clip_region(handle, region.handle);
+ }
+}
+/**
+ * Sets the font which will be used by the receiver
+ * to draw and measure text to the argument. If the
+ * argument is null, then a default font appropriate
+ * for the platform will be used instead.
+ *
+ * @param font the new font for the receiver, or null to indicate a default font
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the font has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setFont(Font font) {
+ int fontHandle = 0;
+ if (font == null) {
+ GtkStyle gtkStyle = new GtkStyle();
+ int style = OS.gtk_widget_get_default_style();
+ OS.memmove(gtkStyle, style, GtkStyle.sizeof);
+ fontHandle = gtkStyle.font;
+ } else {
+ fontHandle = font.handle;
+ }
+ OS.gdk_gc_set_font(handle, fontHandle);
+}
+
+/**
+ * Sets the receiver's line style to the argument, which must be one
+ * of the constants <code>SWT.LINE_SOLID</code>, <code>SWT.LINE_DASH</code>,
+ * <code>SWT.LINE_DOT</code>, <code>SWT.LINE_DASHDOT</code> or
+ * <code>SWT.LINE_DASHDOTDOT</code>.
+ *
+ * @param lineStyle the style to be used for drawing lines
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setLineStyle(int lineStyle) {
+ switch (lineStyle) {
+ case SWT.LINE_SOLID:
+ this.data.lineStyle = lineStyle;
+ OS.gdk_gc_set_line_attributes(handle, 0, OS.GDK_LINE_SOLID, OS.GDK_CAP_BUTT, OS.GDK_JOIN_MITER);
+ return;
+ case SWT.LINE_DASH:
+ OS.gdk_gc_set_dashes(handle, 0, new byte[] {6, 2}, 2);
+ break;
+ case SWT.LINE_DOT:
+ OS.gdk_gc_set_dashes(handle, 0, new byte[] {3, 1}, 2);
+ break;
+ case SWT.LINE_DASHDOT:
+ OS.gdk_gc_set_dashes(handle, 0, new byte[] {6, 2, 3, 1}, 4);
+ break;
+ case SWT.LINE_DASHDOTDOT:
+ OS.gdk_gc_set_dashes(handle, 0, new byte[] {6, 2, 3, 1, 3, 1}, 6);
+ break;
+ default:
+ error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ this.data.lineStyle = lineStyle;
+ OS.gdk_gc_set_line_attributes(handle, 0, OS.GDK_LINE_DOUBLE_DASH, OS.GDK_CAP_BUTT, OS.GDK_JOIN_MITER);
+}
+/**
+ * Sets the width that will be used when drawing lines
+ * for all of the figure drawing operations (that is,
+ * <code>drawLine</code>, <code>drawRectangle</code>,
+ * <code>drawPolyline</code>, and so forth.
+ *
+ * @param lineWidth the width of a line
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setLineWidth(int width) {
+ if (data.lineStyle == SWT.LINE_SOLID) {
+ OS.gdk_gc_set_line_attributes(handle, width, OS.GDK_LINE_SOLID, OS.GDK_CAP_BUTT, OS.GDK_JOIN_MITER);
+ } else {
+ OS.gdk_gc_set_line_attributes(handle, width, OS.GDK_LINE_DOUBLE_DASH, OS.GDK_CAP_BUTT, OS.GDK_JOIN_MITER);
+ }
+}
+/**
+ * If the argument is <code>true</code>, puts the receiver
+ * in a drawing mode where the resulting color in the destination
+ * is the <em>exclusive or</em> of the color values in the source
+ * and the destination, and if the argument is <code>false</code>,
+ * puts the receiver in a drawing mode where the destination color
+ * is replaced with the source color value.
+ *
+ * @param xor if <code>true</code>, then <em>xor</em> mode is used, otherwise <em>source copy</em> mode is used
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setXORMode(boolean val) {
+ if (val) {
+ OS.gdk_gc_set_function(handle, OS.GDK_XOR);
+ } else {
+ OS.gdk_gc_set_function(handle, OS.GDK_COPY);
+ }
+}
+/**
+ * Returns the extent of the given string. No tab
+ * expansion or carriage return processing will be performed.
+ * <p>
+ * The <em>extent</em> of a string is the width and height of
+ * the rectangular area it would cover if drawn in a particular
+ * font (in this case, the current font in the receiver).
+ * </p>
+ *
+ * @param string the string to measure
+ * @return a point containing the extent of the string
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Point stringExtent(String string) {
+ if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
+ byte[] buffer = Converter.wcsToMbcs(null, string, true);
+ int width = OS.gdk_string_width(_getGCFont(), buffer);
+ int height = OS.gdk_string_height(_getGCFont(), buffer);
+ return new Point(width, height);
+}
+/**
+ * Returns the extent of the given string. Tab expansion and
+ * carriage return processing are performed.
+ * <p>
+ * The <em>extent</em> of a string is the width and height of
+ * the rectangular area it would cover if drawn in a particular
+ * font (in this case, the current font in the receiver).
+ * </p>
+ *
+ * @param string the string to measure
+ * @return a point containing the extent of the string
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Point textExtent(String string) {
+ if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
+ byte[] buffer = Converter.wcsToMbcs(null, string, true);
+ int width = OS.gdk_string_width(_getGCFont(), buffer);
+ int height = OS.gdk_string_height(_getGCFont(), buffer);
+ return new Point(width, height);
+}
+
+
+
+/*
+ * === Access - Internal utils ===
+ */
+
+private GdkGCValues _getGCValues() {
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ return values;
+}
+private GdkColor _getForegroundGdkColor() {
+ GdkGCValues values = _getGCValues();
+ GdkColor color = new GdkColor();
+ color.pixel = values.foreground_pixel;
+ color.red = values.foreground_red;
+ color.green = values.foreground_green;
+ color.blue = values.foreground_blue;
+ return color;
+}
+private GdkColor _getBackgroundGdkColor() {
+ GdkGCValues values = _getGCValues();
+ GdkColor color = new GdkColor();
+ color.pixel = values.background_pixel;
+ color.red = values.background_red;
+ color.green = values.background_green;
+ color.blue = values.background_blue;
+ return color;
+}
+private int _getGCFont() {
+ GdkGCValues values = _getGCValues();
+ if (values.font==0) {
+ SWT.error(SWT.ERROR_UNSPECIFIED);
+ }
+ return values.font;
+}
+
+
+
+/**
+ * Copies a rectangular area of the receiver at the source
+ * position onto the receiver at the destination position.
+ *
+ * @param srcX the x coordinate in the receiver of the area to be copied
+ * @param srcY the y coordinate in the receiver of the area to be copied
+ * @param width the width of the area to copy
+ * @param height the height of the area to copy
+ * @param destX the x coordinate in the receiver of the area to copy to
+ * @param destY the y coordinate in the receiver of the area to copy to
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+/*
+ * === Drawing operations proper ===
+ */
+
+public void copyArea(int srcX, int srcY, int width, int height, int destX, int destY) {
+ OS.gdk_window_copy_area(data.drawable, handle, destX, destY, data.drawable, srcX, srcY, width, height);
+}
+
+/**
+ * Draws the outline of a circular or elliptical arc
+ * within the specified rectangular area.
+ * <p>
+ * The resulting arc begins at <code>startAngle</code> and extends
+ * for <code>arcAngle</code> degrees, using the current color.
+ * Angles are interpreted such that 0 degrees is at the 3 o'clock
+ * position. A positive value indicates a counter-clockwise rotation
+ * while a negative value indicates a clockwise rotation.
+ * </p><p>
+ * The center of the arc is the center of the rectangle whose origin
+ * is (<code>x</code>, <code>y</code>) and whose size is specified by the
+ * <code>width</code> and <code>height</code> arguments.
+ * </p><p>
+ * The resulting arc covers an area <code>width + 1</code> pixels wide
+ * by <code>height + 1</code> pixels tall.
+ * </p>
+ *
+ * @param x the x coordinate of the upper-left corner of the arc to be drawn
+ * @param y the y coordinate of the upper-left corner of the arc to be drawn
+ * @param width the width of the arc to be drawn
+ * @param height the height of the arc to be drawn
+ * @param startAngle the beginning angle
+ * @param arcAngle the angular extent of the arc, relative to the start angle
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if any of the width, height or endAngle is zero.</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawArc(int x, int y, int width, int height, int startAngle, int endAngle) {
+ if (width < 0) {
+ x = x + width;
+ width = -width;
+ }
+ if (height < 0) {
+ y = y + height;
+ height = -height;
+ }
+ if (width == 0 || height == 0 || endAngle == 0) {
+ error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ OS.gdk_draw_arc(data.drawable, handle, 0, x, y, width, height, startAngle * 64, endAngle * 64);
+}
+/**
+ * Draws a rectangle, based on the specified arguments, which has
+ * the appearance of the platform's <em>focus rectangle</em> if the
+ * platform supports such a notion, and otherwise draws a simple
+ * rectangle in the receiver's forground color.
+ *
+ * @param x the x coordinate of the rectangle
+ * @param y the y coordinate of the rectangle
+ * @param width the width of the rectangle
+ * @param height the height of the rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #drawRectangle
+ */
+public void drawFocus(int x, int y, int width, int height) {
+ GtkStyle style = new GtkStyle();
+ int hStyle = OS.gtk_widget_get_default_style();
+ OS.memmove(style, hStyle, GtkStyle.sizeof);
+ GdkColor color = new GdkColor();
+ color.pixel = style.fg0_pixel;
+ color.red = style.fg0_red;
+ color.green = style.fg0_green;
+ color.blue = style.fg0_blue;
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ OS.gdk_gc_set_foreground(handle, color);
+ OS.gdk_draw_rectangle(data.drawable, handle, 0, x, y, width, height);
+ color.pixel = values.foreground_pixel;
+ color.red = values.foreground_red;
+ color.green = values.foreground_green;
+ color.blue = values.foreground_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+}
+/**
+ * Draws the given image in the receiver at the specified
+ * coordinates.
+ *
+ * @param image the image to draw
+ * @param x the x coordinate of where to draw
+ * @param y the y coordinate of where to draw
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the image is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the given coordinates are outside the bounds of the image</li>
+ * @exception SWTError <ul>
+ * <li>ERROR_NO_HANDLES - if no handles are available to perform the operation</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawImage(Image image, int x, int y) {
+ if (image == null) error(SWT.ERROR_NULL_ARGUMENT);
+ int pixmap = image.pixmap;
+ int [] unused = new int [1]; int [] width = new int [1]; int [] height = new int [1];
+ OS.gdk_window_get_geometry(pixmap, unused, unused, width, height, unused);
+ drawImage(image, 0, 0, width[0], height[0], x, y, width[0], height[0]);
+}
+
+/**
+ * Copies a rectangular area from the source image into a (potentially
+ * different sized) rectangular area in the receiver. If the source
+ * and destination areas are of differing sizes, then the source
+ * area will be stretched or shrunk to fit the destination area
+ * as it is copied. The copy fails if any of the given coordinates
+ * are negative or lie outside the bounds of their respective images.
+ *
+ * @param image the source image
+ * @param srcX the x coordinate in the source image to copy from
+ * @param srcY the y coordinate in the source image to copy from
+ * @param srcWidth the width in pixels to copy from the source
+ * @param srcHeight the height in pixels to copy from the source
+ * @param destX the x coordinate in the destination to copy to
+ * @param destY the y coordinate in the destination to copy to
+ * @param destWidth the width in pixels of the destination rectangle
+ * @param destHeight the height in pixels of the destination rectangle
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the image is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the given coordinates are outside the bounds of their respective images</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_NO_HANDLES - if no handles are available to perform the operation</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight) {
+ /* basic sanity checks */
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (srcWidth == 0 || srcHeight == 0 || destWidth == 0 || destHeight == 0) return;
+ if (srcX < 0 || srcY < 0 || srcWidth < 0 || srcHeight < 0 || destWidth < 0 || destHeight < 0) {
+ SWT.error (SWT.ERROR_INVALID_ARGUMENT);
+ }
+ if (srcImage == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (srcImage.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+
+ /* source image properties */
+ int[] width = new int[1];
+ int[] height = new int[1];
+ int[] unused = new int[1];
+ OS.gdk_window_get_geometry(srcImage.pixmap, unused, unused, width, height, unused);
+ if ((srcY + srcWidth > width[0]) ||
+ (srcY + srcHeight > height[0])) {
+ error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+
+ /* Special case: If we don't need to scale, and there is no alpha/mask,
+ * then we can just blit the image inside the X server - no net traffic
+ */
+ boolean needScaling = (srcWidth != destWidth) || (srcHeight != destHeight);
+ boolean simple = !needScaling & (srcImage.mask == 0);
+
+ if (simple) {
+ OS.gdk_draw_pixmap(data.drawable, handle, srcImage.pixmap,
+ srcX, srcY,
+ destX, destY,
+ width[0], height[0]);
+ return;
+ }
+
+
+ /* Fetch a local GdkPixbuf from server */
+ Pixbuffer pixbuf = new Pixbuffer(srcImage);
+
+ /* Scale if necessary */
+ if ((srcWidth != destWidth) || (srcHeight != destHeight)) {
+ double scale_x = (double)destWidth / (double)srcWidth;
+ double scale_y = (double)destHeight / (double)srcHeight;
+ double offset_x = - srcX * scale_x;
+ double offset_y = - srcY * scale_y;
+
+ int destSizePixbuf = GDKPIXBUF.gdk_pixbuf_new (
+ GDKPIXBUF.GDK_COLORSPACE_RGB,
+ true, 8, destWidth, destHeight);
+ GDKPIXBUF.gdk_pixbuf_scale(
+ pixbuf.handle, // src,
+ destSizePixbuf,
+ 0,
+ 0,
+ destWidth, destHeight,
+ offset_x, offset_y,
+ scale_x, scale_y,
+ GDKPIXBUF.GDK_INTERP_BILINEAR);
+ pixbuf.handle = destSizePixbuf;
+ }
+
+ /* Paint it */
+ GDKPIXBUF.gdk_pixbuf_render_to_drawable_alpha(
+ pixbuf.handle,
+ data.drawable,
+ 0, 0,
+ destX, destY,
+ destWidth, destHeight,
+ GDKPIXBUF.GDK_PIXBUF_ALPHA_BILEVEL, 128,
+ GDKPIXBUF.GDK_RGB_DITHER_NORMAL,
+ 0, 0
+ );
+}
+
+/**
+ * Draws a line, using the foreground color, between the points
+ * (<code>x1</code>, <code>y1</code>) and (<code>x2</code>, <code>y2</code>).
+ *
+ * @param x1 the first point's x coordinate
+ * @param y1 the first point's y coordinate
+ * @param x2 the second point's x coordinate
+ * @param y2 the second point's y coordinate
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawLine(int x1, int y1, int x2, int y2) {
+ OS.gdk_draw_line (data.drawable, handle, x1, y1, x2, y2);
+}
+/**
+ * Draws the outline of an oval, using the foreground color,
+ * within the specified rectangular area.
+ * <p>
+ * The result is a circle or ellipse that fits within the
+ * rectangle specified by the <code>x</code>, <code>y</code>,
+ * <code>width</code>, and <code>height</code> arguments.
+ * </p><p>
+ * The oval covers an area that is <code>width + 1</code>
+ * pixels wide and <code>height + 1</code> pixels tall.
+ * </p>
+ *
+ * @param x the x coordinate of the upper left corner of the oval to be drawn
+ * @param y the y coordinate of the upper left corner of the oval to be drawn
+ * @param width the width of the oval to be drawn
+ * @param height the height of the oval to be drawn
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawOval(int x, int y, int width, int height) {
+ if (width < 0) {
+ x = x + width;
+ width = -width;
+ }
+ if (height < 0) {
+ y = y + height;
+ height = -height;
+ }
+ OS.gdk_draw_arc(data.drawable, handle, 0, x, y, width, height, 0, 23040);
+}
+/**
+ * Draws the closed polygon which is defined by the specified array
+ * of integer coordinates, using the receiver's foreground color. The array
+ * contains alternating x and y values which are considered to represent
+ * points which are the vertices of the polygon. Lines are drawn between
+ * each consecutive pair, and between the first pair and last pair in the
+ * array.
+ *
+ * @param pointArray an array of alternating x and y values which are the vertices of the polygon
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT if pointArray is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawPolygon(int[] pointArray) {
+ if (pointArray == null) error(SWT.ERROR_NULL_ARGUMENT);
+ short[] points = new short[pointArray.length];
+ for (int i = 0; i < pointArray.length; i++) {
+ points[i] = (short)pointArray[i];
+ }
+ OS.gdk_draw_polygon(data.drawable, handle, 0, points, points.length / 2);
+}
+/**
+ * Draws the polyline which is defined by the specified array
+ * of integer coordinates, using the receiver's foreground color. The array
+ * contains alternating x and y values which are considered to represent
+ * points which are the corners of the polyline. Lines are drawn between
+ * each consecutive pair, but not between the first pair and last pair in
+ * the array.
+ *
+ * @param pointArray an array of alternating x and y values which are the corners of the polyline
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the point array is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawPolyline(int[] pointArray) {
+ if (pointArray == null) error(SWT.ERROR_NULL_ARGUMENT);
+ short[] points = new short[pointArray.length];
+ for (int i = 0; i < pointArray.length; i++) {
+ points[i] = (short)pointArray[i];
+ }
+ OS.gdk_draw_lines(data.drawable, handle, points, points.length / 2);
+}
+/**
+ * Draws the outline of the rectangle specified by the arguments,
+ * using the receiver's foreground color. The left and right edges
+ * of the rectangle are at <code>x</code> and <code>x + width</code>.
+ * The top and bottom edges are at <code>y</code> and <code>y + height</code>.
+ *
+ * @param x the x coordinate of the rectangle to be drawn
+ * @param y the y coordinate of the rectangle to be drawn
+ * @param width the width of the rectangle to be drawn
+ * @param height the height of the rectangle to be drawn
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawRectangle(int x, int y, int width, int height) {
+ if (width < 0) {
+ x = x + width;
+ width = -width;
+ }
+ if (height < 0) {
+ y = y + height;
+ height = -height;
+ }
+ OS.gdk_draw_rectangle(data.drawable, handle, 0, x, y, width, height);
+}
+/**
+ * Draws the outline of the specified rectangle, using the receiver's
+ * foreground color. The left and right edges of the rectangle are at
+ * <code>rect.x</code> and <code>rect.x + rect.width</code>. The top
+ * and bottom edges are at <code>rect.y</code> and
+ * <code>rect.y + rect.height</code>.
+ *
+ * @param rect the rectangle to draw
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the rectangle is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawRectangle(Rectangle rect) {
+ if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
+ drawRectangle (rect.x, rect.y, rect.width, rect.height);
+}
+/**
+ * Draws the outline of the round-cornered rectangle specified by
+ * the arguments, using the receiver's foreground color. The left and
+ * right edges of the rectangle are at <code>x</code> and <code>x + width</code>.
+ * The top and bottom edges are at <code>y</code> and <code>y + height</code>.
+ * The <em>roundness</em> of the corners is specified by the
+ * <code>arcWidth</code> and <code>arcHeight</code> arguments.
+ *
+ * @param x the x coordinate of the rectangle to be drawn
+ * @param y the y coordinate of the rectangle to be drawn
+ * @param width the width of the rectangle to be drawn
+ * @param height the height of the rectangle to be drawn
+ * @param arcWidth the horizontal diameter of the arc at the four corners
+ * @param arcHeight the vertical diameter of the arc at the four corners
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight) {
+ int nx = x;
+ int ny = y;
+ int nw = width;
+ int nh = height;
+ int naw = arcWidth;
+ int nah = arcHeight;
+
+ if (nw < 0) {
+ nw = 0 - nw;
+ nx = nx - nw;
+ }
+ if (nh < 0) {
+ nh = 0 - nh;
+ ny = ny -nh;
+ }
+ if (naw < 0) naw = 0 - naw;
+ if (nah < 0) nah = 0 - nah;
+
+ int naw2 = Compatibility.floor(naw, 2);
+ int nah2 = Compatibility.floor(nah, 2);
+
+ OS.gdk_draw_arc(data.drawable, handle, 0, nx, ny, naw, nah, 5760, 5760);
+ OS.gdk_draw_arc(data.drawable, handle, 0, nx, ny + nh - nah, naw, nah, 11520, 5760);
+ OS.gdk_draw_arc(data.drawable, handle, 0, nx + nw - naw, ny + nh - nah, naw, nah, 17280, 5760);
+ OS.gdk_draw_arc(data.drawable, handle, 0, nx + nw - naw, ny, naw, nah, 0, 5760);
+ OS.gdk_draw_line(data.drawable, handle, nx + naw2, ny, nx + nw - naw2, ny);
+ OS.gdk_draw_line(data.drawable, handle, nx,ny + nah2, nx, ny + nh - nah2);
+ OS.gdk_draw_line(data.drawable, handle, nx + naw2, ny + nh, nx + nw - naw2, ny + nh);
+ OS.gdk_draw_line(data.drawable, handle, nx + nw, ny + nah2, nx + nw, ny + nh - nah2);
+}
+/**
+ * Draws the given string, using the receiver's current font and
+ * foreground color. No tab expansion or carriage return processing
+ * will be performed. The background of the rectangular area where
+ * the string is being drawn will be filled with the receiver's
+ * background color.
+ *
+ * @param string the string to be drawn
+ * @param x the x coordinate of the top left corner of the rectangular area where the string is to be drawn
+ * @param y the y coordinate of the top left corner of the rectangular area where the string is to be drawn
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawString (String string, int x, int y) {
+ drawString(string, x, y, false);
+}
+/**
+ * Draws the given string, using the receiver's current font and
+ * foreground color. No tab expansion or carriage return processing
+ * will be performed. If <code>isTransparent</code> is <code>true</code>,
+ * then the background of the rectangular area where the string is being
+ * drawn will not be modified, otherwise it will be filled with the
+ * receiver's background color.
+ *
+ * @param string the string to be drawn
+ * @param x the x coordinate of the top left corner of the rectangular area where the string is to be drawn
+ * @param y the y coordinate of the top left corner of the rectangular area where the string is to be drawn
+ * @param isTransparent if <code>true</code> the background will be transparent, otherwise it will be opaque
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawString(String string, int x, int y, boolean isTransparent) {
+ if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
+ byte[] buffer = Converter.wcsToMbcs(null, string, true);
+ byte[] buffer1 = Converter.wcsToMbcs(null, "Y", true);
+ int[] unused = new int[1];
+ int[] width = new int[1];
+ int[] ascent = new int[1];
+ int[] average_ascent = new int [1];
+ int fontHandle = _getGCFont();
+ OS.gdk_string_extents(fontHandle, buffer, unused, unused, width, ascent, unused);
+ OS.gdk_string_extents(fontHandle, buffer1, unused, unused, unused, average_ascent, unused);
+ if (ascent[0]<average_ascent[0]) ascent[0] = average_ascent[0];
+ if (!isTransparent) {
+ int height = OS.gdk_string_height(fontHandle, buffer);
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ GdkColor color = new GdkColor();
+ color.pixel = values.background_pixel;
+ color.red = values.background_red;
+ color.green = values.background_green;
+ color.blue = values.background_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+ OS.gdk_draw_rectangle(data.drawable, handle, 1, x, y, width[0], height);
+ color.pixel = values.foreground_pixel;
+ color.red = values.foreground_red;
+ color.green = values.foreground_green;
+ color.blue = values.foreground_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+ }
+ OS.gdk_draw_string(data.drawable, fontHandle, handle, x, y + ascent[0], buffer);
+}
+/**
+ * Draws the given string, using the receiver's current font and
+ * foreground color. Tab expansion and carriage return processing
+ * are performed. The background of the rectangular area where
+ * the text is being drawn will be filled with the receiver's
+ * background color.
+ *
+ * @param string the string to be drawn
+ * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
+ * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawText(String string, int x, int y) {
+ drawText(string, x, y, false);
+}
+/**
+ * Draws the given string, using the receiver's current font and
+ * foreground color. Tab expansion and carriage return processing
+ * are performed. If <code>isTransparent</code> is <code>true</code>,
+ * then the background of the rectangular area where the text is being
+ * drawn will not be modified, otherwise it will be filled with the
+ * receiver's background color.
+ *
+ * @param string the string to be drawn
+ * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
+ * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
+ * @param isTransparent if <code>true</code> the background will be transparent, otherwise it will be opaque
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawText(String string, int x, int y, boolean isTransparent) {
+ if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
+ byte[] buffer = Converter.wcsToMbcs(null, string, true);
+ byte[] buffer1 = Converter.wcsToMbcs(null, "Y", true);
+ int fontHandle = _getGCFont();
+ int[] unused = new int[1];
+ int[] width = new int[1];
+ int[] ascent = new int[1];
+ int[] average_ascent = new int [1];
+ OS.gdk_string_extents(fontHandle, buffer, unused, unused, width, ascent, unused);
+ OS.gdk_string_extents(fontHandle, buffer1, unused, unused, unused, average_ascent, unused);
+ if (ascent[0]<average_ascent[0]) ascent[0] = average_ascent[0];
+ if (!isTransparent) {
+ int height = OS.gdk_string_height(fontHandle, buffer);
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ GdkColor color = new GdkColor();
+ color.pixel = values.background_pixel;
+ color.red = values.background_red;
+ color.green = values.background_green;
+ color.blue = values.background_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+ OS.gdk_draw_rectangle(data.drawable, handle, 1, x, y, width[0], height);
+ color.pixel = values.foreground_pixel;
+ color.red = values.foreground_red;
+ color.green = values.foreground_green;
+ color.blue = values.foreground_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+ }
+ OS.gdk_draw_string(data.drawable, fontHandle, handle, x, y + ascent[0], buffer);
+}
+
+/**
+ * Draws the given string, using the receiver's current font and
+ * foreground color. Tab expansion, line delimiter and mnemonic
+ * processing are performed according to the specified flags. If
+ * <code>flags</code> includes <code>DRAW_TRANSPARENT</code>,
+ * then the background of the rectangular area where the text is being
+ * drawn will not be modified, otherwise it will be filled with the
+ * receiver's background color.
+ * <p>
+ * The parameter <code>flags</code> may be a combination of:
+ * <dl>
+ * <dt><b>DRAW_DELIMITER</b></dt>
+ * <dd>draw multiple lines</dd>
+ * <dt><b>DRAW_TAB</b></dt>
+ * <dd>expand tabs</dd>
+ * <dt><b>DRAW_MNEMONIC</b></dt>
+ * <dd>underline the mnemonic character</dd>
+ * <dt><b>DRAW_TRANSPARENT</b></dt>
+ * <dd>transparent background</dd>
+ * </dl>
+ * </p>
+ *
+ * @param string the string to be drawn
+ * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
+ * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
+ * @param flags the flags specifing how to process the text
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawText (String string, int x, int y, int flags) {
+ // NOT IMPLEMENTED
+ drawText(string, x, y, (flags & SWT.DRAW_TRANSPARENT) != 0);
+}
+
+/**
+ * Fills the interior of a circular or elliptical arc within
+ * the specified rectangular area, with the receiver's background
+ * color.
+ * <p>
+ * The resulting arc begins at <code>startAngle</code> and extends
+ * for <code>arcAngle</code> degrees, using the current color.
+ * Angles are interpreted such that 0 degrees is at the 3 o'clock
+ * position. A positive value indicates a counter-clockwise rotation
+ * while a negative value indicates a clockwise rotation.
+ * </p><p>
+ * The center of the arc is the center of the rectangle whose origin
+ * is (<code>x</code>, <code>y</code>) and whose size is specified by the
+ * <code>width</code> and <code>height</code> arguments.
+ * </p><p>
+ * The resulting arc covers an area <code>width + 1</code> pixels wide
+ * by <code>height + 1</code> pixels tall.
+ * </p>
+ *
+ * @param x the x coordinate of the upper-left corner of the arc to be filled
+ * @param y the y coordinate of the upper-left corner of the arc to be filled
+ * @param width the width of the arc to be filled
+ * @param height the height of the arc to be filled
+ * @param startAngle the beginning angle
+ * @param arcAngle the angular extent of the arc, relative to the start angle
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if any of the width, height or endAngle is zero.</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #drawArc
+ */
+public void fillArc(int x, int y, int width, int height, int startAngle, int endAngle) {
+ if (width < 0) {
+ x = x + width;
+ width = -width;
+ }
+ if (height < 0) {
+ y = y + height;
+ height = -height;
+ }
+ if (width == 0 || height == 0 || endAngle == 0) {
+ error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ GdkColor color = new GdkColor();
+ color.pixel = values.background_pixel;
+ color.red = values.background_red;
+ color.green = values.background_green;
+ color.blue = values.background_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+ OS.gdk_draw_arc(data.drawable, handle, 1, x, y, width, height, startAngle * 64, endAngle * 64);
+ color.pixel = values.foreground_pixel;
+ color.red = values.foreground_red;
+ color.green = values.foreground_green;
+ color.blue = values.foreground_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+}
+
+/**
+ * Fills the interior of the specified rectangle with a gradient
+ * sweeping from left to right or top to bottom progressing
+ * from the receiver's foreground color to its background color.
+ *
+ * @param x the x coordinate of the rectangle to be filled
+ * @param y the y coordinate of the rectangle to be filled
+ * @param width the width of the rectangle to be filled, may be negative
+ * (inverts direction of gradient if horizontal)
+ * @param height the height of the rectangle to be filled, may be negative
+ * (inverts direction of gradient if vertical)
+ * @param vertical if true sweeps from top to bottom, else
+ * sweeps from left to right
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #drawRectangle
+ */
+public void fillGradientRectangle(int x, int y, int width, int height, boolean vertical) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if ((width == 0) || (height == 0)) return;
+
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ GdkColor foregroundGdkColor = new GdkColor();
+
+ RGB backgroundRGB, foregroundRGB;
+ backgroundRGB = Color.gtk_getRGBIntensities(_getBackgroundGdkColor());
+ foregroundRGB = Color.gtk_getRGBIntensities(_getForegroundGdkColor());
+
+ RGB fromRGB, toRGB;
+ fromRGB = foregroundRGB;
+ toRGB = backgroundRGB;
+ boolean swapColors = false;
+ if (width < 0) {
+ x += width; width = -width;
+ if (! vertical) swapColors = true;
+ }
+ if (height < 0) {
+ y += height; height = -height;
+ if (vertical) swapColors = true;
+ }
+ if (swapColors) {
+ fromRGB = backgroundRGB;
+ toRGB = foregroundRGB;
+ }
+ if (fromRGB == toRGB) {
+ fillRectangle(x, y, width, height);
+ return;
+ }
+ ImageData.fillGradientRectangle(this, Display.getCurrent(),
+ x, y, width, height, vertical, fromRGB, toRGB,
+ 8, 8, 8);
+}
+
+/**
+ * Fills the interior of an oval, within the specified
+ * rectangular area, with the receiver's background
+ * color.
+ *
+ * @param x the x coordinate of the upper left corner of the oval to be filled
+ * @param y the y coordinate of the upper left corner of the oval to be filled
+ * @param width the width of the oval to be filled
+ * @param height the height of the oval to be filled
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #drawOval
+ */
+public void fillOval(int x, int y, int width, int height) {
+ if (width < 0) {
+ x = x + width;
+ width = -width;
+ }
+ if (height < 0) {
+ y = y + height;
+ height = -height;
+ }
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ GdkColor color = new GdkColor();
+ color.pixel = values.background_pixel;
+ color.red = values.background_red;
+ color.green = values.background_green;
+ color.blue = values.background_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+ OS.gdk_draw_arc(data.drawable, handle, 1, x, y, width, height, 0, 23040);
+ color.pixel = values.foreground_pixel;
+ color.red = values.foreground_red;
+ color.green = values.foreground_green;
+ color.blue = values.foreground_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+}
+/**
+ * Fills the interior of the closed polygon which is defined by the
+ * specified array of integer coordinates, using the receiver's
+ * background color. The array contains alternating x and y values
+ * which are considered to represent points which are the vertices of
+ * the polygon. Lines are drawn between each consecutive pair, and
+ * between the first pair and last pair in the array.
+ *
+ * @param pointArray an array of alternating x and y values which are the vertices of the polygon
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT if pointArray is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #drawPolygon
+ */
+public void fillPolygon(int[] pointArray) {
+ if (pointArray == null) error(SWT.ERROR_NULL_ARGUMENT);
+ short[] points = new short[pointArray.length];
+ for (int i = 0; i < pointArray.length; i++) {
+ points[i] = (short)pointArray[i];
+ }
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ GdkColor color = new GdkColor();
+ color.pixel = values.background_pixel;
+ color.red = values.background_red;
+ color.green = values.background_green;
+ color.blue = values.background_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+ OS.gdk_draw_polygon(data.drawable, handle, 1, points, points.length / 2);
+ color.pixel = values.foreground_pixel;
+ color.red = values.foreground_red;
+ color.green = values.foreground_green;
+ color.blue = values.foreground_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+}
+/**
+ * Fills the interior of the rectangle specified by the arguments,
+ * using the receiver's background color.
+ *
+ * @param x the x coordinate of the rectangle to be filled
+ * @param y the y coordinate of the rectangle to be filled
+ * @param width the width of the rectangle to be filled
+ * @param height the height of the rectangle to be filled
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #drawRectangle
+ */
+public void fillRectangle(int x, int y, int width, int height) {
+ if (width < 0) {
+ x = x + width;
+ width = -width;
+ }
+ if (height < 0) {
+ y = y + height;
+ height = -height;
+ }
+
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ GdkColor color = new GdkColor();
+ color.pixel = values.background_pixel;
+ color.red = values.background_red;
+ color.green = values.background_green;
+ color.blue = values.background_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+ OS.gdk_draw_rectangle(data.drawable, handle, 1, x, y, width, height);
+ color.pixel = values.foreground_pixel;
+ color.red = values.foreground_red;
+ color.green = values.foreground_green;
+ color.blue = values.foreground_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+}
+/**
+ * Fills the interior of the specified rectangle, using the receiver's
+ * background color.
+ *
+ * @param rectangle the rectangle to be filled
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the rectangle is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #drawRectangle
+ */
+public void fillRectangle(Rectangle rect) {
+ if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
+ fillRectangle(rect.x, rect.y, rect.width, rect.height);
+}
+/**
+ * Fills the interior of the round-cornered rectangle specified by
+ * the arguments, using the receiver's background color.
+ *
+ * @param x the x coordinate of the rectangle to be filled
+ * @param y the y coordinate of the rectangle to be filled
+ * @param width the width of the rectangle to be filled
+ * @param height the height of the rectangle to be filled
+ * @param arcWidth the horizontal diameter of the arc at the four corners
+ * @param arcHeight the vertical diameter of the arc at the four corners
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #drawRoundRectangle
+ */
+public void fillRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight) {
+ int nx = x;
+ int ny = y;
+ int nw = width;
+ int nh = height;
+ int naw = arcWidth;
+ int nah = arcHeight;
+
+ if (nw < 0) {
+ nw = 0 - nw;
+ nx = nx - nw;
+ }
+ if (nh < 0) {
+ nh = 0 - nh;
+ ny = ny -nh;
+ }
+ if (naw < 0)
+ naw = 0 - naw;
+ if (nah < 0)
+ nah = 0 - nah;
+
+ naw = Math.min(naw,nw);
+ nah = Math.min(nah, nh);
+
+ int naw2 = Compatibility.round(naw, 2);
+ int nah2 = Compatibility.round(nah, 2);
+
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ GdkColor color = new GdkColor();
+ color.pixel = values.background_pixel;
+ color.red = values.background_red;
+ color.green = values.background_green;
+ color.blue = values.background_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+ OS.gdk_draw_arc(data.drawable, handle, 1, nx, ny, naw, nah, 5760, 5760);
+ OS.gdk_draw_arc(data.drawable, handle, 1, nx, ny + nh - nah, naw, nah, 11520, 5760);
+ OS.gdk_draw_arc(data.drawable, handle, 1, nx + nw - naw, ny + nh - nah, naw, nah, 17280, 5760);
+ OS.gdk_draw_arc(data.drawable, handle, 1, nx + nw - naw, ny, naw, nah, 0, 5760);
+ OS.gdk_draw_rectangle(data.drawable, handle, 1, nx + naw2, ny, nw - naw, nh);
+ OS.gdk_draw_rectangle(data.drawable, handle, 1, nx, ny + nah2, naw2, nh - nah);
+ OS.gdk_draw_rectangle(data.drawable, handle, 1, nx + nw - (naw / 2), ny + nah2, naw2, nh -nah);
+ color.pixel = values.foreground_pixel;
+ color.red = values.foreground_red;
+ color.green = values.foreground_green;
+ color.blue = values.foreground_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+}
+
+/**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the <em>same</em> object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
+ *
+ * @see #hashCode
+ */
+/*
+ * === As yet unclassified ===
+ */
+
+public boolean equals(Object object) {
+ return (object == this) || ((object instanceof GC) && (handle == ((GC)object).handle));
+}
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects which return <code>true</code> when passed to
+ * <code>equals</code> must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #equals
+ */
+public int hashCode() {
+ return handle;
+}
+void error(int code) {
+ throw new SWTError(code);
+}
+/**
+ * Returns <code>true</code> if the GC has been disposed,
+ * and <code>false</code> otherwise.
+ * <p>
+ * This method gets the dispose state for the GC.
+ * When a GC has been disposed, it is an error to
+ * invoke any other method using the GC.
+ *
+ * @return <code>true</code> when the GC is disposed and <code>false</code> otherwise
+ */
+public boolean isDisposed() {
+ return handle == 0;
+}
+/**
+ * Disposes of the operating system resources associated with
+ * the graphics context. Applications must dispose of all GCs
+ * which they allocate.
+ */
+public void dispose() {
+ if (handle == 0) return;
+
+ /* Free resources */
+ int clipRgn = data.clipRgn;
+ if (clipRgn != 0) OS.gdk_region_destroy(clipRgn);
+ Image image = data.image;
+ if (image != null) image.memGC = null;
+
+ /* Dispose the GC */
+ if(drawable == null)
+ OS.gdk_gc_unref(handle);
+ else
+ drawable.internal_dispose_GC(handle, data);
+
+ data.drawable = // data.colormap = data.fontList =
+ data.clipRgn = data.renderTable = 0;
+ drawable = null;
+ data.image = null;
+ data = null;
+ handle = 0;
+
+}
+
+/**
+ * Returns the extent of the given string. Tab expansion, line
+ * delimiter and mnemonic processing are performed according to
+ * the specified flags, which can be a combination of:
+ * <dl>
+ * <dt><b>DRAW_DELIMITER</b></dt>
+ * <dd>draw multiple lines</dd>
+ * <dt><b>DRAW_TAB</b></dt>
+ * <dd>expand tabs</dd>
+ * <dt><b>DRAW_MNEMONIC</b></dt>
+ * <dd>underline the mnemonic character</dd>
+ * <dt><b>DRAW_TRANSPARENT</b></dt>
+ * <dd>transparent background</dd>
+ * </dl>
+ * <p>
+ * The <em>extent</em> of a string is the width and height of
+ * the rectangular area it would cover if drawn in a particular
+ * font (in this case, the current font in the receiver).
+ * </p>
+ *
+ * @param string the string to measure
+ * @param flags the flags specifing how to process the text
+ * @return a point containing the extent of the string
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Point textExtent(String string, int flags) {
+ //NOT IMPLEMENTED
+ return textExtent(string);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GCData.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GCData.java
new file mode 100644
index 0000000..0b3a703
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GCData.java
@@ -0,0 +1,28 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+
+/**
+ * Instances of this class are descriptions of GCs in terms
+ * of unallocated platform-specific data fields.
+ * <p>
+ * <b>IMPORTANT:</b> This class is <em>not</em> part of the public
+ * API for SWT. It is marked public only so that it can be shared
+ * within the packages provided by SWT. It is not available on all
+ * platforms, and should never be called from application code.
+ * </p>
+ *
+ * @private
+ */
+public class GCData {
+ public Image image;
+ public int drawable;
+ public int clipRgn;
+ public int lineStyle = SWT.LINE_SOLID;
+ public int renderTable;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java
new file mode 100644
index 0000000..c8d5f3f
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java
@@ -0,0 +1,638 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.*;
+import java.io.*;
+
+/**
+ * Instances of this class are graphics which have been prepared
+ * for display on a specific device. That is, they are ready
+ * to paint using methods such as <code>GC.drawImage()</code>
+ * and display on widgets with, for example, <code>Button.setImage()</code>.
+ * <p>
+ * If loaded from a file format that supports it, an
+ * <code>Image</code> may have transparency, meaning that certain
+ * pixels are specified as being transparent when drawn. Examples
+ * of file formats that support transparency are GIF and PNG.
+ * </p><p>
+ * There are two primary ways to use <code>Images</code>.
+ * The first is to load a graphic file from disk and create an
+ * <code>Image</code> from it. This is done using an <code>Image</code>
+ * constructor, for example:
+ * <pre>
+ * Image i = new Image(device, "C:\\graphic.bmp");
+ * </pre>
+ * A graphic file may contain a color table specifying which
+ * colors the image was intended to possess. In the above example,
+ * these colors will be mapped to the closest available color in
+ * SWT. It is possible to get more control over the mapping of
+ * colors as the image is being created, using code of the form:
+ * <pre>
+ * ImageData data = new ImageData("C:\\graphic.bmp");
+ * RGB[] rgbs = data.getRGBs();
+ * // At this point, rgbs contains specifications of all
+ * // the colors contained within this image. You may
+ * // allocate as many of these colors as you wish by
+ * // using the Color constructor Color(RGB), then
+ * // create the image:
+ * Image i = new Image(device, data);
+ * </pre>
+ * <p>
+ * Applications which require even greater control over the image
+ * loading process should use the support provided in class
+ * <code>ImageLoader</code>.
+ * </p><p>
+ * Application code must explicitely invoke the <code>Image.dispose()</code>
+ * method to release the operating system resources managed by each instance
+ * when those instances are no longer required.
+ * </p>
+ *
+ * @see Color
+ * @see ImageData
+ * @see ImageLoader
+ */
+public final class Image implements Drawable{
+
+ /**
+ * specifies whether the receiver is a bitmap or an icon
+ * (one of <code>SWT.BITMAP</code>, <code>SWT.ICON</code>)
+ */
+ public int type;
+
+ /**
+ * The handle to the OS pixmap resource.
+ * Warning: This field is platform dependent.
+ */
+ public int pixmap;
+
+ /**
+ * The handle to the OS mask resource.
+ * Warning: This field is platform dependent.
+ */
+ public int mask;
+
+ /**
+ * The device where this image was created.
+ */
+ Device device;
+
+ /**
+ * specifies the transparent pixel
+ * (Warning: This field is platform dependent)
+ */
+ int transparentPixel = -1;
+
+ /**
+ * The GC the image is currently selected in.
+ * Warning: This field is platform dependent.
+ */
+ GC memGC;
+
+ /**
+ * The alpha data of the image.
+ * Warning: This field is platform dependent.
+ */
+ byte[] alphaData;
+
+ /**
+ * The global alpha value to be used for every pixel.
+ * Warning: This field is platform dependent.
+ */
+ int alpha = -1;
+
+ /**
+ * Specifies the default scanline padding.
+ * Warning: This field is platform dependent.
+ */
+ static final int DEFAULT_SCANLINE_PAD = 4;
+
+
+
+/*
+ * CONSTRUCTORS
+ */
+
+Image() {
+}
+
+/**
+ * Constructs an empty instance of this class with the
+ * specified width and height. The result may be drawn upon
+ * by creating a GC and using any of its drawing operations,
+ * as shown in the following example:
+ * <pre>
+ * Image i = new Image(device, width, height);
+ * GC gc = new GC(i);
+ * gc.drawRectangle(0, 0, 50, 50);
+ * gc.dispose();
+ * </pre>
+ *
+ * @param device the device on which to create the image
+ * @param width the width of the new image
+ * @param height the height of the new image
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if either the width or height is negative</li>
+ * </ul>
+ */
+public Image(Device display, int width, int height) {
+ init(display, width, height);
+}
+
+/**
+ * Constructs a new instance of this class based on the
+ * provided image, with an appearance that varies depending
+ * on the value of the flag. The possible flag values are:
+ * <dl>
+ * <dt><b>IMAGE_COPY</b></dt>
+ * <dd>the result is an identical copy of srcImage</dd>
+ * <dt><b>IMAGE_DISABLE</b></dt>
+ * <dd>the result is a copy of srcImage which has a <em>disabled</em> look</dd>
+ * <dt><b>IMAGE_GRAY</b></dt>
+ * <dd>the result is a copy of srcImage which has a <em>gray scale</em> look</dd>
+ * </dl>
+ *
+ * @param device the device on which to create the image
+ * @param srcImage the image to use as the source
+ * @param flag the style, either <code>IMAGE_COPY</code>, <code>IMAGE_DISABLE</code> or <code>IMAGE_GRAY</code>
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if srcImage is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the flag is not one of <code>IMAGE_COPY</code>, <code>IMAGE_DISABLE</code> or <code>IMAGE_GRAY</code></li>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon, or
+ * is otherwise in an invalid state</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_NO_HANDLES if a handle could not be obtained for image creation</li>
+ * </ul>
+ */
+public Image(Device device, Image srcImage, int flag) {
+ /* basic sanity */
+ if (device == null) device = Device.getDevice();
+ if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ this.device = device;
+ if (srcImage == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (srcImage.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ this.type = srcImage.type;
+ this.mask = 0;
+
+ /* this is somewhat ugly, because this dilutes the encapsulation
+ * of knowledge about what the cloning operations do (e.g., the
+ * following lines assume graying and disabling don't change alpha)
+ */
+ this.alphaData = srcImage.alphaData;
+ this.alpha = srcImage.alpha;
+ this.transparentPixel = srcImage.transparentPixel;
+ // bogus - are we sure about memGC?
+
+ /* Special case:
+ * If all we want is just a clone of the existing pixmap, it can
+ * be done entirely in the X server, without copying across the net.
+ */
+ if (flag == SWT.IMAGE_COPY) {
+ int[] unused = new int[1];
+ int[] width = new int[1]; int[] height = new int[1];
+ int[] depth = new int[1];
+ OS.gdk_window_get_geometry(pixmap, unused, unused, width, height, depth);
+ pixmap = OS.gdk_pixmap_new (0, width[0], height[0], depth[0]);
+ int gc = OS.gdk_gc_new (pixmap);
+ OS.gdk_draw_pixmap(pixmap, gc, srcImage.pixmap,
+ 0,0,0,0, width[0], height[0]);
+ OS.gdk_gc_destroy(gc);
+ transparentPixel = srcImage.transparentPixel;
+ alpha = srcImage.alpha;
+ if (srcImage.alphaData != null) {
+ alphaData = new byte[srcImage.alphaData.length];
+ System.arraycopy(srcImage.alphaData, 0, alphaData, 0, alphaData.length);
+ }
+
+ /* we are not quite done yet. Need to copy the maskData */
+ if (srcImage.mask != 0) {
+ /* Generate the mask if necessary. */
+// if (srcImage.transparentPixel != -1) srcImage.createMask();
+ mask = OS.gdk_pixmap_new(0, width[0], height[0], 1);
+ gc = OS.gdk_gc_new(mask);
+ OS.gdk_draw_pixmap(mask, gc, srcImage.mask,
+ 0,0,0,0, width[0], height[0]);
+ OS.gdk_gc_destroy(gc);
+ /* Destroy the image mask if the there is a GC created on the image */
+ if (srcImage.transparentPixel != -1 && srcImage.memGC != null) srcImage.destroyMask();
+ }
+
+
+ return;
+ }
+
+
+
+
+ Pixbuffer pb = new Pixbuffer(srcImage);
+ Pixbuffer pb2 = new Pixbuffer(pb, flag);
+ pb2.toImage(this);
+
+
+}
+
+/**
+ * Constructs an empty instance of this class with the
+ * width and height of the specified rectangle. The result
+ * may be drawn upon by creating a GC and using any of its
+ * drawing operations, as shown in the following example:
+ * <pre>
+ * Image i = new Image(device, boundsRectangle);
+ * GC gc = new GC(i);
+ * gc.drawRectangle(0, 0, 50, 50);
+ * gc.dispose();
+ * </pre>
+ *
+ * @param device the device on which to create the image
+ * @param bounds a rectangle specifying the image's width and height (must not be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the bounds rectangle is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if either the rectangle's width or height is negative</li>
+ * </ul>
+ */
+public Image(Device display, Rectangle bounds) {
+ if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ init(display, bounds.width, bounds.height);
+}
+
+/**
+ * Constructs an instance of this class from the given
+ * <code>ImageData</code>.
+ *
+ * @param device the device on which to create the image
+ * @param data the image data to create the image from (must not be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the image data is null</li>
+ * </ul>
+ */
+public Image(Device display, ImageData image) {
+ if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (display == null) display = Display.getDefault();
+ init(display, image);
+}
+
+/**
+ * Constructs an instance of this class, whose type is
+ * <code>SWT.ICON</code>, from the two given <code>ImageData</code>
+ * objects. The two images must be the same size, and the mask image
+ * must have a color depth of 1. Pixel transparency in either image
+ * will be ignored. If either image is an icon to begin with, an
+ * exception is thrown.
+ * <p>
+ * The mask image should contain white wherever the icon is to be visible,
+ * and black wherever the icon is to be transparent. In addition,
+ * the source image should contain black wherever the icon is to be
+ * transparent.
+ * </p>
+ *
+ * @param device the device on which to create the icon
+ * @param source the color data for the icon
+ * @param mask the mask data for the icon
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if either the source or mask is null </li>
+ * <li>ERROR_INVALID_ARGUMENT - if source and mask are different sizes or
+ * if the mask is not monochrome, or if either the source or mask
+ * is already an icon</li>
+ * </ul>
+ */
+public Image(Device display, ImageData source, ImageData mask) {
+ if (source == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (mask == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (display == null) display = Display.getDefault();
+ if (source.width != mask.width || source.height != mask.height) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ if (mask.depth != 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ ImageData image;
+ if (source.depth != 1)
+ image = new ImageData(source.width, source.height, source.depth, source.palette, source.scanlinePad, source.data);
+ else {
+ image = source.getTransparencyMask(); //create an imagedata with scanlinepad == 1 and invalid data
+ int[] row = new int[source.width];
+ for (int y = 0; y < source.height; y++) {
+ source.getPixels(0, y, source.width, row, 0);
+ image.setPixels(0, y, source.width, row, 0);
+ }//change source data format from scanlinePad == 4 to scanlinePad == 1;
+
+ }
+ image.type = SWT.ICON;
+ image.maskPad = mask.scanlinePad;
+ image.maskData = mask.data;
+ init(display, image);
+}
+
+/**
+ * Constructs an instance of this class by loading its representation
+ * from the specified input stream. Throws an error if an error
+ * occurs while loading the image, or if the result is an image
+ * of an unsupported type.
+ * <p>
+ * This constructor is provided for convenience when loading a single
+ * image only. If the stream contains multiple images, only the first
+ * one will be loaded. To load multiple images, use
+ * <code>ImageLoader.load()</code>.
+ * </p><p>
+ * This constructor may be used to load a resource as follows:
+ * </p>
+ * <pre>
+ * new Image(device, clazz.getResourceAsStream("file.gif"));
+ * </pre>
+ *
+ * @param device the device on which to create the image
+ * @param stream the input stream to load the image from
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data </li>
+ * <li>ERROR_IO - if an IO error occurs while reading data</li>
+ * </ul>
+ */
+public Image(Device display, InputStream stream) {
+ if (stream == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (display == null) display = Display.getDefault();
+ init(display, new ImageData(stream));
+}
+
+/**
+ * Constructs an instance of this class by loading its representation
+ * from the file with the specified name. Throws an error if an error
+ * occurs while loading the image, or if the result is an image
+ * of an unsupported type.
+ * <p>
+ * This constructor is provided for convenience when loading
+ * a single image only. If the specified file contains
+ * multiple images, only the first one will be used.
+ *
+ * @param device the device on which to create the image
+ * @param filename the name of the file to load the image from
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data </li>
+ * <li>ERROR_IO - if an IO error occurs while reading data</li>
+ * </ul>
+ */
+public Image(Device display, String filename) {
+ if (filename == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (display == null) display = Display.getDefault();
+ init(display, new ImageData(filename));
+}
+
+/**
+ * Destroy the receiver's mask if it exists.
+ */
+void destroyMask() {
+ if (mask == 0) return;
+ OS.gdk_bitmap_unref(mask);
+ mask = 0;
+}
+
+/**
+ * Disposes of the operating system resources associated with
+ * the image. Applications must dispose of all images which
+ * they allocate.
+ */
+public void dispose () {
+ if (pixmap != 0) OS.gdk_pixmap_unref(pixmap);
+ if (mask != 0) OS.gdk_pixmap_unref(mask);
+ pixmap = mask = 0;
+ memGC = null;
+}
+/**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the <em>same</em> object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
+ *
+ * @see #hashCode
+ */
+public boolean equals (Object object) {
+ return (object == this) || ((object instanceof Image) &&
+ (pixmap == ((Image)object).pixmap) &&
+ (mask == ((Image)object).mask));
+}
+
+/**
+ * Returns the color to which to map the transparent pixel, or null if
+ * the receiver has no transparent pixel.
+ * <p>
+ * There are certain uses of Images that do not support transparency
+ * (for example, setting an image into a button or label). In these cases,
+ * it may be desired to simulate transparency by using the background
+ * color of the widget to paint the transparent pixels of the image.
+ * Use this method to check which color will be used in these cases
+ * in place of transparency. This value may be set with setBackground().
+ * <p>
+ *
+ * @return the background color of the image, or null if there is no transparency in the image
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Color getBackground() {
+ return null;
+}
+
+/**
+ * Sets the color to which to map the transparent pixel.
+ * <p>
+ * There are certain uses of <code>Images</code> that do not support
+ * transparency (for example, setting an image into a button or label).
+ * In these cases, it may be desired to simulate transparency by using
+ * the background color of the widget to paint the transparent pixels
+ * of the image. This method specifies the color that will be used in
+ * these cases. For example:
+ * <pre>
+ * Button b = new Button();
+ * image.setBackground(b.getBackground());>
+ * b.setImage(image);
+ * </pre>
+ * </p><p>
+ * The image may be modified by this operation (in effect, the
+ * transparent regions may be filled with the supplied color). Hence
+ * this operation is not reversible and it is not legal to call
+ * this function twice or with a null argument.
+ * </p><p>
+ * This method has no effect if the receiver does not have a transparent
+ * pixel value.
+ * </p>
+ *
+ * @param color the color to use when a transparent pixel is specified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setBackground(Color color) {
+ if (color == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+}
+
+/**
+ * Returns the bounds of the receiver. The rectangle will always
+ * have x and y values of 0, and the width and height of the
+ * image.
+ *
+ * @return a rectangle specifying the image's bounds
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li>
+ * </ul>
+ */
+public Rectangle getBounds() {
+ int[] unused = new int[1]; int[] width = new int[1]; int[] height = new int[1];
+ OS.gdk_window_get_geometry(pixmap, unused, unused, width, height, unused);
+ return new Rectangle(0, 0, width[0], height[0]);
+
+}
+/**
+ * Returns an <code>ImageData</code> based on the receiver
+ * Modifications made to this <code>ImageData</code> will not
+ * affect the Image.
+ *
+ * @return an <code>ImageData</code> containing the image's data and attributes
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li>
+ * </ul>
+ *
+ * @see ImageData
+ */
+public ImageData getImageData() {
+ return new Pixbuffer(this).getImageData();
+}
+
+public static Image gtk_new(int type, int pixmap, int mask) {
+ Image image = new Image();
+ image.type = type;
+ image.pixmap = pixmap;
+ image.mask = mask;
+ return image;
+}
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects which return <code>true</code> when passed to
+ * <code>equals</code> must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals
+ */
+public int hashCode () {
+ return pixmap;
+}
+/**
+ * Invokes platform specific functionality to allocate a new GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Image</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param data the platform specific GC data
+ * @return the platform specific GC handle
+ *
+ * @private
+ */
+public int internal_new_GC (GCData data) {
+ if (pixmap == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (data == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ if (type != SWT.BITMAP || memGC != null) {
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+
+ data.image = this;
+ int gc = OS.gdk_gc_new(pixmap);
+ data.drawable = pixmap;
+ return gc;
+}
+/**
+ * Invokes platform specific functionality to dispose a GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Image</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param handle the platform specific GC handle
+ * @param data the platform specific GC data
+ *
+ * @private
+ */
+public void internal_dispose_GC (int gc, GCData data) {
+ OS.gdk_gc_unref(gc);
+}
+
+void init(Device display, int width, int height) {
+ device = display;
+ GdkVisual visual = new GdkVisual ();
+ OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
+ this.pixmap = OS.gdk_pixmap_new(0, width, height, visual.depth);
+ if (pixmap == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ /* Fill the bitmap with white */
+ GdkColor white = new GdkColor();
+ int colormap = OS.gdk_colormap_get_system();
+ OS.gdk_color_white(colormap, white);
+ int gc = OS.gdk_gc_new(pixmap);
+ OS.gdk_gc_set_foreground(gc, white);
+ OS.gdk_draw_rectangle(pixmap, gc, 1, 0, 0, width, height);
+ OS.gdk_gc_destroy(gc);
+ OS.gdk_colors_free(colormap, new int[] { white.pixel }, 1, 0);
+ this.type = SWT.BITMAP;
+}
+
+void init(Device display, ImageData image) {
+ if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (display == null) display = Display.getCurrent();
+ device = display;
+
+ /*
+ * We don't really care about the real depth of the ImageData we are
+ * given. We stretch everything to 24bpp which is the native GdkPixbuffer
+ * depth. HOWEVER, there is one situation where this is not acceptable,
+ * namely bitmaps (1bpp), because they may be used in contexts that are
+ * sensitive to pixmap depth.
+ */
+ Pixbuffer buff = new Pixbuffer(image);
+ buff.toImage(this);
+ return;
+}
+
+/**
+ * Returns <code>true</code> if the image has been disposed,
+ * and <code>false</code> otherwise.
+ * <p>
+ * This method gets the dispose state for the image.
+ * When an image has been disposed, it is an error to
+ * invoke any other method using the image.
+ *
+ * @return <code>true</code> when the image is disposed and <code>false</code> otherwise
+ */
+public boolean isDisposed() {
+ return pixmap == 0;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Pixbuffer.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Pixbuffer.java
new file mode 100644
index 0000000..460a3bb
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Pixbuffer.java
@@ -0,0 +1,492 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ * This class is <strong>not</strong> part of the SWT API,
+ * and its existence is not relevant for application programmers.
+ *
+ * Pixbuffer represents local GdkPixbuf images on the client.
+ */
+final class Pixbuffer {
+
+ /* the handle to the OS resource.
+ All state is kept in the OS */
+ int handle;
+
+ /* pointer to the actual pixel array */
+ int data;
+
+ /* whether the alpha data in the pixbuf is due to
+ a transparency mask or an alpha channel */
+ boolean hasMask = false;
+ boolean hasAlpha = false;
+ int constantAlpha = -1;
+ int transparentPixel = -1;
+
+
+ /*
+ * Constructors.
+ * There are three ways to create a Pixbuffer:
+ * pull one from a Drawable, create from ImageData,
+ * or clone an existing Pixbuffer.
+ */
+
+ private Pixbuffer() {}
+
+ /**
+ * Pull a Pixbuffer from an Image living on the X Server
+ * (making this operation expensive).
+ */
+ Pixbuffer (Image src) {
+ if (src == null || src.pixmap == 0) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+
+ // get the geometry
+ int[] unused = new int[1];
+ int[] w = new int[1];
+ int[] h = new int[1];
+ int[] d = new int[1];
+ OS.gdk_window_get_geometry(src.pixmap, unused, unused, w, h, unused);
+ int width = w[0];
+ int height = h[0];
+
+ // create the actual OS resource
+ createHandle(width, height);
+
+ // pull the color data
+ int cmap = OS.gdk_colormap_get_system();
+ GDKPIXBUF.gdk_pixbuf_get_from_drawable(
+ handle,
+ src.pixmap,
+ cmap,
+ 0,0,0,0,
+ width, height);
+
+ // the tricky part is alpha
+ if (src.alphaData != null) fillAlphaFromAlphaBytes(src.alphaData);
+ else if (src.alpha != -1) fillConstantAlpha(src.alpha);
+ else if (src.mask != 0) fillAlphaFromPixmapMask(src.mask);
+ else if (src.transparentPixel != -1) fillAlphaFromTransparentPixel(src.pixmap, src.transparentPixel);
+ else fillOpaque();
+ }
+
+ /**
+ * Create a Pixbuffer from image data.
+ */
+ Pixbuffer (ImageData src) {
+ if (src == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+
+ createHandle(src.width, src.height);
+
+ // populate the pixbuf with data
+ int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
+ int dataSize = src.height*stride;
+ byte[] bytes = new byte[dataSize];
+ switch (src.getTransparencyType()) {
+ case SWT.TRANSPARENCY_ALPHA: _blit2platformAlpha(bytes, src, src.width, src.height, stride); break;
+ case SWT.TRANSPARENCY_MASK: _blit2platformMask (bytes, src, src.width, src.height, stride); break;
+ case SWT.TRANSPARENCY_PIXEL: _blit2platformPixel(bytes, src, src.width, src.height, stride); break;
+ case SWT.TRANSPARENCY_NONE: _blit2platformNone (bytes, src, src.width, src.height, stride); break;
+ }
+ OS.memmove(data, bytes, dataSize);
+ }
+
+ /**
+ * Clone an existing Pixbuffer (possibly making it look
+ * grayed out or disabled)
+ */
+ Pixbuffer (Pixbuffer src, int flag) {
+ if (src == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (src.handle==0) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ this.hasAlpha = src.hasAlpha;
+ this.constantAlpha = src.constantAlpha;
+ this.hasMask = src.hasMask;
+
+ /* First, get a copy all our own */
+ handle = GDKPIXBUF.gdk_pixbuf_copy(src.handle);
+ data = GDKPIXBUF.gdk_pixbuf_get_pixels(this.handle);
+
+ // simplest case - just clone what we have
+ if (flag==SWT.IMAGE_COPY) return;
+
+ // gather some information we will need for disabling or graying
+ int width = getWidth();
+ int height = getHeight();
+ int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(this.handle);
+ int dataSize = height * stride;
+ byte[] bytes = new byte[dataSize];
+ OS.memmove(bytes,data,dataSize);
+ int lineAddress = 0;
+ int pixelAddress;
+
+ if (flag==SWT.IMAGE_DISABLE) {
+ for (int y=0; y<height; y++) {
+ for (int x=0; x<width; x++) {
+ pixelAddress = lineAddress+x*4;
+
+ int intensity =
+ bytes[pixelAddress+0] * bytes[pixelAddress+0] +
+ bytes[pixelAddress+1] * bytes[pixelAddress+1] +
+ bytes[pixelAddress+2] * bytes[pixelAddress+2];
+ byte value = (intensity < 9000)?
+ (byte)0 : (byte) 255;
+ bytes[pixelAddress+0] = bytes[pixelAddress+1] = bytes[pixelAddress+2] = value;
+ // no change to alpha
+ }
+ lineAddress += stride;
+ }
+ /* move it back */
+ OS.memmove(data, bytes, dataSize);
+ return;
+ }
+
+ if (flag==SWT.IMAGE_GRAY) {
+ for (int y=0; y<height; y++) {
+ for (int x=0; x<width; x++) {
+ pixelAddress = lineAddress+x*4;
+ int intensity =
+ (bytes[pixelAddress+0] +
+ bytes[pixelAddress+1] +
+ bytes[pixelAddress+2] ) / 3;
+ bytes[pixelAddress+0] = (byte)intensity;
+ bytes[pixelAddress+1] = (byte)intensity;
+ bytes[pixelAddress+2] = (byte)intensity;
+ // no change to alpha
+ }
+ lineAddress += stride;
+ }
+ /* move it back */
+ OS.memmove(data, bytes, dataSize);
+ return;
+ }
+
+ // flag is neither COPY nor DISABLE nor GRAY
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+
+
+ /**
+ * Push the pixbuf to the X Server
+ */
+ void toImage (Image dest) {
+ if (dest==null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ int w = getWidth();
+ int h = getHeight();
+ GdkVisual visual = new GdkVisual();
+ OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
+ dest.pixmap = OS.gdk_pixmap_new (0, w, h, visual.depth);
+ dest.mask = 0; // for now; we fill it later in this method
+ GDKPIXBUF.gdk_pixbuf_render_to_drawable_alpha(handle, // src
+ dest.pixmap, // dest drawable
+ 0,0, 0,0,
+ w, h,
+ GDKPIXBUF.GDK_PIXBUF_ALPHA_BILEVEL, 128,
+ GDKPIXBUF.GDK_RGB_DITHER_NORMAL, 0,0);
+
+ // now the mask, if any
+ if (hasMask) {
+ // bring the pixel data into Java memory
+ int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
+ byte[] srcBytes = new byte[h*stride];
+ OS.memmove(srcBytes, data, h*stride);
+
+ // the mask lines are padded to 4 bytes, that is 32 pixels
+ int maskwpl = w/32; if (w%32!=0) maskwpl+=1;
+ int maskBpl = maskwpl*4; // Bytes per line for the mask
+ byte[] bytes = new byte[h * maskBpl];
+ for (int y=0; y<h; y++) {
+ int lineAddress = y * maskBpl;
+ for (int x=0; x<w; x++)
+ if (srcBytes[y*stride + x*4 + 3] != 0) {
+ int byteAddress = lineAddress + x/8;
+ int bit = 1<<(x%8);
+ bytes[byteAddress] |= (byte)bit;
+ } // if
+ } // for y
+ dest.mask = OS.gdk_bitmap_create_from_data(0, bytes, maskBpl*8, h);
+ } // hasMask
+
+ else if (hasAlpha) {
+ SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
+ }
+
+ else if (constantAlpha!=-1) {
+ SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
+ }
+ }
+
+ /**
+ * Return the ImageData for the receiver.
+ */
+ ImageData getImageData() {
+ int width = getWidth();
+ int height = getHeight();
+ int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
+ byte[] bytes = _getDataBytes();
+ ImageData answer = new ImageData(width, height, 24, new PaletteData(0xFF0000, 0x00FF00, 0x0000FF));
+
+ if (hasMask) {
+ answer.maskData = new byte[((width+7)/8)*height];
+ answer.maskPad = 1;
+ }
+
+ for (int y=0; y<height; y++)
+ for (int x=0; x<width; x++) {
+ int address = y*stride + x*4;
+ byte r = bytes[address+0];
+ byte g = bytes[address+1];
+ byte b = bytes[address+2];
+ answer.setPixel(x,y, r<<16+g<<8+b);
+ byte alpha = bytes[address+3];
+ if (hasAlpha) {
+ answer.setAlpha(x,y, alpha);
+ }
+ if (hasMask && (alpha!=0)) {
+ // Find out where to stab the bit
+ int mask_bytes_per_line = (width+7) / 8;
+ int x_inside_line = x / 8;
+ int shift_inside_byte = x - (x_inside_line*8);
+ answer.maskData[x_inside_line + (y*mask_bytes_per_line)] |= (128 >> shift_inside_byte);
+ }
+ }
+ if (constantAlpha!=-1) answer.alpha = constantAlpha;
+ return answer;
+ }
+
+ int getWidth() {
+ return GDKPIXBUF.gdk_pixbuf_get_width (handle);
+ }
+
+ int getHeight() {
+ return GDKPIXBUF.gdk_pixbuf_get_height (handle);
+ }
+
+
+ /**
+ * Actually create the OS resource.
+ * No matter what, the GdkPixbuf we create always has
+ * an alpha channel.
+ */
+ private void createHandle(int width, int height) {
+ handle = GDKPIXBUF.gdk_pixbuf_new(GDKPIXBUF.GDK_COLORSPACE_RGB,
+ true,
+ 8,
+ width, height);
+ if (this.handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ data = GDKPIXBUF.gdk_pixbuf_get_pixels(handle);
+ }
+
+ private void fillAlphaFromPixmapMask(int mask) {
+ hasMask = true;
+
+ /* pull the mask data from the X Server */
+ // get the geometry
+ int[] unused = new int[1];
+ int[] w = new int[1];
+ int[] h = new int[1];
+ int[] d = new int[1];
+ OS.gdk_window_get_geometry(mask, unused, unused, w, h, unused);
+ int width = Math.min(w[0], getWidth());
+ int height = Math.min(h[0], getHeight());
+ /* Get the data */
+ int xMaskPtr = OS.gdk_image_get(mask, 0, 0, width, height);
+ if (xMaskPtr == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+
+ /* stuff the alpha values */
+ byte[] bytes = _getDataBytes();
+ int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
+ for (int y=0; y<height; y++)
+ for (int x=0; x<width; x++) {
+ int pixel_value = OS.gdk_image_get_pixel(xMaskPtr, x, y);
+ if (pixel_value==0) bytes[y*stride + x*4 +3] = 0;
+ else if (pixel_value==1) bytes[y*stride + x*4 +3] = (byte)255;
+ else { System.out.println("GDK insanity: bitmap contains bits other than 0 or 1"); SWT.error(SWT.ERROR_UNSPECIFIED); }
+ }
+ /* move it back */
+ OS.memmove(data, bytes, bytes.length);
+ }
+
+ private void fillAlphaFromTransparentPixel(int pm, int pixel) {
+ transparentPixel = pixel;
+
+ /* pull the data from the X Server */
+ // get the geometry
+ int[] unused = new int[1];
+ int[] w = new int[1];
+ int[] h = new int[1];
+ int[] d = new int[1];
+ OS.gdk_window_get_geometry(pm, unused, unused, w, h, unused);
+ int width = Math.min(w[0], getWidth());
+ int height = Math.min(h[0], getHeight());
+ /* Get the data */
+ int xImage = OS.gdk_image_get(pm, 0, 0, width, height);
+ if (xImage == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+
+ /* stuff the alpha values */
+ byte[] bytes = _getDataBytes();
+ int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
+ for (int y=0; y<height; y++)
+ for (int x=0; x<width; x++) {
+ int pixel_value = OS.gdk_image_get_pixel(xImage, x, y);
+ if (pixel_value==pixel) bytes[y*stride + x*4 +3] = 0;
+ else bytes[y*stride + x*4 +3] = (byte)255;
+ }
+ /* move it back */
+ OS.memmove(data, bytes, bytes.length);
+ }
+
+ private void fillAlphaFromAlphaBytes(byte[] alpha) {
+ hasAlpha = true;
+ SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
+ }
+
+ private void fillConstantAlpha(int alpha) {
+ if ((alpha<0)||(alpha>255)) SWT.error (SWT.ERROR_INVALID_ARGUMENT);
+ constantAlpha = alpha;
+ _fillConstantAlpha((byte)alpha);
+ }
+
+ private void fillOpaque() {
+ _fillConstantAlpha((byte)255);
+ }
+
+ /**
+ * Assume the handle represents a valid GdkPixbuf,
+ * and data is pointing to the correct location in memory.
+ * Fill all alpha bytes with the specified value.
+ */
+ private void _fillConstantAlpha (byte value) {
+ // first, get some technical info
+ int width = getWidth();
+ int height = getHeight();
+ int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(this.handle);
+ int dataSize = height * stride;
+ byte[] bytes = new byte[dataSize];
+ OS.memmove(bytes,data,dataSize);
+ int lineAddress = 0;
+ int pixelAddress;
+
+ // set all alpha bytes to 255
+ for (int y=0; y<height; y++) {
+ for (int x=0; x<width; x++) {
+ pixelAddress = lineAddress+x*4;
+ bytes[pixelAddress+3] = value;
+ }
+ lineAddress += stride;
+ }
+ /* move it back */
+ OS.memmove(data, bytes, dataSize);
+ }
+
+ private void _blit2platformNone (byte[] bytes,
+ ImageData source,
+ int width,
+ int height,
+ int stride)
+ {
+ int lineAddress = 0;
+ for (int y=0; y<height; y++) {
+ for (int x=0; x<width; x++) {
+ RGB rgb = source.palette.getRGB(source.getPixel(x,y));
+ bytes[lineAddress + x*4 + 0] = (byte)rgb.red;
+ bytes[lineAddress + x*4 + 1] = (byte)rgb.green;
+ bytes[lineAddress + x*4 + 2] = (byte)rgb.blue;
+ bytes[lineAddress + x*4 + 3] = (byte)255;
+ }
+ lineAddress += stride;
+ }
+ }
+
+ private void _blit2platformAlpha (byte[] bytes,
+ ImageData source,
+ int width,
+ int height,
+ int stride)
+ {
+ hasAlpha = true;
+ int lineAddress = 0;
+ for (int y=0; y<height; y++) {
+ for (int x=0; x<width; x++) {
+ RGB rgb = source.palette.getRGB(source.getPixel(x,y));
+ bytes[lineAddress + x*4 + 0] = (byte)rgb.red;
+ bytes[lineAddress + x*4 + 1] = (byte)rgb.green;
+ bytes[lineAddress + x*4 + 2] = (byte)rgb.blue;
+ bytes[lineAddress + x*4 + 3] = (byte)source.getAlpha(x,y);
+ }
+ lineAddress += stride;
+ }
+ }
+
+ private void _blit2platformPixel (byte[] bytes,
+ ImageData source,
+ int width,
+ int height,
+ int stride
+ )
+ {
+ hasMask = true;
+ int lineAddress = 0;
+ for (int y=0; y<height; y++) {
+ for (int x=0; x<width; x++) {
+ int pixel = source.getPixel(x,y);
+ if (pixel==source.transparentPixel) {
+ bytes[lineAddress + x*4 + 0] = (byte)0;
+ bytes[lineAddress + x*4 + 1] = (byte)0;
+ bytes[lineAddress + x*4 + 2] = (byte)0;
+ bytes[lineAddress + x*4 + 3] = (byte)0;
+ } else {
+ RGB rgb = source.palette.getRGB(pixel);
+ bytes[lineAddress + x*4 + 0] = (byte)rgb.red;
+ bytes[lineAddress + x*4 + 1] = (byte)rgb.green;
+ bytes[lineAddress + x*4 + 2] = (byte)rgb.blue;
+ bytes[lineAddress + x*4 + 3] = (byte)255;
+ }
+ }
+ lineAddress += stride;
+ }
+ }
+
+ private void _blit2platformMask (byte[] bytes,
+ ImageData source,
+ int width,
+ int height,
+ int stride
+ )
+ {
+ hasMask = true;
+ ImageData maskData = source.getTransparencyMask();
+ int lineAddress = 0;
+ for (int y=0; y<height; y++) {
+ for (int x=0; x<width; x++) {
+ RGB rgb = source.palette.getRGB(source.getPixel(x,y));
+ bytes[lineAddress + x*4 + 0] = (byte)rgb.red;
+ bytes[lineAddress + x*4 + 1] = (byte)rgb.green;
+ bytes[lineAddress + x*4 + 2] = (byte)rgb.blue;
+ int alpha = 0;
+ if (maskData.getPixel(x,y) !=0) alpha=255;
+ bytes[lineAddress + x*4 + 3] = (byte)alpha;
+ }
+ lineAddress += stride;
+ }
+ }
+
+ /**
+ * Transfer the pixel data from OS memory to Java memory
+ * and return the Java byte array
+ */
+ private byte[] _getDataBytes() {
+ int height = GDKPIXBUF.gdk_pixbuf_get_height (handle);
+ int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
+ int size = height*stride;
+ byte[] bytes = new byte[size];
+ OS.memmove(bytes, data, size);
+ return bytes;
+ }
+}
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java
new file mode 100644
index 0000000..2b80dd5
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Region.java
@@ -0,0 +1,263 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.*;
+
+/**
+ * Instances of this class represent areas of an x-y coordinate
+ * system that are aggregates of the areas covered by a number
+ * of rectangles.
+ * <p>
+ * Application code must explicitly invoke the <code>Region.dispose()</code>
+ * method to release the operating system resources managed by each instance
+ * when those instances are no longer required.
+ * </p>
+ */
+public final class Region {
+ /**
+ * the OS resource for the region
+ * (Warning: This field is platform dependent)
+ */
+ public int handle;
+/**
+ * Constructs a new empty region.
+ */
+public Region() {
+ handle = OS.gdk_region_new();
+}
+Region(int handle) {
+ this.handle = handle;
+}
+/**
+ * Adds the given rectangle to the collection of rectangles
+ * the receiver maintains to describe its area.
+ *
+ * @param rect the rectangle to merge with the receiver
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the rectangle's width or height is negative</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void add(Rectangle rect) {
+ if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
+ if (rect.width < 0 || rect.height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ GdkRectangle gdkRect = new GdkRectangle();
+ gdkRect.x = (short)rect.x;
+ gdkRect.y = (short)rect.y;
+ gdkRect.width = (short)rect.width;
+ gdkRect.height = (short)rect.height;
+ int hOld = handle;
+ /**
+ * Feature in GDK. Due to the way the GDK region calls work,
+ * we have to reassign the handle and destroy the old one.
+ */
+ handle = OS.gdk_region_union_with_rect(handle, gdkRect);
+ OS.gdk_region_destroy(hOld);
+}
+/**
+ * Adds all of the rectangles which make up the area covered
+ * by the argument to the collection of rectangles the receiver
+ * maintains to describe its area.
+ *
+ * @param region the region to merge
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void add(Region region) {
+ if (region == null) error(SWT.ERROR_NULL_ARGUMENT);
+ /**
+ * Feature in GDK. Due to the way the GDK region calls work,
+ * we have to reassign the handle and destroy the old one.
+ */
+ int hOld = handle;
+ handle = OS.gdk_regions_union(handle, region.handle);
+ OS.gdk_region_destroy(hOld);
+}
+/**
+ * Returns <code>true</code> if the point specified by the
+ * arguments is inside the area specified by the receiver,
+ * and <code>false</code> otherwise.
+ *
+ * @param x the x coordinate of the point to test for containment
+ * @param y the y coordinate of the point to test for containment
+ * @return <code>true</code> if the region contains the point and <code>false</code> otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public boolean contains(int x, int y) {
+ return OS.gdk_region_point_in(handle, x, y);
+}
+/**
+ * Returns <code>true</code> if the given point is inside the
+ * area specified by the receiver, and <code>false</code>
+ * otherwise.
+ *
+ * @param pt the point to test for containment
+ * @return <code>true</code> if the region contains the point and <code>false</code> otherwise
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public boolean contains(Point pt) {
+ if (pt == null) error(SWT.ERROR_NULL_ARGUMENT);
+ return contains(pt.x, pt.y);
+}
+/**
+ * Disposes of the operating system resources associated with
+ * the region. Applications must dispose of all regions which
+ * they allocate.
+ */
+public void dispose() {
+ if (handle != 0) OS.gdk_region_destroy(handle);
+ handle = 0;
+}
+/**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the <em>same</em> object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
+ *
+ * @see #hashCode
+ */
+public boolean equals(Object object) {
+ if (this == object) return true;
+ if (!(object instanceof Region)) return false;
+ int xRegion = ((Region)object).handle;
+ if (handle == xRegion) return true;
+ if (xRegion == 0) return false;
+ return OS.gdk_region_equal(handle, xRegion);
+}
+void error(int code) {
+ throw new SWTError(code);
+}
+/**
+ * Returns a rectangle which represents the rectangular
+ * union of the collection of rectangles the receiver
+ * maintains to describe its area.
+ *
+ * @return a bounding rectangle for the region
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see Rectangle#union
+ */
+public Rectangle getBounds() {
+ GdkRectangle rect = new GdkRectangle();
+ OS.gdk_region_get_clipbox(handle, rect);
+ return new Rectangle(rect.x, rect.y, rect.width, rect.height);
+}
+public static Region gtk_new(int handle) {
+ return new Region(handle);
+}
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects which return <code>true</code> when passed to
+ * <code>equals</code> must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals
+ */
+public int hashCode() {
+ return handle;
+}
+/**
+ * Returns <code>true</code> if the rectangle described by the
+ * arguments intersects with any of the rectangles the receiver
+ * mainains to describe its area, and <code>false</code> otherwise.
+ *
+ * @param x the x coordinate of the origin of the rectangle
+ * @param y the y coordinate of the origin of the rectangle
+ * @param width the width of the rectangle
+ * @param height the height of the rectangle
+ * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see Rectangle#intersects
+ */
+public boolean intersects (int x, int y, int width, int height) {
+ GdkRectangle osRect = new GdkRectangle();
+ osRect.x = (short)x;
+ osRect.y = (short)y;
+ osRect.width = (short)width;
+ osRect.height = (short)height;
+ return OS.gdk_region_rect_in(handle, osRect) != OS.GDK_OVERLAP_RECTANGLE_OUT;
+}
+/**
+ * Returns <code>true</code> if the given rectangle intersects
+ * with any of the rectangles the receiver mainains to describe
+ * its area and <code>false</code> otherwise.
+ *
+ * @param rect the rectangle to test for intersection
+ * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see Rectangle#intersects
+ */
+public boolean intersects(Rectangle rect) {
+ if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
+ return intersects(rect.x, rect.y, rect.width, rect.height);
+}
+/**
+ * Returns <code>true</code> if the region has been disposed,
+ * and <code>false</code> otherwise.
+ * <p>
+ * This method gets the dispose state for the region.
+ * When a region has been disposed, it is an error to
+ * invoke any other method using the region.
+ *
+ * @return <code>true</code> when the region is disposed, and <code>false</code> otherwise
+ */
+public boolean isDisposed() {
+ return handle == 0;
+}
+/**
+ * Returns <code>true</code> if the receiver does not cover any
+ * area in the (x, y) coordinate plane, and <code>false</code> if
+ * the receiver does cover some area in the plane.
+ *
+ * @return <code>true</code> if the receiver is empty, and <code>false</code> otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public boolean isEmpty() {
+ return OS.gdk_region_empty(handle);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/Converter.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/Converter.java
new file mode 100644
index 0000000..66d9149
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/Converter.java
@@ -0,0 +1,85 @@
+package org.eclipse.swt.internal;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+/**
+ * This class implements the conversions between unicode characters
+ * and the <em>platform supported</em> representation for characters.
+ * <p>
+ * Note that, unicode characters which can not be found in the platform
+ * encoding will be converted to an arbitrary platform specific character.
+ * </p>
+ */
+public final class Converter {
+ public static final byte [] NullByteArray = new byte [1];
+ public static final char [] NullCharArray = new char [1];
+ public static final byte [] EmptyByteArray = new byte [0];
+ public static final char [] EmptyCharArray = new char [0];
+/**
+ * Returns the default code page for the platform where the
+ * application is currently running.
+ *
+ * @return the default code page
+ */
+public static String defaultCodePage () {
+ /*
+ | ptr cp |
+ DefaultCodePage == nil ifFalse: [^DefaultCodePage].
+ cp := ''. "$NON-NLS$"
+ (ptr := OSStringZ address: (NlLanginfo callWith: 49)) isNull
+ ifFalse: [cp := String copyFromOSMemory: ptr].
+ cp isEmpty ifFalse: [
+ IsSunOS ifTrue: [
+ (cp size > 3 and: [(cp copyFrom: 1 to: 3) = 'ISO'])
+ ifTrue: [cp := cp copyFrom: 4 to: cp size]].
+ ^DefaultCodePage := cp].
+ IsAIX ifTrue: [^DefaultCodePage := 'ISO8859-1'].
+ IsSunOS ifTrue: [^DefaultCodePage := '8859-1'].
+ ^DefaultCodePage := 'iso8859_1'
+ */
+ return null;
+}
+static boolean is7BitAscii (byte [] buffer) {
+ for (int i=0; i<buffer.length; i++) {
+ if ((buffer [i] & 0xFF) > 0x7F) return false;
+ }
+ return true;
+}
+static boolean is7BitAscii (char [] buffer) {
+ for (int i=0; i<buffer.length; i++) {
+ if (buffer [i] > 0x7F) return false;
+ }
+ return true;
+}
+public static char [] mbcsToWcs (String codePage, byte [] buffer) {
+ //SLOW AND BOGUS
+ return new String (buffer).toCharArray ();
+}
+/* TEMPORARY CODE */
+public static byte [] wcsToMbcs (String codePage, String string) {
+ return wcsToMbcs (codePage, string, false);
+}
+public static byte [] wcsToMbcs (String codePage, String string, boolean terminate) {
+ //SLOW AND BOGUS
+ int count = string.length ();
+ if (terminate) count++;
+ char [] buffer = new char [count];
+ string.getChars (0, string.length (), buffer, 0);
+ return wcsToMbcs (codePage, buffer, false);
+}
+/* TEMPORARY CODE */
+public static byte [] wcsToMbcs (String codePage, char [] buffer) {
+ return wcsToMbcs (codePage, buffer, false);
+}
+public static byte [] wcsToMbcs (String codePage, char [] buffer, boolean terminate) {
+ //SLOW AND BOGUS
+ if (!terminate) return new String (buffer).getBytes ();
+ byte [] buffer1 = new String (buffer).getBytes ();
+ byte [] buffer2 = new byte [buffer1.length + 1];
+ System.arraycopy (buffer1, 0, buffer2, 0, buffer1.length);
+ return buffer2;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
new file mode 100644
index 0000000..c08b892
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
@@ -0,0 +1,493 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class represent a selectable user interface object that
+ * issues notification when pressed and released.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>ARROW, CHECK, PUSH, RADIO, TOGGLE, FLAT</dd>
+ * <dd>LEFT, RIGHT, CENTER</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+public class Button extends Control {
+ int boxHandle;
+ Image image;
+ String text;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Button (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+static int checkStyle (int style) {
+ style = checkBits (style, SWT.PUSH, SWT.ARROW, SWT.CHECK, SWT.RADIO, SWT.TOGGLE, 0);
+ if ((style & SWT.PUSH) != 0) {
+ return checkBits (style, SWT.CENTER, SWT.LEFT, SWT.RIGHT, 0, 0, 0);
+ }
+ if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) != 0) {
+ return checkBits (style, SWT.LEFT, SWT.RIGHT, SWT.CENTER, 0, 0, 0);
+ }
+ if ((style & SWT.ARROW) != 0) {
+ return checkBits (style, SWT.UP, SWT.DOWN, SWT.LEFT, SWT.RIGHT, 0, 0);
+ }
+ return style;
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control is selected, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * <code>widgetSelected</code> is called when the control is selected.
+ * <code>widgetDefaultSelected</code> is not called.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener (SelectionListener listener) {
+ checkWidget ();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+ int bits = SWT.ARROW | SWT.TOGGLE | SWT.CHECK | SWT.RADIO | SWT.PUSH;
+
+ boxHandle = OS.gtk_event_box_new ();
+ if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ switch (style & bits) {
+ case SWT.ARROW:
+ handle = OS.gtk_button_new ();
+ int arrow = OS.gtk_arrow_new (OS.GTK_ARROW_UP, OS.GTK_SHADOW_OUT);
+ OS.gtk_container_add (handle, arrow);
+ OS.gtk_widget_show (arrow);
+ break;
+ case SWT.TOGGLE:
+ handle = OS.gtk_toggle_button_new ();
+ break;
+ case SWT.CHECK:
+ handle = OS.gtk_check_button_new ();
+ break;
+ case SWT.RADIO:
+ handle = OS.gtk_radio_button_new (parent.radioGroup());
+ break;
+ case SWT.PUSH:
+ default:
+ handle = OS.gtk_button_new ();
+ break;
+ }
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void setHandleStyle() {}
+
+void configure() {
+ _connectParent();
+ OS.gtk_container_add (boxHandle, handle);
+}
+
+void showHandle() {
+ OS.gtk_widget_show (boxHandle);
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void hookEvents () {
+ super.hookEvents();
+ /*
+ * Feature in GTK. For some reason, when the widget
+ * is a check or radio button, mouse move and key
+ * release events are not signaled. The fix is to
+ * look for them on the parent.
+ */
+ if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
+ int mask = OS.GDK_POINTER_MOTION_MASK | OS.GDK_KEY_RELEASE_MASK;
+ OS.gtk_widget_add_events (boxHandle, mask);
+ signal_connect_after (boxHandle, "motion_notify_event", SWT.MouseMove, 3);
+ signal_connect_after (boxHandle, "key_release_event", SWT.KeyUp, 3);
+ }
+ signal_connect (handle, "clicked", SWT.Selection, 2);
+}
+
+void register () {
+ super.register ();
+ WidgetTable.put (boxHandle, this);
+}
+
+void createWidget (int index) {
+ super.createWidget (index);
+ text = "";
+}
+
+int topHandle () { return boxHandle; }
+
+/**
+ * Returns a value which describes the position of the
+ * text or image in the receiver. The value will be one of
+ * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
+ * unless the receiver is an <code>ARROW</code> button, in
+ * which case, the alignment will indicate the direction of
+ * the arrow (one of <code>LEFT</code>, <code>RIGHT</code>,
+ * <code>UP</code> or <code>DOWN</code>.
+ *
+ * @return the alignment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getAlignment () {
+ checkWidget ();
+ if ((style & SWT.ARROW) != 0) {
+ if ((style & SWT.UP) != 0) return SWT.UP;
+ if ((style & SWT.DOWN) != 0) return SWT.DOWN;
+ if ((style & SWT.LEFT) != 0) return SWT.LEFT;
+ if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
+ return SWT.UP;
+ }
+ if ((style & SWT.LEFT) != 0) return SWT.LEFT;
+ if ((style & SWT.CENTER) != 0) return SWT.CENTER;
+ if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
+ return SWT.LEFT;
+}
+
+/**
+ * Returns the receiver's image if it has one, or null
+ * if it does not.
+ *
+ * @return the receiver's image
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Image getImage () {
+ checkWidget ();
+ return image;
+}
+
+String getNameText () {
+ return getText ();
+}
+
+/**
+ * Returns <code>true</code> if the receiver is selected,
+ * and false otherwise.
+ * <p>
+ * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
+ * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
+ * it is selected when it is pushed. If the receiver is of any other type,
+ * this method returns false.
+ *
+ * @return the selection state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getSelection () {
+ checkWidget ();
+ if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return false;
+ return OS.gtk_toggle_button_get_active (handle);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is selected.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener (SelectionListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+
+/**
+ * Controls how text, images and arrows will be displayed
+ * in the receiver. The argument should be one of
+ * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
+ * unless the receiver is an <code>ARROW</code> button, in
+ * which case, the argument indicates the direction of
+ * the arrow (one of <code>LEFT</code>, <code>RIGHT</code>,
+ * <code>UP</code> or <code>DOWN</code>.
+ *
+ * @param alignment the new alignment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setAlignment (int alignment) {
+ checkWidget ();
+ if ((style & SWT.ARROW) != 0) {
+ if ((style & (SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT)) == 0) return;
+ style &= ~(SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT);
+ style |= alignment & (SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT);
+ int arrow_type = OS.GTK_ARROW_UP;
+ switch (alignment) {
+ case SWT.UP:
+ arrow_type = OS.GTK_ARROW_UP;
+ break;
+ case SWT.DOWN:
+ arrow_type = OS.GTK_ARROW_DOWN;
+ break;
+ case SWT.LEFT:
+ arrow_type = OS.GTK_ARROW_LEFT;
+ break;
+ case SWT.RIGHT:
+ arrow_type = OS.GTK_ARROW_RIGHT;
+ break;
+ }
+ int list = OS.gtk_container_children (handle);
+ int arrow = OS.g_list_nth_data (list, 0);
+ OS.gtk_arrow_set (arrow, arrow_type, OS.GTK_SHADOW_OUT);
+ return;
+ }
+ if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
+ style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
+ style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
+ int list = OS.gtk_container_children (handle);
+ int label = OS.g_list_nth_data (list, 0);
+ if (label == 0) return;
+ boolean isText = OS.GTK_WIDGET_TYPE (handle) == OS.gtk_label_get_type ();
+ if ((style & SWT.LEFT) != 0) {
+ OS.gtk_misc_set_alignment (label, 0.0f, 0.5f);
+ if (isText) OS.gtk_label_set_justify (label, OS.GTK_JUSTIFY_LEFT);
+ return;
+ }
+ if ((style & SWT.CENTER) != 0) {
+ OS.gtk_misc_set_alignment (label, 0.5f, 0.5f);
+ if (isText) OS.gtk_label_set_justify (label, OS.GTK_JUSTIFY_CENTER);
+ return;
+ }
+ if ((style & SWT.RIGHT) != 0) {
+ OS.gtk_misc_set_alignment (label, 1.0f, 0.5f);
+ if (isText) OS.gtk_label_set_justify (label, OS.GTK_JUSTIFY_RIGHT);
+ return;
+ }
+}
+
+/**
+ * Sets the receiver's image to the argument, which may be
+ * null indicating that no image should be displayed.
+ *
+ * @param image the image to display on the receiver (may be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setImage (Image image) {
+ checkWidget ();
+ this.image = image;
+ if ((style & SWT.ARROW) != 0) return;
+ int list = OS.gtk_container_children (handle);
+ if (list != 0) {
+ int widget = OS.g_list_nth_data (list, 0);
+ if (widget != 0) OS.gtk_widget_destroy (widget);
+ }
+ if (image != null) {
+ int pixmap = OS.gtk_pixmap_new (image.pixmap, image.mask);
+ OS.gtk_container_add (handle, pixmap);
+ OS.gtk_widget_show (pixmap);
+ }
+}
+
+/**
+ * Returns the receiver's text, which will be an empty
+ * string if it has never been set.
+ *
+ * @return the receiver's text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getText () {
+ checkWidget();
+ return text;
+}
+
+/**
+ * Sets the selection state of the receiver, if it is of type <code>CHECK</code>,
+ * <code>RADIO</code>, or <code>TOGGLE</code>.
+ *
+ * <p>
+ * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
+ * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
+ * it is selected when it is pushed.
+ *
+ * @param selected the new selection state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (boolean selected) {
+ checkWidget();
+ if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return;
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_toggle_button_set_active (handle, selected);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+
+/**
+ * Sets the receiver's text.
+ * <p>
+ * This method sets the button label. The label may include
+ * the mnemonic character but must not contain line delimiters.
+ * </p>
+ *
+ * @param string the new text
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setText (String string) {
+ checkWidget ();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ text = string;
+ if ((style & SWT.ARROW) != 0) return;
+ int length = string.length ();
+ char [] text = new char [length + 1];
+ char [] pattern = new char [length + 1];
+ string.getChars (0, length, text, 0);
+ int i = 0, j = 0;
+ while (i < length) {
+ pattern [j] = ' ';
+ if (text [i] == '&') {
+ i++;
+ if (i < length && text [i] != '&') {
+ pattern [j] = '_';
+ }
+ }
+ text [j++] = text [i++];
+ }
+ while (j < i) {
+ text [j] = pattern [j] = '\0';
+ j++;
+ }
+ int list = OS.gtk_container_children (handle);
+ if (list != 0) {
+ int widget = OS.g_list_nth_data (list, 0);
+ if (widget != 0) OS.gtk_widget_destroy (widget);
+ }
+ byte [] buffer1 = Converter.wcsToMbcs (null, text);
+ int label = OS.gtk_label_new (buffer1);
+ byte [] buffer2 = Converter.wcsToMbcs (null, pattern);
+ OS.gtk_label_set_pattern (label, buffer2);
+ OS.gtk_container_add (handle, label);
+ OS.gtk_widget_show (label);
+}
+
+int processSelection (int int0, int int1, int int2) {
+ postEvent(SWT.Selection);
+ return 0;
+}
+
+void deregister () {
+ super.deregister ();
+ WidgetTable.remove (boxHandle);
+}
+
+void releaseWidget () {
+ super.releaseWidget ();
+ image = null;
+ text = null;
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ boxHandle = 0;
+}
+
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java
new file mode 100644
index 0000000..3374e5c
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java
@@ -0,0 +1,264 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class provide a surface for drawing
+ * arbitrary graphics.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * This class may be subclassed by custom control implementors
+ * who are building controls that are <em>not</em> constructed
+ * from aggregates of other controls. That is, they are either
+ * painted using SWT graphics calls or are handled by native
+ * methods.
+ * </p>
+ *
+ * @see Composite
+ */
+public class Canvas extends Composite {
+
+ Caret caret;
+
+/*
+ * === CONSTRUCTORS ===
+ */
+
+
+Canvas () {}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Canvas (Composite parent, int style) {
+ super (parent, style);
+}
+
+/**
+ * Returns the caret.
+ * <p>
+ * The caret for the control is automatically hidden
+ * and shown when the control is painted or resized,
+ * when focus is gained or lost and when an the control
+ * is scrolled. To avoid drawing on top of the caret,
+ * the programmer must hide and show the caret when
+ * drawing in the window any other time.
+ * </p>
+ *
+ * @return the caret
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Caret getCaret () {
+ checkWidget();
+ return caret;
+}
+
+/**
+ * Scrolls a rectangular area of the receiver by first copying
+ * the source area to the destination and then causing the area
+ * of the source which is not covered by the destination to
+ * be repainted. Children that intersect the rectangle are
+ * optionally moved during the operation. In addition, outstanding
+ * paint events are flushed before the source area is copied to
+ * ensure that the contents of the canvas are drawn correctly.
+ *
+ * @param destX the x coordinate of the destination
+ * @param destY the y coordinate of the destination
+ * @param x the x coordinate of the source
+ * @param y the y coordinate of the source
+ * @param width the width of the area
+ * @param height the height of the area
+ * @param all <code>true</code>if children should be scrolled, and <code>false</code> otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void scroll (int destX, int destY, int x, int y, int width, int height, boolean all) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+
+ if (width <= 0 || height <= 0) return;
+ int deltaX = destX - x, deltaY = destY - y;
+ if (deltaX == 0 && deltaY == 0) return;
+ if (!isVisible ()) return;
+
+ /* Hide the caret */
+ boolean isVisible = (caret != null) && (caret.isVisible ());
+ if (isVisible) caret.hideCaret ();
+
+ GtkWidget widget = new GtkWidget();
+ OS.memmove (widget, paintHandle(), GtkWidget.sizeof);
+ int window = widget.window;
+ if (window == 0) return;
+
+ /* Emit a NoExpose Event */
+ int gc = OS.gdk_gc_new (window);
+ OS.gdk_gc_set_exposures(gc, true);
+ OS.gdk_window_copy_area (window, gc, x, y, window, x, y, width, height);
+ OS.gdk_gc_destroy (gc);
+
+ /* Flush outstanding Exposes */
+ int eventHandle=0;
+ while ((eventHandle = OS.gdk_event_get_graphics_expose(window)) != 0) {
+ OS.gtk_widget_event(handle, eventHandle);
+ OS.gdk_event_free(eventHandle);
+ }
+
+ /* Scroll the window */
+ int gc1 = OS.gdk_gc_new (window);
+ OS.gdk_gc_set_exposures(gc1, true);
+ OS.gdk_window_copy_area (window, gc1, destX, destY, window, x, y, width, height);
+ OS.gdk_gc_destroy (gc1);
+ boolean disjoint = (destX + width < x) || (x + width < destX) || (destY + height < y) || (y + height < destY);
+ if (disjoint) {
+ OS.gdk_window_clear_area(window, x, y, width, height);
+ } else {
+ if (deltaX != 0) {
+ int newX = destX - deltaX;
+ if (deltaX < 0) newX = destX + width;
+ OS.gdk_window_clear_area_e(window, newX, y, Math.abs (deltaX), height);
+ }
+ if (deltaY != 0) {
+ int newY = destY - deltaY;
+ if (deltaY < 0) newY = destY + height;
+ OS.gdk_window_clear_area_e (window, x, newY, width, Math.abs (deltaY));
+ }
+ }
+
+ /* Show the caret */
+ if (isVisible) caret.showCaret ();
+}
+/**
+ * Sets the receiver's caret.
+ * <p>
+ * The caret for the control is automatically hidden
+ * and shown when the control is painted or resized,
+ * when focus is gained or lost and when an the control
+ * is scrolled. To avoid drawing on top of the caret,
+ * the programmer must hide and show the caret when
+ * drawing in the window any other time.
+ * </p>
+ * @param caret the new caret for the receiver, may be null
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the caret has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setCaret (Caret caret) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ Caret newCaret = caret;
+ Caret oldCaret = this.caret;
+ this.caret = newCaret;
+ if (isFocusControl()) {
+ if (oldCaret != null) oldCaret.killFocus ();
+ if (newCaret != null) newCaret.setFocus ();
+ }
+}
+public boolean setFocus () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & SWT.NO_FOCUS) != 0) return false;
+ return super.setFocus ();
+}
+int processFocusIn (int int0, int int1, int int2) {
+ int result = super.processFocusIn (int0, int1, int2);
+ if (caret != null) caret.setFocus ();
+ return result;
+}
+int processFocusOut(int int0, int int1, int int2) {
+ int result = super.processFocusOut (int0, int1, int2);
+ if (caret != null) caret.killFocus ();
+ return result;
+}
+/*
+int processMouseDown (int callData, int arg1, int int2) {
+ if ((UtilFuncs.GTK_WIDGET_GET_FLAGS(handle) & OS.GTK_HAS_FOCUS) == 0)
+ OS.gtk_widget_grab_focus(handle);
+ GdkEventButton gdkEvent = new GdkEventButton ();
+ OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
+ int eventType = SWT.MouseDown;
+ if (gdkEvent.type == OS.GDK_2BUTTON_PRESS) eventType = SWT.MouseDoubleClick;
+ sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
+ if (gdkEvent.button == 3 && menu != null) {
+ menu.setVisible (true);
+ }
+ return 1;
+}
+
+int processMouseUp (int callData, int arg1, int int2) {
+ GdkEventButton gdkEvent = new GdkEventButton ();
+ OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
+ sendMouseEvent (SWT.MouseUp, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
+ return 1;
+}
+*/
+int processPaint (int callData, int arg1, int int2) {
+ //if (!hooks (SWT.Paint)) return 0;
+
+ GdkEventExpose gdkEvent = new GdkEventExpose ();
+ OS.memmove (gdkEvent, callData, GdkEventExpose.sizeof);
+ Event event = new Event ();
+ event.count = gdkEvent.count;
+ event.x = gdkEvent.x; event.y = gdkEvent.y;
+ event.width = gdkEvent.width; event.height = gdkEvent.height;
+ GC gc = event.gc = new GC (this);
+ sendEvent (SWT.Paint, event);
+ gc.dispose ();
+ event.gc = null;
+ return 0;
+}
+void releaseWidget () {
+ if (caret != null) caret.releaseWidget ();
+ caret = null;
+ super.releaseWidget ();
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Caret.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Caret.java
new file mode 100644
index 0000000..0500c51
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Caret.java
@@ -0,0 +1,498 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class provide an i-beam that is typically used
+ * as the insertion point for text.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+
+public class Caret extends Widget {
+ Canvas parent;
+ int x, y, width, height;
+ boolean moved, resized;
+ boolean isVisible,isShowing;
+ int blinkRate = 500;
+ Image image;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Caret (Canvas parent, int style) {
+ super (parent, style);
+ this.parent = parent;
+ createWidget (0);
+}
+void createWidget (int index) {
+ super.createWidget (index);
+ isVisible = true;
+ if (parent.getCaret () == null) {
+ parent.setCaret (this);
+ }
+}
+
+boolean blinkCaret () {
+ if (!isVisible) return true;
+ if (!isShowing) return showCaret();
+ if (blinkRate==0) return true;
+ return hideCaret();
+}
+
+boolean drawCaret () {
+ if (parent == null) return false;
+ if (parent.isDisposed ()) return false;
+ int handle = parent.handle;
+ GtkWidget widget = new GtkWidget();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ int window = widget.window;
+ if (window == 0) return false;
+ int gc = OS.gdk_gc_new(window);
+ GdkGCValues gcvalues = new GdkGCValues();
+ OS.gdk_gc_get_values(gc, gcvalues);
+ //GdkColor color = new GdkColor();
+ //color.pixel = gcvalues.foreground_pixel ^ gcvalues.background_pixel;
+ //color.red = (short)(gcvalues.foreground_red ^ gcvalues.background_red);
+ //color.green = (short)(gcvalues.foreground_green ^ gcvalues.background_green);
+ //color.blue = (short)(gcvalues.foreground_blue ^ gcvalues.background_blue);
+ Color COLOR_DARK_RED = new Color (Display.getCurrent(), 0x80,0xFF,0xFF);
+ OS.gdk_gc_set_foreground(gc, COLOR_DARK_RED.handle);
+ OS.gdk_gc_set_function(gc, OS.GDK_XOR);
+ int nWidth = width;
+ if (nWidth <= 0) nWidth = 2;
+ OS.gdk_draw_rectangle(window, gc, 1, x, y, nWidth, height);
+ OS.gdk_gc_destroy(gc);
+ return true;
+}
+/**
+ * Returns a rectangle describing the receiver's size and location
+ * relative to its parent (or its display if its parent is null).
+ *
+ * @return the receiver's bounding rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Rectangle getBounds () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return new Rectangle (x, y, width, height);
+}
+public Display getDisplay () {
+ Composite parent = this.parent;
+ if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getDisplay ();
+}
+/**
+ * Returns the font that the receiver will use to paint textual information.
+ *
+ * @return the receiver's font
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Font getFont () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getFont ();
+}
+/**
+ * Returns a point describing the receiver's location relative
+ * to its parent (or its display if its parent is null).
+ *
+ * @return the receiver's location
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getLocation () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return new Point (x, y);
+}
+/**
+ * Returns the receiver's parent, which must be a <code>Canvas</code>.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Canvas getParent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent;
+}
+/**
+ * Returns a point describing the receiver's size.
+ *
+ * @return the receiver's size
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getSize () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return new Point (width, height);
+}
+/**
+ * Returns <code>true</code> if the receiver is visible, and
+ * <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getVisible () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return isVisible;
+}
+boolean hideCaret () {
+// Display display = getDisplay ();
+// if (display.currentCaret != this) return false;
+ if (!isShowing) return true;
+ isShowing = false;
+ return drawCaret ();
+}
+/**
+ * Returns <code>true</code> if the receiver is visible, and
+ * <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isVisible () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return isVisible && parent.isVisible (); // && parent.hasFocus ();
+}
+void killFocus () {
+// OS.DestroyCaret ();
+// self restoreFont.
+}
+void move () {
+ showCaret();
+ moved = false;
+}
+void releaseChild () {
+ super.releaseChild ();
+ if (this == parent.getCaret ()) parent.setCaret (null);
+}
+void releaseWidget () {
+ super.releaseWidget ();
+ parent = null;
+}
+void resize () {
+ int hwnd = parent.handle;
+ if (hwnd == 0) return;
+// OS.DestroyCaret ();
+// OS.CreateCaret (hwnd, 0, width, height);
+// OS.SetCaretPos (x, y);
+// OS.ShowCaret (hwnd);
+// self move.
+// showCaret();
+ resized = false;
+}
+/**
+ * Sets the receiver's size and location to the rectangular
+ * area specified by the arguments. The <code>x</code> and
+ * <code>y</code> arguments are relative to the receiver's
+ * parent (or its display if its parent is null).
+ *
+ * @param x the new x coordinate for the receiver
+ * @param y the new y coordinate for the receiver
+ * @param width the new width for the receiver
+ * @param height the new height for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setBounds (int x, int y, int width, int height) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ boolean samePosition, sameExtent, showing;
+ samePosition = (this.x == x) && (this.y == y);
+ sameExtent = (this.width == width) && (this.height == height);
+ if (samePosition && sameExtent) return;
+ if (isShowing) hideCaret ();
+ this.x = x; this.y = y;
+ this.width = width; this.height = height;
+ if (sameExtent) {
+ moved = true;
+ if (isVisible ()) move ();
+ } else {
+ resized = true;
+ if (isVisible ()) resize ();
+ }
+ if(isVisible())
+ showCaret ();
+}
+/**
+ * Sets the receiver's size and location to the rectangular
+ * area specified by the argument. The <code>x</code> and
+ * <code>y</code> fields of the rectangle are relative to
+ * the receiver's parent (or its display if its parent is null).
+ *
+ * @param rect the new bounds for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setBounds (Rectangle rect) {
+ if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
+ setBounds (rect.x, rect.y, rect.width, rect.height);
+}
+void setFocus () {
+ Display display = getDisplay();
+ if (display.currentCaret==this) return;
+ display.setCurrentCaret(this);
+ if (isVisible) showCaret ();
+}
+
+/**
+ * Sets the font that the receiver will use to paint textual information
+ * to the font specified by the argument, or to the default font for that
+ * kind of control if the argument is null.
+ *
+ * @param font the new font (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the font has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setFont (Font font) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (font != null && font.isDisposed ()) {
+ error (SWT.ERROR_INVALID_ARGUMENT);
+ }
+}
+
+/**
+ * Returns the image that the receiver will use to paint the caret.
+ *
+ * @return the receiver's image
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Image getImage () {
+ checkWidget();
+ return image;
+}
+/**
+ * Sets the image that the receiver will use to paint the caret
+ * to the image specified by the argument, or to the default
+ * which is a filled rectangle if the argument is null
+ *
+ * @param font the new font (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setImage (Image image) {
+ checkWidget();
+ if (image != null && image.isDisposed ()) {
+ error (SWT.ERROR_INVALID_ARGUMENT);
+ }
+ if (isShowing) hideCaret ();
+ this.image = image;
+ if (isShowing) showCaret ();
+}
+/**
+ * Sets the receiver's location to the point specified by
+ * the arguments which are relative to the receiver's
+ * parent (or its display if its parent is null).
+ *
+ * @param x the new x coordinate for the receiver
+ * @param y the new y coordinate for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLocation (int x, int y) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ setBounds (x, y, width, height);
+}
+/**
+ * Sets the receiver's location to the point specified by
+ * the argument which is relative to the receiver's
+ * parent (or its display if its parent is null).
+ *
+ * @param location the new location for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLocation (Point location) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
+ setLocation (location.x, location.y);
+}
+/**
+ * Sets the receiver's size to the point specified by the arguments.
+ *
+ * @param width the new width for the receiver
+ * @param height the new height for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSize (int width, int height) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (this.width == width && this.height == height) return;
+ this.width = width; this.height = height;
+ resized = true;
+ if (isVisible ()) resize ();
+}
+/**
+ * Sets the receiver's size to the point specified by the argument.
+ *
+ * @param size the new extent for the receiver
+ * @param height the new height for the receiver
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSize (Point size) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
+ setSize (size.x, size.y);
+}
+/**
+ * Marks the receiver as visible if the argument is <code>true</code>,
+ * and marks it invisible otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, marking
+ * it visible may not actually cause it to be displayed.
+ * </p>
+ *
+ * @param visible the new visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setVisible (boolean visible) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (visible == isVisible) return;
+ if (isVisible = visible) {
+ showCaret ();
+ } else {
+ hideCaret ();
+ }
+
+}
+boolean showCaret () {
+// if (getDisplay ().currentCaret != this) return false;
+ if (isShowing) return true;
+ isShowing = true;
+ return drawCaret ();
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ColorDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ColorDialog.java
new file mode 100644
index 0000000..33dfd4b
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ColorDialog.java
@@ -0,0 +1,166 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class allow the user to select a color
+ * from a predefined set of available colors.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+public class ColorDialog extends Dialog {
+ RGB rgb;
+/**
+ * Constructs a new instance of this class given only its parent.
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public ColorDialog (Shell parent) {
+ this (parent, SWT.NULL);
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public ColorDialog (Shell parent, int style) {
+ super (parent, style);
+}
+int cancelFunc (int widget, int callData) {
+ OS.gtk_widget_destroy (callData);
+ return 0;
+}
+int destroyFunc (int widget, int colorInfo) {
+ OS.gtk_main_quit ();
+ return 0;
+}
+/**
+ * Returns the currently selected color in the receiver.
+ *
+ * @return the RGB value for the selected color, may be null
+ *
+ * @see PaletteData#getRGBs
+ */
+public RGB getRGB () {
+ return rgb;
+}
+int okFunc (int widget, int callData) {
+ GtkColorSelectionDialog dialog = new GtkColorSelectionDialog ();
+ OS.memmove (dialog, callData, GtkColorSelectionDialog.sizeof);
+ double [] color = new double [4];
+ OS.gtk_color_selection_get_color (dialog.colorsel, color);
+ rgb = new RGB ((int)(color [0] * 256), (int)(color [1] * 256), (int)(color [2] * 256));
+ OS.gtk_widget_destroy (callData);
+ return 0;
+}
+/**
+ * Makes the receiver visible and brings it to the front
+ * of the display.
+ *
+ * @return the selected color, or null if the dialog was
+ * cancelled, no color was selected, or an error
+ * occurred
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public RGB open () {
+ int handle;
+ byte [] titleBytes;
+ titleBytes = Converter.wcsToMbcs (null, title, true);
+ handle = OS.gtk_color_selection_dialog_new (titleBytes);
+ GtkColorSelectionDialog dialog = new GtkColorSelectionDialog ();
+ OS.memmove (dialog, handle, GtkColorSelectionDialog.sizeof);
+ OS.gtk_widget_hide (dialog.help_button);
+ if (rgb != null) {
+ double [] color = new double [4];
+ color [0] = (double)rgb.red / 256;
+ color [1] = (double)rgb.green / 256;
+ color [2] = (double)rgb.blue / 256;
+ OS.gtk_color_selection_set_color (dialog.colorsel, color);
+ }
+ Callback destroyCallback = new Callback (this, "destroyFunc", 2);
+ int destroyFunc = destroyCallback.getAddress ();
+ byte [] destroy = Converter.wcsToMbcs (null, "destroy", true);
+ OS.gtk_signal_connect (handle, destroy, destroyFunc, handle);
+ byte [] clicked = Converter.wcsToMbcs (null, "clicked", true);
+ Callback okCallback = new Callback (this, "okFunc", 2);
+ int okFunc = okCallback.getAddress ();
+ Callback cancelCallback = new Callback (this, "cancelFunc", 2);
+ int cancelFunc = cancelCallback.getAddress ();
+ OS.gtk_signal_connect (dialog.ok_button, clicked, okFunc, handle);
+ OS.gtk_signal_connect (dialog.cancel_button, clicked, cancelFunc, handle);
+ rgb = null;
+ OS.gtk_widget_show_now (handle);
+ OS.gtk_main ();
+ destroyCallback.dispose ();
+ okCallback.dispose ();
+ cancelCallback.dispose ();
+ return rgb;
+}
+/**
+ * Returns the receiver's selected color to be the argument.
+ *
+ * @param rgb the new RGB value for the selected color, may be
+ * null to let the platform to select a default when
+ * open() is called
+ *
+ * @see PaletteData#getRGBs
+ */
+public void setRGB (RGB rgb) {
+ this.rgb = rgb;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
new file mode 100644
index 0000000..d2f6fe6
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
@@ -0,0 +1,1010 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class are controls that allow the user
+ * to choose an item from a list of items, or optionally
+ * enter a new value by typing it into an editable text
+ * field. Often, <code>Combo</code>s are used in the same place
+ * where a single selection <code>List</code> widget could
+ * be used but space is limited. A <code>Combo</code> takes
+ * less space than a <code>List</code> widget and shows
+ * similar information.
+ * <p>
+ * Note: Since <code>Combo</code>s can contain both a list
+ * and an editable text field, it is possible to confuse methods
+ * which access one versus the other (compare for example,
+ * <code>clearSelection()</code> and <code>deselectAll()</code>).
+ * The API documentation is careful to indicate either "the
+ * receiver's list" or the "the receiver's text field" to
+ * distinguish between the two cases.
+ * </p><p>
+ * Note that although this class is a subclass of <code>Composite</code>,
+ * it does not make sense to add children to it, or set a layout on it.
+ * </p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>DROP_DOWN, READ_ONLY, SIMPLE</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>DefaultSelection, Modify, Selection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ *
+ * @see List
+ */
+
+public class Combo extends Composite {
+ int padHandle, _entryHandle, _listHandle, _arrowHandle;
+ int glist;
+ boolean isSelection;
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Combo (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+/**
+ * Adds the argument to the end of the receiver's list.
+ *
+ * @param string the new item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ *
+ * @see #add(String,int)
+ */
+public void add (String string) {
+ checkWidget();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ String [] items = getItems ();
+ String [] newItems = new String [items.length + 1];
+ System.arraycopy (items, 0, newItems, 0, items.length);
+ newItems [items.length] = string;
+ setItems (newItems);
+}
+/**
+ * Adds the argument to the receiver's list at the given
+ * zero-relative index.
+ * <p>
+ * Note: To add an item at the end of the list, use the
+ * result of calling <code>getItemCount()</code> as the
+ * index or use <code>add(String)</code>.
+ * </p>
+ *
+ * @param string the new item
+ * @param index the index for the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ *
+ * @see #add(String)
+ */
+public void add (String string, int index) {
+ checkWidget();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (!(0 <= index && index <= getItemCount ())) {
+ error (SWT.ERROR_ITEM_NOT_ADDED);
+ }
+ String [] items = getItems ();
+ String [] newItems = new String [items.length + 1];
+ System.arraycopy (items, 0, newItems, 0, items.length);
+ newItems [index] = string;
+ setItems (newItems);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's text is modified, by sending
+ * it one of the messages defined in the <code>ModifyListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ModifyListener
+ * @see #removeModifyListener
+ */
+public void addModifyListener (ModifyListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Modify, typedListener);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's selection changes, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * <code>widgetSelected</code> is called when the combo's list selection changes.
+ * <code>widgetDefaultSelected</code> is typically called when ENTER is pressed the combo's text area.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener(SelectionListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+static int checkStyle (int style) {
+ /*
+ * Feature in Windows. It is not possible to create
+ * a combo box that has a border using Windows style
+ * bits. All combo boxes draw their own border and
+ * do not use the standard Windows border styles.
+ * Therefore, no matter what style bits are specified,
+ * clear the BORDER bits so that the SWT style will
+ * match the Windows widget.
+ *
+ * The Windows behavior is currently implemented on
+ * all platforms.
+ */
+ style &= ~SWT.BORDER;
+
+ /*
+ * Even though it is legal to create this widget
+ * with scroll bars, they serve no useful purpose
+ * because they do not automatically scroll the
+ * widget's client area. The fix is to clear
+ * the SWT style.
+ */
+ style &= ~(SWT.H_SCROLL | SWT.V_SCROLL);
+ style = checkBits (style, SWT.DROP_DOWN, SWT.SIMPLE, 0, 0, 0, 0);
+ if ((style & SWT.SIMPLE) != 0) return style & ~SWT.READ_ONLY;
+ return style;
+}
+/**
+ * Sets the selection in the receiver's text field to an empty
+ * selection starting just before the first character. If the
+ * text field is editable, this has the effect of placing the
+ * i-beam at the start of the text.
+ * <p>
+ * Note: To clear the selected items in the receiver's list,
+ * use <code>deselectAll()</code>.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #deselectAll
+ */
+public void clearSelection () {
+ checkWidget();
+ int position = OS.gtk_editable_get_position (_entryHandle);
+ OS.gtk_editable_set_position (_entryHandle, position);
+}
+
+
+/* === Handle code 1 (creation) ========= */
+
+void createHandle (int index) {
+ state |= HANDLE;
+ eventBoxHandle = OS.gtk_event_box_new ();
+ if (eventBoxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ padHandle = OS.gtk_fixed_new ();
+ if (padHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ handle = OS.gtk_combo_new ();
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+ fixedHandle = OS.gtk_fixed_new();
+ if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ // The GtkCombo internal widgets.
+ // We don't create them, and actually these are not all of them
+ GtkCombo gtkCombo = new GtkCombo();
+ OS.memmove (gtkCombo, handle, GtkCombo.sizeof);
+ _entryHandle = gtkCombo.entry;
+ _listHandle = gtkCombo.list;
+ _arrowHandle = gtkCombo.button;
+}
+
+void setHandleStyle() {
+ boolean isEditable = (style & SWT.READ_ONLY) == 0;
+ OS.gtk_entry_set_editable(_entryHandle, isEditable);
+}
+
+void configure () {
+ _connectParent();
+ OS.gtk_container_add(eventBoxHandle, padHandle);
+ OS.gtk_fixed_put (padHandle, fixedHandle, (short)0, (short)0);
+ OS.gtk_fixed_put (padHandle, handle, (short)0, (short)0);
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ return _computeSize(wHint, hHint, changed);
+}
+
+void showHandle() {
+ OS.gtk_widget_show(eventBoxHandle);
+ OS.gtk_widget_show(padHandle);
+ OS.gtk_widget_show(fixedHandle);
+ OS.gtk_widget_show(handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void register () {
+ super.register ();
+ WidgetTable.put (padHandle, this);
+ WidgetTable.put (_entryHandle, this);
+ WidgetTable.put (_listHandle, this);
+ WidgetTable.put (_arrowHandle, this);
+}
+
+void deregister () {
+ super.deregister ();
+ WidgetTable.remove (padHandle);
+ WidgetTable.remove (_entryHandle);
+ WidgetTable.remove (_listHandle);
+ WidgetTable.remove (_arrowHandle);
+}
+
+void hookEvents () {
+ // TO DO - expose, enter/exit, focus in/out
+ super.hookEvents ();
+ signal_connect(_entryHandle, "changed", SWT.Selection, 2);
+ int mask =
+ OS.GDK_POINTER_MOTION_MASK |
+ OS.GDK_BUTTON_PRESS_MASK | OS.GDK_BUTTON_RELEASE_MASK |
+ OS.GDK_KEY_PRESS_MASK | OS.GDK_KEY_RELEASE_MASK;
+ int [] handles = new int [] {_entryHandle, _listHandle, _arrowHandle};
+ for (int i=0; i<handles.length; i++) {
+ int handle = handles [i];
+ if (!OS.GTK_WIDGET_NO_WINDOW (handle)) {
+ OS.gtk_widget_add_events (handle, mask);
+ }
+ signal_connect_after (handle, "motion_notify_event", SWT.MouseMove, 3);
+ signal_connect_after (handle, "button_press_event", SWT.MouseDown, 3);
+ signal_connect_after (handle, "button_release_event", SWT.MouseUp, 3);
+ signal_connect_after (handle, "key_press_event", SWT.KeyDown, 3);
+ signal_connect_after (handle, "key_release_event", SWT.KeyUp, 3);
+ }
+}
+
+/* === Handle code 2 (identification) === */
+int topHandle() { return eventBoxHandle; }
+int parentingHandle() { return fixedHandle; }
+boolean isMyHandle(int h) {
+ if (h==eventBoxHandle) return true;
+ if (h==padHandle) return true;
+ if (h==fixedHandle) return true;
+ if (h==handle) return true;
+
+ if (h==_arrowHandle) return true;
+ if (h==_entryHandle) return true;
+ if (h==_listHandle) return true;
+
+ return false;
+}
+
+void _connectChild (int h) {
+ OS.gtk_fixed_put (fixedHandle, h, (short)0, (short)0);
+}
+
+/* Geometry */
+
+protected Point _getClientAreaSize () {
+ return UtilFuncs.getSize(fixedHandle);
+}
+
+boolean _setSize(int width, int height) {
+ boolean differentExtent = UtilFuncs.setSize(eventBoxHandle, width,height);
+ UtilFuncs.setSize (fixedHandle, width,height);
+ UtilFuncs.setSize (handle, width,height);
+ return differentExtent;
+}
+
+/**
+ * Deselects the item at the given zero-relative index in the receiver's
+ * list. If the item at the index was already deselected, it remains
+ * deselected. Indices that are out of range are ignored.
+ *
+ * @param index the index of the item to deselect
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselect (int index) {
+ checkWidget();
+ setItems (getItems ());
+}
+/**
+ * Deselects all selected items in the receiver's list.
+ * <p>
+ * Note: To clear the selection in the receiver's text field,
+ * use <code>clearSelection()</code>.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #clearSelection
+ */
+public void deselectAll () {
+ checkWidget();
+ setItems (getItems ());
+}
+/**
+ * Returns the item at the given, zero-relative index in the
+ * receiver's list. Throws an exception if the index is out
+ * of range.
+ *
+ * @param index the index of the item to return
+ * @return the item at the given index
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public String getItem (int index) {
+ checkWidget();
+ if (!(0 <= index && index < getItemCount ())) {
+ error (SWT.ERROR_CANNOT_GET_ITEM);
+ }
+ String [] items = getItems ();
+ return items [index];
+}
+/**
+ * Returns the number of items contained in the receiver's list.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public int getItemCount () {
+ checkWidget();
+ if (glist == 0) return 0;
+ return OS.g_list_length (glist);
+}
+/**
+ * Returns the height of the area which would be used to
+ * display <em>one</em> of the items in the receiver's list.
+ *
+ * @return the height of one item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public int getItemHeight () {
+ checkWidget();
+ /* FIXME */
+ return 0;
+}
+/**
+ * Returns an array of <code>String</code>s which are the items
+ * in the receiver's list.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the items in the receiver's list
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public String [] getItems () {
+ checkWidget();
+ if (glist == 0) return new String [0];
+ int count = OS.g_list_length (glist);
+ String [] items = new String [count];
+ for (int i=0; i<count; i++) {
+ int data = OS.g_list_nth_data (glist, i);
+ int length = OS.strlen (data);
+ byte [] buffer1 = new byte [length];
+ OS.memmove (buffer1, data, length);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ items [i] = new String (buffer2, 0, length);
+ }
+ return items;
+}
+/**
+ * Returns a <code>Point</code> whose x coordinate is the start
+ * of the selection in the receiver's text field, and whose y
+ * coordinate is the end of the selection. The returned values
+ * are zero-relative. An "empty" selection as indicated by
+ * the the x and y coordinates having the same value.
+ *
+ * @return a point representing the selection start and end
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getSelection () {
+ GtkEditable widget = new GtkEditable();
+ OS.memmove (widget, _entryHandle, GtkEditable.sizeof);
+ return new Point (widget.selection_start_pos, widget.selection_end_pos);
+}
+/**
+ * Returns the zero-relative index of the item which is currently
+ * selected in the receiver's list, or -1 if no item is selected.
+ *
+ * @return the index of the selected item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelectionIndex () {
+ checkWidget();
+ return indexOf(getText());
+}
+/**
+ * Returns a string containing a copy of the contents of the
+ * receiver's text field.
+ *
+ * @return the receiver's text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getText () {
+ checkWidget();
+ int address = OS.gtk_entry_get_text(_entryHandle);
+ int length = OS.strlen (address);
+ byte [] buffer1 = new byte [length];
+ OS.memmove (buffer1, address, length);
+ //OS.g_free (address);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ return new String (buffer2, 0, buffer2.length);
+}
+String getText (int start, int stop) {
+ /*
+ * NOTE: The current implementation uses substring ()
+ * which can reference a potentially large character
+ * array.
+ */
+ return getText ().substring (start, stop - 1);
+}
+/**
+ * Returns the height of the receivers's text field.
+ *
+ * @return the text height
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public int getTextHeight () {
+ checkWidget();
+ /* A native approach, just measuring the entry:
+ * return UtilFuncs.getSize(_entryHandle).y;
+ * does not work - the entry is the same size as
+ * the whole combo.
+ */
+ error (SWT.ERROR_CANNOT_GET_ITEM_HEIGHT);
+ return 0;
+}
+/**
+ * Returns the maximum number of characters that the receiver's
+ * text field is capable of holding. If this has not been changed
+ * by <code>setTextLimit()</code>, it will be the constant
+ * <code>Combo.LIMIT</code>.
+ *
+ * @return the text limit
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getTextLimit () {
+ checkWidget();
+ /* Temporary implementation.
+ * Gtk lacks API to get the text limit, and GtkEntry is private.
+ */
+ int limitAddress = _entryHandle + GtkEditable.sizeof + 4*5;
+ int[] bytes = new int[2];
+ OS.memmove(bytes, limitAddress, 4*2);
+
+ return 0xFFFF & bytes[0];
+}
+
+/**
+ * Searches the receiver's list starting at the first item
+ * (index 0) until an item is found that is equal to the
+ * argument, and returns the index of that item. If no item
+ * is found, returns -1.
+ *
+ * @param string the search item
+ * @return the index of the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int indexOf (String string) {
+ checkWidget();
+ return indexOf (string, 0);
+}
+/**
+ * Searches the receiver's list starting at the given,
+ * zero-relative index until an item is found that is equal
+ * to the argument, and returns the index of that item. If
+ * no item is found or the starting index is out of range,
+ * returns -1.
+ *
+ * @param string the search item
+ * @return the index of the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int indexOf (String string, int start) {
+ checkWidget();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ String [] items = getItems ();
+ for (int i=start; i<items.length; i++) {
+ if (string.equals(items [i])) return i;
+ }
+ return -1;
+}
+
+int processSelection (int int0, int int1, int int2) {
+ if (!isSelection){
+ postEvent (SWT.Selection);
+ postEvent (SWT.Modify);
+ }
+ return 0;
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ int padHandle = _entryHandle = _listHandle = _arrowHandle = 0;
+}
+
+void releaseWidget () {
+ if (glist != 0) {
+ int count = OS.g_list_length (glist);
+ for (int i=0; i<count; i++) {
+ int data = OS.g_list_nth_data (glist, i);
+ if (data != 0) OS.g_free (data);
+ }
+ OS.g_list_free (glist);
+ }
+ glist = 0;
+ super.releaseWidget ();
+}
+/**
+ * Removes the item from the receiver's list at the given
+ * zero-relative index.
+ *
+ * @param index the index for the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (int index) {
+ checkWidget();
+ if (!(0 <= index && index < getItemCount ())) {
+ error (SWT.ERROR_ITEM_NOT_REMOVED);
+ }
+ String [] oldItems = getItems ();
+ String [] newItems = new String [oldItems.length - 1];
+ System.arraycopy (oldItems, 0, newItems, 0, index);
+ System.arraycopy (oldItems, index + 1, newItems, index, oldItems.length - index - 1);
+ setItems (newItems);
+}
+/**
+ * Removes the items from the receiver's list which are
+ * between the given zero-relative start and end
+ * indices (inclusive).
+ *
+ * @param start the start of the range
+ * @param end the end of the range
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (int start, int end) {
+ checkWidget();
+ if (!(0 <= start && start <= end && end < getItemCount ())) {
+ error (SWT.ERROR_ITEM_NOT_REMOVED);
+ }
+ String [] oldItems = getItems ();
+ String [] newItems = new String [oldItems.length - (end - start + 1)];
+ System.arraycopy (oldItems, 0, newItems, 0, start);
+ System.arraycopy (oldItems, end + 1, newItems, start, oldItems.length - end - 1);
+ setItems (newItems);
+}
+/**
+ * Searches the receiver's list starting at the first item
+ * until an item is found that is equal to the argument,
+ * and removes that item from the list.
+ *
+ * @param string the item to remove
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (String string) {
+ checkWidget();
+ int index = indexOf (string, 0);
+ if (index != -1) remove (index);
+}
+/**
+ * Removes all of the items from the receiver's list.
+ * <p>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void removeAll () {
+ checkWidget();
+ _removeAll();
+}
+void _removeAll() {
+ clearSelection ();
+ OS.gtk_list_clear_items(_listHandle, 0, -1);
+ glist = 0;
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's text is modified.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ModifyListener
+ * @see #addModifyListener
+ */
+public void removeModifyListener (ModifyListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Modify, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's selection changes.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener (SelectionListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+/**
+ * Selects the item at the given zero-relative index in the receiver's
+ * list. If the item at the index was already selected, it remains
+ * selected. Indices that are out of range are ignored.
+ *
+ * @param index the index of the item to select
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void select (int index) {
+ checkWidget();
+ String selectedText = getItems()[index];
+ GtkCombo gtkCombo = new GtkCombo ();
+ OS.memmove (gtkCombo, handle, GtkCombo.sizeof);
+ int list = gtkCombo.list;
+ int entry = gtkCombo.entry;
+ OS.gtk_list_select_item (list, index);
+ OS.gtk_entry_set_text (entry, Converter.wcsToMbcs (null, selectedText, true));
+}
+/**
+ * Sets the text of the item in the receiver's list at the given
+ * zero-relative index to the string argument. This is equivalent
+ * to <code>remove</code>'ing the old item at the index, and then
+ * <code>add</code>'ing the new item at that index.
+ *
+ * @param index the index for the item
+ * @param string the new text for the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the remove operation fails because of an operating system failure</li>
+ * <li>ERROR_ITEM_NOT_ADDED - if the add operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void setItem (int index, String string) {
+ checkWidget();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (!(0 <= index && index <= getItemCount ())) {
+ error (SWT.ERROR_INVALID_ARGUMENT);
+ }
+ String [] items = getItems ();
+ items [index] = string;
+ setItems (items);
+}
+/**
+ * Sets the receiver's list to be the given array of items.
+ *
+ * @param items the array of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void setItems (String [] items) {
+ checkWidget();
+ if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (items.length==0) {
+ _removeAll();
+ return;
+ }
+ int new_glist = 0;
+ for (int i=0; i<items.length; i++) {
+ String string = items [i];
+ // FIXME leaked strings and glist
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ int data = OS.g_malloc (buffer.length);
+ OS.memmove (data, buffer, buffer.length);
+ new_glist = OS.g_list_append (new_glist, data);
+ }
+ OS.gtk_combo_set_popdown_strings (handle, new_glist);
+ if (glist != 0) {
+ int count = OS.g_list_length (glist);
+ for (int i=0; i<count; i++) {
+ int data = OS.g_list_nth_data (glist, i);
+ if (data != 0) OS.g_free (data);
+ }
+ OS.g_list_free (glist);
+ }
+ glist = new_glist;
+}
+/**
+ * Sets the selection in the receiver's text field to the
+ * range specified by the argument whose x coordinate is the
+ * start of the selection and whose y coordinate is the end
+ * of the selection.
+ *
+ * @param a point representing the new selection start and end
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (Point selection) {
+ checkWidget();
+ if (selection == null) error (SWT.ERROR_NULL_ARGUMENT);
+ GtkCombo gtkCombo = new GtkCombo ();
+ OS.memmove (gtkCombo, handle, GtkCombo.sizeof);
+ int entry = gtkCombo.entry;
+ isSelection = true;
+ OS.gtk_editable_set_position (entry, selection.x);
+ OS.gtk_editable_select_region (entry, selection.x, selection.y);
+ isSelection = false;
+}
+/**
+ * Sets the contents of the receiver's text field to the
+ * given string.
+ * <p>
+ * Note: The text field in a <code>Combo</code> is typically
+ * only capable of displaying a single line of text. Thus,
+ * setting the text to a string containing line breaks or
+ * other special characters will probably cause it to
+ * display incorrectly.
+ * </p>
+ *
+ * @param text the new text
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setText (String string) {
+ checkWidget();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ GtkCombo gtkCombo = new GtkCombo ();
+ OS.memmove (gtkCombo, handle, GtkCombo.sizeof);
+ int entry = gtkCombo.entry;
+ OS.gtk_editable_delete_text (entry, 0, -1);
+ int [] position = new int [1];
+ byte [] buffer = Converter.wcsToMbcs (null, string);
+ OS.gtk_editable_insert_text (entry, buffer, buffer.length, position);
+ OS.gtk_editable_set_position (entry, 0);
+}
+/**
+ * Sets the maximum number of characters that the receiver's
+ * text field is capable of holding to be the argument.
+ *
+ * @param limit new text limit
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_CANNOT_BE_ZERO - if the limit is zero</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setTextLimit (int limit) {
+ checkWidget();
+ if (limit == 0) error (SWT.ERROR_CANNOT_BE_ZERO);
+ OS.gtk_entry_set_max_length(_entryHandle, (short)limit);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
new file mode 100644
index 0000000..85b5077
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
@@ -0,0 +1,489 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class are controls which are capable
+ * of containing other controls.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>NO_BACKGROUND, NO_FOCUS, NO_MERGE_PAINTS, NO_REDRAW_RESIZE</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * This class may be subclassed by custom control implementors
+ * who are building controls that are constructed from aggregates
+ * of other controls.
+ * </p>
+ *
+ * @see Canvas
+ */
+public class Composite extends Scrollable {
+ int topHandle, eventBoxHandle, fixedHandle, radioHandle;
+ Layout layout;
+
+/*
+ * === CONSTRUCTORS ===
+ */
+
+Composite () {
+ /* Do nothing */
+}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a widget which will be the parent of the new instance (cannot be null)
+ * @param style the style of widget to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Composite (Composite parent, int style) {
+ super (parent, style);
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+
+ topHandle = OS.gtk_event_box_new();
+ if (topHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+
+ scrolledHandle = OS.gtk_scrolled_window_new(0,0);
+ if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ eventBoxHandle = OS.gtk_event_box_new();
+ if (eventBoxHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+
+ fixedHandle = OS.gtk_fixed_new ();
+ if (fixedHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+
+ handle = OS.gtk_drawing_area_new();
+ if (handle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+ OS.GTK_WIDGET_SET_FLAGS(handle, OS.GTK_CAN_FOCUS);
+}
+
+void configure() {
+ _connectParent();
+ OS.gtk_container_add(topHandle, scrolledHandle);
+ _fillBin(scrolledHandle, eventBoxHandle);
+ OS.gtk_container_add(eventBoxHandle, fixedHandle);
+ OS.gtk_fixed_put(fixedHandle, handle, (short)0,(short)0);
+}
+
+void setHandleStyle() {
+ setScrollingPolicy();
+}
+
+void showHandle() {
+ OS.gtk_widget_realize (topHandle);
+ OS.gtk_widget_show_now(topHandle);
+
+ OS.gtk_widget_show (scrolledHandle);
+
+ OS.gtk_widget_realize (eventBoxHandle);
+ OS.gtk_widget_show_now(eventBoxHandle);
+
+ OS.gtk_widget_realize (fixedHandle);
+ OS.gtk_widget_show_now(fixedHandle);
+
+ OS.gtk_widget_realize (handle);
+ OS.gtk_widget_show_now (handle);
+}
+
+void register () {
+ super.register ();
+ if (topHandle != 0) WidgetTable.put (topHandle, this);
+ if (eventBoxHandle != 0) WidgetTable.put (eventBoxHandle, this);
+ if (fixedHandle != 0) WidgetTable.put (fixedHandle, this);
+}
+
+void deregister () {
+ super.deregister ();
+ if (topHandle != 0) WidgetTable.remove (topHandle);
+ if (eventBoxHandle != 0) WidgetTable.remove (eventBoxHandle);
+ if (fixedHandle != 0) WidgetTable.remove (fixedHandle);
+}
+
+int topHandle() {
+ return topHandle;
+}
+
+int parentingHandle() {
+ return fixedHandle;
+}
+
+/**
+ * Answer whether the argument points to an OS widget that is
+ * implementing the receiver, i.e., one of my own handles
+ */
+boolean isMyHandle(int h) {
+ if (h==topHandle) return true;
+ if (h==eventBoxHandle) return true;
+ if (h==scrolledHandle) return true;
+ if (h==fixedHandle) return true;
+ if (h==handle) return true;
+ if (h==radioHandle) return true;
+ return false;
+}
+
+
+
+
+/*
+ * === GEOMETRY - PHYSICAL ===
+ */
+
+
+public void setBounds (int x, int y, int width, int height) {
+ super.setBounds (x, y, width, height);
+ layout();
+}
+
+public void setSize (int width, int height) {
+ super.setSize(width, height);
+ layout();
+}
+
+boolean _setSize(int width, int height) {
+ boolean differentExtent = UtilFuncs.setSize (topHandle(), width,height);
+ Point clientSize = UtilFuncs.getSize(fixedHandle);
+ OS.gtk_drawing_area_size(handle, width, height);
+ UtilFuncs.setSize (handle, clientSize.x, clientSize.y);
+ return differentExtent;
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ Point size;
+ if (layout != null) {
+ if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) {
+ size = layout.computeSize (this, wHint, hHint, changed);
+ } else {
+ size = new Point (wHint, hHint);
+ }
+ } else {
+ size = minimumSize ();
+ }
+ if (size.x == 0) size.x = DEFAULT_WIDTH;
+ if (size.y == 0) size.y = DEFAULT_HEIGHT;
+ if (wHint != SWT.DEFAULT) size.x = wHint;
+ if (hHint != SWT.DEFAULT) size.y = hHint;
+ Rectangle trim = computeTrim (0, 0, size.x, size.y);
+ return new Point (trim.width, trim.height);
+}
+
+void initializeTrim() {
+ /* Temporary implementation - I just measured the scrollbars
+ * with one particular theme. The fair thing to do is get
+ * the real dimensions from gtk.
+ */
+ trim = new Trim();
+ if ((style&SWT.H_SCROLL)!=0) trim.bottom=18;
+ if ((style&SWT.V_SCROLL)!=0) trim.right=18;
+}
+
+
+/*
+ * === GEOMETRY - LAYOUT ===
+ */
+
+/**
+ * Returns layout which is associated with the receiver, or
+ * null if one has not been set.
+ *
+ * @return the receiver's layout or null
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Layout getLayout () {
+ checkWidget();
+ return layout;
+}
+
+/**
+ * Gets the last specified tabbing order for the control.
+ *
+ * @return tabList the ordered list of controls representing the tab order
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setTabList
+ */
+public Control [] getTabList () {
+ return new Control [0];
+}
+
+/**
+ * Sets the layout which is associated with the receiver to be
+ * the argument which may be null.
+ *
+ * @param layout the receiver's new layout or null
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLayout (Layout layout) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ this.layout = layout;
+}
+
+int _gdkWindow() {
+ int windowHandle = _gdkWindow(handle);
+ if (windowHandle==0) error(SWT.ERROR_UNSPECIFIED);
+ return windowHandle;
+}
+
+/**
+ * Returns an array containing the receiver's children.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of children, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return an array of children
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Control [] getChildren () {
+ checkWidget();
+ return _getChildren();
+}
+
+Control [] _getChildren () {
+ return _getChildren(parentingHandle());
+}
+
+/**
+ * Answer the array of the children of the specified handle,
+ * filtering out widgets we don't consider our children.
+ * That is, the OS may return some children that don't qualify
+ * as such under SWT terminology - e.g., Items are not children.
+ */
+Control [] _getChildren (int h) {
+ if (h==0) {
+ error(SWT.ERROR_UNSPECIFIED);
+ }
+ int list = OS.gtk_container_children (h);
+ int count = OS.g_list_length (list);
+ java.util.Vector children = new java.util.Vector();
+ for (int i=0; i<count; i++) {
+ int data = OS.g_list_nth_data (list, i);
+ if (!isMyHandle(data)) {
+ Control child = _childFromHandle(data);
+ if (child != null) children.addElement(child);
+ }
+ }
+ Control[] answer = new Control[children.size()];
+ children.copyInto(answer);
+ return answer;
+}
+/**
+ * Consider the argument a handle of one of the receiver's children.
+ * If the argument is not a handle to a widget, or the widget is
+ * not our child in SWT (not OS) terminology, return null.
+ */
+Control _childFromHandle(int h) {
+ Widget child = WidgetTable.get(h);
+ return (Control)child;
+}
+
+public Rectangle getClientArea () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+
+ return _getClientArea ();
+}
+
+public Rectangle _getClientArea () {
+ Point size = _getClientAreaSize ();
+ return new Rectangle (0, 0, size.x, size.y);
+}
+
+Point _getClientAreaSize () {
+ return UtilFuncs.getSize(handle);
+}
+
+
+/**
+ * If the receiver has a layout, asks the layout to <em>lay out</em>
+ * (that is, set the size and location of) the receiver's children.
+ * If the receiver does not have a layout, do nothing.
+ * <p>
+ * This is equivalent to calling <code>layout(true)</code>.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void layout () {
+ layout (true);
+}
+/**
+ * If the receiver has a layout, asks the layout to <em>lay out</em>
+ * (that is, set the size and location of) the receiver's children.
+ * If the the argument is <code>true</code> the layout must not rely
+ * on any cached information it is keeping about the children. If it
+ * is <code>false</code> the layout may (potentially) simplify the
+ * work it is doing by assuming that the state of the none of the
+ * receiver's children has changed since the last layout.
+ * If the receiver does not have a layout, do nothing.
+ *
+ * @param changed <code>true</code> if the layout must flush its caches, and <code>false</code> otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void layout (boolean changed) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (layout == null) return;
+ layout.layout (this, changed);
+}
+
+Point minimumSize () {
+ Control [] children = _getChildren ();
+ int width = 0, height = 0;
+ for (int i=0; i<children.length; i++) {
+ Rectangle rect = children [i].getBounds ();
+ width = Math.max (width, rect.x + rect.width);
+ height = Math.max (height, rect.y + rect.height);
+ }
+ return new Point (width, height);
+}
+int processResize (int int0, int int1, int int2) {
+ sendEvent (SWT.Resize);
+ layout();
+ return 0;
+}
+int radioGroup() {
+ if (radioHandle==0) _initializeRadioGroup();
+ return OS.gtk_radio_button_group(radioHandle);
+}
+
+public void redraw () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+// Point size = _getSize();
+// GtkWidget widget = new GtkWidget(handle);
+// _redraw(0, 0, size.x, size.y, true);
+OS.gtk_widget_queue_draw(handle);
+}
+
+void _initializeRadioGroup() {
+ radioHandle = OS.gtk_radio_button_new(0);
+}
+
+/**
+ * Adopt the widget h as our child.
+ */
+void _connectChild (int h) {
+ OS.gtk_fixed_put (parentingHandle(), h, (short)0, (short)0);
+}
+
+void releaseChildren () {
+ Control [] children = _getChildren ();
+ for (int i=0; i<children.length; i++) {
+ Control child = children [i];
+ if (child != null && !child.isDisposed ()) {
+ child.releaseWidget ();
+ child.releaseHandle ();
+ }
+ }
+}
+void releaseWidget () {
+ releaseChildren ();
+ super.releaseWidget ();
+ layout = null;
+}
+void releaseHandle () {
+ super.releaseHandle ();
+ topHandle = eventBoxHandle = fixedHandle = radioHandle = 0;
+}
+
+int processFocusIn(int int0, int int1, int int2) {
+ OS.GTK_WIDGET_SET_FLAGS(handle, OS.GTK_HAS_FOCUS);
+ return super.processFocusIn(int0, int1, int2);
+}
+int processFocusOut(int int0, int int1, int int2) {
+ OS.GTK_WIDGET_UNSET_FLAGS(handle, OS.GTK_HAS_FOCUS);
+ return super.processFocusOut(int0, int1, int2);
+}
+
+public boolean setFocus () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ Control [] children = _getChildren ();
+ for (int i=0; i<children.length; i++) {
+ Control child = children [i];
+ if (child.getVisible () && child.setFocus ()) return true;
+ }
+ return super.setFocus ();
+}
+
+/**
+ * Sets the tabbing order for the specified controls to
+ * match the order that they occur in the argument list.
+ *
+ * @param tabList the ordered list of controls representing the tab order; must not be null
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the tabList is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if a widget in the tabList is null or has been disposed</li>
+ * <li>ERROR_INVALID_PARENT - if widget in the tabList is not in the same widget tree</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setTabList (Control [] tabList) {
+}
+
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
new file mode 100644
index 0000000..470c74e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -0,0 +1,2149 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.Converter;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Control is the abstract superclass of all windowed user interface classes.
+ * <p>
+ * <dl>
+ * <dt><b>Styles:</b>
+ * <dd>BORDER</dd>
+ * <dt><b>Events:</b>
+ * <dd>FocusIn, FocusOut, Help, KeyDown, KeyUp, MouseDoubleClick, MouseDown, MouseEnter,
+ * MouseExit, MouseHover, MouseUp, MouseMove, Move, Paint, Resize</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+public abstract class Control extends Widget implements Drawable {
+
+ Composite parent;
+ Menu menu;
+ String toolTipText;
+ Object layoutData;
+
+/*
+ * === CONSTRUCTORS ===
+ */
+
+Control () {
+}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Control (Composite parent, int style) {
+ super (parent, style);
+ this.parent = parent;
+ createWidget (0);
+}
+
+abstract void createHandle(int index);
+
+int eventHandle () {
+ return handle;
+}
+
+/**
+ * Connect the appropriate signal handlers.
+ *
+ * At a minimum, we must connect
+ * <ul>
+ * <li>expose_event
+ * <li>button_press_event / button_release_event
+ * <li>motion_notify_event
+ * <li>enter_notify_event / leave_notify_event
+ * <li>key_press_event / key_release_event
+ * <li>focus_in_event / focus_out_event
+ * </ul>
+ *
+ * The possible mask bits are:
+ * <ul>
+ * GDK_EXPOSURE_MASK |
+ * GDK_POINTER_MOTION_MASK |
+ * GDK_POINTER_MOTION_HINT_MASK |
+ * GDK_ENTER_NOTIFY_MASK |
+ * GDK_LEAVE_NOTIFY_MASK |
+ * GDK_BUTTON_PRESS_MASK
+ * GDK_BUTTON_RELEASE_MASK
+ * GDK_KEY_PRESS_MASK
+ * GDK_KEY_RELEASE_MASK
+ * GDK_FOCUS_CHANGE_MASK
+ * </ul>
+ */
+void hookEvents () {
+ signal_connect (handle, "expose_event", SWT.Paint, 3);
+ int mask =
+ OS.GDK_POINTER_MOTION_MASK |
+ OS.GDK_BUTTON_PRESS_MASK | OS.GDK_BUTTON_RELEASE_MASK |
+ OS.GDK_ENTER_NOTIFY_MASK | OS.GDK_LEAVE_NOTIFY_MASK |
+ OS.GDK_KEY_PRESS_MASK | OS.GDK_KEY_RELEASE_MASK |
+ OS.GDK_FOCUS_CHANGE_MASK;
+ int eventHandle = eventHandle ();
+ if (!OS.GTK_WIDGET_NO_WINDOW (eventHandle)) {
+ OS.gtk_widget_add_events (eventHandle, mask);
+ }
+ signal_connect_after (eventHandle, "motion_notify_event", SWT.MouseMove, 3);
+ signal_connect_after (eventHandle, "button_press_event", SWT.MouseDown, 3);
+ signal_connect_after (eventHandle, "button_release_event", SWT.MouseUp, 3);
+ signal_connect_after (eventHandle, "enter_notify_event", SWT.MouseEnter, 3);
+ signal_connect_after (eventHandle, "leave_notify_event", SWT.MouseExit, 3);
+ signal_connect_after (eventHandle, "key_press_event", SWT.KeyDown, 3);
+ signal_connect_after (eventHandle, "key_release_event", SWT.KeyUp, 3);
+ signal_connect_after (eventHandle, "focus_in_event", SWT.FocusIn, 3);
+ signal_connect_after (eventHandle, "focus_out_event", SWT.FocusOut, 3);
+}
+
+abstract void setHandleStyle ();
+void setInitialSize() { UtilFuncs.setZeroSize(topHandle()); }
+void configure () {
+ // Do NOT directly use gtk_fixed_put in configure(),
+ // because not all composites have GtkFixed as their
+ // parenting (bottom) handle.
+ _connectParent();
+}
+void _connectParent() {
+ parent._connectChild(topHandle());
+}
+/**
+ * Every Control must implement this to map the gtk widgets,
+ * and also realize those that have to be realized - this means
+ * create the actual X window so that there are no surprizes
+ * if the user calls a method expecting the X window to be there.
+ * Widgets normally do it by invoking gtk_widget_show() on all
+ * handles, and then doing gtk_widget_realize() on bottommost
+ * handle, which will realize everything above as well.
+ * An exception to this is the Shell, which we do NOT realize
+ * at this point.
+ */
+abstract void showHandle();
+
+int topHandle() {
+ return handle;
+}
+
+int paintHandle() {
+ return handle;
+}
+
+/*
+ * === GEOMETRY ===
+ */
+
+int computeHandle () {
+ return handle;
+}
+
+Point _computeSize (int wHint, int hHint, boolean changed) {
+ int handle = computeHandle ();
+ byte [] gtk_aux_info = Converter.wcsToMbcs (null, "gtk-aux-info", true);
+ int id = OS.g_quark_from_string (gtk_aux_info);
+ int aux_info = OS.gtk_object_get_data_by_id (handle, id);
+ OS.gtk_object_set_data_by_id (handle, id, 0);
+ GtkRequisition requisition = new GtkRequisition ();
+ OS.gtk_widget_size_request (handle, requisition);
+ OS.gtk_object_set_data_by_id (handle, id, aux_info);
+ int width = wHint == SWT.DEFAULT ? requisition.width : wHint;
+ int height = hHint == SWT.DEFAULT ? requisition.height : hHint;
+ return new Point (width, height);
+}
+
+/**
+ * Returns the preferred size of the receiver.
+ * <p>
+ * The <em>prefered size</em> of a control is the size that it would
+ * best be displayed at. The width hint and height hint arguments
+ * allow the caller to ask a control questions such as "Given a particular
+ * width, how high does the control need to be to show all of the contents?"
+ * To indicate that the caller does not wish to constrain a particular
+ * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
+ * </p>
+ *
+ * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
+ * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
+ * @return the preferred size of the control
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Layout
+ */
+public Point computeSize (int wHint, int hHint) {
+ return computeSize (wHint, hHint, true);
+}
+
+/**
+ * Returns the preferred size of the receiver.
+ * <p>
+ * The <em>prefered size</em> of a control is the size that it would
+ * best be displayed at. The width hint and height hint arguments
+ * allow the caller to ask a control questions such as "Given a particular
+ * width, how high does the control need to be to show all of the contents?"
+ * To indicate that the caller does not wish to constrain a particular
+ * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
+ * </p><p>
+ * If the changed flag is <code>true</code>, it indicates that the receiver's
+ * <em>contents</em> have changed, therefore any caches that a layout manager
+ * containing the control may have been keeping need to be flushed. When the
+ * control is resized, the changed flag will be <code>false</code>, so layout
+ * manager caches can be retained.
+ * </p>
+ *
+ * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
+ * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
+ * @param changed <code>true</code> if the control's contents have changed, and <code>false</code> otherwise
+ * @return the preferred size of the control.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Layout
+ */
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget();
+ return _computeSize (wHint, hHint, changed);
+}
+
+/**
+ * Returns a rectangle describing the receiver's size and location
+ * relative to its parent (or its display if its parent is null).
+ *
+ * @return the receiver's bounding rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Rectangle getBounds () {
+ checkWidget();
+ return _getBounds();
+}
+
+/**
+ * The actual implementation for getBounds().
+ * Concrete controls implement their means to answer the location
+ * and size by overriding _getLocation() and _getSize().
+ */
+final Rectangle _getBounds() {
+ Point location = _getLocation();
+ Point size = _getSize();
+ return new Rectangle(location.x, location.y, size.x, size.y);
+}
+
+/**
+ * Sets the receiver's size and location to the rectangular
+ * area specified by the argument. The <code>x</code> and
+ * <code>y</code> fields of the rectangle are relative to
+ * the receiver's parent (or its display if its parent is null).
+ * <p>
+ * Note: Attempting to set the width or height of the
+ * receiver to a negative number will cause that
+ * value to be set to zero instead.
+ * </p>
+ *
+ * @param rect the new bounds for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setBounds (Rectangle rect) {
+ if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
+ setBounds (rect.x, rect.y, rect.width, rect.height);
+}
+
+/**
+ * Sets the receiver's size and location to the rectangular
+ * area specified by the arguments. The <code>x</code> and
+ * <code>y</code> arguments are relative to the receiver's
+ * parent (or its display if its parent is null).
+ * <p>
+ * Note: Attempting to set the width or height of the
+ * receiver to a negative number will cause that
+ * value to be set to zero instead.
+ * </p>
+ *
+ * @param x the new x coordinate for the receiver
+ * @param y the new y coordinate for the receiver
+ * @param width the new width for the receiver
+ * @param height the new height for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setBounds (int x, int y, int width, int height) {
+ checkWidget();
+ boolean differentOrigin = _setLocation(x,y);
+ boolean differentExtent = _setSize (width,height);
+ if (differentOrigin) sendEvent (SWT.Move);
+ if (differentExtent) sendEvent (SWT.Resize);
+}
+
+/**
+ * Returns a point describing the receiver's location relative
+ * to its parent (or its display if its parent is null).
+ *
+ * @return the receiver's location
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getLocation () {
+ checkWidget();
+ return _getLocation();
+}
+
+Point _getLocation () {
+ return UtilFuncs.getLocation(topHandle());
+}
+
+/**
+ * Sets the receiver's location to the point specified by
+ * the argument which is relative to the receiver's
+ * parent (or its display if its parent is null).
+ *
+ * @param location the new location for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLocation (Point location) {
+ if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
+ setLocation (location.x, location.y);
+}
+
+/**
+ * Sets the receiver's location to the point specified by
+ * the arguments which are relative to the receiver's
+ * parent (or its display if its parent is null).
+ *
+ * @param x the new x coordinate for the receiver
+ * @param y the new y coordinate for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLocation(int x, int y) {
+ checkWidget();
+ if (_setLocation(x,y)) sendEvent(SWT.Move);
+}
+
+boolean _setLocation(int x, int y) {
+ return UtilFuncs.setLocation(parent.parentingHandle(), topHandle(), x,y);
+}
+
+/**
+ * Returns a point describing the receiver's size. The
+ * x coordinate of the result is the width of the receiver.
+ * The y coordinate of the result is the height of the
+ * receiver.
+ *
+ * @return the receiver's size
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getSize () {
+ checkWidget();
+ return _getSize();
+}
+Point _getSize() {
+ return UtilFuncs.getSize(topHandle());
+}
+
+/**
+ * Sets the receiver's size to the point specified by the argument.
+ * <p>
+ * Note: Attempting to set the width or height of the
+ * receiver to a negative number will cause them to be
+ * set to zero instead.
+ * </p>
+ *
+ * @param size the new size for the receiver
+ * @param height the new height for the receiver
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSize (Point size) {
+ if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
+ setSize (size.x, size.y);
+}
+
+/**
+ * Sets the receiver's size to the point specified by the arguments.
+ * <p>
+ * Note: Attempting to set the width or height of the
+ * receiver to a negative number will cause that
+ * value to be set to zero instead.
+ * </p>
+ *
+ * @param width the new width for the receiver
+ * @param height the new height for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSize (int width, int height) {
+ checkWidget();
+ // Even though GTK+ will not let any widget be smaller
+ // than 3@3, we don't care about it here, as this kind
+ // of platform weirdness is handled in UtilFuncs.
+ width = Math.max(width, 0);
+ height = Math.max(height, 0);
+ if (_setSize(width, height)) sendEvent(SWT.Resize);
+}
+boolean _setSize(int width, int height) { return UtilFuncs.setSize(topHandle(), width, height); }
+
+/**
+ * Moves the receiver above the specified control in the
+ * drawing order. If the argument is null, then the receiver
+ * is moved to the top of the drawing order. The control at
+ * the top of the drawing order will not be covered by other
+ * controls even if they occupy intersecting areas.
+ *
+ * @param the sibling control (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void moveAbove (Control control) {
+ checkWidget();
+ GtkWidget widget = new GtkWidget();
+ OS.memmove (widget, topHandle(), GtkWidget.sizeof);
+ int topGdkWindow = widget.window;
+ if (topGdkWindow!=0) OS.gdk_window_raise (topGdkWindow);
+}
+
+/**
+ * Moves the receiver below the specified control in the
+ * drawing order. If the argument is null, then the receiver
+ * is moved to the bottom of the drawing order. The control at
+ * the bottom of the drawing order will be covered by all other
+ * controls which occupy intersecting areas.
+ *
+ * @param the sibling control (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void moveBelow (Control control) {
+ checkWidget();
+ GtkWidget widget = new GtkWidget();
+ OS.memmove (widget, topHandle(), GtkWidget.sizeof);
+ int topGdkWindow = widget.window;
+ if (topGdkWindow!=0) OS.gdk_window_lower (topGdkWindow);
+}
+
+/**
+ * Causes the receiver to be resized to its preferred size.
+ * For a composite, this involves computing the preferred size
+ * from its layout, if there is one.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #computeSize
+ */
+public void pack () {
+ pack (true);
+}
+
+/**
+ * Causes the receiver to be resized to its preferred size.
+ * For a composite, this involves computing the preferred size
+ * from its layout, if there is one.
+ * <p>
+ * If the changed flag is <code>true</code>, it indicates that the receiver's
+ * <em>contents</em> have changed, therefore any caches that a layout manager
+ * containing the control may have been keeping need to be flushed. When the
+ * control is resized, the changed flag will be <code>false</code>, so layout
+ * manager caches can be retained.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #computeSize
+ */
+public void pack (boolean changed) {
+ checkWidget();
+ setSize (computeSize (SWT.DEFAULT, SWT.DEFAULT, changed));
+}
+
+/**
+ * Sets the layout data associated with the receiver to the argument.
+ *
+ * @param layoutData the new layout data for the receiver.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLayoutData (Object layoutData) {
+ checkWidget();
+ this.layoutData = layoutData;
+}
+
+/**
+ * Returns a point which is the result of converting the
+ * argument, which is specified in display relative coordinates,
+ * to coordinates relative to the receiver.
+ * <p>
+ * @param point the point to be translated (must not be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point toControl (Point point) {
+ checkWidget();
+ int[] x = new int[1], y = new int[1];
+ OS.gdk_window_get_origin(_gdkWindow(), x,y);
+ int ctlX = point.x - x[0];
+ int ctlY = point.y - y[0];
+ return new Point (ctlX, ctlY);
+}
+/**
+ * Returns a point which is the result of converting the
+ * argument, which is specified in coordinates relative to
+ * the receiver, to display relative coordinates.
+ * <p>
+ * @param point the point to be translated (must not be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point toDisplay (Point point) {
+ checkWidget();
+ int[] x = new int[1], y = new int[1];
+ OS.gdk_window_get_origin(_gdkWindow(), x,y);
+ return new Point (x[0]+point.x, y[0]+point.y);
+}
+// === End of GEOMETRY Category ===
+
+
+/*
+ * == ADD/REMOVE LISTENERS ==
+ */
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control is moved or resized, by sending
+ * it one of the messages defined in the <code>ControlListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ControlListener
+ * @see #removeControlListener
+ */
+public void addControlListener(ControlListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Resize,typedListener);
+ addListener (SWT.Move,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control gains or loses focus, by sending
+ * it one of the messages defined in the <code>FocusListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see FocusListener
+ * @see #removeFocusListener
+ */
+public void addFocusListener(FocusListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener(SWT.FocusIn,typedListener);
+ addListener(SWT.FocusOut,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the help events are generated for the control, by sending
+ * it one of the messages defined in the <code>HelpListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see HelpListener
+ * @see #removeHelpListener
+ */
+public void addHelpListener (HelpListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Help, typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when keys are pressed and released on the system keyboard, by sending
+ * it one of the messages defined in the <code>KeyListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see KeyListener
+ * @see #removeKeyListener
+ */
+public void addKeyListener(KeyListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener(SWT.KeyUp,typedListener);
+ addListener(SWT.KeyDown,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when mouse buttons are pressed and released, by sending
+ * it one of the messages defined in the <code>MouseListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseListener
+ * @see #removeMouseListener
+ */
+public void addMouseListener(MouseListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener(SWT.MouseDown,typedListener);
+ addListener(SWT.MouseUp,typedListener);
+ addListener(SWT.MouseDoubleClick,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the mouse moves, by sending it one of the
+ * messages defined in the <code>MouseMoveListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseMoveListener
+ * @see #removeMouseMoveListener
+ */
+public void addMouseMoveListener(MouseMoveListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener(SWT.MouseMove,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the mouse passes or hovers over controls, by sending
+ * it one of the messages defined in the <code>MouseTrackListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseTrackListener
+ * @see #removeMouseTrackListener
+ */
+public void addMouseTrackListener (MouseTrackListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.MouseEnter,typedListener);
+ addListener (SWT.MouseExit,typedListener);
+ addListener (SWT.MouseHover,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver needs to be painted, by sending it
+ * one of the messages defined in the <code>PaintListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see PaintListener
+ * @see #removePaintListener
+ */
+public void addPaintListener(PaintListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener(SWT.Paint,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when traversal events occur, by sending it
+ * one of the messages defined in the <code>TraverseListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see TraverseListener
+ * @see #removeTraverseListener
+ */
+public void addTraverseListener (TraverseListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Traverse,typedListener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is moved or resized.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ControlListener
+ * @see #addControlListener
+ */
+public void removeControlListener (ControlListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Move, listener);
+ eventTable.unhook (SWT.Resize, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control gains or loses focus.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see FocusListener
+ * @see #addFocusListener
+ */
+public void removeFocusListener(FocusListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.FocusIn, listener);
+ eventTable.unhook (SWT.FocusOut, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the help events are generated for the control.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see HelpListener
+ * @see #addHelpListener
+ */
+public void removeHelpListener (HelpListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Help, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when keys are pressed and released on the system keyboard.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see KeyListener
+ * @see #addKeyListener
+ */
+public void removeKeyListener(KeyListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.KeyUp, listener);
+ eventTable.unhook (SWT.KeyDown, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when mouse buttons are pressed and released.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseListener
+ * @see #addMouseListener
+ */
+public void removeMouseListener (MouseListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.MouseDown, listener);
+ eventTable.unhook (SWT.MouseUp, listener);
+ eventTable.unhook (SWT.MouseDoubleClick, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the mouse moves.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseMoveListener
+ * @see #addMouseMoveListener
+ */
+public void removeMouseMoveListener(MouseMoveListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.MouseMove, listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the mouse passes or hovers over controls.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseTrackListener
+ * @see #addMouseTrackListener
+ */
+public void removeMouseTrackListener(MouseTrackListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.MouseEnter, listener);
+ eventTable.unhook (SWT.MouseExit, listener);
+ eventTable.unhook (SWT.MouseHover, listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver needs to be painted.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see PaintListener
+ * @see #addPaintListener
+ */
+public void removePaintListener(PaintListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook(SWT.Paint, listener);
+}
+
+/*
+ * Return (GTKWIDGET)h->window.
+ */
+final int _gdkWindow(int h) {
+ /* Temporary code.
+ * This check is not necessary as the (internal) callers
+ * always make sure h!=0.
+ */
+ if (h==0) error(SWT.ERROR_CANNOT_BE_ZERO);
+
+ GtkWidget widget = new GtkWidget();
+ OS.memmove (widget, h, GtkWidget.sizeof);
+ return widget.window;
+}
+
+int _gdkWindow() {
+ int windowHandle = _gdkWindow(handle);
+ if (windowHandle==0) error(SWT.ERROR_NO_HANDLES);
+ return windowHandle;
+}
+
+/**
+ * Forces the receiver to have the <em>keyboard focus</em>, causing
+ * all keyboard events to be delivered to it.
+ *
+ * @return <code>true</code> if the control got focus, and <code>false</code> if it was unable to.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setFocus
+ */
+public boolean forceFocus () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_widget_grab_focus (handle);
+ return true;
+}
+
+/**
+ * Returns the receiver's background color.
+ *
+ * @return the background color
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Color getBackground () {
+ checkWidget();
+ return Color.gtk_new (_getBackgroundGdkColor());
+}
+
+/*
+ * Subclasses should override this to pass a meaningful handle
+ */
+GdkColor _getBackgroundGdkColor() {
+ /* Override this */
+ int h = paintHandle();
+
+ int hStyle = OS.gtk_widget_get_style (handle);
+ GtkStyle style = new GtkStyle ();
+ OS.memmove (style, hStyle, GtkStyle.sizeof);
+ GdkColor color = new GdkColor ();
+ color.pixel = style.bg0_pixel;
+ color.red = style.bg0_red;
+ color.green = style.bg0_green;
+ color.blue = style.bg0_blue;
+ return color;
+}
+
+/**
+ * Returns the receiver's border width.
+ *
+ * @return the border width
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getBorderWidth () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return (style & SWT.BORDER) == 0 ? 0 : 1;
+}
+
+/**
+ * Returns the display that the receiver was created on.
+ *
+ * @return the receiver's display
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Display getDisplay () {
+ if (parent == null) {
+ error (SWT.ERROR_WIDGET_DISPOSED);
+ }
+ return parent.getDisplay ();
+}
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getEnabled () {
+ checkWidget ();
+ int topHandle = topHandle ();
+ return OS.GTK_WIDGET_SENSITIVE (topHandle);
+}
+
+/**
+ * Returns the font that the receiver will use to paint textual information.
+ *
+ * @return the receiver's font
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Font getFont () {
+ checkWidget();
+ return Font.gtk_new(_getFontHandle());
+}
+/*
+ * Subclasses should override this, passing a meaningful handle
+ */
+int _getFontHandle () {
+ return UtilFuncs.getFont(handle);
+}
+
+/**
+ * Returns the foreground color that the receiver will use to draw.
+ *
+ * @return the receiver's foreground color
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Color getForeground () {
+ checkWidget();
+ return Color.gtk_new (_getForegroundGdkColor());
+}
+
+/*
+ * Subclasses should override this to pass a meaningful handle
+ */
+GdkColor _getForegroundGdkColor() {
+ /* Override this */
+ int h = paintHandle();
+
+ int hStyle = OS.gtk_widget_get_style (handle);
+ GtkStyle style = new GtkStyle ();
+ OS.memmove (style, hStyle, GtkStyle.sizeof);
+ GdkColor color = new GdkColor ();
+ color.pixel = style.fg0_pixel;
+ color.red = style.fg0_red;
+ color.green = style.fg0_green;
+ color.blue = style.fg0_blue;
+ return color;
+}
+
+/**
+ * Returns layout data which is associated with the receiver.
+ *
+ * @return the receiver's layout data
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Object getLayoutData () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return layoutData;
+}
+
+/**
+ * Returns the receiver's pop up menu if it has one, or null
+ * if it does not. All controls may optionally have a pop up
+ * menu that is displayed when the user requests one for
+ * the control. The sequence of key strokes, button presses
+ * and/or button releases that are used to request a pop up
+ * menu is platform specific.
+ *
+ * @return the receiver's menu
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Menu getMenu () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return menu;
+}
+/**
+ * Returns the receiver's parent, which must be a <code>Composite</code>
+ * or null when the receiver is a shell that was created with null or
+ * a display for a parent.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Composite getParent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent;
+}
+
+/**
+ * Returns the receiver's shell. For all controls other than
+ * shells, this simply returns the control's nearest ancestor
+ * shell. Shells return themselves, even if they are children
+ * of other shells.
+ *
+ * @return the receiver's shell
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #getParent
+ */
+public Shell getShell() {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return _getShell();
+}
+Shell _getShell() {
+ return parent._getShell();
+}
+
+/**
+ * Returns the receiver's tool tip text, or null if it has
+ * not been set.
+ *
+ * @return the receiver's tool tip text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getToolTipText () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return toolTipText;
+}
+/**
+ * Returns <code>true</code> if the receiver is visible, and
+ * <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getVisible () {
+ checkWidget();
+ return _getVisible();
+}
+boolean _getVisible() {
+ return _getVisible(topHandle());
+}
+boolean _getVisible(int h) {
+ return (OS.GTK_WIDGET_FLAGS(h) & OS.GTK_VISIBLE) != 0;
+}
+
+/**
+ * Invokes platform specific functionality to allocate a new GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Control</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param data the platform specific GC data
+ * @return the platform specific GC handle
+ *
+ * @private
+ */
+public int internal_new_GC (GCData data) {
+ if (data == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (paintHandle() == 0) error(SWT.ERROR_UNSPECIFIED);
+
+ // Create the GC with default values for this control
+ GtkWidget w = new GtkWidget();
+ OS.memmove (w, paintHandle(), GtkWidget.sizeof);
+
+ if (w.window == 0) error(SWT.ERROR_UNSPECIFIED);
+ int gc = OS.gdk_gc_new(w.window);
+
+ OS.gdk_gc_set_font(gc, _getFontHandle());
+ OS.gdk_gc_set_background(gc, _getBackgroundGdkColor());
+ OS.gdk_gc_set_foreground(gc, _getForegroundGdkColor());
+
+ data.drawable = w.window;
+ return gc;
+}
+
+/**
+ * Invokes platform specific functionality to dispose a GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Control</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param handle the platform specific GC handle
+ * @param data the platform specific GC data
+ *
+ * @private
+ */
+public void internal_dispose_GC (int xGC, GCData data) {
+ if(xGC == 0) error(SWT.ERROR_NO_HANDLES);
+ OS.gdk_gc_unref(xGC);
+}
+
+/**
+ * Returns <code>true</code> if the underlying operating
+ * system supports this reparenting, otherwise <code>false</code>
+ *
+ * @return <code>true</code> if the widget can be reparented, otherwise <code>false</code>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isReparentable () {
+ checkWidget();
+ return false;
+}
+
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isEnabled () {
+ checkWidget ();
+ int topHandle = topHandle ();
+ return OS.GTK_WIDGET_IS_SENSITIVE (topHandle);
+}
+
+/**
+ * Returns <code>true</code> if the receiver has the user-interface
+ * focus, and <code>false</code> otherwise.
+ *
+ * @return the receiver's focus state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isFocusControl () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return (OS.GTK_WIDGET_FLAGS(handle)&OS.GTK_HAS_FOCUS)!=0;
+}
+/**
+ * Returns <code>true</code> if the receiver is visible, and
+ * <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isVisible () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ boolean result = getVisible ();
+ if (parent != null)
+ result = result && parent.isVisible();
+ return result;
+}
+Decorations menuShell () {
+ return parent.menuShell ();
+}
+
+int processKeyDown (int callData, int arg1, int int2) {
+ GdkEventKey gdkEvent = new GdkEventKey ();
+ OS.memmove (gdkEvent, callData, GdkEventKey.sizeof);
+ sendKeyEvent (SWT.KeyDown, gdkEvent);
+ return 1;
+}
+
+int processKeyUp (int callData, int arg1, int int2) {
+ GdkEventKey gdkEvent = new GdkEventKey ();
+ OS.memmove (gdkEvent, callData, GdkEventKey.sizeof);
+ sendKeyEvent (SWT.KeyUp, gdkEvent);
+ return 1;
+}
+
+int processMouseDown (int callData, int arg1, int int2) {
+ OS.gtk_widget_grab_focus(handle);
+ GdkEventButton gdkEvent = new GdkEventButton ();
+ OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
+ int eventType = SWT.MouseDown;
+ if (gdkEvent.type == OS.GDK_2BUTTON_PRESS) eventType = SWT.MouseDoubleClick;
+ sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
+ if (gdkEvent.button == 3 && menu != null) {
+ menu.setVisible (true);
+ }
+ return 1;
+}
+
+int processMouseEnter (int arg0, int arg1, int int2) {
+ //NOT IMPLEMENTED - event state
+ sendEvent (SWT.MouseEnter);
+ return 1;
+}
+int processMouseExit (int arg0, int arg1, int int2) {
+ //NOT IMPLEMENTED - event state
+ sendEvent (SWT.MouseExit);
+ return 1;
+}
+
+int processMouseUp (int callData, int arg1, int int2) {
+ GdkEventButton gdkEvent = new GdkEventButton ();
+ OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
+ sendMouseEvent (SWT.MouseUp, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
+ return 1;
+}
+
+int processMouseMove (int callData, int arg1, int int2) {
+ GdkEventMotion gdkEvent = new GdkEventMotion ();
+ OS.memmove (gdkEvent, callData, GdkEventMotion.sizeof);
+ Point where = _gdkWindowGetPointer();
+ sendMouseEvent (SWT.MouseMove, 0, gdkEvent.state, gdkEvent.time, where.x, where.y);
+ return 1;
+}
+Point _gdkWindowGetPointer() {
+ int[] px = new int[1], py = new int[1];
+ OS.gdk_window_get_pointer(_gdkWindow(), px, py, 0);
+ return new Point(px[0], py[0]);
+}
+int processFocusIn(int int0, int int1, int int2) {
+ postEvent(SWT.FocusIn);
+ return 0;
+}
+int processFocusOut(int int0, int int1, int int2) {
+ postEvent(SWT.FocusOut);
+ return 0;
+}
+
+int processPaint (int callData, int int2, int int3) {
+ if (!hooks (SWT.Paint)) return 1;
+
+ GdkEventExpose gdkEvent = new GdkEventExpose ();
+ OS.memmove (gdkEvent, callData, GdkEventExpose.sizeof);
+ Event event = new Event ();
+ event.count = gdkEvent.count;
+ event.x = gdkEvent.x; event.y = gdkEvent.y;
+ event.width = gdkEvent.width; event.height = gdkEvent.height;
+ GC gc = event.gc = new GC (this);
+ GdkRectangle rect = new GdkRectangle ();
+ rect.x = gdkEvent.x; rect.y = gdkEvent.y;
+ rect.width = gdkEvent.width; rect.height = gdkEvent.height;
+ OS.gdk_gc_set_clip_rectangle (gc.handle, rect);
+ gc.fillRectangle(rect.x, rect.y, rect.width, rect.height);
+ sendEvent (SWT.Paint, event);
+ gc.dispose ();
+ event.gc = null;
+ return 1;
+}
+
+/**
+ * Causes the entire bounds of the receiver to be marked
+ * as needing to be redrawn. The next time a paint request
+ * is processed, the control will be completely painted.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #update
+ */
+public void redraw () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ Point size = _getSize();
+ _redraw(0, 0, size.x, size.y, true);
+//OS.gtk_widget_queue_draw(handle);
+}
+/**
+ * Causes the rectangular area of the receiver specified by
+ * the arguments to be marked as needing to be redrawn.
+ * The next time a paint request is processed, that area of
+ * the receiver will be painted. If the <code>all</code> flag
+ * is <code>true</code>, any children of the receiver which
+ * intersect with the specified area will also paint their
+ * intersecting areas. If the <code>all</code> flag is
+ * <code>false</code>, the children will not be painted.
+ *
+ * @param x the x coordinate of the area to draw
+ * @param y the y coordinate of the area to draw
+ * @param width the width of the area to draw
+ * @param height the height of the area to draw
+ * @param all <code>true</code> if children should redraw, and <code>false</code> otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #update
+ */
+public void redraw (int x, int y, int width, int height, boolean all) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ _redraw(x, y, width, height, all);
+}
+protected void _redraw(int x, int y, int width, int height, boolean all) {
+ OS.gdk_window_clear_area_e (_gdkWindow(), x, y, width, height);
+
+GdkRectangle rect = new GdkRectangle();
+rect.x = (short)x;
+rect.y = (short)y;
+rect.width = (short)width;
+rect.height =(short) height;
+//OS.gtk_widget_draw(handle, rect);
+OS.gtk_widget_queue_draw(handle);
+
+// OS.gtk_widget_queue_draw_area (handle, x, y, width, height);
+}
+
+void releaseWidget () {
+ super.releaseWidget ();
+ toolTipText = null;
+ parent = null;
+ menu = null;
+ layoutData = null;
+}
+void sendKeyEvent (int type, GdkEventKey gdkEvent) {
+ /* Look up the keysym and character(s) */
+ int size = gdkEvent.length;
+ if (gdkEvent.keyval == 0 && size == 0) return;
+
+ /* If there is no composed string input by keypress, only send the keyvalue */
+ if (size == 0 ) {
+ Event event = new Event ();
+ event.time = gdkEvent.time;
+// event.character = (char) 0; //no character sent
+ event.keyCode = Display.translateKey (gdkEvent.keyval);
+ event.character = (char) event.keyCode; //no character sent
+ if ((gdkEvent.state & OS.GDK_MOD1_MASK) != 0) event.stateMask |= SWT.ALT;
+ if ((gdkEvent.state & OS.GDK_SHIFT_MASK) != 0) event.stateMask |= SWT.SHIFT;
+ if ((gdkEvent.state & OS.GDK_CONTROL_MASK) != 0) event.stateMask |= SWT.CONTROL;
+ if ((gdkEvent.state & OS.GDK_BUTTON1_MASK) != 0) event.stateMask |= SWT.BUTTON1;
+ if ((gdkEvent.state & OS.GDK_BUTTON2_MASK) != 0) event.stateMask |= SWT.BUTTON2;
+ if ((gdkEvent.state & OS.GDK_BUTTON3_MASK) != 0) event.stateMask |= SWT.BUTTON3;
+ postEvent (type, event);
+ }
+ else {
+ byte [] buffer = new byte [size];
+ OS.memmove (buffer, gdkEvent.string, size);
+ /* Convert from MBCS to UNICODE and send the event */
+ char [] result = Converter.mbcsToWcs (null, buffer);
+ for (int i=0; i<result.length; i++) {
+ Event event = new Event ();
+ event.time = gdkEvent.time;
+ event.character = result [i];
+ event.keyCode = result [i]; //0; //no keyCode sent
+ if ((gdkEvent.state & OS.GDK_MOD1_MASK) != 0) event.stateMask |= SWT.ALT;
+ if ((gdkEvent.state & OS.GDK_SHIFT_MASK) != 0) event.stateMask |= SWT.SHIFT;
+ if ((gdkEvent.state & OS.GDK_CONTROL_MASK) != 0) event.stateMask |= SWT.CONTROL;
+ if ((gdkEvent.state & OS.GDK_BUTTON1_MASK) != 0) event.stateMask |= SWT.BUTTON1;
+ if ((gdkEvent.state & OS.GDK_BUTTON2_MASK) != 0) event.stateMask |= SWT.BUTTON2;
+ if ((gdkEvent.state & OS.GDK_BUTTON3_MASK) != 0) event.stateMask |= SWT.BUTTON3;
+ postEvent (type, event);
+ }
+ }
+}
+void sendMouseEvent (int type, int button, int mask, int time, int x, int y) {
+ Event event = new Event ();
+ event.time = time;
+ event.button = button;
+ event.x = x; event.y = y;
+ if ((mask & OS.GDK_MOD1_MASK) != 0) event.stateMask |= SWT.ALT;
+ if ((mask & OS.GDK_SHIFT_MASK) != 0) event.stateMask |= SWT.SHIFT;
+ if ((mask & OS.GDK_CONTROL_MASK) != 0) event.stateMask |= SWT.CONTROL;
+ if ((mask & OS.GDK_BUTTON1_MASK) != 0) event.stateMask |= SWT.BUTTON1;
+ if ((mask & OS.GDK_BUTTON2_MASK) != 0) event.stateMask |= SWT.BUTTON2;
+ if ((mask & OS.GDK_BUTTON3_MASK) != 0) event.stateMask |= SWT.BUTTON3;
+ postEvent (type, event);
+}
+
+/**
+ * Sets the receiver's background color to the color specified
+ * by the argument, or to the default system color for the control
+ * if the argument is null.
+ *
+ * @param color the new color (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setBackground (Color color) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int hDefaultStyle = OS.gtk_widget_get_default_style ();
+ int hStyle = OS.gtk_widget_get_style (handle);
+ boolean makeCopy = hStyle == hDefaultStyle;
+ hStyle = OS.gtk_style_copy (makeCopy ? hDefaultStyle : hStyle);
+ GtkStyle style = new GtkStyle ();
+ OS.memmove (style, hStyle, GtkStyle.sizeof);
+ if (color == null) {
+ GtkStyle defaultStyle = new GtkStyle ();
+ OS.memmove (defaultStyle, hDefaultStyle, GtkStyle.sizeof);
+ style.bg0_pixel = defaultStyle.bg0_pixel;
+ style.bg0_red = defaultStyle.bg0_red;
+ style.bg0_green = defaultStyle.bg0_green;
+ style.bg0_blue = defaultStyle.bg0_blue;
+ style.bg1_pixel = defaultStyle.bg1_pixel;
+ style.bg1_red = defaultStyle.bg1_red;
+ style.bg1_green = defaultStyle.bg1_green;
+ style.bg1_blue = defaultStyle.bg1_blue;
+ style.bg2_pixel = defaultStyle.bg2_pixel;
+ style.bg2_red = defaultStyle.bg2_red;
+ style.bg2_green = defaultStyle.bg2_green;
+ style.bg2_blue = defaultStyle.bg2_blue;
+ style.bg3_pixel = defaultStyle.bg3_pixel;
+ style.bg3_red = defaultStyle.bg3_red;
+ style.bg3_green = defaultStyle.bg3_green;
+ style.bg3_blue = defaultStyle.bg3_blue;
+ style.bg4_pixel = defaultStyle.bg4_pixel;
+ style.bg4_red = defaultStyle.bg4_red;
+ style.bg4_green = defaultStyle.bg4_green;
+ style.bg4_blue = defaultStyle.bg4_blue;
+ } else {
+ style.bg0_pixel = color.handle.pixel;
+ style.bg0_red = color.handle.red;
+ style.bg0_green = color.handle.green;
+ style.bg0_blue = color.handle.blue;
+ style.bg1_pixel = color.handle.pixel;
+ style.bg1_red = color.handle.red;
+ style.bg1_green = color.handle.green;
+ style.bg1_blue = color.handle.blue;
+ style.bg2_pixel = color.handle.pixel;
+ style.bg2_red = color.handle.red;
+ style.bg2_green = color.handle.green;
+ style.bg2_blue = color.handle.blue;
+ style.bg3_pixel = color.handle.pixel;
+ style.bg3_red = color.handle.red;
+ style.bg3_green = color.handle.green;
+ style.bg3_blue = color.handle.blue;
+ style.bg4_pixel = color.handle.pixel;
+ style.bg4_red = color.handle.red;
+ style.bg4_green = color.handle.green;
+ style.bg4_blue = color.handle.blue;
+ }
+ OS.memmove (hStyle, style, GtkStyle.sizeof);
+ OS.gtk_widget_set_style (handle, hStyle);
+ if (makeCopy) {
+ OS.gtk_style_unref (hStyle);
+ }
+}
+
+/**
+ * If the argument is <code>true</code>, causes the receiver to have
+ * all mouse events delivered to it until the method is called with
+ * <code>false</code> as the argument.
+ *
+ * @param capture <code>true</code> to capture the mouse, and <code>false</code> to release it
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setCapture (boolean capture) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ /*
+ if (capture) {
+ OS.gtk_widget_grab_focus (handle);
+ } else {
+ OS.gtk_widget_grab_default (handle);
+ }
+ */
+}
+/**
+ * Sets the receiver's cursor to the cursor specified by the
+ * argument, or to the default cursor for that kind of control
+ * if the argument is null.
+ * <p>
+ * When the mouse pointer passes over a control its appearance
+ * is changed to match the control's cursor.
+ * </p>
+ *
+ * @param cursor the new cursor (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setCursor (Cursor cursor) {
+ checkWidget();
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, paintHandle(), GtkWidget.sizeof);
+ int window = widget.window;
+ if (window == 0) return;
+ int hCursor = 0;
+ if (cursor != null) hCursor = cursor.handle;
+ OS.gdk_window_set_cursor (window, hCursor);
+}
+/**
+ * Enables the receiver if the argument is <code>true</code>,
+ * and disables it otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @param enabled the new enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setEnabled (boolean enabled) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int topHandle = topHandle ();
+ OS.gtk_widget_set_sensitive (topHandle, enabled);
+ /*
+ * This code is intentionally commented
+ */
+// OS.gtk_widget_set_state (topHandle, enabled ? OS.GTK_STATE_NORMAL : OS.GTK_STATE_INSENSITIVE);
+// if (enabled) {
+// OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_SENSITIVE);
+// } else {
+// OS.GTK_WIDGET_UNSET_FLAGS (handle, OS.GTK_SENSITIVE);
+// }
+}
+/**
+ * Causes the receiver to have the <em>keyboard focus</em>,
+ * such that all keyboard events will be delivered to it.
+ *
+ * @return <code>true</code> if the control got focus, and <code>false</code> if it was unable to.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #forceFocus
+ */
+public boolean setFocus () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return forceFocus ();
+}
+
+/**
+ * Sets the font that the receiver will use to paint textual information
+ * to the font specified by the argument, or to the default font for that
+ * kind of control if the argument is null.
+ *
+ * @param font the new font (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setFont (Font font) {
+ checkWidget();
+
+ /* The non-null font case */
+ if (font != null) {
+ if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ int fontHandle = OS.gdk_font_ref(font.handle);
+ _setFontHandle(fontHandle);
+ return;
+ }
+
+ /* The font argument is null, revert to default font */
+ GtkStyle style = new GtkStyle();
+ OS.memmove (style, OS.gtk_widget_get_default_style(), GtkStyle.sizeof);
+ int fontHandle = OS.gdk_font_ref(style.font);
+ if (fontHandle==0) error(SWT.ERROR_NO_HANDLES);
+ _setFontHandle(fontHandle);
+}
+
+/**
+ * Actually set the receiver's font in the OS.
+ * Concrete subclasses may override this method to operate
+ * on a different handle.
+ */
+void _setFontHandle (int f) {
+ UtilFuncs.setFont(handle, f);
+}
+
+/**
+ * Sets the receiver's foreground color to the color specified
+ * by the argument, or to the default system color for the control
+ * if the argument is null.
+ *
+ * @param color the new color (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setForeground (Color color) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int hStyle = OS.gtk_widget_get_style (handle);
+ hStyle = OS.gtk_style_copy (hStyle);
+ GtkStyle style = new GtkStyle ();
+ OS.memmove (style, hStyle, GtkStyle.sizeof);
+ if (color == null) {
+ int hDefaultStyle = OS.gtk_widget_get_default_style ();
+ GtkStyle defaultStyle = new GtkStyle ();
+ OS.memmove (defaultStyle, hDefaultStyle, GtkStyle.sizeof);
+ style.fg0_pixel = defaultStyle.fg0_pixel;
+ style.fg0_red = defaultStyle.fg0_red;
+ style.fg0_green = defaultStyle.fg0_green;
+ style.fg0_blue = defaultStyle.fg0_blue;
+ style.fg1_pixel = defaultStyle.fg1_pixel;
+ style.fg1_red = defaultStyle.fg1_red;
+ style.fg1_green = defaultStyle.fg1_green;
+ style.fg1_blue = defaultStyle.fg1_blue;
+ style.fg2_pixel = defaultStyle.fg2_pixel;
+ style.fg2_red = defaultStyle.fg2_red;
+ style.fg2_green = defaultStyle.fg2_green;
+ style.fg2_blue = defaultStyle.fg2_blue;
+ style.fg3_pixel = defaultStyle.fg3_pixel;
+ style.fg3_red = defaultStyle.fg3_red;
+ style.fg3_green = defaultStyle.fg3_green;
+ style.fg3_blue = defaultStyle.fg3_blue;
+ style.fg4_pixel = defaultStyle.fg4_pixel;
+ style.fg4_red = defaultStyle.fg4_red;
+ style.fg4_green = defaultStyle.fg4_green;
+ style.fg4_blue = defaultStyle.fg4_blue;
+ } else {
+ style.fg0_pixel = color.handle.pixel;
+ style.fg0_red = color.handle.red;
+ style.fg0_green = color.handle.green;
+ style.fg0_blue = color.handle.blue;
+ style.fg1_pixel = color.handle.pixel;
+ style.fg1_red = color.handle.red;
+ style.fg1_green = color.handle.green;
+ style.fg1_blue = color.handle.blue;
+ style.fg2_pixel = color.handle.pixel;
+ style.fg2_red = color.handle.red;
+ style.fg2_green = color.handle.green;
+ style.fg2_blue = color.handle.blue;
+ style.fg3_pixel = color.handle.pixel;
+ style.fg3_red = color.handle.red;
+ style.fg3_green = color.handle.green;
+ style.fg3_blue = color.handle.blue;
+ style.fg4_pixel = color.handle.pixel;
+ style.fg4_red = color.handle.red;
+ style.fg4_green = color.handle.green;
+ style.fg4_blue = color.handle.blue;
+ }
+ OS.memmove (hStyle, style, GtkStyle.sizeof);
+ OS.gtk_widget_set_style (handle, hStyle);
+}
+
+/**
+ * Sets the receiver's pop up menu to the argument.
+ * All controls may optionally have a pop up
+ * menu that is displayed when the user requests one for
+ * the control. The sequence of key strokes, button presses
+ * and/or button releases that are used to request a pop up
+ * menu is platform specific.
+ *
+ * @param menu the new pop up menu
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_MENU_NOT_POP_UP - the menu is not a pop up menu</li>
+ * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMenu (Menu menu) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (menu != null) {
+ if ((menu.style & SWT.POP_UP) == 0) {
+ error (SWT.ERROR_MENU_NOT_POP_UP);
+ }
+ if (menu.parent != menuShell ()) {
+ error (SWT.ERROR_INVALID_PARENT);
+ }
+ }
+ this.menu = menu;
+}
+
+/**
+ * Changes the parent of the widget to be the one provided if
+ * the underlying operating system supports this feature.
+ * Answers <code>true</code> if the parent is successfully changed.
+ *
+ * @param parent the new parent for the control.
+ * @return <code>true</code> if the parent is changed and <code>false</code> otherwise.
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
+ * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
+ * </ul>
+ */
+public boolean setParent (Composite parent) {
+ checkWidget();
+ if (parent.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ return false;
+}
+
+/**
+ * If the argument is <code>false</code>, causes subsequent drawing
+ * operations in the receiver to be ignored. No drawing of any kind
+ * can occur in the receiver until the flag is set to true.
+ * Graphics operations that occurred while the flag was
+ * <code>false</code> are lost. When the flag is set to <code>true</code>,
+ * the entire widget is marked as needing to be redrawn.
+ * <p>
+ * Note: This operation is a hint and may not be supported on some
+ * platforms or for some widgets.
+ * </p>
+ *
+ * @param redraw the new redraw state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #redraw
+ * @see #update
+ */
+public void setRedraw (boolean redraw) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+/**
+ * Sets the receiver's tool tip text to the argument, which
+ * may be null indicating that no tool tip text should be shown.
+ *
+ * @param string the new tool tip text (or null)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setToolTipText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ toolTipText = string;
+}
+/**
+ * Marks the receiver as visible if the argument is <code>true</code>,
+ * and marks it invisible otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, marking
+ * it visible may not actually cause it to be displayed.
+ * </p>
+ *
+ * @param visible the new visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setVisible (boolean visible) {
+ checkWidget();
+ int topHandle = topHandle();
+ if (visible) {
+ sendEvent (SWT.Show);
+ OS.gtk_widget_show (topHandle);
+ } else {
+ OS.gtk_widget_hide (topHandle);
+ sendEvent (SWT.Hide);
+ }
+}
+void sort (int [] items) {
+ /* Shell Sort from K&R, pg 108 */
+ int length = items.length;
+ for (int gap=length/2; gap>0; gap/=2) {
+ for (int i=gap; i<length; i++) {
+ for (int j=i-gap; j>=0; j-=gap) {
+ if (items [j] <= items [j + gap]) {
+ int swap = items [j];
+ items [j] = items [j + gap];
+ items [j + gap] = swap;
+ }
+ }
+ }
+ }
+}
+/**
+ * Forces all outstanding paint requests for the widget tree
+ * to be processed before this method returns.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #redraw
+ */
+public void update () {
+ checkWidget ();
+ //NOT DONE - should only dispatch paint events
+ OS.gdk_flush ();
+ while ((OS.gtk_events_pending()) != 0) {
+ OS.gtk_main_iteration ();
+ }
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java
new file mode 100644
index 0000000..9ee0f06
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java
@@ -0,0 +1,459 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class provide the appearance and
+ * behavior of <code>Shells</code>, but are not top
+ * level shells or dialogs. Class <code>Shell</code>
+ * shares a significant amount of code with this class,
+ * and is a subclass.
+ * <p>
+ * Instances are always displayed in one of the maximized,
+ * minimized or normal states:
+ * <ul>
+ * <li>
+ * When an instance is marked as <em>maximized</em>, the
+ * window manager will typically resize it to fill the
+ * entire visible area of the display, and the instance
+ * is usually put in a state where it can not be resized
+ * (even if it has style <code>RESIZE</code>) until it is
+ * no longer maximized.
+ * </li><li>
+ * When an instance is in the <em>normal</em> state (neither
+ * maximized or minimized), its appearance is controlled by
+ * the style constants which were specified when it was created
+ * and the restrictions of the window manager (see below).
+ * </li><li>
+ * When an instance has been marked as <em>minimized</em>,
+ * its contents (client area) will usually not be visible,
+ * and depending on the window manager, it may be
+ * "iconified" (that is, replaced on the desktop by a small
+ * simplified representation of itself), relocated to a
+ * distinguished area of the screen, or hidden. Combinations
+ * of these changes are also possible.
+ * </li>
+ * </ul>
+ * </p>
+ * Note: The styles supported by this class must be treated
+ * as <em>HINT</em>s, since the window manager for the
+ * desktop on which the instance is visible has ultimate
+ * control over the appearance and behavior of decorations.
+ * For example, some window managers only support resizable
+ * windows and will always assume the RESIZE style, even if
+ * it is not set.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * Class <code>SWT</code> provides two "convenience constants"
+ * for the most commonly required style combinations:
+ * <dl>
+ * <dt><code>SHELL_TRIM</code></dt>
+ * <dd>
+ * the result of combining the constants which are required
+ * to produce a typical application top level shell: (that
+ * is, <code>CLOSE | TITLE | MIN | MAX | RESIZE</code>)
+ * </dd>
+ * <dt><code>DIALOG_TRIM</code></dt>
+ * <dd>
+ * the result of combining the constants which are required
+ * to produce a typical application dialog shell: (that
+ * is, <code>TITLE | CLOSE | BORDER</code>)
+ * </dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ *
+ * @see #getMinimized
+ * @see #getMaximized
+ * @see Shell
+ * @see SWT
+ */
+
+public class Decorations extends Canvas {
+ String text;
+ Image image;
+ Menu menuBar;
+ Menu [] menus;
+ Button defaultButton, saveDefault;
+Decorations () {
+ /* Do nothing */
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Decorations (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+static int checkStyle (int style) {
+ if ((style & (SWT.MENU | SWT.MIN | SWT.MAX | SWT.CLOSE)) != 0) {
+ style |= SWT.TITLE;
+ }
+ return style;
+}
+
+void add (Menu menu) {
+ if (menus == null) menus = new Menu [4];
+ for (int i=0; i<menus.length; i++) {
+ if (menus [i] == null) {
+ menus [i] = menu;
+ return;
+ }
+ }
+ Menu [] newMenus = new Menu [menus.length + 4];
+ newMenus [menus.length] = menu;
+ System.arraycopy (menus, 0, newMenus, 0, menus.length);
+ menus = newMenus;
+}
+
+void createWidget (int index) {
+ super.createWidget (index);
+ text = "";
+}
+
+/**
+ * Returns the receiver's default button if one had
+ * previously been set, otherwise returns null.
+ *
+ * @return the default button or null
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setDefaultButton
+ */
+public Button getDefaultButton () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return defaultButton;
+}
+/**
+ * Returns the receiver's image if it had previously been
+ * set using <code>setImage()</code>. The image is typically
+ * displayed by the window manager when the instance is
+ * marked as iconified, and may also be displayed somewhere
+ * in the trim when the instance is in normal or maximized
+ * states.
+ * <p>
+ * Note: This method will return null if called before
+ * <code>setImage()</code> is called. It does not provide
+ * access to a window manager provided, "default" image
+ * even if one exists.
+ * </p>
+ *
+ * @return the image
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Image getImage () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return image;
+}
+/**
+ * Returns <code>true</code> if the receiver is currently
+ * maximized, and false otherwise.
+ * <p>
+ *
+ * @return the maximized state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setMaximized
+ */
+public boolean getMaximized () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return false;
+}
+/**
+ * Returns the receiver's menu bar if one had previously
+ * been set, otherwise returns null.
+ *
+ * @return the menu bar or null
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Menu getMenuBar () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return menuBar;
+}
+/**
+ * Returns <code>true</code> if the receiver is currently
+ * minimized, and false otherwise.
+ * <p>
+ *
+ * @return the minimized state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setMinimized
+ */
+public boolean getMinimized () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return false;
+}
+String getNameText () {
+ return getText ();
+}
+/**
+ * Returns the receiver's text, which is the string that the
+ * window manager will typically display as the receiver's
+ * <em>title</em>. If the text has not previously been set,
+ * returns an empty string.
+ *
+ * @return the text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getText () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return text;
+}
+Decorations menuShell () {
+ return this;
+}
+
+void remove (Menu menu) {
+ if (menus == null) return;
+ for (int i=0; i<menus.length; i++) {
+ if (menus [i] == menu) {
+ menus [i] = null;
+ return;
+ }
+ }
+}
+
+void releaseWidget () {
+ if (menuBar != null) {
+ menuBar.releaseWidget ();
+ menuBar.releaseHandle ();
+ }
+ menuBar = null;
+ if (menus != null) {
+ for (int i=0; i<menus.length; i++) {
+ Menu menu = menus [i];
+ if (menu != null && !menu.isDisposed ()) {
+ menu.dispose ();
+ }
+ }
+ }
+ menus = null;
+ super.releaseWidget ();
+ image = null;
+ defaultButton = saveDefault = null;
+}
+/**
+ * If the argument is not null, sets the receiver's default
+ * button to the argument, and if the argument is null, sets
+ * the receiver's default button to the first button which
+ * was set as the receiver's default button (called the
+ * <em>saved default button</em>). If no default button had
+ * previously been set, or the saved default button was
+ * disposed, the receiver's default button will be set to
+ * null.
+ *
+ * @param the new default button
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the button has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setDefaultButton (Button button) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+/**
+ * Sets the receiver's image to the argument, which may
+ * be null. The image is typically displayed by the window
+ * manager when the instance is marked as iconified, and
+ * may also be displayed somewhere in the trim when the
+ * instance is in normal or maximized states.
+ *
+ * @param image the new image (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setImage (Image image) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ this.image = image;
+ int pixmap = 0, mask = 0;
+ if (image != null) {
+ pixmap = image.pixmap;
+ mask = image.mask;
+ }
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove(widget, topHandle(), GtkWidget.sizeof);
+ OS.gdk_window_set_icon (widget.window, 0, pixmap, mask);
+}
+/**
+ * Sets the maximized state of the receiver.
+ * If the argument is <code>true</code> causes the receiver
+ * to switch to the maximized state, and if the argument is
+ * <code>false</code> and the receiver was previously maximized,
+ * causes the receiver to switch back to either the minimized
+ * or normal states.
+ * <p>
+ * Note: The result of intermixing calls to<code>setMaximized(true)</code>
+ * and <code>setMinimized(true)</code> will vary by platform. Typically,
+ * the behavior will match the platform user's expectations, but not
+ * always. This should be avoided if possible.
+ * </p>
+ *
+ * @param the new maximized state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setMinimized
+ */
+public void setMaximized (boolean maximized) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+/**
+ * Sets the receiver's menu bar to the argument, which
+ * may be null.
+ *
+ * @param menu the new menu bar
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
+ * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMenuBar (Menu menu) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (menuBar == menu) return;
+ if (menu != null) {
+ if ((menu.style & SWT.BAR) == 0) error (SWT.ERROR_MENU_NOT_BAR);
+ if (menu.parent != this) error (SWT.ERROR_INVALID_PARENT);
+ }
+ menuBar = menu;
+}
+/**
+ * Sets the minimized stated of the receiver.
+ * If the argument is <code>true</code> causes the receiver
+ * to switch to the minimized state, and if the argument is
+ * <code>false</code> and the receiver was previously minimized,
+ * causes the receiver to switch back to either the maximized
+ * or normal states.
+ * <p>
+ * Note: The result of intermixing calls to<code>setMaximized(true)</code>
+ * and <code>setMinimized(true)</code> will vary by platform. Typically,
+ * the behavior will match the platform user's expectations, but not
+ * always. This should be avoided if possible.
+ * </p>
+ *
+ * @param the new maximized state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setMaximized
+ */
+public void setMinimized (boolean minimized) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+/**
+ * Sets the receiver's text, which is the string that the
+ * window manager will typically display as the receiver's
+ * <em>title</em>, to the argument, which may not be null.
+ *
+ * @param text the new text
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ text = string;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java
new file mode 100644
index 0000000..d1c762e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java
@@ -0,0 +1,137 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Instances of this class allow the user to navigate
+ * the file system and select a directory.
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+
+public class DirectoryDialog extends Dialog {
+ String message = "", filterPath = "";
+ String directoryPath;
+/**
+ * Constructs a new instance of this class given only its
+ * parent.
+ * <p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the dialog on the currently active
+ * display if there is one. If there is no current display, the
+ * dialog is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public DirectoryDialog (Shell parent) {
+ this (parent, SWT.PRIMARY_MODAL);
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT dialog classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the dialog on the currently active
+ * display if there is one. If there is no current display, the
+ * dialog is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public DirectoryDialog (Shell parent, int style) {
+ super (parent, style);
+}
+/**
+ * Returns the path which the dialog will use to filter
+ * the directories it shows.
+ *
+ * @return the filter path
+ */
+public String getFilterPath () {
+ return filterPath;
+}
+/**
+ * Returns the dialog's message, which is a description of
+ * the purpose for which it was opened. This message will be
+ * visible on the dialog while it is open.
+ *
+ * @return the message
+ */
+public String getMessage () {
+ return message;
+}
+/**
+ * Makes the dialog visible and brings it to the front
+ * of the display.
+ *
+ * @return a string describing the absolute path of the selected directory,
+ * or null if the dialog was cancelled or an error occurred
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
+ * </ul>
+ */
+public String open () {
+ return null;
+}
+/**
+ * Sets the path which the dialog will use to filter
+ * the directories it shows to the argument, which may be
+ * null.
+ *
+ * @param string the filter path
+ */
+public void setFilterPath (String string) {
+ filterPath = string;
+}
+/**
+ * Sets the dialog's message, which is a description of
+ * the purpose for which it was opened. This message will be
+ * visible on the dialog while it is open.
+ *
+ * @param string the message
+ */
+public void setMessage (String string) {
+ message = string;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
new file mode 100644
index 0000000..6f77884
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
@@ -0,0 +1,1513 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class are responsible for managing the
+ * connection between SWT and the underlying operating
+ * system. Their most important function is to implement
+ * the SWT event loop in terms of the platform event model.
+ * They also provide various methods for accessing information
+ * about the operating system, and have overall control over
+ * the operating system resources which SWT allocates.
+ * <p>
+ * Applications which are built with SWT will <em>almost always</em>
+ * require only a single display. In particular, some platforms
+ * which SWT supports will not allow more than one <em>active</em>
+ * display. In other words, some platforms do not support
+ * creating a new display if one already exists that has not been
+ * sent the <code>dispose()</code> message.
+ * <p>
+ * In SWT, the thread which creates a <code>Display</code>
+ * instance is distinguished as the <em>user-interface thread</em>
+ * for that display.
+ * </p>
+ * The user-interface thread for a particular display has the
+ * following special attributes:
+ * <ul>
+ * <li>
+ * The event loop for that display must be run from the thread.
+ * </li>
+ * <li>
+ * Some SWT API methods (notably, most of the public methods in
+ * <code>Widget</code> and its subclasses), may only be called
+ * from the thread. (To support multi-threaded user-interface
+ * applications, class <code>Display</code> provides inter-thread
+ * communication methods which allow threads other than the
+ * user-interface thread to request that it perform operations
+ * on their behalf.)
+ * </li>
+ * <li>
+ * The thread is not allowed to construct other
+ * <code>Display</code>s until that display has been disposed.
+ * (Note that, this is in addition to the restriction mentioned
+ * above concerning platform support for multiple displays. Thus,
+ * the only way to have multiple simultaneously active displays,
+ * even on platforms which support it, is to have multiple threads.)
+ * </li>
+ * </ul>
+ * Enforcing these attributes allows SWT to be implemented directly
+ * on the underlying operating system's event model. This has
+ * numerous benefits including smaller footprint, better use of
+ * resources, safer memory management, clearer program logic,
+ * better performance, and fewer overall operating system threads
+ * required. The down side however, is that care must be taken
+ * (only) when constructing multi-threaded applications to use the
+ * inter-thread communication mechanisms which this class provides
+ * when required.
+ * </p><p>
+ * All SWT API methods which may only be called from the user-interface
+ * thread are distinguished in their documentation by indicating that
+ * they throw the "<code>ERROR_THREAD_INVALID_ACCESS</code>"
+ * SWT exception.
+ * </p><p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ *
+ * @see #syncExec
+ * @see #asyncExec
+ * @see #wake
+ * @see #readAndDispatch
+ * @see #sleep
+ * @see #dispose
+ */
+
+public class Display extends Device {
+
+ /* Events Dispatching and Callback */
+ Event [] eventQueue;
+ int windowProc2, windowProc3, windowProc4, windowProc5;
+ Callback windowCallback2, windowCallback3, windowCallback4, windowCallback5;
+
+ /* Sync/Async Widget Communication */
+ Synchronizer synchronizer = new Synchronizer (this);
+ int messagesSize;
+ RunnableLock [] messages;
+ Object messageLock = new Object ();
+ Thread thread = Thread.currentThread ();
+
+ /* Display Shutdown */
+ Runnable [] disposeList;
+
+ /* Timers */
+ int [] timerIDs;
+ Runnable [] timerList;
+ Callback timerCallback;
+ int timerProc;
+
+ /* Caret */
+ Caret currentCaret;
+ Callback caretCallback;
+ int caretID, caretProc;
+
+ Color NORMAL_fg, NORMAL_bg, NORMAL_dark, NORMAL_mid, NORMAL_light, NORMAL_text, NORMAL_base;
+ Color ACTIVE_fg, ACTIVE_bg, ACTIVE_dark, ACTIVE_mid, ACTIVE_light, ACTIVE_text, ACTIVE_base;
+ Color PRELIGHT_fg, PRELIGHT_bg, PRELIGHT_dark, PRELIGHT_mid, PRELIGHT_light, PRELIGHT_text, PRELIGHT_base;
+ Color SELECTED_fg, SELECTED_bg, SELECTED_dark, SELECTED_mid, SELECTED_light, SELECTED_text, SELECTED_base;
+ Color INSENSITIVE_fg, INSENSITIVE_bg, INSENSITIVE_dark, INSENSITIVE_mid, INSENSITIVE_light, INSENSITIVE_text, INSENSITIVE_base;
+
+ /* Key Mappings */
+ static final int [] [] KeyTable = {
+
+ /* Keyboard and Mouse Masks */
+ {OS.GDK_Alt_L, SWT.ALT},
+ {OS.GDK_Alt_R, SWT.ALT},
+ {OS.GDK_Shift_L, SWT.SHIFT},
+ {OS.GDK_Shift_R, SWT.SHIFT},
+ {OS.GDK_Control_L, SWT.CONTROL},
+ {OS.GDK_Control_R, SWT.CONTROL},
+
+ /* Non-Numeric Keypad Constants */
+ {OS.GDK_Up, SWT.ARROW_UP},
+ {OS.GDK_Down, SWT.ARROW_DOWN},
+ {OS.GDK_Left, SWT.ARROW_LEFT},
+ {OS.GDK_Right, SWT.ARROW_RIGHT},
+ {OS.GDK_Page_Up, SWT.PAGE_UP},
+ {OS.GDK_Page_Down, SWT.PAGE_DOWN},
+ {OS.GDK_Home, SWT.HOME},
+ {OS.GDK_End, SWT.END},
+ {OS.GDK_Insert, SWT.INSERT},
+
+ /* NOT CURRENTLY USED */
+// {OS.GDK_Delete, SWT.DELETE},
+ {OS.GDK_Return, SWT.CR},
+
+ /* Functions Keys */
+ {OS.GDK_F1, SWT.F1},
+ {OS.GDK_F2, SWT.F2},
+ {OS.GDK_F3, SWT.F3},
+ {OS.GDK_F4, SWT.F4},
+ {OS.GDK_F5, SWT.F5},
+ {OS.GDK_F6, SWT.F6},
+ {OS.GDK_F7, SWT.F7},
+ {OS.GDK_F8, SWT.F8},
+ {OS.GDK_F9, SWT.F9},
+ {OS.GDK_F10, SWT.F10},
+ {OS.GDK_F11, SWT.F11},
+ {OS.GDK_F12, SWT.F12},
+
+ /* Numeric Keypad Constants */
+ /* NOT CURRENTLY USED */
+// {OS.GDK_KP_Add, SWT.KP_PLUS},
+// {OS.GDK_KP_Subtract, SWT.KP_MINUS},
+// {OS.GDK_KP_Multiply, SWT.KP_TIMES},
+// {OS.GDK_KP_Divide, SWT.KP_DIVIDE},
+// {OS.GDK_KP_Decimal, SWT.KP_PERIOD},
+// {OS.GDK_KP_Enter, SWT.CR},
+// {OS.GDK_KP_0, SWT.KP_0},
+// {OS.GDK_KP_1, SWT.KP_1},
+// {OS.GDK_KP_2, SWT.KP_2},
+// {OS.GDK_KP_3, SWT.KP_3},
+// {OS.GDK_KP_4, SWT.KP_4},
+// {OS.GDK_KP_5, SWT.KP_5},
+// {OS.GDK_KP_6, SWT.KP_6},
+// {OS.GDK_KP_7, SWT.KP_7},
+// {OS.GDK_KP_8, SWT.KP_8},
+// {OS.GDK_KP_9, SWT.KP_9},
+
+ };
+
+ /* Multiple Displays. */
+ static Display Default;
+ static Display [] Displays = new Display [4];
+
+ /* Package name */
+ static final String PACKAGE_NAME;
+ static {
+ String name = Display.class.getName ();
+ int index = name.lastIndexOf ('.');
+ PACKAGE_NAME = name.substring (0, index + 1);
+ }
+
+ /* #define in gdkevents.h */
+ static final int DOUBLE_CLICK_TIME = 250;
+
+ /* Display Data */
+ Object data;
+ String [] keys;
+ Object [] values;
+
+ /*
+ * TEMPORARY CODE. Install the runnable that
+ * gets the current display. This code will
+ * be removed in the future.
+ */
+ static {
+ DeviceFinder = new Runnable () {
+ public void run () {
+ Device device = getCurrent ();
+ if (device == null) {
+ device = getDefault ();
+ }
+ setDevice (device);
+ }
+ };
+ }
+
+/*
+* TEMPORARY CODE.
+*/
+static void setDevice (Device device) {
+ CurrentDevice = device;
+}
+
+/**
+ * Constructs a new instance of this class.
+ * <p>
+ * Note: The resulting display is marked as the <em>current</em>
+ * display. If this is the first display which has been
+ * constructed since the application started, it is also
+ * marked as the <em>default</em> display.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see #getCurrent
+ * @see #getDefault
+ * @see Widget#checkSubclass
+ * @see Shell
+ */
+public Display () {
+ this (null);
+}
+
+public Display (DeviceData data) {
+ super (data);
+}
+
+void addLast (RunnableLock entry) {
+ synchronized (messageLock) {
+ if (messages == null) messages = new RunnableLock [4];
+ if (messagesSize == messages.length) {
+ RunnableLock[] newMessages = new RunnableLock [messagesSize + 4];
+ System.arraycopy (messages, 0, newMessages, 0, messagesSize);
+ messages = newMessages;
+ }
+ messages [messagesSize++] = entry;
+ }
+}
+
+/**
+ * Causes the <code>run()</code> method of the runnable to
+ * be invoked by the user-interface thread at the next
+ * reasonable opportunity. The caller of this method continues
+ * to run in parallel, and is not notified when the
+ * runnable has completed.
+ *
+ * @param runnable code to run on the user-interface thread.
+ *
+ * @see #syncExec
+ */
+public void asyncExec (Runnable runnable) {
+ if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
+ synchronizer.asyncExec (runnable);
+}
+
+/**
+ * Causes the system hardware to emit a short sound
+ * (if it supports this capability).
+ */
+public void beep () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ OS.gdk_beep();
+ OS.gdk_flush();
+}
+
+protected void checkDevice () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
+}
+
+synchronized void checkDisplay () {
+ for (int i=0; i<Displays.length; i++) {
+ if (Displays [i] != null && Displays [i].thread == thread) {
+ error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ }
+ }
+}
+
+protected void checkSubclass () {
+ if (!isValidClass (getClass ())) error (SWT.ERROR_INVALID_SUBCLASS);
+}
+
+protected void create (DeviceData data) {
+ checkDisplay ();
+ checkSubclass ();
+ thread = Thread.currentThread ();
+ createDisplay (data);
+ register ();
+ if (Default == null) Default = this;
+}
+
+synchronized void createDisplay (DeviceData data) {
+ if (!OS.gtk_init_check (new int [] {0}, null)) {
+ /*
+ * This code is intentionally commented.
+ */
+// disposed = true;
+// SWT.error (SWT.ERROR_DEVICE_DISPOSED);
+ return;
+ }
+ OS.gdk_rgb_init ();
+ int ptr = OS.gtk_check_version (1, 2, 8);
+ if (ptr != 0) {
+ System.out.println ("***WARNING: SWT requires GTK version 1.2.8 or greater");
+ int length = OS.strlen (ptr);
+ byte [] buffer = new byte [length];
+ OS.memmove (buffer, ptr, length);
+ System.out.println ("***WARNING: " + new String (Converter.mbcsToWcs (null, buffer)));
+ }
+}
+
+synchronized void deregister () {
+ for (int i=0; i<Displays.length; i++) {
+ if (this == Displays [i]) Displays [i] = null;
+ }
+}
+
+protected void destroy () {
+ if (this == Default) Default = null;
+ deregister ();
+ destroyDisplay ();
+}
+
+void destroyDisplay () {
+}
+
+/**
+ * Returns the display which the given thread is the
+ * user-interface thread for, or null if the given thread
+ * is not a user-interface thread for any display.
+ *
+ * @param thread the user-interface thread
+ * @return the display for the given thread
+ */
+public static synchronized Display findDisplay (Thread thread) {
+ for (int i=0; i<Displays.length; i++) {
+ Display display = Displays [i];
+ if (display != null && display.thread == thread) {
+ return display;
+ }
+ }
+ return null;
+}
+
+/**
+ * Causes the <code>run()</code> method of the runnable to
+ * be invoked by the user-interface thread just before the
+ * receiver is disposed.
+ *
+ * @param runnable code to run at dispose time.
+ */
+public void disposeExec (Runnable runnable) {
+ checkDevice ();
+ if (disposeList == null) disposeList = new Runnable [4];
+ for (int i=0; i<disposeList.length; i++) {
+ if (disposeList [i] == null) {
+ disposeList [i] = runnable;
+ return;
+ }
+ }
+ Runnable [] newDisposeList = new Runnable [disposeList.length + 4];
+ System.arraycopy (disposeList, 0, newDisposeList, 0, disposeList.length);
+ newDisposeList [disposeList.length] = runnable;
+ disposeList = newDisposeList;
+}
+
+/**
+ * Does whatever display specific cleanup is required, and then
+ * uses the code in <code>SWTError.error</code> to handle the error.
+ *
+ * @param code the descriptive error code
+ *
+ * @see SWTError#error
+ */
+void error (int code) {
+ throw new SWTError (code);
+}
+
+/**
+ * Given the operating system handle for a widget, returns
+ * the instance of the <code>Widget</code> subclass which
+ * represents it in the currently running application, if
+ * such exists, or null if no matching widget can be found.
+ *
+ * @param handle the handle for the widget
+ * @return the SWT widget that the handle represents
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Widget findWidget (int handle) {
+ checkDevice ();
+ // In 0.058 and before, this used to go up the parent
+ // chain if the handle was not found in the widget
+ // table, up to the root. Now, we require that all
+ // widgets register ALL their handles.
+ // If somebody creates their own handles outside
+ // SWT, it's their problem.
+ return WidgetTable.get (handle);
+}
+
+/*
+ * In SWT, we force all widgets to have real Gdk windows,
+ * thus getting rid of the concept of "lightweight" widgets.
+ * Given a GdkWindow, answer a handle to the GtkWidget realized
+ * through that window.
+ * If the argument is not the pointe rto a GdkWindow, the
+ * universe will be left in an inconsistent state.
+ */
+int findGtkWidgetByGdkWindow (int gdkWindow) {
+ int[] pwidget = new int[1];
+ OS.gdk_window_get_user_data(gdkWindow, pwidget);
+ return pwidget[0];
+}
+
+/**
+ * Returns the currently active <code>Shell</code>, or null
+ * if no shell belonging to the currently running application
+ * is active.
+ *
+ * @return the active shell or null
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Shell getActiveShell () {
+ checkDevice ();
+ Shell [] shells = getShells();
+ for (int i=0; i<shells.length; i++) {
+ if (shells [i].hasFocus) return shells [i];
+ }
+ return null;
+}
+
+/**
+ * Returns a rectangle describing the receiver's size and location.
+ *
+ * @return the bounding rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Rectangle getBounds () {
+ checkDevice ();
+ return new Rectangle(0, 0, OS.gdk_screen_width (), OS.gdk_screen_height ());
+}
+
+/**
+ * Returns the display which the currently running thread is
+ * the user-interface thread for, or null if the currently
+ * running thread is not a user-interface thread for any display.
+ *
+ * @return the current display
+ */
+public static synchronized Display getCurrent () {
+ Thread current = Thread.currentThread ();
+ for (int i=0; i<Displays.length; i++) {
+ Display display = Displays [i];
+ if (display != null && display.thread == current) return display;
+ }
+ return null;
+}
+
+/**
+ * Returns the control which the on-screen pointer is currently
+ * over top of, or null if it is not currently over one of the
+ * controls built by the currently running application.
+ *
+ * @return the control under the cursor
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Control getCursorControl () {
+ checkDevice();
+ int[] x = new int[1], y = new int[1];
+ int cursorWindowHandle = OS.gdk_window_at_pointer(x,y);
+ if (cursorWindowHandle==0) return null;
+ int handle = findGtkWidgetByGdkWindow(cursorWindowHandle);
+ if (handle==0) return null;
+ return findControl(handle);
+}
+
+Control findControl(int h) {
+ Widget w = findWidget(h);
+ if (w==null) return null;
+ if (w instanceof Control) return (Control)w;
+ // w is something like an Item. Go for the parent
+
+ GtkWidget widget = new GtkWidget();
+ OS.memmove(widget, h, GtkWidget.sizeof);
+ return findControl(widget.parent);
+}
+
+/**
+ * Returns the location of the on-screen pointer relative
+ * to the top left corner of the screen.
+ *
+ * @return the cursor location
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getCursorLocation () {
+ checkDevice ();
+ int [] x = new int [1], y = new int [1];
+ OS.gdk_window_get_pointer (0, x, y, 0);
+ return new Point (x [0], y [0]);
+}
+
+/**
+ * Returns the application defined property of the receiver
+ * with the specified name, or null if it has not been set.
+ * <p>
+ * Applications may have associated arbitrary objects with the
+ * receiver in this fashion. If the objects stored in the
+ * properties need to be notified when the display is disposed
+ * of, it is the application's responsibility provide a
+ * <code>disposeExec()</code> handler which does so.
+ * </p>
+ *
+ * @param key the name of the property
+ * @return the value of the property or null if it has not been set
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setData
+ * @see #disposeExec
+ */
+public Object getData (String key) {
+ checkDevice ();
+ if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (keys == null) return null;
+ for (int i=0; i<keys.length; i++) {
+ if (keys [i].equals (key)) return values [i];
+ }
+ return null;
+}
+
+/**
+ * Returns the application defined, display specific data
+ * associated with the receiver, or null if it has not been
+ * set. The <em>display specific data</em> is a single,
+ * unnamed field that is stored with every display.
+ * <p>
+ * Applications may put arbitrary objects in this field. If
+ * the object stored in the display specific data needs to
+ * be notified when the display is disposed of, it is the
+ * application's responsibility provide a
+ * <code>disposeExec()</code> handler which does so.
+ * </p>
+ *
+ * @return the display specific data
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
+ * </ul>
+ *
+ * @see #setData
+ * @see #disposeExec
+ */
+public Object getData () {
+ checkDevice ();
+ return data;
+}
+/**
+ * Returns a point whose x coordinate is the horizontal
+ * dots per inch of the display, and whose y coordinate
+ * is the vertical dots per inch of the display.
+ *
+ * @return the horizontal and vertical DPI
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getDPI () {
+ checkDevice ();
+ int widthMM = OS.gdk_screen_width_mm ();
+ int width = OS.gdk_screen_width ();
+ // compute round(25.4 * width / widthMM)
+ int dpi = Compatibility.round(254 * width, widthMM * 10);
+ return new Point (dpi, dpi);
+}
+
+/**
+ * Returns the default display. One is created (making the
+ * thread that invokes this method its user-interface thread)
+ * if it did not already exist.
+ *
+ * @return the default display
+ */
+public static synchronized Display getDefault () {
+ if (Default == null) Default = new Display ();
+ return Default;
+}
+
+static boolean isValidClass (Class clazz) {
+ String name = clazz.getName ();
+ int index = name.lastIndexOf ('.');
+ return name.substring (0, index + 1).equals (PACKAGE_NAME);
+}
+
+/**
+ * Returns the longest duration, in milliseconds, between
+ * two mouse button clicks that will be considered a
+ * <em>double click</em> by the underlying operating system.
+ *
+ * @return the double click time
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getDoubleClickTime () {
+ checkDevice ();
+ return DOUBLE_CLICK_TIME;
+}
+
+/**
+ * Returns the control which currently has keyboard focus,
+ * or null if keyboard events are not currently going to
+ * any of the controls built by the currently running
+ * application.
+ *
+ * @return the control under the cursor
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Control getFocusControl () {
+ checkDevice ();
+ Shell active = getActiveShell();
+ if (active==null) return null;
+ return active.getFocusControl();
+}
+
+public int getDepth () {
+ checkDevice ();
+ GdkVisual visual = new GdkVisual ();
+ OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
+ return visual.depth;
+}
+
+/**
+ * Returns the maximum allowed depth of icons on this display.
+ * On some platforms, this may be different than the actual
+ * depth of the display.
+ *
+ * @return the maximum icon depth
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getIconDepth () {
+ checkDevice ();
+ return getDepth ();
+}
+
+/**
+ * Returns an array containing all shells which have not been
+ * disposed and have the receiver as their display.
+ *
+ * @return the receiver's shells
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Shell [] getShells () {
+ checkDevice ();
+ int count = 0;
+ Shell [] shells = WidgetTable.shells ();
+ for (int i=0; i<shells.length; i++) {
+ Shell shell = shells [i];
+ if (!shell.isDisposed () && (this == shell.getDisplay ())) {
+ count++;
+ }
+ }
+ int index = 0;
+ Shell [] result = new Shell [count];
+ for (int i=0; i<shells.length; i++) {
+ Shell shell = shells [i];
+ if (!shell.isDisposed () && (this == shell.getDisplay ())) {
+ result [index++] = shell;
+ }
+ }
+ return result;
+}
+
+/**
+ * Returns the thread that has invoked <code>syncExec</code>
+ * or null if no such runnable is currently being invoked by
+ * the user-interface thread.
+ * <p>
+ * Note: If a runnable invoked by asyncExec is currently
+ * running, this method will return null.
+ * </p>
+ *
+ * @return the receiver's sync-interface thread
+ */
+public Thread getSyncThread () {
+ if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
+ return synchronizer.syncThread;
+}
+
+/**
+ * Returns the matching standard color for the given
+ * constant, which should be one of the color constants
+ * specified in class <code>SWT</code>. Any value other
+ * than one of the SWT color constants which is passed
+ * in will result in the color black. This color should
+ * not be free'd because it was allocated by the system,
+ * not the application.
+ *
+ * @param id the color constant
+ * @return the matching color
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SWT
+ */
+public Color getSystemColor (int id) {
+ checkDevice ();
+ switch (id) {
+ case SWT.COLOR_INFO_FOREGROUND: return NORMAL_fg;
+ case SWT.COLOR_INFO_BACKGROUND: return NORMAL_bg;
+
+ case SWT.COLOR_TITLE_FOREGROUND: return SELECTED_text;
+ case SWT.COLOR_TITLE_BACKGROUND: return SELECTED_bg;
+ case SWT.COLOR_TITLE_BACKGROUND_GRADIENT: return SELECTED_light;
+ case SWT.COLOR_TITLE_INACTIVE_FOREGROUND: return INSENSITIVE_fg;
+ case SWT.COLOR_TITLE_INACTIVE_BACKGROUND: return INSENSITIVE_bg;
+ case SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT: return INSENSITIVE_light;
+
+ case SWT.COLOR_WIDGET_DARK_SHADOW: return NORMAL_dark;
+ case SWT.COLOR_WIDGET_NORMAL_SHADOW: return NORMAL_mid;
+ case SWT.COLOR_WIDGET_LIGHT_SHADOW: return NORMAL_light;
+ case SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW: return NORMAL_light;
+ case SWT.COLOR_WIDGET_BACKGROUND: return NORMAL_bg;
+ case SWT.COLOR_WIDGET_FOREGROUND: return NORMAL_fg;
+ case SWT.COLOR_WIDGET_BORDER: return super.getSystemColor (SWT.COLOR_BLACK);
+
+ case SWT.COLOR_LIST_FOREGROUND: return super.getSystemColor (SWT.COLOR_BLACK);
+ case SWT.COLOR_LIST_BACKGROUND: return super.getSystemColor (SWT.COLOR_WHITE);
+ case SWT.COLOR_LIST_SELECTION: return SELECTED_bg;
+ case SWT.COLOR_LIST_SELECTION_TEXT: return SELECTED_text;
+ }
+ return super.getSystemColor (id);
+}
+
+void initializeSystemColors() {
+
+ /* Get the theme colors */
+ GtkStyle defaultStyle = new GtkStyle();
+ OS.memmove (defaultStyle, OS.gtk_widget_get_default_style(), GtkStyle.sizeof);
+
+ GdkColor gdk_NORMAL_dark = new GdkColor();
+ gdk_NORMAL_dark.pixel = defaultStyle.dark0_pixel;
+ gdk_NORMAL_dark.red = defaultStyle.dark0_red;
+ gdk_NORMAL_dark.green = defaultStyle.dark0_green;
+ gdk_NORMAL_dark.blue = defaultStyle.dark0_blue;
+ NORMAL_dark = Color.gtk_new(gdk_NORMAL_dark);
+
+ GdkColor gdk_NORMAL_mid = new GdkColor();
+ gdk_NORMAL_mid.pixel = defaultStyle.mid0_pixel;
+ gdk_NORMAL_mid.red = defaultStyle.mid0_red;
+ gdk_NORMAL_mid.green = defaultStyle.mid0_green;
+ gdk_NORMAL_mid.blue = defaultStyle.mid0_blue;
+ NORMAL_mid = Color.gtk_new(gdk_NORMAL_mid);
+
+ GdkColor gdk_NORMAL_light = new GdkColor();
+ gdk_NORMAL_light.pixel = defaultStyle.light0_pixel;
+ gdk_NORMAL_light.red = defaultStyle.light0_red;
+ gdk_NORMAL_light.green = defaultStyle.light0_green;
+ gdk_NORMAL_light.blue = defaultStyle.light0_blue;
+ NORMAL_light = Color.gtk_new(gdk_NORMAL_light);
+
+ GdkColor gdk_NORMAL_fg = new GdkColor();
+ gdk_NORMAL_fg.pixel = defaultStyle.fg0_pixel;
+ gdk_NORMAL_fg.red = defaultStyle.fg0_red;
+ gdk_NORMAL_fg.green = defaultStyle.fg0_green;
+ gdk_NORMAL_fg.blue = defaultStyle.fg0_blue;
+ NORMAL_fg = Color.gtk_new(gdk_NORMAL_fg);
+
+ GdkColor gdk_NORMAL_bg = new GdkColor();
+ gdk_NORMAL_bg.pixel = defaultStyle.bg0_pixel;
+ gdk_NORMAL_bg.red = defaultStyle.bg0_red;
+ gdk_NORMAL_bg.green = defaultStyle.bg0_green;
+ gdk_NORMAL_bg.blue = defaultStyle.bg0_blue;
+ NORMAL_bg = Color.gtk_new(gdk_NORMAL_bg);
+
+ GdkColor gdk_NORMAL_text = new GdkColor();
+ gdk_NORMAL_text.pixel = defaultStyle.text0_pixel;
+ gdk_NORMAL_text.red = defaultStyle.text0_red;
+ gdk_NORMAL_text.green = defaultStyle.text0_green;
+ gdk_NORMAL_text.blue = defaultStyle.text0_blue;
+ NORMAL_text = Color.gtk_new(gdk_NORMAL_text);
+
+ GdkColor gdk_NORMAL_base = new GdkColor();
+ gdk_NORMAL_base.pixel = defaultStyle.base0_pixel;
+ gdk_NORMAL_base.red = defaultStyle.base0_red;
+ gdk_NORMAL_base.green = defaultStyle.base0_green;
+ gdk_NORMAL_base.blue = defaultStyle.base0_blue;
+ NORMAL_base = Color.gtk_new(gdk_NORMAL_base);
+
+ GdkColor gdk_SELECTED_text = new GdkColor();
+ gdk_SELECTED_text.pixel = defaultStyle.text3_pixel;
+ gdk_SELECTED_text.red = defaultStyle.text3_red;
+ gdk_SELECTED_text.green = defaultStyle.text3_green;
+ gdk_SELECTED_text.blue = defaultStyle.text3_blue;
+ SELECTED_text = Color.gtk_new(gdk_SELECTED_text);
+
+ GdkColor gdk_SELECTED_bg = new GdkColor();
+ gdk_SELECTED_bg.pixel = defaultStyle.bg3_pixel;
+ gdk_SELECTED_bg.red = defaultStyle.bg3_red;
+ gdk_SELECTED_bg.green = defaultStyle.bg3_green;
+ gdk_SELECTED_bg.blue = defaultStyle.bg3_blue;
+ SELECTED_bg = Color.gtk_new(gdk_SELECTED_bg);
+
+ GdkColor gdk_SELECTED_base = new GdkColor();
+ gdk_SELECTED_base.pixel = defaultStyle.base3_pixel;
+ gdk_SELECTED_base.red = defaultStyle.base3_red;
+ gdk_SELECTED_base.green = defaultStyle.base3_green;
+ gdk_SELECTED_base.blue = defaultStyle.base3_blue;
+ SELECTED_base = Color.gtk_new(gdk_SELECTED_base);
+
+ GdkColor gdk_SELECTED_light = new GdkColor();
+ gdk_SELECTED_light.pixel = defaultStyle.light3_pixel;
+ gdk_SELECTED_light.red = defaultStyle.light3_red;
+ gdk_SELECTED_light.green = defaultStyle.light3_green;
+ gdk_SELECTED_light.blue = defaultStyle.light3_blue;
+ SELECTED_light = Color.gtk_new(gdk_SELECTED_light);
+
+
+ GdkColor gdk_PRELIGHT_light = new GdkColor();
+ gdk_PRELIGHT_light.pixel = defaultStyle.light2_pixel;
+ gdk_PRELIGHT_light.red = defaultStyle.light2_red;
+ gdk_PRELIGHT_light.green = defaultStyle.light2_green;
+ gdk_PRELIGHT_light.blue = defaultStyle.light2_blue;
+ PRELIGHT_light = Color.gtk_new(gdk_PRELIGHT_light);
+
+ GdkColor gdk_INSENSITIVE_light = new GdkColor();
+ gdk_INSENSITIVE_light.pixel = defaultStyle.light4_pixel;
+ gdk_INSENSITIVE_light.red = defaultStyle.light4_red;
+ gdk_INSENSITIVE_light.green = defaultStyle.light4_green;
+ gdk_INSENSITIVE_light.blue = defaultStyle.light4_blue;
+ INSENSITIVE_light = Color.gtk_new(gdk_INSENSITIVE_light);
+
+ GdkColor gdk_INSENSITIVE_fg = new GdkColor();
+ gdk_INSENSITIVE_fg.pixel = defaultStyle.fg4_pixel;
+ gdk_INSENSITIVE_fg.red = defaultStyle.fg4_red;
+ gdk_INSENSITIVE_fg.green = defaultStyle.fg4_green;
+ gdk_INSENSITIVE_fg.blue = defaultStyle.fg4_blue;
+ INSENSITIVE_fg = Color.gtk_new(gdk_INSENSITIVE_fg);
+
+ GdkColor gdk_INSENSITIVE_bg = new GdkColor();
+ gdk_INSENSITIVE_bg.pixel = defaultStyle.bg4_pixel;
+ gdk_INSENSITIVE_bg.red = defaultStyle.bg4_red;
+ gdk_INSENSITIVE_bg.green = defaultStyle.bg4_green;
+ gdk_INSENSITIVE_bg.blue = defaultStyle.bg4_blue;
+ INSENSITIVE_bg = Color.gtk_new(gdk_INSENSITIVE_bg);
+
+
+}
+
+/**
+ * Returns a reasonable font for applications to use.
+ * On some platforms, this will match the "default font"
+ * or "system font" if such can be found. This font
+ * should not be free'd because it was allocated by the
+ * system, not the application.
+ * <p>
+ * Typically, applications which want the default look
+ * should simply not set the font on the widgets they
+ * create. Widgets are always created with the correct
+ * default font for the class of user-interface component
+ * they represent.
+ * </p>
+ *
+ * @return a font
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Font getSystemFont () {
+ checkDevice ();
+ GtkStyle style = new GtkStyle();
+ OS.memmove (style, OS.gtk_widget_get_default_style(), GtkStyle.sizeof);
+ int gdkFont = style.font; // gives a GdkFont*
+ return Font.gtk_new (gdkFont);
+}
+
+/**
+ * Returns the user-interface thread for the receiver.
+ *
+ * @return the receiver's user-interface thread
+ */
+public Thread getThread () {
+ if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
+ return thread;
+}
+
+protected void init () {
+ super.init ();
+ initializeCallbacks ();
+ initializeSystemColors ();
+}
+
+void initializeCallbacks () {
+ windowCallback2 = new Callback (this, "windowProc", 2);
+ windowProc2 = windowCallback2.getAddress ();
+ if (windowProc2 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+ windowCallback3 = new Callback (this, "windowProc", 3);
+ windowProc3 = windowCallback3.getAddress ();
+ if (windowProc3 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+ windowCallback4 = new Callback (this, "windowProc", 4);
+ windowProc4 = windowCallback4.getAddress ();
+ if (windowProc4 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+ windowCallback5 = new Callback (this, "windowProc", 5);
+ windowProc5 = windowCallback5.getAddress ();
+ if (windowProc5 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+ timerCallback = new Callback (this, "timerProc", 2);
+ timerProc = timerCallback.getAddress ();
+ if (timerProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+ caretCallback = new Callback(this, "caretProc", 2);
+ caretProc = caretCallback.getAddress();
+ if (caretProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
+}
+
+/**
+ * Invokes platform specific functionality to dispose a GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Display</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param handle the platform specific GC handle
+ * @param data the platform specific GC data
+ *
+ * @private
+ */
+public void internal_dispose_GC (int handle, GCData data) {
+ OS.gdk_gc_destroy(handle);
+}
+
+/**
+ * Invokes platform specific functionality to allocate a new GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Display</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param data the platform specific GC data
+ * @return the platform specific GC handle
+ *
+ * @private
+ */
+public int internal_new_GC (GCData data) {
+ if (isDisposed()) SWT.error(SWT.ERROR_DEVICE_DISPOSED);
+ int root = OS.GDK_ROOT_PARENT();
+ int gc = OS.gdk_gc_new(root);
+ data.drawable = root;
+ return gc;
+}
+
+boolean isValidThread () {
+ return thread == Thread.currentThread ();
+}
+
+void postEvent (Event event) {
+ /*
+ * Place the event at the end of the event queue.
+ * This code is always called in the Display's
+ * thread so it must be re-enterant but does not
+ * need to be synchronized.
+ */
+ if (eventQueue == null) eventQueue = new Event [4];
+ int index = 0;
+ int length = eventQueue.length;
+ while (index < length) {
+ if (eventQueue [index] == null) break;
+ index++;
+ }
+ if (index == length) {
+ Event [] newQueue = new Event [length + 4];
+ System.arraycopy (eventQueue, 0, newQueue, 0, length);
+ eventQueue = newQueue;
+ }
+ eventQueue [index] = event;
+}
+
+/**
+ * Reads an event from the operating system's event queue,
+ * dispatches it appropriately, and returns <code>true</code>
+ * if there is potentially more work to do, or <code>false</code>
+ * if the caller can sleep until another event is placed on
+ * the event queue.
+ * <p>
+ * In addition to checking the system event queue, this method also
+ * checks if any inter-thread messages (created by <code>syncExec()</code>
+ * or <code>asyncExec()</code>) are waiting to be processed, and if
+ * so handles them before returning.
+ * </p>
+ *
+ * @return <code>false</code> if the caller can sleep upon return from this method
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #sleep
+ * @see #wake
+ */
+public boolean readAndDispatch () {
+ checkDevice ();
+ int status = OS.gtk_events_pending ();
+ if (status != 0) {
+// if ((status & OS.XtIMTimer) != 0) OS.XtAppProcessEvent (context, OS.XtIMTimer);
+// if ((status & OS.XtIMAlternateInput) != 0) OS.XtAppProcessEvent (context, OS.XtIMAlternateInput);
+// if ((status & OS.XtIMXEvent) != 0) {
+// OS.XtAppNextEvent (context, event);
+// OS.XtDispatchEvent (event);
+// }
+/* int eventPtr = OS.gdk_event_get();
+ if (eventPtr != 0) {
+ OS.gtk_main_do_event(eventPtr);
+ }*/
+ OS.gtk_main_iteration ();
+ runDeferredEvents ();
+ return true;
+ }
+ return runAsyncMessages ();
+}
+
+synchronized void register () {
+ for (int i=0; i<Displays.length; i++) {
+ if (Displays [i] == null) {
+ Displays [i] = this;
+ return;
+ }
+ }
+ Display [] newDisplays = new Display [Displays.length + 4];
+ System.arraycopy (Displays, 0, newDisplays, 0, Displays.length);
+ newDisplays [Displays.length] = this;
+ Displays = newDisplays;
+}
+
+protected void release () {
+
+ /* Release shells */
+ Shell [] shells = WidgetTable.shells ();
+ for (int i=0; i<shells.length; i++) {
+ Shell shell = shells [i];
+ if (!shell.isDisposed ()) {
+ if (this == shell.getDisplay ()) shell.dispose ();
+ }
+ }
+ while (readAndDispatch ()) {};
+
+ /* Run dispose list */
+ if (disposeList != null) {
+ for (int i=0; i<disposeList.length; i++) {
+ if (disposeList [i] != null) disposeList [i].run ();
+ }
+ }
+ disposeList = null;
+
+ /* Release synchronizer */
+ synchronizer.releaseSynchronizer ();
+ synchronizer = null;
+ releaseDisplay ();
+
+ super.release ();
+}
+
+void releaseDisplay () {
+ windowCallback2.dispose (); windowCallback2 = null;
+ windowCallback3.dispose (); windowCallback3 = null;
+ windowCallback4.dispose (); windowCallback4 = null;
+ windowCallback5.dispose (); windowCallback5 = null;
+
+ /* Dispose the caret callback */
+ if (caretID != 0) OS.gtk_timeout_remove (caretID);
+ caretID = caretProc = 0;
+ caretCallback.dispose ();
+ caretCallback = null;
+
+ /* Dispose the timer callback */
+ if (timerIDs != null) {
+ for (int i=0; i<timerIDs.length; i++) {
+ if (timerIDs [i] != 0) OS.gtk_timeout_remove (timerIDs [i]);
+ }
+ }
+ timerIDs = null;
+ timerList = null;
+ timerProc = 0;
+ timerCallback.dispose ();
+ timerCallback = null;
+
+ messages = null; messageLock = null; thread = null;
+ messagesSize = windowProc2 = windowProc3 = windowProc4 = windowProc5 = 0;
+
+ NORMAL_fg = NORMAL_bg = NORMAL_dark = NORMAL_mid = NORMAL_light = NORMAL_text = NORMAL_base =
+ ACTIVE_fg = ACTIVE_bg = ACTIVE_dark = ACTIVE_mid = ACTIVE_light = ACTIVE_text = ACTIVE_base =
+ PRELIGHT_fg = PRELIGHT_bg = PRELIGHT_dark = PRELIGHT_mid = PRELIGHT_light = PRELIGHT_text = PRELIGHT_base =
+ SELECTED_fg = SELECTED_bg = SELECTED_dark = SELECTED_mid = SELECTED_light = SELECTED_text = SELECTED_base =
+ INSENSITIVE_fg = INSENSITIVE_bg = INSENSITIVE_dark = INSENSITIVE_mid = INSENSITIVE_light = INSENSITIVE_text =
+ INSENSITIVE_base = null;
+}
+
+RunnableLock removeFirst () {
+ synchronized (messageLock) {
+ if (messagesSize == 0) return null;
+ RunnableLock lock = messages [0];
+ System.arraycopy (messages, 1, messages, 0, --messagesSize);
+ messages [messagesSize] = null;
+ if (messagesSize == 0) messages = null;
+ return lock;
+ }
+}
+
+boolean runAsyncMessages () {
+ return synchronizer.runAsyncMessages ();
+}
+
+boolean runDeferredEvents () {
+ /*
+ * Run deferred events. This code is always
+ * called in the Display's thread so it must
+ * be re-enterant need not be synchronized.
+ */
+ while (eventQueue != null) {
+
+ /* Take an event off the queue */
+ Event event = eventQueue [0];
+ if (event == null) break;
+ int length = eventQueue.length;
+ System.arraycopy (eventQueue, 1, eventQueue, 0, --length);
+ eventQueue [length] = null;
+
+ /* Run the event */
+ Widget widget = event.widget;
+ if (widget != null && !widget.isDisposed ()) {
+ Widget item = event.item;
+ if (item == null || !item.isDisposed ()) {
+ widget.notifyListeners (event.type, event);
+ }
+ }
+
+ /*
+ * At this point, the event queue could
+ * be null due to a recursive invokation
+ * when running the event.
+ */
+ }
+
+ /* Clear the queue */
+ eventQueue = null;
+ return true;
+}
+
+/**
+ * On platforms which support it, sets the application name
+ * to be the argument. On Motif, for example, this can be used
+ * to set the name used for resource lookup.
+ *
+ * @param name the new app name
+ */
+public static void setAppName (String name) {
+ /* Do nothing - Gtk doesn't have the concept of application name. */
+}
+
+/**
+ * Sets the application defined property of the receiver
+ * with the specified name to the given argument.
+ * <p>
+ * Applications may have associated arbitrary objects with the
+ * receiver in this fashion. If the objects stored in the
+ * properties need to be notified when the display is disposed
+ * of, it is the application's responsibility provide a
+ * <code>disposeExec()</code> handler which does so.
+ * </p>
+ *
+ * @param key the name of the property
+ * @param value the new value for the property
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setData
+ * @see #disposeExec
+ */
+public void setData (String key, Object value) {
+ checkDevice ();
+ if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
+
+ /* Remove the key/value pair */
+ if (value == null) {
+ if (keys == null) return;
+ int index = 0;
+ while (index < keys.length && !keys [index].equals (key)) index++;
+ if (index == keys.length) return;
+ if (keys.length == 1) {
+ keys = null;
+ values = null;
+ } else {
+ String [] newKeys = new String [keys.length - 1];
+ Object [] newValues = new Object [values.length - 1];
+ System.arraycopy (keys, 0, newKeys, 0, index);
+ System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index);
+ System.arraycopy (values, 0, newValues, 0, index);
+ System.arraycopy (values, index + 1, newValues, index, newValues.length - index);
+ keys = newKeys;
+ values = newValues;
+ }
+ return;
+ }
+
+ /* Add the key/value pair */
+ if (keys == null) {
+ keys = new String [] {key};
+ values = new Object [] {value};
+ return;
+ }
+ for (int i=0; i<keys.length; i++) {
+ if (keys [i].equals (key)) {
+ values [i] = value;
+ return;
+ }
+ }
+ String [] newKeys = new String [keys.length + 1];
+ Object [] newValues = new Object [values.length + 1];
+ System.arraycopy (keys, 0, newKeys, 0, keys.length);
+ System.arraycopy (values, 0, newValues, 0, values.length);
+ newKeys [keys.length] = key;
+ newValues [values.length] = value;
+ keys = newKeys;
+ values = newValues;
+}
+
+/**
+ * Sets the application defined, display specific data
+ * associated with the receiver, to the argument.
+ * The <em>display specific data</em> is a single,
+ * unnamed field that is stored with every display.
+ * <p>
+ * Applications may put arbitrary objects in this field. If
+ * the object stored in the display specific data needs to
+ * be notified when the display is disposed of, it is the
+ * application's responsibility provide a
+ * <code>disposeExec()</code> handler which does so.
+ * </p>
+ *
+ * @param data the new display specific data
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
+ * </ul>
+ *
+ * @see #getData
+ * @see #disposeExec
+ */
+public void setData (Object data) {
+ checkDevice ();
+ this.data = data;
+}
+
+/**
+ * Sets the synchronizer used by the display to be
+ * the argument, which can not be null.
+ *
+ * @param synchronizer the new synchronizer for the display (must not be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the synchronizer is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSynchronizer (Synchronizer synchronizer) {
+ checkDevice ();
+ if (synchronizer == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (this.synchronizer != null) {
+ this.synchronizer.runAsyncMessages();
+ }
+ this.synchronizer = synchronizer;
+}
+
+/**
+ * Causes the user-interface thread to <em>sleep</em> (that is,
+ * to be put in a state where it does not consume CPU cycles)
+ * until an event is received or it is otherwise awakened.
+ *
+ * @return <code>true</code> if an event requiring dispatching was placed on the queue.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #wake
+ */
+
+public boolean sleep () {
+ checkDevice ();
+ /* Temporary code - need to sleep waiting for the next message */
+ try { Thread.sleep(50); } catch (Exception e) {};
+ return true;
+}
+
+/**
+ * Causes the <code>run()</code> method of the runnable to
+ * be invoked by the user-interface thread after the specified
+ * number of milliseconds have elapsed.
+ *
+ * @param milliseconds the delay before running the runnable
+ * @param runnable code to run on the user-interface thread
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #asyncExec
+ */
+public void timerExec (int milliseconds, Runnable runnable) {
+ checkDevice ();
+ if (timerList == null) timerList = new Runnable [4];
+ if (timerIDs == null) timerIDs = new int [4];
+ int index = 0;
+ while (index < timerList.length) {
+ if (timerList [index] == null) break;
+ index++;
+ }
+ if (index == timerList.length) {
+ Runnable [] newTimerList = new Runnable [timerList.length + 4];
+ System.arraycopy (timerList, 0, newTimerList, 0, timerList.length);
+ timerList = newTimerList;
+ int [] newTimerIDs = new int [timerIDs.length + 4];
+ System.arraycopy (timerIDs, 0, newTimerIDs, 0, timerIDs.length);
+ timerIDs = newTimerIDs;
+ }
+ int timerID = OS.gtk_timeout_add (milliseconds, timerProc, index);
+ if (timerID != 0) {
+ timerIDs [index] = timerID;
+ timerList [index] = runnable;
+ }
+}
+
+int timerProc (int index, int id) {
+ if (timerList == null) return 0;
+ if (0 <= index && index < timerList.length) {
+ Runnable runnable = timerList [index];
+ timerList [index] = null;
+ timerIDs [index] = 0;
+ if (runnable != null) runnable.run ();
+ }
+ return 0;
+}
+
+int caretProc (int clientData, int id) {
+ caretID = 0;
+ if (currentCaret == null) {
+ return 0;
+ }
+ if (currentCaret.blinkCaret()) {
+ int blinkRate = currentCaret.blinkRate;
+ caretID = OS.gtk_timeout_add (blinkRate, caretProc, 0);
+ } else {
+ currentCaret = null;
+ }
+ return 0;
+}
+
+void setCurrentCaret (Caret caret) {
+ if (caretID != 0) OS.gtk_timeout_remove(caretID);
+ caretID = 0;
+ currentCaret = caret;
+ if (caret == null) return;
+ int blinkRate = currentCaret.blinkRate;
+ caretID = OS.gtk_timeout_add (blinkRate, caretProc, 0);
+}
+
+/**
+ * Causes the <code>run()</code> method of the runnable to
+ * be invoked by the user-interface thread at the next
+ * reasonable opportunity. The thread which calls this method
+ * is suspended until the runnable completes.
+ *
+ * @param runnable code to run on the user-interface thread.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_FAILED_EXEC - if an exception occured when executing the runnable</li>
+ * </ul>
+ *
+ * @see #asyncExec
+ */
+public void syncExec (Runnable runnable) {
+ if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
+ synchronizer.syncExec (runnable);
+}
+
+static int translateKey (int key) {
+ for (int i=0; i<KeyTable.length; i++) {
+ if (KeyTable [i] [0] == key) return KeyTable [i] [1];
+ }
+ return 0;
+}
+
+static int untranslateKey (int key) {
+ for (int i=0; i<KeyTable.length; i++) {
+ if (KeyTable [i] [1] == key) return KeyTable [i] [0];
+ }
+ return 0;
+}
+
+public void update () {
+ checkDevice ();
+ /* NOT IMPLEMENTED - Need to flush only pending draws */
+ OS.gdk_flush ();
+ while ((OS.gtk_events_pending ()) != 0) {
+ OS.gtk_main_iteration ();
+ }
+}
+
+/**
+ * If the receiver's user-interface thread was <code>sleep</code>'ing,
+ * causes it to be awakened and start running again. Note that this
+ * method may be called from any thread.
+ *
+ * @see #sleep
+ */
+public void wake () {
+ /* NOT IMPLEMENTED - Need to wake up the event loop */
+ if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
+}
+
+int windowProc (int handle, int user_data) {
+ Widget widget = WidgetTable.get (handle);
+ if (widget == null) return 0;
+ return widget.processEvent (user_data, 0, 0, 0);
+}
+
+int windowProc (int handle, int int0, int user_data) {
+ Widget widget = WidgetTable.get (handle);
+ if (widget == null) return 0;
+ return widget.processEvent (user_data, int0, 0, 0);
+}
+
+int windowProc (int handle, int int0, int int1, int user_data) {
+ Widget widget = WidgetTable.get (handle);
+ if (widget == null) return 0;
+ return widget.processEvent (user_data, int0, int1, 0);
+}
+
+int windowProc (int handle, int int0, int int1, int int2, int user_data) {
+ Widget widget = WidgetTable.get (handle);
+ if (widget == null) return 0;
+ return widget.processEvent (user_data, int0, int1, int2);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java
new file mode 100644
index 0000000..8192904
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java
@@ -0,0 +1,288 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ * Instances of this class allow the user to navigate
+ * the file system and select or enter a file name.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>SAVE, OPEN, MULTI</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+public class FileDialog extends Dialog {
+ String [] filterNames = new String [0];
+ String [] filterExtensions = new String [0];
+ String filterPath = "", fileName = "";
+ String fullPath = "";
+ boolean cancel = true;
+
+/**
+ * Constructs a new instance of this class given only its
+ * parent.
+ * <p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the dialog on the currently active
+ * display if there is one. If there is no current display, the
+ * dialog is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public FileDialog (Shell parent) {
+ this (parent, SWT.PRIMARY_MODAL);
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT dialog classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the dialog on the currently active
+ * display if there is one. If there is no current display, the
+ * dialog is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public FileDialog (Shell parent, int style) {
+ super (parent, style);
+}
+int cancelFunc (int widget, int callData) {
+ cancel = true;
+ OS.gtk_widget_destroy (callData);
+ return 0;
+}
+int destroyFunc (int widget, int callData) {
+ OS.gtk_main_quit ();
+ return 0;
+}
+/**
+ * Returns the path of the first file that was
+ * selected in the dialog relative to the filter path,
+ * or null if none is available.
+ *
+ * @return the relative path of the file
+ */
+public String getFileName () {
+ return fileName;
+}
+/**
+ * Returns the paths of all files that were selected
+ * in the dialog relative to the filter path, or null
+ * if none are available.
+ *
+ * @return the relative paths of the files
+ */
+public String [] getFileNames () {
+ return new String[] {fileName};
+}
+/**
+ * Returns the file extensions which the dialog will
+ * use to filter the files it shows.
+ *
+ * @return the file extensions filter
+ */
+public String [] getFilterExtensions () {
+ return filterExtensions;
+}
+/**
+ * Returns the file names which the dialog will
+ * use to filter the files it shows.
+ *
+ * @return the file name filter
+ */
+public String [] getFilterNames () {
+ return filterNames;
+}
+/**
+ * Returns the path which the dialog will use to filter
+ * the files it shows.
+ *
+ * @return the filter path
+ */
+public String getFilterPath () {
+ return filterPath;
+}
+int okFunc (int widget, int callData) {
+ cancel = false;
+ char separator = System.getProperty ("file.separator").charAt (0);
+ int lpFilename = OS.gtk_file_selection_get_filename (callData);
+ int filenameLength = OS.strlen (lpFilename);
+ byte [] filenameBytes = new byte [filenameLength];
+ OS.memmove (filenameBytes, lpFilename, filenameLength);
+ fullPath = new String (Converter.mbcsToWcs (null, filenameBytes));
+
+ /* Calculate fileName and filterPath */
+ int separatorIndex = fullPath.indexOf (separator);
+ int index = separatorIndex;
+ while (index != -1) {
+ separatorIndex = index;
+ index = fullPath.indexOf (separator, index + 1);
+ }
+ fileName = fullPath.substring (separatorIndex + 1, fullPath.length ());
+ filterPath = fullPath.substring (0, separatorIndex);
+ OS.gtk_widget_destroy (callData);
+ return 0;
+}
+/**
+ * Makes the dialog visible and brings it to the front
+ * of the display.
+ *
+ * @return a string describing the absolute path of the first selected file,
+ * or null if the dialog was cancelled or an error occurred
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
+ * </ul>
+ */
+public String open () {
+ byte [] titleBytes = Converter.wcsToMbcs (null, title, true);
+ int handle = OS.gtk_file_selection_new (titleBytes);
+ GtkFileSelection dialog = new GtkFileSelection ();
+ OS.memmove (dialog, handle, GtkFileSelection.sizeof);
+
+ /* Calculate the fully-specified file name and convert to bytes */
+ StringBuffer stringBuffer = new StringBuffer ();
+ char separator = System.getProperty ("file.separator").charAt (0);
+ if (filterPath == null) {
+ filterPath = "";
+ } else {
+ if (filterPath.length () > 0) {
+ stringBuffer.append (filterPath);
+ if (filterPath.charAt (filterPath.length () - 1) != separator) {
+ stringBuffer.append (separator);
+ }
+ }
+ }
+ if (fileName == null) {
+ fileName = "";
+ } else {
+ stringBuffer.append (fileName);
+ }
+ fullPath = stringBuffer.toString ();
+ byte [] fullPathBytes = Converter.wcsToMbcs (null, fullPath, true);
+ OS.gtk_file_selection_set_filename (handle, fullPathBytes);
+
+ /* Set the extension */
+ if (filterNames == null) filterNames = new String [0];
+ if (filterExtensions == null) filterExtensions = new String [0];
+ if (filterExtensions.length == 1) {
+ String ext = filterExtensions [0];
+ byte [] extBytes = Converter.wcsToMbcs (null, ext, true);
+ OS.gtk_file_selection_complete (handle, extBytes);
+ }
+
+ /* Hook callbacks */
+ Callback destroyCallback = new Callback (this, "destroyFunc", 2);
+ int destroyFunc = destroyCallback.getAddress ();
+ byte [] destroy = Converter.wcsToMbcs (null, "destroy", true);
+ OS.gtk_signal_connect (handle, destroy, destroyFunc, handle);
+ byte [] clicked = Converter.wcsToMbcs (null, "clicked", true);
+ Callback okCallback = new Callback (this, "okFunc", 2);
+ int okFunc = okCallback.getAddress ();
+ Callback cancelCallback = new Callback (this, "cancelFunc", 2);
+ int cancelFunc = cancelCallback.getAddress ();
+ OS.gtk_signal_connect (dialog.ok_button, clicked, okFunc, handle);
+ OS.gtk_signal_connect (dialog.cancel_button, clicked, cancelFunc, handle);
+
+ fileName = null;
+ fullPath = null;
+ filterPath = null;
+
+ /* Show the dialog */
+ cancel = true;
+ OS.gtk_widget_show_now (handle);
+ OS.gtk_main ();
+
+ destroyCallback.dispose ();
+ okCallback.dispose ();
+ cancelCallback.dispose ();
+
+ /* Return the full path or null */
+ if (cancel) return null;
+ return fullPath;
+}
+/**
+ * Set the initial filename which the dialog will
+ * select by default when opened to the argument,
+ * which may be null. The name will be prefixed with
+ * the filter path when one is supplied.
+ *
+ * @param string the file name
+ */
+public void setFileName (String string) {
+ fileName = string;
+}
+/**
+ * Set the file extensions which the dialog will
+ * use to filter the files it shows to the argument,
+ * which may be null.
+ *
+ * @param extensions the file extension filter
+ */
+public void setFilterExtensions (String [] extensions) {
+ filterExtensions = extensions;
+}
+/**
+ * Sets the file names which the dialog will
+ * use to filter the files it shows to the argument,
+ * which may be null.
+ *
+ * @param names the file name filter
+ */
+public void setFilterNames (String [] names) {
+ filterNames = names;
+}
+/**
+ * Sets the path which the dialog will use to filter
+ * the files it shows to the argument, which may be
+ * null.
+ *
+ * @param string the filter path
+ */
+public void setFilterPath (String string) {
+ filterPath = string;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FontDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FontDialog.java
new file mode 100644
index 0000000..bf6b90c
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FontDialog.java
@@ -0,0 +1,161 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class allow the user to select a font
+ * from all available fonts in the system.
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+
+public class FontDialog extends Dialog {
+ FontData fontData;
+/**
+ * Constructs a new instance of this class given only its
+ * parent.
+ * <p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the dialog on the currently active
+ * display if there is one. If there is no current display, the
+ * dialog is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public FontDialog (Shell parent) {
+ this (parent, SWT.PRIMARY_MODAL);
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT dialog classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the dialog on the currently active
+ * display if there is one. If there is no current display, the
+ * dialog is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public FontDialog (Shell parent, int style) {
+ super (parent, style);
+}
+int cancelFunc (int widget, int callData) {
+ OS.gtk_widget_destroy (callData);
+ return 0;
+}
+int destroyFunc (int widget, int colorInfo) {
+ OS.gtk_main_quit ();
+ return 0;
+}
+/**
+ * Returns a FontData object describing the font that was
+ * selected in the dialog, or null if none is available.
+ *
+ * @return the FontData for the selected font, or null
+ */
+public FontData getFontData() {
+ return fontData;
+}
+int okFunc (int widget, int callData) {
+ int hFontName = OS.gtk_font_selection_dialog_get_font_name (callData);
+ int fontSize = OS.strlen (hFontName);
+ byte [] buffer = new byte [fontSize];
+ OS.memmove (buffer, hFontName, fontSize);
+ char [] fontName = Converter.mbcsToWcs (null, buffer);
+ fontData = FontData.gtk_new(new String (fontName));
+ OS.gtk_widget_destroy (callData);
+ return 0;
+}
+/**
+ * Makes the dialog visible and brings it to the front
+ * of the display.
+ *
+ * @return a FontData object describing the font that was selected,
+ * or null if the dialog was cancelled or an error occurred
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
+ * </ul>
+ */
+public FontData open () {
+ int handle;
+ byte [] titleBytes;
+ titleBytes = Converter.wcsToMbcs (null, title, true);
+ handle = OS.gtk_font_selection_dialog_new (titleBytes);
+ GtkFontSelectionDialog dialog = new GtkFontSelectionDialog ();
+ OS.memmove (dialog, handle, GtkFontSelectionDialog.sizeof);
+ if (fontData != null) {
+ byte[] buffer = Converter.wcsToMbcs(null, fontData.getXlfd(), true);
+ OS.gtk_font_selection_set_font_name(dialog.fontsel, buffer);
+ }
+ Callback destroyCallback = new Callback (this, "destroyFunc", 2);
+ int destroyFunc = destroyCallback.getAddress ();
+ byte [] destroy = Converter.wcsToMbcs (null, "destroy", true);
+ OS.gtk_signal_connect (handle, destroy, destroyFunc, handle);
+ byte [] clicked = Converter.wcsToMbcs (null, "clicked", true);
+ Callback okCallback = new Callback (this, "okFunc", 2);
+ int okFunc = okCallback.getAddress ();
+ Callback cancelCallback = new Callback (this, "cancelFunc", 2);
+ int cancelFunc = cancelCallback.getAddress ();
+ OS.gtk_signal_connect (dialog.ok_button, clicked, okFunc, handle);
+ OS.gtk_signal_connect (dialog.cancel_button, clicked, cancelFunc, handle);
+ fontData = null;
+ OS.gtk_widget_show_now (handle);
+ OS.gtk_main ();
+ destroyCallback.dispose ();
+ okCallback.dispose ();
+ cancelCallback.dispose ();
+ return fontData;
+}
+/**
+ * Sets a FontData object describing the font to be
+ * selected by default in the dialog, or null to let
+ * the platform choose one.
+ *
+ * @param fontData the FontData to use initially, or null
+ */
+public void setFontData (FontData fontData) {
+ this.fontData = fontData;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
new file mode 100644
index 0000000..b0d72d4
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
@@ -0,0 +1,253 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class provide an etched border
+ * with an optional title.
+ * <p>
+ * Shadow styles are hints and may not be honoured
+ * by the platform. To create a group with the
+ * default shadow style for the platform, do not
+ * specify a shadow style.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>SHADOW_ETCHED_IN, SHADOW_ETCHED_OUT, SHADOW_IN, SHADOW_OUT, SHADOW_NONE</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+public class Group extends Composite {
+ int frameHandle;
+ String text="";
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Group (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+static int checkStyle (int style) {
+ /*
+ * Even though it is legal to create this widget
+ * with scroll bars, they serve no useful purpose
+ * because they do not automatically scroll the
+ * widget's client area. The fix is to clear
+ * the SWT style.
+ */
+ return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
+}
+
+void createHandle(int index) {
+ state |= HANDLE;
+
+ eventBoxHandle = OS.gtk_event_box_new ();
+ if (eventBoxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ frameHandle = OS.gtk_frame_new(null);
+ if (frameHandle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ handle = OS.gtk_fixed_new();
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void _setHandleStyle() {
+ int shadow = OS.GTK_SHADOW_IN;
+ if ((style & SWT.SHADOW_IN) != 0) shadow = OS.GTK_SHADOW_IN;
+ if ((style & SWT.SHADOW_OUT) != 0) shadow = OS.GTK_SHADOW_OUT;
+ if ((style & SWT.SHADOW_ETCHED_IN) != 0) shadow = OS.GTK_SHADOW_ETCHED_IN;
+ if ((style & SWT.SHADOW_ETCHED_OUT) != 0) shadow = OS.GTK_SHADOW_ETCHED_OUT;
+ OS.gtk_frame_set_shadow_type(frameHandle, shadow);
+}
+
+void configure() {
+ _connectParent();
+ OS.gtk_container_add(eventBoxHandle, frameHandle);
+ OS.gtk_container_add(frameHandle, handle);
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ int width = _computeSize(wHint, hHint, changed).x;
+ int height = 0;
+ Point size;
+ if (layout != null) {
+ size = layout.computeSize (this, wHint, hHint, changed);
+ } else {
+ size = minimumSize ();
+ }
+ if (size.x == 0) size.x = DEFAULT_WIDTH;
+ if (size.y == 0) size.y = DEFAULT_HEIGHT;
+ if (wHint != SWT.DEFAULT) size.x = wHint;
+ if (hHint != SWT.DEFAULT) size.y = hHint;
+ width = Math.max (width, size.x);
+ height = Math.max (height, size.y);
+ Rectangle trim = computeTrim (0, 0, width, height);
+ width = trim.width; height = trim.height;
+ return new Point (width, height);
+}
+
+void showHandle() {
+ OS.gtk_widget_show (eventBoxHandle);
+ OS.gtk_widget_show (frameHandle);
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void register () {
+ super.register ();
+ WidgetTable.put (frameHandle, this);
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ frameHandle = 0;
+}
+
+void releaseWidget () {
+ super.releaseWidget ();
+ text = null;
+}
+
+void deregister () {
+ super.deregister ();
+ WidgetTable.remove (frameHandle);
+}
+
+int topHandle () { return eventBoxHandle; }
+int parentingHandle() { return handle; }
+
+/*
+ * === GEOMETRY ===
+ */
+
+public Rectangle _getClientArea () {
+ /*
+ * The Group coordinates originate at the client area
+ */
+ int width, height;
+ Point size = _getSize();
+ width = size.x - _getTrim().left - _getTrim().right;
+ height = size.y - _getTrim().top - _getTrim().bottom;
+ return new Rectangle(0,0, width, height);
+}
+
+Trim _getTrim() {
+ trim = new Trim();
+
+ // set up the test widgets
+ int testWindowHandle = OS.gtk_window_new(0);
+ int testHandle = OS.gtk_frame_new(string2bytesConvertMnemonic("Test String"));
+ OS.gtk_container_add(testWindowHandle, testHandle);
+ OS.gtk_widget_realize(testHandle);
+
+ // get info
+ GtkFrame frame = new GtkFrame();
+ OS.memmove (frame, testHandle, GtkFrame.sizeof);
+ GtkStyle groupStyle = new GtkStyle();
+ OS.memmove (groupStyle, frame.style, GtkStyle.sizeof);
+ GtkStyleClass styleClass = new GtkStyleClass();
+ OS.memmove (styleClass, groupStyle.klass, GtkStyleClass.sizeof);
+
+ // see gtk_frame_size_allocate()
+ trim.left = trim.right = frame.border_width + styleClass.xthickness;
+ trim.top = frame.border_width + Math.max(frame.label_height, styleClass.ythickness);
+ trim.bottom = frame.border_width + styleClass.ythickness;
+
+ // clean up
+ OS.gtk_widget_destroy(testHandle);
+ OS.gtk_widget_destroy(testWindowHandle);
+ return trim;
+}
+
+boolean _setSize(int width, int height) {
+ boolean differentExtent = UtilFuncs.setSize (topHandle(), width,height);
+ Point clientSize = UtilFuncs.getSize(frameHandle);
+ // WRONG but it's quite safe - the frame clips it
+ UtilFuncs.setSize (handle, clientSize.x, clientSize.y);
+ return differentExtent;
+}
+/* ========= Model Logic ========= */
+
+String getNameText () {
+ return getText ();
+}
+/**
+ * Returns the receiver's text, which is the string that the
+ * is used as the <em>title</em>. If the text has not previously
+ * been set, returns an empty string.
+ *
+ * @return the text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getText () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return text;
+}
+
+
+/**
+ * Sets the receiver's text, which is the string that will
+ * be displayed as the receiver's <em>title</em>, to the argument,
+ * which may not be null.
+ *
+ * @param text the new text
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ OS.gtk_frame_set_label (frameHandle, string2bytesConvertMnemonic(string));
+ text=string;
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
new file mode 100644
index 0000000..84f872b
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
@@ -0,0 +1,365 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class represent a non-selectable
+ * user interface object that displays a string or image.
+ * When SEPARATOR is specified, displays a single
+ * vertical or horizontal line.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>SEPARATOR, HORIZONTAL, SHADOW_IN, SHADOW_OUT, VERTICAL</dd>
+ * <dd>CENTER, LEFT, RIGHT, WRAP</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+
+public class Label extends Control {
+ int boxHandle, frameHandle;
+ Image image;
+ String text;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Label (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+static int checkStyle (int style) {
+ if ((style & SWT.SEPARATOR) != 0) return style;
+ return checkBits (style, SWT.LEFT, SWT.CENTER, SWT.RIGHT, 0, 0, 0);
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+
+ boxHandle = OS.gtk_event_box_new ();
+ if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ frameHandle = OS.gtk_frame_new(null);
+ if (frameHandle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ handle = ((style&SWT.SEPARATOR) != 0)? (((style&SWT.HORIZONTAL)!= 0)?
+ OS.gtk_hseparator_new() : OS.gtk_vseparator_new()):
+ OS.gtk_label_new (new byte [1]);
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void createWidget (int index) {
+ super.createWidget (index);
+ text = "";
+}
+
+void setHandleStyle () {
+ int type = (style & SWT.BORDER) != 0 ? OS.GTK_SHADOW_ETCHED_IN : OS.GTK_SHADOW_NONE;
+ OS.gtk_frame_set_shadow_type (frameHandle, type);
+ if ((style & SWT.SEPARATOR) != 0) return;
+ if ((style & SWT.WRAP) != 0) OS.gtk_label_set_line_wrap (handle, true);
+ if ((style & SWT.LEFT) != 0) {
+ OS.gtk_misc_set_alignment (handle, 0.0f, 0.0f);
+ OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_LEFT);
+ return;
+ }
+ if ((style & SWT.CENTER) != 0) {
+ OS.gtk_misc_set_alignment (handle, 0.5f, 0.0f);
+ OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_CENTER);
+ return;
+ }
+ if ((style & SWT.RIGHT) != 0) {
+ OS.gtk_misc_set_alignment (handle, 1.0f, 0.0f);
+ OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_RIGHT);
+ return;
+ }
+}
+
+void configure() {
+ _connectParent();
+ OS.gtk_container_add(boxHandle, frameHandle);
+ OS.gtk_container_add(frameHandle, handle);
+}
+
+void showHandle() {
+ OS.gtk_widget_show (boxHandle);
+ OS.gtk_widget_show (frameHandle);
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void register () {
+ super.register ();
+ WidgetTable.put (boxHandle, this);
+ WidgetTable.put (frameHandle, this);
+}
+
+void deregister () {
+ super.deregister ();
+ WidgetTable.remove (boxHandle);
+ WidgetTable.remove (frameHandle);
+}
+
+int eventHandle () {
+ return boxHandle;
+}
+
+void releaseWidget () {
+ super.releaseWidget ();
+ image = null;
+ text = null;
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ boxHandle = frameHandle = 0;
+}
+
+int topHandle () {
+ return boxHandle;
+}
+
+int computeHandle () {
+ return frameHandle;
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ if ((style&SWT.SEPARATOR) != 0) {
+ int w, h;
+ if ((style&SWT.HORIZONTAL)!= 0) {
+ w = 45;
+ h = 6;
+ } else { // vertical
+ w = 6;
+ h = 45;
+ }
+ if (wHint != SWT.DEFAULT) w = wHint;
+ if (hHint != SWT.DEFAULT) h = hHint;
+ return new Point(w,h);
+ }
+ return super.computeSize(wHint, hHint, changed);
+}
+
+/**
+ * Returns a value which describes the position of the
+ * text or image in the receiver. The value will be one of
+ * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
+ * unless the receiver is a <code>SEPARATOR</code> label, in
+ * which case, <code>NONE</code> is returned.
+ *
+ * @return the alignment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getAlignment () {
+ checkWidget ();
+ if ((style & SWT.SEPARATOR) != 0) return 0;
+ if ((style & SWT.LEFT) != 0) return SWT.LEFT;
+ if ((style & SWT.CENTER) != 0) return SWT.CENTER;
+ if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
+ return SWT.LEFT;
+}
+
+/**
+ * Returns the receiver's image if it has one, or null
+ * if it does not.
+ *
+ * @return the receiver's image
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Image getImage () {
+ checkWidget ();
+ return image;
+}
+
+String getNameText () {
+ return getText ();
+}
+
+/**
+ * Returns the receiver's text, which will be an empty
+ * string if it has never been set or if the receiver is
+ * a <code>SEPARATOR</code> label.
+ *
+ * @return the receiver's text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getText () {
+ checkWidget ();
+ if ((style & SWT.SEPARATOR) != 0) return "";
+ return text;
+}
+
+/**
+ * Controls how text and images will be displayed in the receiver.
+ * The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
+ * or <code>CENTER</code>. If the receiver is a <code>SEPARATOR</code>
+ * label, the argument is ignored and the alignment is not changed.
+ *
+ * @param alignment the new alignment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setAlignment (int alignment) {
+ checkWidget ();
+ if ((style & SWT.SEPARATOR) != 0) return;
+ if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
+ style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
+ style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
+ boolean isText = OS.GTK_WIDGET_TYPE (handle) == OS.gtk_label_get_type ();
+ if ((style & SWT.LEFT) != 0) {
+ OS.gtk_misc_set_alignment (handle, 0.0f, 0.0f);
+ if (isText) OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_LEFT);
+ return;
+ }
+ if ((style & SWT.CENTER) != 0) {
+ OS.gtk_misc_set_alignment (handle, 0.5f, 0.0f);
+ if (isText) OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_CENTER);
+ return;
+ }
+ if ((style & SWT.RIGHT) != 0) {
+ OS.gtk_misc_set_alignment (handle, 1.0f, 0.0f);
+ if (isText) OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_RIGHT);
+ return;
+ }
+}
+
+/**
+ * Sets the receiver's image to the argument, which may be
+ * null indicating that no image should be displayed.
+ *
+ * @param image the image to display on the receiver (may be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setImage (Image image) {
+ checkWidget ();
+ this.image = image;
+ if ((style & SWT.SEPARATOR) != 0) return;
+ //NOT IMPLEMENTED - events and state of handle lost
+ WidgetTable.remove (handle);
+ OS.gtk_widget_destroy (handle);
+ if (image == null) {
+ handle = OS.gtk_label_new (new byte [1]);
+ } else {
+ handle = OS.gtk_pixmap_new (image.pixmap, image.mask);
+ }
+ OS.gtk_container_add (frameHandle, handle);
+ WidgetTable.put (handle, this);
+ int alignment = style & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
+ switch (alignment) {
+ case SWT.LEFT: OS.gtk_misc_set_alignment (handle, 0.0f, 0.0f); break;
+ case SWT.CENTER: OS.gtk_misc_set_alignment (handle, 0.5f, 0.0f); break;
+ case SWT.RIGHT: OS.gtk_misc_set_alignment (handle, 1.0f, 0.0f); break;
+ }
+ OS.gtk_widget_show (handle);
+}
+
+/**
+ * Sets the receiver's text.
+ * <p>
+ * This method sets the widget label. The label may include
+ * the mnemonic characters and line delimiters.
+ * </p>
+ *
+ * @param string the new text
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setText (String string) {
+ checkWidget();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if ((style & SWT.SEPARATOR) != 0) return;
+ text = string;
+ boolean isText = OS.GTK_WIDGET_TYPE (handle) == OS.gtk_label_get_type ();
+ if (!isText) {
+ //NOT IMPLEMENTED - events and state of handle lost
+ WidgetTable.remove (handle);
+ OS.gtk_widget_destroy (handle);
+ handle = OS.gtk_label_new (new byte [1]);
+ OS.gtk_container_add (frameHandle, handle);
+ WidgetTable.put (handle, this);
+ int alignment = style & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
+ switch (alignment) {
+ case SWT.LEFT:
+ OS.gtk_misc_set_alignment (handle, 0.0f, 0.0f);
+ OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_LEFT);
+ break;
+ case SWT.CENTER:
+ OS.gtk_misc_set_alignment (handle, 0.5f, 0.0f);
+ OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_CENTER);
+ break;
+ case SWT.RIGHT:
+ OS.gtk_misc_set_alignment (handle, 1.0f, 0.0f);
+ OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_RIGHT);
+ break;
+ }
+ }
+ OS.gtk_label_parse_uline (handle, string2bytesConvertMnemonic(string));
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
new file mode 100644
index 0000000..3965964
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
@@ -0,0 +1,1089 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+
+/**
+ * Instances of this class represent a selectable user interface
+ * object that displays a list of strings and issues notificiation
+ * when a string selected. A list may be single or multi select.
+ * <p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>SINGLE, MULTI</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection, DefaultSelection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+
+public class List extends Scrollable {
+ int boxHandle;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public List (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+/**
+ * Adds the argument to the end of the receiver's list.
+ *
+ * @param string the new item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ *
+ * @see #add(String,int)
+ */
+public void add (String string) {
+ checkWidget();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ int ptr = OS.g_malloc (buffer.length);
+ OS.memmove (ptr, buffer, buffer.length);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ int result = OS.gtk_clist_append (handle, new int [] {ptr});
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ OS.g_free (ptr);
+}
+/**
+ * Adds the argument to the receiver's list at the given
+ * zero-relative index.
+ * <p>
+ * Note: To add an item at the end of the list, use the
+ * result of calling <code>getItemCount()</code> as the
+ * index or use <code>add(String)</code>.
+ * </p>
+ *
+ * @param string the new item
+ * @param index the index for the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ *
+ * @see #add(String)
+ */
+public void add (String string, int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (index == -1) error (SWT.ERROR_ITEM_NOT_ADDED);
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ int ptr = OS.g_malloc (buffer.length);
+ OS.memmove (ptr, buffer, buffer.length);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ int result = OS.gtk_clist_insert (handle, index, new int [] {ptr});
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ OS.g_free (ptr);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's selection changes, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * <code>widgetSelected</code> is called when the selection changes.
+ * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener(SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+static int checkStyle (int style) {
+ return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+ boxHandle = OS.gtk_hbox_new(true,0); // false for homogeneous; doesn't really matter
+ if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ handle = OS.gtk_clist_new (1);
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+ scrolledHandle = OS.gtk_scrolled_window_new (0, 0);
+ if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void setHandleStyle() {
+ int selectionMode = ((style & SWT.MULTI) != 0)?
+ OS.GTK_SELECTION_EXTENDED :
+ OS.GTK_SELECTION_BROWSE;
+ OS.gtk_clist_set_selection_mode (handle, selectionMode);
+
+ int border = OS.GTK_SHADOW_NONE;
+ if ((style&SWT.BORDER)!=0) {
+ border = OS.GTK_SHADOW_ETCHED_IN;
+ if ((style&SWT.SHADOW_IN)!=0) border = OS.GTK_SHADOW_IN;
+ if ((style&SWT.SHADOW_OUT)!=0) border = OS.GTK_SHADOW_OUT;
+ if ((style&SWT.SHADOW_ETCHED_IN)!=0) border = OS.GTK_SHADOW_ETCHED_IN;
+ if ((style&SWT.SHADOW_ETCHED_OUT)!=0) border = OS.GTK_SHADOW_ETCHED_OUT;
+ }
+ OS.gtk_clist_set_shadow_type(handle, border);
+ setScrollingPolicy();
+}
+
+void configure() {
+ _connectParent();
+ OS.gtk_box_pack_start(boxHandle, scrolledHandle, true,true,0);
+ OS.gtk_container_add (scrolledHandle, handle);
+}
+
+void hookEvents () {
+ //TO DO - get rid of enter/exit for mouse crossing border
+ super.hookEvents();
+ signal_connect(handle, "select_row", SWT.Selection, 5);
+ signal_connect(handle, "unselect_row", SWT.Selection, 5);
+ signal_connect(handle, "extend_selection", SWT.Selection, 5);
+}
+
+void showHandle() {
+ OS.gtk_widget_show (boxHandle);
+ OS.gtk_widget_show (scrolledHandle);
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void register () {
+ super.register ();
+ WidgetTable.put (boxHandle, this);
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ boxHandle = 0;
+}
+
+void deregister () {
+ super.deregister ();
+ WidgetTable.remove (boxHandle);
+}
+
+int topHandle() {
+ return boxHandle;
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ if (wHint == SWT.DEFAULT) wHint = 200;
+ return super.computeSize (wHint, hHint, changed);
+}
+
+
+/**
+ * Deselects the item at the given zero-relative index in the receiver.
+ * If the item at the index was already deselected, it remains
+ * deselected. Indices that are out of range are ignored.
+ *
+ * @param index the index of the item to deselect
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselect (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_unselect_row (handle, index, 0);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Deselects the items at the given zero-relative indices in the receiver.
+ * If the item at the given zero-relative index in the receiver
+ * is selected, it is deselected. If the item at the index
+ * was not selected, it remains deselected. The range of the
+ * indices is inclusive. Indices that are out of range are ignored.
+ *
+ * @param start the start index of the items to deselect
+ * @param end the end index of the items to deselect
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselect (int start, int end) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ for (int i=start; i<=end; i++) {
+ OS.gtk_clist_unselect_row (handle, i, 0);
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Deselects the items at the given zero-relative indices in the receiver.
+ * If the item at the given zero-relative index in the receiver
+ * is selected, it is deselected. If the item at the index
+ * was not selected, it remains deselected. Indices that are out
+ * of range and duplicate indices are ignored.
+ *
+ * @param indices the array of indices for the items to deselect
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselect (int [] indices) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ for (int i=0; i<indices.length; i++) {
+ OS.gtk_clist_unselect_row (handle, indices [i], 0);
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Deselects all selected items in the receiver.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselectAll () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_unselect_all (handle);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Returns the item at the given, zero-relative index in the
+ * receiver. Throws an exception if the index is out of range.
+ *
+ * @param index the index of the item to return
+ * @return the item at the given index
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public String getItem (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int [] buffer = new int [1];
+ int result = OS.gtk_clist_get_text (handle, index, 0, buffer);
+ int length = OS.strlen (buffer [0]);
+ byte [] buffer1 = new byte [length];
+ OS.memmove (buffer1, buffer [0], length);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ return new String (buffer2, 0, buffer2.length);
+}
+/**
+ * Returns the number of items contained in the receiver.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public int getItemCount () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkCList widget = new GtkCList ();
+ OS.memmove (widget, handle, GtkCList.sizeof);
+ return widget.rows;
+}
+/**
+ * Returns the height of the area which would be used to
+ * display <em>one</em> of the items in the tree.
+ *
+ * @return the height of one item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public int getItemHeight () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkCList clist = new GtkCList ();
+ OS.memmove (clist, handle, GtkCList.sizeof);
+ return clist.row_height;
+}
+/**
+ * Returns an array of <code>String</code>s which are the items
+ * in the receiver.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the items in the receiver's list
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
+ * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure while getting the item count</li>
+ * </ul>
+ */
+public String [] getItems () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int count = getItemCount ();
+ String [] result = new String [count];
+ for (int i=0; i<count; i++) result [i] = getItem (i);
+ return result;
+}
+/**
+ * Returns an array of <code>String</code>s that are currently
+ * selected in the receiver. An empty array indicates that no
+ * items are selected.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its selection, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ * @return an array representing the selection
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure while getting the selection</li>
+ * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
+ * </ul>
+ */
+public String [] getSelection () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkCList widget = new GtkCList ();
+ OS.memmove (widget, handle, GtkCList.sizeof);
+ int list = widget.selection;
+ if (list==0) return new String[0];
+ int length = OS.g_list_length (list);
+ String [] items = new String [length];
+ int [] buffer = new int [1];
+ for (int i=0; i<length; i++) {
+ int index = OS.g_list_nth_data (list, i);
+ int result = OS.gtk_clist_get_text (handle, index, 0, buffer);
+ int strlen = OS.strlen (buffer [0]);
+ byte [] buffer1 = new byte [strlen];
+ OS.memmove (buffer1, buffer [0], strlen);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ items [i] = new String (buffer2, 0, buffer2.length);
+ }
+ return items;
+}
+/**
+ * Returns the number of selected items contained in the receiver.
+ *
+ * @return the number of selected items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public int getSelectionCount () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkCList widget = new GtkCList ();
+ OS.memmove (widget, handle, GtkCList.sizeof);
+ return OS.g_list_length (widget.selection);
+}
+/**
+ * Returns the zero-relative index of the item which is currently
+ * selected in the receiver, or -1 if no item is selected.
+ *
+ * @return the index of the selected item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public int getSelectionIndex () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+
+ if ((style&SWT.SINGLE)!=0) {
+ GtkCList clist = new GtkCList();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ int pselection = clist.selection;
+ if (OS.g_list_length (pselection) == 0) return -1;
+ return OS.g_list_nth_data (pselection, 0);
+ }
+
+ error(SWT.ERROR_NOT_IMPLEMENTED);
+ return 0;
+}
+/**
+ * Returns the zero-relative indices of the items which are currently
+ * selected in the receiver. The array is empty if no items are selected.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its selection, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ * @return the array of indices of the selected items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public int [] getSelectionIndices () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkCList widget = new GtkCList ();
+ OS.memmove (widget, handle, GtkCList.sizeof);
+ int list = widget.selection;
+ int length = OS.g_list_length (list);
+ int [] indices = new int [length];
+ for (int i=0; i<length; i++) {
+ indices [i] = OS.g_list_nth_data (list, i);
+ }
+ return indices;
+}
+/**
+ * Returns the zero-relative index of the item which is currently
+ * at the top of the receiver. This index can change when items are
+ * scrolled or new items are added or removed.
+ *
+ * @return the index of the top item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getTopIndex () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkCList clist = new GtkCList ();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ return -clist.voffset / (clist.row_height + 1);
+}
+
+/**
+ * Gets the index of an item.
+ * <p>
+ * The list is searched starting at 0 until an
+ * item is found that is equal to the search item.
+ * If no item is found, -1 is returned. Indexing
+ * is zero based.
+ *
+ * @param string the search item
+ * @return the index of the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int indexOf (String string) {
+ if (!isValidThread ()) error(SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error(SWT.ERROR_WIDGET_DISPOSED);
+ return indexOf (string, 0);
+}
+/**
+ * Searches the receiver's list starting at the given,
+ * zero-relative index until an item is found that is equal
+ * to the argument, and returns the index of that item. If
+ * no item is found or the starting index is out of range,
+ * returns -1.
+ *
+ * @param string the search item
+ * @return the index of the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure while getting the item count</li>
+ * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
+ * </ul>
+ */
+public int indexOf (String string, int start) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ String [] items = getItems ();
+ for (int i=start; i<items.length; i++) {
+ if (items [i].equals (string)) return i;
+ }
+ return -1;
+}
+/**
+ * Returns <code>true</code> if the item is selected,
+ * and <code>false</code> otherwise. Indices out of
+ * range are ignored.
+ *
+ * @param index the index of the item
+ * @return the visibility state of the item at the index
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isSelected (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkCList widget = new GtkCList ();
+ OS.memmove (widget, handle, GtkCList.sizeof);
+ int list = widget.selection;
+ int length = OS.g_list_length (list);
+ for (int i=0; i<length; i++) {
+ if (index == OS.g_list_nth_data (list, i)) return true;
+ }
+ return false;
+}
+/**
+ * Removes the item from the receiver at the given
+ * zero-relative index.
+ *
+ * @param index the index for the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_remove (handle, index);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Removes the items from the receiver which are
+ * between the given zero-relative start and end
+ * indices (inclusive).
+ *
+ * @param start the start of the range
+ * @param end the end of the range
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (int start, int end) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ int index = start;
+ while (index <= end) {
+ OS.gtk_clist_remove (handle, start);
+ index++;
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Searches the receiver's list starting at the first item
+ * until an item is found that is equal to the argument,
+ * and removes that item from the list.
+ *
+ * @param string the item to remove
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int index = indexOf (string, 0);
+ if (index == -1) error (SWT.ERROR_ITEM_NOT_REMOVED);
+ remove (index);
+}
+/**
+ * Removes the items from the receiver at the given
+ * zero-relative indices.
+ *
+ * @param indices the array of indices of the items
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (int [] indices) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
+ int [] newIndices = new int [indices.length];
+ System.arraycopy (indices, 0, newIndices, 0, indices.length);
+ sort (newIndices);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ int last = -1;
+ for (int i=0; i<newIndices.length; i++) {
+ int index = newIndices [i];
+ if (index != last || i == 0) {
+ OS.gtk_clist_remove (handle, index);
+ last = index;
+ }
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Removes all of the items from the receiver.
+ * <p>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void removeAll () {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_clear (handle);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's selection changes.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener(SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+/**
+ * Selects the item at the given zero-relative index in the receiver's
+ * list. If the item at the index was already selected, it remains
+ * selected. Indices that are out of range are ignored.
+ *
+ * @param index the index of the item to select
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void select (int index) {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_select_row (handle, index, 0);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Selects the items at the given zero-relative indices in the receiver.
+ * If the item at the index was already selected, it remains
+ * selected. The range of the indices is inclusive. Indices that are
+ * out of range are ignored.
+ *
+ * @param start the start of the range
+ * @param end the end of the range
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void select (int start, int end) {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ for (int i=start; i<=end; i++) {
+ OS.gtk_clist_select_row (handle, i, 0);
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Selects the items at the given zero-relative indices in the receiver.
+ * If the item at the given zero-relative index in the receiver
+ * is not selected, it is selected. If the item at the index
+ * was selected, it remains selected. Indices that are out
+ * of range and duplicate indices are ignored.
+ *
+ * @param indices the array of indices for the items to select
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void select (int [] indices) {
+ checkWidget();
+ if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ for (int i=0; i<indices.length; i++) {
+ OS.gtk_clist_select_row (handle, indices [i], 0);
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Selects all the items in the receiver.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void selectAll () {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_select_all (handle);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Sets the text of the item in the receiver's list at the given
+ * zero-relative index to the string argument. This is equivalent
+ * to <code>remove</code>'ing the old item at the index, and then
+ * <code>add</code>'ing the new item at that index.
+ *
+ * @param index the index for the item
+ * @param string the new text for the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the remove operation fails because of an operating system failure</li>
+ * <li>ERROR_ITEM_NOT_ADDED - if the add operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void setItem (int index, String string) {
+ checkWidget();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_set_text (handle, index, 0, buffer);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Sets the receiver's items to be the given array of items.
+ *
+ * @param items the array of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void setItems (String [] items) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
+ removeAll ();
+ for (int i=0; i<items.length; i++) {
+ add (items [i]);
+ }
+}
+/**
+ * Selects the item at the given zero-relative index in the receiver.
+ * If the item at the index was already selected, it remains selected.
+ * The current selected is first cleared, then the new items are selected.
+ * Indices that are out of range are ignored.
+ *
+ * @param index the index of the item to select
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @see List#deselectAll()
+ * @see List#select(int)
+ */
+public void setSelection (int index) {
+ if ((style & SWT.MULTI) != 0) deselectAll ();
+ select (index);
+}
+/**
+ * Selects the items at the given zero-relative indices in the receiver.
+ * The current selected if first cleared, then the new items are selected.
+ *
+ * @param start the start index of the items to select
+ * @param end the end index of the items to select
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Table#deselectAll()
+ * @see Table#select(int,int)
+ */
+public void setSelection (int start, int end) {
+ if ((style & SWT.MULTI) != 0) deselectAll ();
+ select (start, end);
+}
+/**
+ * Selects the items at the given zero-relative indices in the receiver.
+ * The current selection is first cleared, then the new items are selected.
+ *
+ * @param indices the indices of the items to select
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see List#deselectAll()
+ * @see List#select(int[])
+ */
+public void setSelection(int[] indices) {
+ if ((style & SWT.MULTI) != 0) deselectAll ();
+ select (indices);
+}
+/**
+ * Sets the receiver's selection to be the given array of items.
+ * The current selected is first cleared, then the new items are
+ * selected.
+ *
+ * @param items the array of items
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see List#deselectAll()
+ * @see List#select(int)
+ */
+public void setSelection (String [] items) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if ((style & SWT.MULTI) != 0) deselectAll ();
+ for (int i=items.length-1; i>=0; --i) {
+ int index = 0;
+ String string = items [i];
+ if (string != null) {
+ while ((index = indexOf (string, index)) != -1) {
+ select (index);
+ if (((style & SWT.SINGLE) != 0) && isSelected (index)) return;
+ index++;
+ }
+ }
+ }
+ if ((style & SWT.SINGLE) != 0) deselectAll ();
+}
+/**
+ * Sets the zero-relative index of the item which is currently
+ * at the top of the receiver. This index can change when items
+ * are scrolled or new items are added and removed.
+ *
+ * @param index the index of the top item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setTopIndex (int index) {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_moveto (handle, index, 0, 0.0f, 0.0f);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Shows the selection. If the selection is already showing in the receiver,
+ * this method simply returns. Otherwise, the items are scrolled until
+ * the selection is visible.
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void showSelection () {
+ checkWidget();
+ /* FIXME */
+}
+
+int processSelection (int int0, int int1, int int2) {
+ Event event = new Event();
+ event.widget=this;
+ sendEvent (SWT.Selection,event);
+ return 0;
+}
+int processMouseDown (int callData, int arg1, int int2) {
+ OS.gtk_widget_grab_focus(handle);
+ GdkEventButton gdkEvent = new GdkEventButton ();
+ OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
+ int eventType = SWT.MouseDown;
+ if (gdkEvent.type == OS.GDK_2BUTTON_PRESS) {
+ eventType = SWT.MouseDoubleClick;
+ Event event = new Event ();
+ event.widget=this;
+ sendEvent (SWT.DefaultSelection, event);
+ }else
+ sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
+ if (gdkEvent.button == 3 && menu != null) {
+ menu.setVisible (true);
+ }
+ return 1;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
new file mode 100644
index 0000000..7a77f50
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
@@ -0,0 +1,563 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class are user interface objects that contain
+ * menu items.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>BAR, DROP_DOWN, POP_UP</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Help, Hide, Show </dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+
+public class Menu extends Widget {
+ MenuItem cascade;
+ Decorations parent;
+/**
+* Creates a new instance of the widget.
+*/
+public Menu (Control parent) {
+ this (parent.getShell (), SWT.POP_UP);
+}
+/**
+* Creates a new instance of the widget.
+*/
+public Menu (Decorations parent, int style) {
+ super (parent, checkStyle (style));
+ this.parent = parent;
+ createWidget (0);
+}
+/**
+* Creates a new instance of the widget.
+*/
+public Menu (Menu parentMenu) {
+ this (parentMenu.parent, SWT.DROP_DOWN);
+}
+/**
+* Creates a new instance of the widget.
+*/
+public Menu (MenuItem parentItem) {
+ this (parentItem.parent);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the help events are generated for the control, by sending
+ * it one of the messages defined in the <code>MenuListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MenuListener
+ * @see #removeMenuListener
+ */
+public void addMenuListener (MenuListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Hide,typedListener);
+ addListener (SWT.Show,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the help events are generated for the control, by sending
+ * it one of the messages defined in the <code>HelpListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see HelpListener
+ * @see #removeHelpListener
+ */
+public void addHelpListener (HelpListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Help, typedListener);
+}
+
+static int checkStyle (int style) {
+ return checkBits (style, SWT.POP_UP, SWT.BAR, SWT.DROP_DOWN, 0, 0, 0);
+}
+void createHandle (int index) {
+ state |= HANDLE;
+ if ((style & SWT.BAR) != 0) {
+ handle = OS.gtk_menu_bar_new ();
+ OS.gtk_widget_show (handle);
+ } else {
+ handle = OS.gtk_menu_new ();
+ }
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void createWidget (int index) {
+ super.createWidget (index);
+ parent.add (this);
+}
+
+/**
+ * Returns the default menu item or null if none has
+ * been previously set.
+ *
+ * @return the default menu item.
+ *
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public MenuItem getDefaultItem () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return null;
+}
+public Display getDisplay () {
+ Decorations parent = this.parent;
+ if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getDisplay ();
+}
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getEnabled () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return (widget.flags & OS.GTK_SENSITIVE) != 0;
+}
+/**
+ * Returns the item at the given, zero-relative index in the
+ * receiver. Throws an exception if the index is out of range.
+ *
+ * @param index the index of the item to return
+ * @return the item at the given index
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public MenuItem getItem (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int list = OS.gtk_container_children (handle);
+ int data = OS.g_list_nth_data (list, index);
+ if (data == 0) error (SWT.ERROR_CANNOT_GET_ITEM);
+ return (MenuItem) WidgetTable.get (data);
+}
+/**
+ * Returns the number of items contained in the receiver.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getItemCount () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int list = OS.gtk_container_children (handle);
+ return OS.g_list_length (list);
+}
+/**
+ * Returns an array of <code>MenuItem</code>s which are the items
+ * in the receiver.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the items in the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public MenuItem [] getItems () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int list = OS.gtk_container_children (handle);
+ int count = OS.g_list_length (list);
+ MenuItem [] items = new MenuItem [count];
+ for (int i=0; i<count; i++) {
+ int data = OS.g_list_nth_data (list, i);
+ items [i] = (MenuItem) WidgetTable.get (data);
+ }
+ return items;
+}
+/**
+ * Returns the receiver's parent, which must be a <code>Decorations</code>.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Decorations getParent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent;
+}
+/**
+ * Returns the receiver's parent item, which must be a
+ * <code>MenuItem</code> or null when the receiver is a
+ * root.
+ *
+ * @return the receiver's parent item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public MenuItem getParentItem () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return cascade;
+}
+/**
+ * Returns the receiver's parent item, which must be a
+ * <code>Menu</code> or null when the receiver is a
+ * root.
+ *
+ * @return the receiver's parent item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Menu getParentMenu () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (cascade == null) return null;
+ return cascade.getParent ();
+}
+/**
+ * Returns the receiver's shell. For all controls other than
+ * shells, this simply returns the control's nearest ancestor
+ * shell. Shells return themselves, even if they are children
+ * of other shells.
+ *
+ * @return the receiver's shell
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #getParent
+ */
+public Shell getShell () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getShell ();
+}
+/**
+ * Returns <code>true</code> if the receiver is visible, and
+ * <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getVisible () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return (widget.flags & OS.GTK_MAPPED) != 0;
+}
+/**
+ * Searches the receiver's list starting at the first item
+ * (index 0) until an item is found that is equal to the
+ * argument, and returns the index of that item. If no item
+ * is found, returns -1.
+ *
+ * @param item the search item
+ * @return the index of the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int indexOf (MenuItem item) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
+ MenuItem [] items = getItems ();
+ for (int i=0; i<items.length; i++) {
+ if (items [i] == item) return i;
+ }
+ return -1;
+}
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isEnabled () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return getEnabled () && getParent ().getEnabled ();
+}
+/**
+ * Returns <code>true</code> if the receiver is visible, and
+ * <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isVisible () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return getVisible ();
+}
+void releaseChild () {
+ super.releaseChild ();
+ if (cascade != null) cascade.setMenu (null);
+ if ((style & SWT.BAR) != 0 && this == parent.menuBar) {
+ parent.setMenuBar (null);
+ }
+}
+void releaseWidget () {
+ MenuItem [] items = getItems ();
+ for (int i=0; i<items.length; i++) {
+ MenuItem item = items [i];
+ if (!item.isDisposed ()) {
+ item.releaseWidget ();
+ item.releaseHandle ();
+ }
+ }
+ if (parent != null) parent.remove (this);
+ super.releaseWidget ();
+ parent = null;
+ cascade = null;
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the menu events are generated for the control.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MenuListener
+ * @see #addMenuListener
+ */
+public void removeMenuListener (MenuListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Hide, listener);
+ eventTable.unhook (SWT.Show, listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the help events are generated for the control.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see HelpListener
+ * @see #addHelpListener
+ */
+public void removeHelpListener (HelpListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Help, listener);
+}
+
+/**
+ * Sets the default menu item to the argument or removes
+ * the default emphasis when the argument is <code>null</code>.
+ *
+ * @param item the default menu item or null
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the menu item has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setDefaultItem (MenuItem item) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+/**
+ * Enables the receiver if the argument is <code>true</code>,
+ * and disables it otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @param enabled the new enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setEnabled (boolean enabled) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_widget_set_sensitive (handle, enabled);
+}
+
+/**
+ * Sets the receiver's location to the point specified by
+ * the arguments which are relative to the display.
+ * <p>
+ * Note: This is different from most widgets where the
+ * location of the widget is relative to the parent.
+ * </p>
+ *
+ * @param x the new x coordinate for the receiver
+ * @param y the new y coordinate for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLocation (int x, int y) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & (SWT.BAR | SWT.DROP_DOWN)) != 0) return;
+// OS.gtk_widget_set_uposition(handle, x, y);
+// OS.gtk_widget_set_uposition(handle, 0, 0);
+ sendEvent(SWT.Move);
+}
+
+/**
+ * Marks the receiver as visible if the argument is <code>true</code>,
+ * and marks it invisible otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, marking
+ * it visible may not actually cause it to be displayed.
+ * </p>
+ *
+ * @param visible the new visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setVisible (boolean visible) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & SWT.BAR) != 0) return;
+ if (visible) {
+ sendEvent(SWT.Show);
+ OS.gtk_menu_popup (handle, 0, 0, 0, 0, 3, 0);
+ } else {
+ OS.gtk_menu_popdown (handle);
+ sendEvent(SWT.Hide);
+ }
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
new file mode 100644
index 0000000..bfe074e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java
@@ -0,0 +1,627 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class represent a selectable user interface object
+ * that issues notification when pressed and released.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>CHECK, CASCADE, PUSH, RADIO, SEPARATOR</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Arm, Help, Selection</dd>
+ * </dl>
+ *<p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+
+public class MenuItem extends Item {
+ Menu parent, menu;
+ int accelerator;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Menu</code>) and a style value
+ * describing its behavior and appearance. The item is added
+ * to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public MenuItem (Menu parent, int style) {
+ super (parent, checkStyle (style));
+ this.parent = parent;
+ createWidget (parent.getItemCount ());
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Menu</code>), a style value
+ * describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public MenuItem (Menu parent, int style, int index) {
+ super (parent, checkStyle (style));
+ this.parent = parent;
+ int count = parent.getItemCount ();
+ if (!(0 <= index && index <= count)) {
+ error (SWT.ERROR_ITEM_NOT_ADDED);
+ }
+ createWidget (index);
+}
+void addAccelerator (int accel_group) {
+ if (accel_group == 0) return;
+ if (accelerator == 0) return;
+ byte [] activate = Converter.wcsToMbcs (null, "activate", true);
+ int mask = 0;
+ if ((accelerator & SWT.CONTROL) != 0) mask |= OS.GDK_CONTROL_MASK;
+ if ((accelerator & SWT.ALT) != 0) mask |= OS.GDK_MOD1_MASK;
+ if ((accelerator & SWT.SHIFT) != 0) mask |= OS.GDK_SHIFT_MASK;
+ int keysym = accelerator & ~(SWT.ALT | SWT.SHIFT | SWT.CTRL);
+ int newKey = Display.untranslateKey (keysym);
+ if (newKey != 0) {
+ keysym = newKey;
+ } else {
+ keysym = wcsToMbcs ((char) keysym);
+ }
+ OS.gtk_widget_add_accelerator (handle, activate, accel_group, keysym, mask, OS.GTK_ACCEL_VISIBLE);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the arm events are generated for the control, by sending
+ * it one of the messages defined in the <code>ArmListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ArmListener
+ * @see #removeArmListener
+ */
+public void addArmListener (ArmListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Arm, typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the help events are generated for the control, by sending
+ * it one of the messages defined in the <code>HelpListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see HelpListener
+ * @see #removeHelpListener
+ */
+public void addHelpListener (HelpListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Help, typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control is selected, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * When <code>widgetSelected</code> is called, the stateMask field of the event object is valid.
+ * <code>widgetDefaultSelected</code> is not called.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener (SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener(listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+static int checkStyle (int style) {
+ return checkBits (style, SWT.PUSH, SWT.CHECK, SWT.RADIO, SWT.SEPARATOR, SWT.CASCADE, 0);
+}
+void createHandle (int index) {
+ state |= HANDLE;
+ byte [] buffer = new byte [1];
+ int bits = SWT.CHECK | SWT.RADIO | SWT.PUSH | SWT.SEPARATOR;
+ switch (style & bits) {
+ case SWT.SEPARATOR:
+ handle = OS.gtk_menu_item_new ();
+ break;
+ case SWT.RADIO:
+// handle = OS.gtk_radio_menu_item_new_with_label (0, buffer);
+// break;
+ case SWT.CHECK:
+ handle = OS.gtk_check_menu_item_new_with_label (buffer);
+ break;
+ case SWT.PUSH:
+ default:
+ handle = OS.gtk_menu_item_new_with_label (buffer);
+ break;
+ }
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+ if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
+ OS.gtk_check_menu_item_set_show_toggle (handle, true);
+ }
+ if ((parent.style & SWT.BAR) != 0) {
+ OS.gtk_menu_bar_insert (parent.handle, handle, index);
+ } else {
+ OS.gtk_menu_insert (parent.handle, handle, index);
+ }
+ OS.gtk_widget_show (handle);
+}
+/**
+ * Return the widget accelerator. An accelerator is the bit-wise
+ * OR of zero or more modifier masks and a key. Examples:
+ * <code>SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2</code>.
+ *
+ * @return the accelerator
+ *
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getAccelerator () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return accelerator;
+}
+public Display getDisplay () {
+ Menu parent = this.parent;
+ if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getDisplay ();
+}
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getEnabled () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return (widget.flags & OS.GTK_SENSITIVE) != 0;
+}
+/**
+ * Returns the receiver's cascade menu if it has one or null
+ * if it does not. Only <code>CASCADE</code> menu items can have
+ * a pull down menu. The sequence of key strokes, button presses
+ * and/or button releases that are used to request a pull down
+ * menu is platform specific.
+ *
+ * @return the receiver's menu
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Menu getMenu () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return menu;
+}
+/**
+ * Returns the receiver's parent, which must be a <code>Menu</code>.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Menu getParent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent;
+}
+/**
+ * Returns <code>true</code> if the receiver is selected,
+ * and false otherwise.
+ * <p>
+ * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
+ * it is selected when it is checked.
+ *
+ * @return the selection state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getSelection () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return false;
+ GtkCheckMenuItem menuItem = new GtkCheckMenuItem ();
+ OS.memmove (menuItem, handle, GtkCheckMenuItem.sizeof);
+ return menuItem.active != 0;
+}
+void hookEvents () {
+ super.hookEvents ();
+ Display display = getDisplay ();
+ int windowProc2 = display.windowProc2;
+ byte [] activate_event = Converter.wcsToMbcs (null, "activate", true);
+ OS.gtk_signal_connect (handle, activate_event, windowProc2, SWT.Selection);
+}
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isEnabled () {
+ return getEnabled ();
+}
+int processSelection (int int0, int int1, int int2) {
+ postEvent (SWT.Selection);
+ return 0;
+}
+void releaseChild () {
+ super.releaseChild ();
+ if (menu != null) menu.dispose ();
+ menu = null;
+}
+void releaseWidget () {
+ if (menu != null) {
+ menu.releaseWidget ();
+ menu.releaseHandle ();
+ }
+ menu = null;
+ super.releaseWidget ();
+ int accel_group = parent.getShell ().accelGroup;
+ removeAccelerator (accel_group);
+ accelerator = 0;
+ parent = null;
+}
+void removeAccelerator (int accel_group) {
+ if (accel_group == 0) return;
+ if (accelerator == 0) return;
+ int mask = 0;
+ if ((accelerator & SWT.CONTROL) != 0) mask |= OS.GDK_CONTROL_MASK;
+ if ((accelerator & SWT.ALT) != 0) mask |= OS.GDK_MOD1_MASK;
+ if ((accelerator & SWT.SHIFT) != 0) mask |= OS.GDK_SHIFT_MASK;
+ int keysym = accelerator & ~(SWT.ALT | SWT.SHIFT | SWT.CTRL);
+ int newKey = Display.untranslateKey (keysym);
+ if (newKey != 0) {
+ keysym = newKey;
+ } else {
+ keysym = wcsToMbcs ((char) keysym);
+ }
+ OS.gtk_widget_remove_accelerator (handle, accel_group, keysym, mask);
+ accelerator = 0;
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the arm events are generated for the control.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ArmListener
+ * @see #addArmListener
+ */
+public void removeArmListener (ArmListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Arm, listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the help events are generated for the control.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see HelpListener
+ * @see #addHelpListener
+ */
+public void removeHelpListener (HelpListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Help, listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is selected.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener (SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+/**
+ * Sets the widget accelerator. An accelerator is the bit-wise
+ * OR of zero or more modifier masks and a key. Examples:
+ * <code>SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2</code>.
+ *
+ * @param accelerator an integer that is the bit-wise OR of masks and a key
+ *
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setAccelerator (int accelerator) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int accel_group = parent.getShell ().accelGroup;
+ if (accelerator != 0) removeAccelerator (accel_group);
+ this.accelerator = accelerator;
+ if (accelerator != 0) addAccelerator (accel_group);
+}
+/**
+ * Enables the receiver if the argument is <code>true</code>,
+ * and disables it otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @param enabled the new enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setEnabled (boolean enabled) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_widget_set_sensitive (handle, enabled);
+}
+
+
+
+/**
+ * Sets the receiver's pull down menu to the argument.
+ * Only <code>CASCADE</code> menu items can have a
+ * pull down menu. The sequence of key strokes, button presses
+ * and/or button releases that are used to request a pull down
+ * menu is platform specific.
+ *
+ * @param menu the new pull down menu
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_MENU_NOT_DROP_DOWN - if the menu is not a drop down menu</li>
+ * <li>ERROR_MENUITEM_NOT_CASCADE - if the menu item is not a <code>CASCADE</code></li>
+ * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
+ * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMenu (Menu menu) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+
+ /* Check to make sure the new menu is valid */
+ if ((style & SWT.CASCADE) == 0) {
+ error (SWT.ERROR_MENUITEM_NOT_CASCADE);
+ }
+ if (menu != null) {
+ if ((menu.style & SWT.DROP_DOWN) == 0) {
+ error (SWT.ERROR_MENU_NOT_DROP_DOWN);
+ }
+ if (menu.parent != parent.parent) {
+ error (SWT.ERROR_INVALID_PARENT);
+ }
+ }
+
+ /* Assign the new menu */
+ Menu oldMenu = this.menu;
+ if (oldMenu == menu) return;
+ if (oldMenu != null) oldMenu.cascade = null;
+ if ((this.menu = menu) != null) {
+ menu.cascade = this;
+ int menuHandle = menu.handle;
+ OS.gtk_menu_item_set_submenu (handle, menuHandle);
+ } else {
+ OS.gtk_menu_item_remove_submenu (handle);
+ }
+
+
+}
+/**
+ * Sets the selection state of the receiver.
+ * <p>
+ * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
+ * it is selected when it is checked.
+ *
+ * @param selected the new selection state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (boolean selected) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return;
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_check_menu_item_set_active (handle, selected);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+public void setText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if ((style & SWT.SEPARATOR) != 0) return;
+ text = string;
+ if ((style & SWT.ARROW) != 0) return;
+ int length = string.length ();
+ int index = string.indexOf('\t');
+ if (index != -1) length = index;
+ char [] text = new char [length + 1];
+ char [] pattern = new char [length + 1];
+ string.getChars (0, length, text, 0);
+ int i = 0, j = 0;
+ while (i < length) {
+ pattern [j] = ' ';
+ if (text [i] == '&') {
+ i++;
+ if (i < length && text [i] != '&') {
+ pattern [j] = '_';
+ }
+ }
+ text [j++] = text [i++];
+ }
+ while (j < i) {
+ text [j] = pattern [j] = '\0';
+ j++;
+ }
+ int list = OS.gtk_container_children (handle);
+ int label = OS.g_list_nth_data (list, 0);
+ byte [] buffer1 = Converter.wcsToMbcs (null, text);
+ OS.gtk_label_set_text (label, buffer1);
+ byte [] buffer2 = Converter.wcsToMbcs (null, pattern);
+ OS.gtk_label_set_pattern (label, buffer2);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MessageBox.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MessageBox.java
new file mode 100644
index 0000000..d6542d4
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MessageBox.java
@@ -0,0 +1,232 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Instances of this class are used used to inform or warn the user.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>ICON_ERROR, ICON_INFORMATION, ICON_QUESTION, ICON_WARNING, ICON_WORKING</dd>
+ * <dd>OK, OK | CANCEL</dd>
+ * <dd>YES | NO, YES | NO | CANCEL</dd>
+ * <dd>RETRY | CANCEL</dd>
+ * <dd>ABORT | RETRY | IGNORE</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+public class MessageBox extends Dialog {
+
+ String message;
+
+ // Handles
+ int handle;
+ int label;
+ int buttonOK, buttonCANCEL, buttonYES, buttonNO, buttonABORT, buttonRETRY, buttonIGNORE;
+
+ // While open...
+ boolean isWaiting = false;
+ int result;
+
+/*
+ * === CONSTRUCTORS ===
+ */
+
+
+/**
+ * Constructs a new instance of this class given only its
+ * parent.
+ * <p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the dialog on the currently active
+ * display if there is one. If there is no current display, the
+ * dialog is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public MessageBox (Shell parent) {
+ this (parent, SWT.OK | SWT.ICON_INFORMATION | SWT.APPLICATION_MODAL);
+}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT dialog classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the dialog on the currently active
+ * display if there is one. If there is no current display, the
+ * dialog is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public MessageBox (Shell parent, int style) {
+ super(parent, checkStyle(style));
+ createHandle();
+}
+
+
+
+/*
+ * === GET/SET MESSAGE; OPEN ===
+ */
+
+/**
+ * Returns the dialog's message, which is a description of
+ * the purpose for which it was opened. This message will be
+ * visible on the dialog while it is open.
+ *
+ * @return the message
+ */
+public String getMessage () {
+ return message;
+}
+
+/**
+ * Sets the dialog's message, which is a description of
+ * the purpose for which it was opened. This message will be
+ * visible on the dialog while it is open.
+ *
+ * @param string the message
+ */
+public void setMessage (String string) {
+ message = string;
+}
+
+/**
+ * Makes the dialog visible and brings it to the front
+ * of the display.
+ *
+ * @return the ID of the button that was selected to dismiss the
+ * message box (e.g. SWT.OK, SWT.CANCEL, etc...)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
+ * </ul>
+ */
+public int open () {
+ OS.gtk_widget_show (handle);
+
+// FIXME - WAIT FOR CLICK
+// There is a fundamental problem here.
+// We can't receive the clicked signal from the buttons, because by the API shape,
+// we are not a widget.
+
+ OS.gtk_widget_hide(handle);
+ return SWT.OK;
+}
+
+/*
+ * === HANDLE DANCES ===
+ */
+
+private void createHandle() {
+ handle = OS.gtk_dialog_new();
+ byte[] bytes = Converter.wcsToMbcs (null, getText(), true);
+
+ label = OS.gtk_label_new (bytes);
+ GtkDialog dialog = new GtkDialog();
+ OS.memmove (dialog, handle, GtkDialog.sizeof);
+ OS.gtk_box_pack_start (dialog.vbox, label, true, true, 5);
+ OS.gtk_widget_show (label);
+
+ if ((style & SWT.OK) != 0) buttonOK = createButton("OK");
+ if ((style & SWT.CANCEL) != 0) buttonCANCEL = createButton("CANCEL");
+
+ if ((style & SWT.YES) != 0) buttonYES = createButton("YES");
+ if ((style & SWT.NO) != 0) buttonNO = createButton("NO");
+
+ if ((style & SWT.ABORT) != 0) buttonABORT = createButton("ABORT");
+ if ((style & SWT.RETRY) != 0) buttonRETRY = createButton("RETRY");
+ if ((style & SWT.IGNORE) != 0) buttonIGNORE = createButton("IGNORE");
+}
+
+int createButton(String buttonName) {
+ byte[] bytes = Converter.wcsToMbcs (null, buttonName, true);
+ int h = OS.gtk_button_new_with_label(bytes);
+ GtkDialog dialog = new GtkDialog();
+ OS.memmove (dialog, handle, GtkDialog.sizeof);
+ OS.gtk_box_pack_start (dialog.action_area, h, true, true, 0);
+ signal_connect(h, "clicked", SWT.Selection, 2);
+// WidgetTable.put (h, this);
+ OS.gtk_widget_show (h);
+ return h;
+}
+
+int processEvent (int eventNumber, int int0, int int1, int int2) {
+ if (eventNumber == SWT.Selection) processSelection (int0, int1, int2);
+ return 0;
+}
+
+void processSelection (int int0, int int1, int int2) {
+}
+
+/*
+ * === AS YET UNCLASSIFIED ==
+ */
+
+private static int checkStyle (int style) {
+ int mask = (SWT.YES | SWT.NO | SWT.OK | SWT.CANCEL | SWT.ABORT | SWT.RETRY | SWT.IGNORE);
+ int bits = style & mask;
+ if (bits == SWT.OK || bits == SWT.CANCEL || bits == (SWT.OK | SWT.CANCEL)) return style;
+ if (bits == SWT.YES || bits == SWT.NO || bits == (SWT.YES | SWT.NO) || bits == (SWT.YES | SWT.NO | SWT.CANCEL)) return style;
+ if (bits == (SWT.RETRY | SWT.CANCEL) || bits == (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) return style;
+ style = (style & ~mask) | SWT.OK;
+ return style;
+}
+private void signal_connect (int handle, String eventName, int swtEvent, int numArgs) {
+ byte [] buffer = Converter.wcsToMbcs (null, eventName, true);
+ int proc=0;
+ switch (numArgs) {
+ case 2: proc=Display.getDefault().windowProc2; break;
+ case 3: proc=Display.getDefault().windowProc3; break;
+ case 4: proc=Display.getDefault().windowProc4; break;
+ case 5: proc=Display.getDefault().windowProc5; break;
+ default: error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ OS.gtk_signal_connect (handle, buffer, proc, swtEvent);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
new file mode 100644
index 0000000..b5b36ce
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
@@ -0,0 +1,215 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of the receiver represent is an unselectable
+ * user interface object that is used to display progress,
+ * typically in the form of a bar.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>SMOOTH, HORIZONTAL, VERTICAL</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+
+public class ProgressBar extends Control {
+ int min = 0, max = 100, value = 0;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public ProgressBar (Composite parent, int style) {
+ super (parent, checkStyle(style));
+}
+
+static int checkStyle (int style) {
+ return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+ handle = OS.gtk_progress_bar_new ();
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+ OS.gtk_progress_configure (handle, value, min, max);
+}
+
+void setHandleStyle() {
+ int orientation = (style & SWT.VERTICAL) != 0 ? OS.GTK_PROGRESS_TOP_TO_BOTTOM : OS.GTK_PROGRESS_LEFT_TO_RIGHT;
+ OS.gtk_progress_bar_set_orientation (handle, orientation);
+ int style = (this.style & SWT.SMOOTH) == 0 ? OS.GTK_PROGRESS_DISCRETE : OS.GTK_PROGRESS_CONTINUOUS;
+ OS.gtk_progress_bar_set_bar_style (handle, style);
+}
+
+void showHandle() {
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+/**
+ * Returns the maximum value which the receiver will allow.
+ *
+ * @return the maximum
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getMaximum () {
+ checkWidget ();
+ return max;
+}
+
+/**
+ * Returns the minimum value which the receiver will allow.
+ *
+ * @return the minimum
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getMinimum () {
+ checkWidget ();
+ return min;
+}
+
+/**
+ * Returns the single <em>selection</em> that is the receiver's position.
+ *
+ * @return the selection
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelection () {
+ checkWidget ();
+ return value;
+}
+
+/**
+ * Sets the maximum value which the receiver will allow
+ * to be the argument which must be greater than or
+ * equal to zero.
+ *
+ * @param value the new maximum (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMaximum (int maximum) {
+ checkWidget ();
+ if (maximum < 0) return;
+ max = maximum;
+ if (value > maximum) value = maximum;
+ OS.gtk_progress_configure (handle, value, min, max);
+ /*
+ * Feature in GTK. The progress bar does
+ * not redraw right away when a value is
+ * changed. This is not strictly incorrect
+ * but unexpected. The fix is to force all
+ * outstanding redraws to be delivered.
+ */
+ update ();
+}
+
+/**
+ * Sets the minimum value which the receiver will allow
+ * to be the argument which must be greater than or
+ * equal to zero.
+ *
+ * @param value the new minimum (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMinimum (int minimum) {
+ checkWidget ();
+ if (minimum < 0) return;
+ if (value < minimum) value = minimum;
+ min = minimum;
+ OS.gtk_progress_configure (handle, value, min, max);
+ /*
+ * Feature in GTK. The progress bar does
+ * not redraw right away when a value is
+ * changed. This is not strictly incorrect
+ * but unexpected. The fix is to force all
+ * outstanding redraws to be delivered.
+ */
+ update ();
+}
+
+/**
+ * Sets the single <em>selection</em> that is the receiver's
+ * position to the argument which must be greater than or equal
+ * to zero.
+ *
+ * @param value the new selection (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (int x) {
+ checkWidget ();
+ if (x < 0) return;
+ value = x;
+ OS.gtk_progress_configure (handle, value, min, max);
+ /*
+ * Feature in GTK. The progress bar does
+ * not redraw right away when a value is
+ * changed. This is not strictly incorrect
+ * but unexpected. The fix is to force all
+ * outstanding redraws to be delivered.
+ */
+ update ();
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
new file mode 100644
index 0000000..cad77f4
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
@@ -0,0 +1,333 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of the receiver represent a selectable user interface object
+ * that allows the user to drag a rubber banded outline of the sash within
+ * the parent control.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd> HORIZONTAL, VERTICAL</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+public class Sash extends Control {
+ boolean dragging, drawing;
+ int startX, startY, lastX, lastY, drawX, drawY;
+ int start_root_x, start_root_y;
+ int last_root_x, last_root_y;
+ int cursor;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Sash (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+ handle=OS.gtk_drawing_area_new();
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void setHandleStyle() {}
+
+void showHandle() {
+ createCursor();
+ OS.gtk_widget_show(handle);
+ OS.gtk_widget_realize(handle);
+}
+
+private void createCursor() {
+ int cursorType = ((style&SWT.VERTICAL)!=0)?
+ OS.GDK_SB_H_DOUBLE_ARROW:OS.GDK_SB_V_DOUBLE_ARROW;
+ cursor = OS.gdk_cursor_new(cursorType);
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove(widget, handle, GtkWidget.sizeof);
+ OS.gdk_window_set_cursor(widget.window, cursor);
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ int border = getBorderWidth ();
+ int width = border * 2, height = border * 2;
+ if ((style & SWT.HORIZONTAL) != 0) {
+ width += DEFAULT_WIDTH; height += 3;
+ } else {
+ width += 3; height += DEFAULT_HEIGHT;
+ }
+ if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
+ if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
+ return new Point (width, height);
+}
+
+
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control is selected, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * When <code>widgetSelected</code> is called, the x, y, width, and height fields of the event object are valid.
+ * If the reciever is being dragged, the event object detail field contains the value <code>SWT.DRAG</code>.
+ * <code>widgetDefaultSelected</code> is not called.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener (SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.MouseDoubleClick,typedListener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is selected.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener(SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.MouseDoubleClick,listener);
+}
+
+int processMouseDown (int callData, int arg1, int int2) {
+ OS.gtk_grab_add(handle);
+ dragging = true;
+ GdkEventButton gdkEvent = new GdkEventButton ();
+ OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
+ if (gdkEvent.button != 1) return 0;
+ startX = (int)gdkEvent.x; startY = (int)gdkEvent.y;
+ start_root_x=(int)gdkEvent.x_root; start_root_y=(int)gdkEvent.y_root;
+ drawX=startX; drawY=startY;
+ GtkWidget gtkwidget = new GtkWidget();
+ OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
+ int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
+ lastX = gtkwidget.alloc_x - border; lastY = gtkwidget.alloc_y - border;
+ Event event = new Event ();
+ event.detail = SWT.DRAG;
+ event.time = gdkEvent.time;
+ event.x = lastX; event.y = lastY;
+ event.width = width; event.height = height;
+ sendEvent (SWT.MouseDown, event);
+ return 0;
+}
+
+int processMouseMove (int callData, int arg1, int int2) {
+ GdkEventMotion gdkEvent = new GdkEventMotion ();
+ OS.memmove (gdkEvent, callData, GdkEventMotion.sizeof);
+ if (!dragging) return 0;
+ GtkWidget gtkwidget = new GtkWidget();
+ OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
+ int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
+ int x = gtkwidget.alloc_x - border, y = gtkwidget.alloc_y - border;
+ Rectangle rect = parent.getClientArea();
+ int parentWidth = rect.width - 2;
+ int parentHeight = rect.height - 2;
+ last_root_x=(int)gdkEvent.x_root; last_root_y=(int)gdkEvent.y_root;
+ int newX = lastX, newY = lastY;
+ if ((style & SWT.VERTICAL) != 0) {
+ if (last_root_x<=start_root_x)
+ newX = Math.min (Math.max (0, x - (start_root_x-last_root_x) - startX ), parentWidth - width);
+ else
+ newX = Math.min (Math.max (0, x + (last_root_x-start_root_x) - startX ), parentWidth - width);
+ } else {
+ if (last_root_y<=start_root_y)
+ newY = Math.min (Math.max (0, y - (start_root_y-last_root_y) - startY ), parentHeight - height);
+ else
+ newY = Math.min (Math.max (0, y + (last_root_y-start_root_y) - startY ), parentHeight - height);
+ }
+ if ((newX == lastX) && (newY == lastY)) return 0;
+ drawBand(newX, newY, width, height);
+ return 0;
+}
+int processMouseUp (int callData, int arg1, int int2) {
+ GdkEventButton gdkEvent = new GdkEventButton ();
+ OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
+ if (gdkEvent.button != 1) return 0;
+ if (!dragging) return 0;
+ GtkWidget gtkwidget = new GtkWidget();
+ OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
+ int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
+ int x = gtkwidget.alloc_x - border, y = gtkwidget.alloc_y - border;
+ Rectangle rect = parent.getClientArea();
+ int parentWidth = rect.width - 2;
+ int parentHeight = rect.height - 2;
+ last_root_x=(int)gdkEvent.x_root; last_root_y=(int)gdkEvent.y_root;
+ int newX = lastX, newY = lastY;
+ if ((style & SWT.VERTICAL) != 0) {
+ if (last_root_x<=start_root_x)
+ newX = Math.min (Math.max (0, x - (start_root_x-last_root_x) - startX ), parentWidth - width);
+ else
+ newX = Math.min (Math.max (0, x + (last_root_x-start_root_x) - startX ), parentWidth - width);
+ } else {
+ if (last_root_y<=start_root_y)
+ newY = Math.min (Math.max (0, y - (start_root_y-last_root_y) - startY ), parentHeight - height);
+ else
+ newY = Math.min (Math.max (0, y + (last_root_y-start_root_y) - startY ), parentHeight - height);
+ }
+ if ((newX == lastX) && (newY == lastY)) return 0;
+
+ Event event = new Event ();
+ event.time = gdkEvent.time;
+ event.x = newX; event.y = newY;
+ event.width = width; event.height = height;
+ dragging = false;
+ drawBand(newX, newY, width, height);
+ drawing = false;
+ OS.gtk_grab_remove(handle);
+ sendEvent (SWT.Selection, event);
+ return 0;
+}
+/*
+int processMouseEnter (int callData, int arg1, int int2) {
+ GdkEventMotion gdkEvent = new GdkEventMotion ();
+ OS.memmove (gdkEvent, callData, GdkEventMotion.sizeof);
+ GtkWidget gtkwidget = new GtkWidget();
+ OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
+ int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
+ lastX = gtkwidget.alloc_x - border; lastY = gtkwidget.alloc_y - border;
+ Event event = new Event ();
+ event.time = gdkEvent.time;
+ event.detail = SWT.DRAG;
+ event.x = lastX; event.y = lastY;
+ event.width = width; event.height = height;
+ Cursor arrowCursor;
+ if ((style & SWT.HORIZONTAL) != 0) {
+ arrowCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_SIZENS);
+ } else {
+ arrowCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_SIZEWE);
+ }
+ setCursor(arrowCursor);
+ sendEvent (SWT.Selection, event);
+ return 0;
+}
+*/
+int processMouseExit (int callData, int arg1, int int2) {
+ GdkEventMotion gdkEvent = new GdkEventMotion ();
+ OS.memmove (gdkEvent, callData, GdkEventMotion.sizeof);
+ GtkWidget gtkwidget = new GtkWidget();
+ OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
+ int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
+ Event event = new Event ();
+ event.time = gdkEvent.time;
+ event.x = lastX; event.y = lastY;
+ event.width = width; event.height = height;
+ sendEvent (SWT.MouseExit, event);
+ return 0;
+
+}
+
+void drawBand (int x, int y, int width, int height) {
+ if (x == drawX && y == drawY) return;
+ Display display= parent.getDisplay ();
+ if (display == null) return;
+ GtkWidget gtkwidget = new GtkWidget();
+ OS.memmove(gtkwidget, parent.topHandle(), GtkWidget.sizeof);
+ int window = gtkwidget.window;
+ if (window == 0) return;
+ byte [] bits = {-86, 0, 85, 0, -86, 0, 85, 0, -86, 0, 85, 0, -86, 0, 85, 0};
+ int stipplePixmap = OS.gdk_bitmap_create_from_data (window, bits, 8, 8);
+ int gc = OS.gdk_gc_new(window);
+ Color color = new Color(display, 0xFF, 0, 0);
+ OS.gdk_gc_set_background(gc, color.handle);
+ Color color1 = new Color(display, 0, 0xFF, 0);
+ OS.gdk_gc_set_foreground(gc, color1.handle);
+ OS.gdk_gc_set_stipple(gc, stipplePixmap);
+ OS.gdk_gc_set_subwindow(gc, OS.GDK_INCLUDE_INFERIORS);
+ OS.gdk_gc_set_fill(gc, OS.GDK_STIPPLED);
+ OS.gdk_gc_set_function(gc, OS.GDK_XOR);
+
+ if (drawing)
+ OS.gdk_draw_rectangle(window, gc, 1, drawX, drawY, width, height);
+ else
+ drawing = true;
+ drawX=x;drawY=y;
+ OS.gdk_draw_rectangle(window, gc, 1, x, y, width, height);
+ OS.gdk_bitmap_unref(stipplePixmap);
+ OS.gdk_gc_destroy(gc);
+}
+static int checkStyle (int style) {
+ return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
+}
+
+void releaseWidget () {
+ super.releaseWidget ();
+ OS.gdk_cursor_destroy (cursor);
+ cursor = 0;
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java
new file mode 100644
index 0000000..0f56d44
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java
@@ -0,0 +1,380 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of the receiver represent a selectable user
+ * interface object that present a range of continuous
+ * numeric values.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd> HORIZONTAL, VERTICAL</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+
+public class Scale extends Control {
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Scale (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's value changes, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ */
+public void addSelectionListener (SelectionListener listener) {
+ checkWidget ();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+
+static int checkStyle (int style) {
+ return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+ int hAdjustment = OS.gtk_adjustment_new (0, 0, 100, 1, 10, 0);
+ if (hAdjustment == 0) error (SWT.ERROR_NO_HANDLES);
+ if ((style & SWT.HORIZONTAL) != 0) {
+ handle = OS.gtk_hscale_new (hAdjustment);
+ } else {
+ handle = OS.gtk_vscale_new (hAdjustment);
+ }
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void setHandleStyle() {
+ OS.gtk_scale_set_digits (handle, 0);
+ OS.gtk_scale_set_draw_value (handle, false);
+}
+
+void showHandle() {
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void hookEvents () {
+ super.hookEvents ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ signal_connect (hAdjustment, "value_changed", SWT.Selection, 2);
+}
+
+void register () {
+ super.register ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ WidgetTable.put (hAdjustment, this);
+}
+
+void deregister () {
+ super.deregister ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ WidgetTable.remove (hAdjustment);
+ /*
+ * This code is intentionally commented.
+ */
+// OS.gtk_object_unref (hAdjustment);
+// OS.gtk_object_destroy (hAdjustment);
+}
+
+/**
+ * Returns the amount that the receiver's value will be
+ * modified by when the up/down (or right/left) arrows
+ * are pressed.
+ *
+ * @return the increment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getIncrement () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.step_increment;
+}
+
+/**
+ * Returns the maximum value which the receiver will allow.
+ *
+ * @return the maximum
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getMaximum () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.upper;
+}
+
+/**
+ * Returns the minimum value which the receiver will allow.
+ *
+ * @return the minimum
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getMinimum () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.lower;
+}
+
+/**
+ * Returns the amount that the receiver's value will be
+ * modified by when the page increment/decrement areas
+ * are selected.
+ *
+ * @return the page increment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getPageIncrement () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.page_increment;
+}
+
+/**
+ * Returns the single <em>selection</em> that is the receiver's position.
+ *
+ * @return the selection
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelection () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.value;
+}
+
+int processSelection (int int0, int int1, int int2) {
+ postEvent (SWT.Selection);
+ return 0;
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's value changes.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener (SelectionListener listener) {
+ checkWidget ();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+
+/**
+ * Sets the amount that the receiver's value will be
+ * modified by when the up/down (or right/left) arrows
+ * are pressed to the argument, which must be at least
+ * one.
+ *
+ * @param value the new increment (must be greater than zero)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setIncrement (int value) {
+ checkWidget ();
+ if (value < 1) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.step_increment = (float) value;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+}
+
+/**
+ * Sets the maximum value which the receiver will allow
+ * to be the argument which must be greater than or
+ * equal to zero.
+ *
+ * @param value the new maximum (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMaximum (int value) {
+ checkWidget ();
+ if (value < 0) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.upper = (float) value;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+}
+
+/**
+ * Sets the minimum value which the receiver will allow
+ * to be the argument which must be greater than or
+ * equal to zero.
+ *
+ * @param value the new minimum (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMinimum (int value) {
+ checkWidget ();
+ if (value < 0) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.lower = (float) value;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+}
+/**
+ * Sets the amount that the receiver's value will be
+ * modified by when the page increment/decrement areas
+ * are selected to the argument, which must be at least
+ * one.
+ *
+ * @return the page increment (must be greater than zero)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setPageIncrement (int value) {
+ checkWidget ();
+ if (value < 1) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.page_increment = (float) value;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+}
+
+/**
+ * Sets the single <em>selection</em> that is the receiver's
+ * value to the argument which must be greater than or equal
+ * to zero.
+ *
+ * @param value the new selection (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (int value) {
+ checkWidget();
+ if (value < 0) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
+ OS.gtk_adjustment_set_value (hAdjustment, value);
+ OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java
new file mode 100644
index 0000000..14d7ba3
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java
@@ -0,0 +1,621 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class are selectable user interface
+ * objects that represent a range of positive, numeric values.
+ * <p>
+ * At any given moment, a given scroll bar will have a
+ * single <em>selection</em> that is considered to be its
+ * value, which is constrained to be within the range of
+ * values the scroll bar represents (that is, between its
+ * <em>minimum</em> and <em>maximum</em> values).
+ * </p><p>
+ * Typically, scroll bars will be made up of five areas:
+ * <ol>
+ * <li>an arrow button for decrementing the value</li>
+ * <li>a page decrement area for decrementing the value by a larger amount</li>
+ * <li>a <em>thumb</em> for modifying the value by mouse dragging</li>
+ * <li>a page increment area for incrementing the value by a larger amount</li>
+ * <li>an arrow button for incrementing the value</li>
+ * </ol>
+ * Based on their style, scroll bars are either <code>HORIZONTAL</code>
+ * (which have left and right facing buttons for incrementing and
+ * decrementing the value) or <code>VERTICAL</code> (which have
+ * up and down facing buttons for incrementing and decrementing
+ * the value).
+ * </p><p>
+ * On some platforms, the size of the scroll bar's thumb can be
+ * varied relative to the magnitude of the range of values it
+ * represents (that is, relative to the difference between its
+ * maximum and minimum values). Typically, this is used to
+ * indicate some proportional value such as the ratio of the
+ * visible area of a document to the total amount of space that
+ * it would take to display it. SWT supports setting the thumb
+ * size even if the underlying platform does not, but in this
+ * case the appearance of the scroll bar will not change.
+ * </p><p>
+ * Scroll bars are created by specifying either <code>H_SCROLL</code>,
+ * <code>V_SCROLL</code> or both when creating a <code>Scrollable</code>.
+ * They are accessed from the <code>Scrollable</code> using
+ * <code>getHorizontalBar</code> and <code>getVerticalBar</code>.
+ * </p><p>
+ * Note: Scroll bars are not Controls. On some platforms, scroll bars
+ * that appear as part of some standard controls such as a text or list
+ * have no operating system resources and are not children of the control.
+ * For this reason, scroll bars are treated specially. To create a control
+ * that looks like a scroll bar but has operating system resources, use
+ * <code>Slider</code>.
+ * </p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>HORIZONTAL, VERTICAL</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ *
+ * @see Slider
+ * @see Scrollable
+ * @see Scrollable#getHorizontalBar
+ * @see Scrollable#getVerticalBar
+ */
+
+public class ScrollBar extends Widget {
+ Scrollable parent;
+ScrollBar () {
+}
+/**
+* Creates a new instance of the widget.
+*/
+ScrollBar (Scrollable parent, int style) {
+ super (parent, checkStyle (style));
+ this.parent = parent;
+ createWidget (0);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's value changes, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * When <code>widgetSelected</code> is called, the event object detail field contains one of the following values:
+ * <code>0</code> - for the end of a drag.
+ * <code>SWT.DRAG</code>.
+ * <code>SWT.HOME</code>.
+ * <code>SWT.END</code>.
+ * <code>SWT.ARROW_DOWN</code>.
+ * <code>SWT.ARROW_UP</code>.
+ * <code>SWT.PAGE_DOWN</code>.
+ * <code>SWT.PAGE_UP</code>.
+ * <code>widgetDefaultSelected</code> is not called.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener (SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener(listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+static int checkStyle (int style) {
+ return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
+}
+public Display getDisplay () {
+ Scrollable parent = this.parent;
+ if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getDisplay ();
+}
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @return the enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getEnabled () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return true;
+}
+/**
+ * Returns the amount that the receiver's value will be
+ * modified by when the up/down (or right/left) arrows
+ * are pressed.
+ *
+ * @return the increment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getIncrement () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ return (int) adjustment.step_increment;
+}
+/**
+ * Returns the maximum value which the receiver will allow.
+ *
+ * @return the maximum
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getMaximum () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ return (int) adjustment.upper;
+}
+/**
+ * Returns the minimum value which the receiver will allow.
+ *
+ * @return the minimum
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getMinimum () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ return (int) adjustment.lower;
+}
+/**
+ * Returns the amount that the receiver's value will be
+ * modified by when the page increment/decrement areas
+ * are selected.
+ *
+ * @return the page increment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getPageIncrement () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ return (int) adjustment.page_increment;
+}
+/**
+ * Returns the receiver's parent, which must be scrollable.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Scrollable getParent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent;
+}
+/**
+ * Returns the single <em>selection</em> that is the receiver's value.
+ *
+ * @return the selection
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelection () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ return (int) adjustment.value;
+}
+/**
+ * For horizontal scroll bars, returns the height of the
+ * instance, and for vertical scroll bars, returns the width
+ * of the instance.
+ *
+ * @return the scroll bar size
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getSize () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return new Point (widget.alloc_width, widget.alloc_height);
+}
+/**
+ * Answers the size of the receiver's thumb relative to the
+ * difference between its maximum and minimum values.
+ *
+ * @return the thumb value
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ScrollBar
+ */
+public int getThumb () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ return (int) adjustment.page_size;
+}
+/**
+ * Returns <code>true</code> if the receiver is visible, and
+ * <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getVisible () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return true;
+}
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ * <p>
+ * Note: Because of the strong connection between a scroll bar
+ * and the widget which contains it (its parent), a scroll bar
+ * will not indicate that it is enabled if its parent is not.
+ * </p>
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isEnabled () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return getEnabled () && getParent ().getEnabled ();
+}
+/**
+ * Returns <code>true</code> if the receiver is visible, and
+ * <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isVisible () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return getVisible () && getParent ().isVisible ();
+}
+int processSelection (int int0, int int1, int int2) {
+ postEvent (SWT.Selection);
+ return 0;
+}
+void releaseChild () {
+ super.releaseChild ();
+ if (parent.horizontalBar == this) parent.horizontalBar = null;
+ if (parent.verticalBar == this) parent.verticalBar = null;
+}
+void releaseWidget () {
+ super.releaseWidget ();
+ parent = null;
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's value changes.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener (SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+/**
+ * Enables the receiver if the argument is <code>true</code>,
+ * and disables it otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @param enabled the new enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setEnabled (boolean enabled) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+/**
+ * Sets the amount that the receiver's value will be
+ * modified by when the up/down (or right/left) arrows
+ * are pressed to the argument, which must be at least
+ * one.
+ *
+ * @param value the new increment (must be greater than zero)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setIncrement (int value) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (value < 1) return;
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ adjustment.step_increment = (float) value;
+ OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (handle);
+}
+/**
+ * Sets the maximum value which the receiver will allow
+ * to be the argument which must be greater than or
+ * equal to zero.
+ *
+ * @param value the new maximum (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMaximum (int value) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (value < 0) return;
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ adjustment.upper = (float) value;
+ OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (handle);
+}
+/**
+ * Sets the minimum value which the receiver will allow
+ * to be the argument which must be greater than or
+ * equal to zero.
+ *
+ * @param value the new minimum (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMinimum (int value) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (value < 0) return;
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ adjustment.lower = (float) value;
+ OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (handle);
+}
+/**
+ * Sets the amount that the receiver's value will be
+ * modified by when the page increment/decrement areas
+ * are selected to the argument, which must be at least
+ * one.
+ *
+ * @return the page increment (must be greater than zero)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setPageIncrement (int value) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (value < 1) return;
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ adjustment.page_increment = (float) value;
+ OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (handle);
+}
+/**
+ * Sets the single <em>selection</em> that is the receiver's
+ * value to the argument which must be greater than or equal
+ * to zero.
+ *
+ * @param value the new selection (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (int value) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (value < 0) return;
+ OS.gtk_adjustment_set_value (handle, value);
+}
+/**
+ * Sets the size of the receiver's thumb relative to the
+ * difference between its maximum and minimum values to the
+ * argument which must be at least one.
+ *
+ * @param value the new thumb value (must be at least one)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ScrollBar
+ */
+public void setThumb (int value) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (value < 1) return;
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ adjustment.page_size = (float) value;
+ OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (handle);
+}
+
+/**
+ * Sets the receiver's selection, minimum value, maximum
+ * value, thumb, increment and page increment all at once.
+ * <p>
+ * Note: This is equivalent to setting the values individually
+ * using the appropriate methods, but may be implemented in a
+ * more efficient fashion on some platforms.
+ * </p>
+ *
+ * @param selection the new selection value
+ * @param minimum the new minimum value
+ * @param maximum the new maximum value
+ * @param thumb the new thumb value
+ * @param increment the new increment value
+ * @param pageIncrement the new pageIncrement value
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setValues (int selection, int minimum, int maximum, int thumb, int increment, int pageIncrement) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (selection < 0) return;
+ if (minimum < 0) return;
+ if (maximum < 0) return;
+ if (thumb < 1) return;
+ if (maximum - minimum - thumb < 0) return;
+ if (increment < 1) return;
+ if (pageIncrement < 1) return;
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ adjustment.lower = minimum;
+ adjustment.upper = maximum;
+ adjustment.step_increment = increment;
+ adjustment.page_increment = pageIncrement;
+ adjustment.page_size = thumb;
+ adjustment.value = selection;
+ OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (handle);
+ OS.gtk_adjustment_value_changed (handle);
+// error(SWT.ERROR_NOT_IMPLEMENTED);
+}
+
+/**
+ * Marks the receiver as visible if the argument is <code>true</code>,
+ * and marks it invisible otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, marking
+ * it visible may not actually cause it to be displayed.
+ * </p>
+ *
+ * @param visible the new visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setVisible (boolean visible) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+
+void hookEvents () {
+ signal_connect(handle, "value_changed", SWT.Selection, 2);
+// signal_connect(handle, "changed", SWT.Selection, 2);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
new file mode 100644
index 0000000..a2405fc
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
@@ -0,0 +1,239 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * This class is the abstract superclass of all classes which
+ * represent controls that have standard scroll bars.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>H_SCROLL, V_SCROLL</dd>
+ * <dt><b>Events:</b>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+
+public abstract class Scrollable extends Control {
+
+ int scrolledHandle;
+ ScrollBar horizontalBar, verticalBar;
+ static Trim trim;
+
+/**
+ * Prevents uninitialized instances from being created outside the package.
+ */
+Scrollable () {}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Scrollable (Composite parent, int style) {
+ super (parent, style);
+}
+
+/**
+ * Given a desired <em>client area</em> for the receiver
+ * (as described by the arguments), returns the bounding
+ * rectangle which would be required to produce that client
+ * area.
+ * <p>
+ * In other words, it returns a rectangle such that, if the
+ * receiver's bounds were set to that rectangle, the area
+ * of the receiver which is capable of displaying data
+ * (that is, not covered by the "trimmings") would be the
+ * rectangle described by the arguments (relative to the
+ * receiver's parent).
+ * </p>
+ *
+ * @return the required bounds to produce the given client area
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #getClientArea
+ */
+public Rectangle computeTrim (int x, int y, int width, int height) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+
+ Trim t = _getTrim();
+ return new Rectangle (x-t.left, y-t.top, width+t.left+t.right, height+t.top+t.bottom);
+}
+
+Trim _getTrim() {
+ if (trim==null) initializeTrim();
+ return trim;
+}
+
+void initializeTrim() { trim = new Trim(); }
+
+void _fillBin(int binHandle, int childHandle) {
+ GtkBin bin = new GtkBin();
+ OS.memmove(bin, binHandle, GtkBin.sizeof);
+ bin.child = childHandle;
+ OS.memmove(binHandle, bin, GtkBin.sizeof);
+ OS.gtk_widget_set_parent(childHandle, binHandle);
+}
+
+/*
+ * Subclasses must only use super.configure()
+ * to connect their topHandle to the parent.
+ * It is the responsibility of the conrete subclass
+ * to configure the scrolled handles.
+ */
+abstract void configure ();
+
+ScrollBar createScrollBar (int style) {
+ if (scrolledHandle == 0) return null;
+ ScrollBar bar = new ScrollBar ();
+ bar.parent = this;
+ bar.style = style;
+ bar.state |= HANDLE;
+ if ((style & SWT.H_SCROLL) != 0) {
+ bar.handle = OS.gtk_scrolled_window_get_hadjustment (scrolledHandle);
+ } else {
+ bar.handle = OS.gtk_scrolled_window_get_vadjustment (scrolledHandle);
+ }
+ bar.hookEvents ();
+ bar.register ();
+ return bar;
+}
+void createWidget (int index) {
+ super.createWidget (index);
+ if ((style & SWT.H_SCROLL) != 0) horizontalBar = createScrollBar (SWT.H_SCROLL);
+ if ((style & SWT.V_SCROLL) != 0) verticalBar = createScrollBar (SWT.V_SCROLL);
+}
+void deregister () {
+ super.deregister ();
+ if (scrolledHandle != 0) {
+ WidgetTable.remove (scrolledHandle);
+ }
+}
+/**
+ * Returns a rectangle which describes the area of the
+ * receiver which is capable of displaying data (that is,
+ * not covered by the "trimmings").
+ *
+ * @return the client area
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #computeTrim
+ */
+public Rectangle getClientArea () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return new Rectangle (0, 0, widget.alloc_width, widget.alloc_height);
+}
+/**
+ * Returns the receiver's horizontal scroll bar if it has
+ * one, and null if it does not.
+ *
+ * @return the horizontal scroll bar (or null)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public ScrollBar getHorizontalBar () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return horizontalBar;
+}
+/**
+ * Returns the receiver's vertical scroll bar if it has
+ * one, and null if it does not.
+ *
+ * @return the vertical scroll bar (or null)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public ScrollBar getVerticalBar () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return verticalBar;
+}
+
+void setScrollingPolicy() {
+ if (scrolledHandle==0) return;
+ int hsp = ((style&SWT.H_SCROLL)==0)? OS.GTK_POLICY_NEVER : OS.GTK_POLICY_ALWAYS;
+ int vsp = ((style&SWT.V_SCROLL)==0)? OS.GTK_POLICY_NEVER : OS.GTK_POLICY_ALWAYS;
+ OS.gtk_scrolled_window_set_policy(scrolledHandle, hsp,vsp);
+}
+
+void register () {
+ super.register ();
+ if (scrolledHandle != 0) {
+ WidgetTable.put (scrolledHandle, this);
+ }
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ scrolledHandle = 0;
+}
+
+void releaseWidget () {
+ if (horizontalBar != null) {
+ horizontalBar.releaseWidget ();
+ horizontalBar.releaseHandle ();
+ }
+ if (verticalBar != null) {
+ verticalBar.releaseWidget ();
+ verticalBar.releaseHandle ();
+ }
+ horizontalBar = verticalBar = null;
+ super.releaseWidget ();
+}
+int topHandle () {
+ if (scrolledHandle != 0) return scrolledHandle;
+ return handle;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
new file mode 100644
index 0000000..3d1b310
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
@@ -0,0 +1,818 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class represent the "windows"
+ * which the desktop or "window manager" is managing.
+ * Instances which do not have a parent (that is, they
+ * are built using the constructor which takes a
+ * <code>Display</code> as the argument) are described
+ * as <em>top level</em> shells. Instances which do have
+ * a parent, are described as <em>secondary</em> or
+ * <em>dialog</em> shells.
+ * <p>
+ * Instances are always displayed in one of the maximized,
+ * minimized or normal states:
+ * <ul>
+ * <li>
+ * When an instance is marked as <em>maximized</em>, the
+ * window manager will typically resize it to fill the
+ * entire visible area of the display, and the instance
+ * is usually put in a state where it can not be resized
+ * (even if it has style <code>RESIZE</code>) until it is
+ * no longer maximized.
+ * </li><li>
+ * When an instance is in the <em>normal</em> state (neither
+ * maximized or minimized), its appearance is controlled by
+ * the style constants which were specified when it was created
+ * and the restrictions of the window manager (see below).
+ * </li><li>
+ * When an instance has been marked as <em>minimized</em>,
+ * its contents (client area) will usually not be visible,
+ * and depending on the window manager, it may be
+ * "iconified" (that is, replaced on the desktop by a small
+ * simplified representation of itself), relocated to a
+ * distinguished area of the screen, or hidden. Combinations
+ * of these changes are also possible.
+ * </li>
+ * </ul>
+ * </p>
+ * Note: The styles supported by this class must be treated
+ * as <em>HINT</em>s, since the window manager for the
+ * desktop on which the instance is visible has ultimate
+ * control over the appearance and behavior of decorations.
+ * For example, some window managers only support resizable
+ * windows and will always assume the RESIZE style, even if
+ * it is not set.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Activate, Close, Deactivate, Deiconify, Iconify</dd>
+ * </dl>
+ * Class <code>SWT</code> provides two "convenience constants"
+ * for the most commonly required style combinations:
+ * <dl>
+ * <dt><code>SHELL_TRIM</code></dt>
+ * <dd>
+ * the result of combining the constants which are required
+ * to produce a typical application top level shell: (that
+ * is, <code>CLOSE | TITLE | MIN | MAX | RESIZE</code>)
+ * </dd>
+ * <dt><code>DIALOG_TRIM</code></dt>
+ * <dd>
+ * the result of combining the constants which are required
+ * to produce a typical application dialog shell: (that
+ * is, <code>TITLE | CLOSE | BORDER</code>)
+ * </dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is not intended to be subclassed.
+ * </p>
+ *
+ * @see Decorations
+ * @see SWT
+ */
+
+public class Shell extends Decorations {
+ Display display;
+ int shellHandle, vboxHandle, eventBoxHandle;
+ int modal;
+ int accelGroup;
+ Rectangle lastClientArea;
+ boolean hasFocus=false;
+/**
+ * Constructs a new instance of this class. This is equivalent
+ * to calling <code>Shell((Display) null)</code>.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public Shell () {
+ this ((Display) null);
+}
+/**
+ * Constructs a new instance of this class given only the style
+ * value describing its behavior and appearance. This is equivalent
+ * to calling <code>Shell((Display) null, style)</code>.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param style the style of control to construct
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public Shell (int style) {
+ this ((Display) null, style);
+}
+
+/**
+ * Constructs a new instance of this class given only the display
+ * to create it on. It is created with style <code>SWT.SHELL_TRIM</code>.
+ * <p>
+ * Note: Currently, null can be passed in for the display argument.
+ * This has the effect of creating the shell on the currently active
+ * display if there is one. If there is no current display, the
+ * shell is created on a "default" display. <b>Passing in null as
+ * the display argument is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param display the display to create the shell on
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public Shell (Display display) {
+ this (display, SWT.SHELL_TRIM);
+}
+/**
+ * Constructs a new instance of this class given the display
+ * to create it on and a style value describing its behavior
+ * and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p><p>
+ * Note: Currently, null can be passed in for the display argument.
+ * This has the effect of creating the shell on the currently active
+ * display if there is one. If there is no current display, the
+ * shell is created on a "default" display. <b>Passing in null as
+ * the display argument is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param display the display to create the shell on
+ * @param style the style of control to construct
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public Shell (Display display, int style) {
+ this (display, null, style);
+}
+Shell (Display display, Shell parent, int style) {
+ super ();
+ if (display == null) display = Display.getCurrent ();
+ if (display == null) display = Display.getDefault ();
+ if (!display.isValidThread ()) {
+ error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ }
+ this.display = display;
+ this.style = checkStyle (style);
+ createWidget (0);
+}
+/**
+ * Constructs a new instance of this class given only its
+ * parent. It is created with style <code>SWT.DIALOG_TRIM</code>.
+ * <p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the shell on the currently active
+ * display if there is one. If there is no current display, the
+ * shell is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public Shell (Shell parent) {
+ this (parent, SWT.TITLE | SWT.CLOSE | SWT.BORDER);
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p><p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the shell on the currently active
+ * display if there is one. If there is no current display, the
+ * shell is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ * @param style the style of control to construct
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public Shell (Shell parent, int style) {
+ this (null, parent, style);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when operations are performed on the receiver,
+ * by sending the listener one of the messages defined in the
+ * <code>ShellListener</code> interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ShellListener
+ * @see #removeShellListener
+ */
+public void addShellListener (ShellListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Close,typedListener);
+ addListener (SWT.Iconify,typedListener);
+ addListener (SWT.Deiconify,typedListener);
+ addListener (SWT.Activate, typedListener);
+ addListener (SWT.Deactivate, typedListener);
+}
+void bringToTop () {
+// OS.gtk_window_activate_focus (shellHandle);
+}
+/**
+ * Requests that the window manager close the receiver in
+ * the same way it would be closed when the user clicks on
+ * the "close box" or performs some other platform specific
+ * key or mouse combination that indicates the window
+ * should be removed.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void close () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ closeWidget ();
+}
+void closeWidget () {
+ Event event = new Event ();
+ event.time = OS.gdk_time_get ();
+ sendEvent (SWT.Close, event);
+ if (event.doit && !isDisposed ()) dispose ();
+}
+
+
+/*
+ * HANDLE DANCES
+ *
+ * FIRST SPECIES: HANDLE CREATION CODE - The createWidget() cycle.
+ */
+
+void createHandle (int index) {
+ state |= HANDLE;
+ shellHandle = OS.gtk_window_new((parent==null)? OS.GTK_WINDOW_TOPLEVEL:OS.GTK_WINDOW_DIALOG);
+ if (shellHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+ vboxHandle = OS.gtk_vbox_new(false,0);
+ if (vboxHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+ eventBoxHandle = OS.gtk_event_box_new ();
+ if (eventBoxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ fixedHandle = OS.gtk_fixed_new ();
+ if (fixedHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+ handle = OS.gtk_drawing_area_new();
+ if (handle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+ accelGroup = OS.gtk_accel_group_new ();
+ OS.gtk_window_add_accel_group (shellHandle, accelGroup);
+ OS.gtk_window_set_title (shellHandle, new byte [1]);
+}
+
+void configure () {
+ OS.gtk_container_add (shellHandle, vboxHandle);
+ OS.gtk_box_pack_end(vboxHandle, eventBoxHandle, true,true,0);
+ OS.gtk_container_add (eventBoxHandle, fixedHandle);
+ OS.gtk_fixed_put(fixedHandle, handle, (short)0,(short)0);
+}
+
+void showHandle() {
+ OS.gtk_widget_realize (shellHandle); // careful: NOT show
+ _setStyle();
+
+ OS.gtk_widget_realize (vboxHandle);
+ OS.gtk_widget_show_now (vboxHandle);
+
+ OS.gtk_widget_realize (eventBoxHandle);
+ OS.gtk_widget_show_now (eventBoxHandle);
+
+ OS.gtk_widget_realize (fixedHandle);
+ OS.gtk_widget_show_now (fixedHandle);
+
+ OS.gtk_widget_realize (handle);
+ OS.gtk_widget_show_now (handle);
+}
+
+void hookEvents () {
+ super.hookEvents ();
+ signal_connect(shellHandle, "map_event", SWT.Deiconify, 3);
+ signal_connect(shellHandle, "unmap_event", SWT.Iconify, 3);
+ signal_connect(shellHandle, "size_allocate", SWT.Resize, 3);
+ signal_connect(shellHandle, "delete_event", SWT.Dispose, 3);
+}
+
+void register () {
+ super.register ();
+ WidgetTable.put (shellHandle, this);
+ WidgetTable.put (vboxHandle, this);
+ WidgetTable.put (eventBoxHandle, this);
+}
+
+private void _setStyle() {
+ int decorations = 0;
+ if ((style & SWT.NO_TRIM) == 0) {
+ if ((style & SWT.MIN) != 0) decorations |= OS.GDK_DECOR_MINIMIZE;
+ if ((style & SWT.MAX) != 0) decorations |= OS.GDK_DECOR_MAXIMIZE;
+ if ((style & SWT.RESIZE) != 0) decorations |= OS.GDK_DECOR_RESIZEH;
+ if ((style & SWT.BORDER) != 0) decorations |= OS.GDK_DECOR_BORDER;
+ if ((style & SWT.MENU) != 0) decorations |= OS.GDK_DECOR_MENU;
+ if ((style & SWT.TITLE) != 0) decorations |= OS.GDK_DECOR_TITLE;
+ /*
+ * Under some Window Managers (Sawmill), in order
+ * to get any border at all from the window manager it is necessary
+ * to set GDK_DECOR_BORDER. The fix is to force these bits when any
+ * kind of border is requested.
+ */
+ if ((style & SWT.RESIZE) != 0) decorations |= OS.GDK_DECOR_BORDER;
+ }
+ GtkWidget widget = new GtkWidget();
+ OS.memmove(widget, shellHandle, GtkWidget.sizeof);
+ int w = widget.window;
+ // PANIC - this must absolutely never happen, so it's not NO_HANDLES actually
+ if (w == 0) error(SWT.ERROR_NO_HANDLES);
+ OS.gdk_window_set_decorations(w, decorations);
+}
+
+void _connectChild (int h) {
+ OS.gtk_fixed_put (fixedHandle, h, (short)0, (short)0);
+}
+
+int topHandle () {
+ return shellHandle;
+}
+
+int parentingHandle() {
+ return fixedHandle;
+}
+
+boolean isMyHandle(int h) {
+ if (h == shellHandle) return true;
+ if (h == vboxHandle) return true;
+ if (h == eventBoxHandle) return true;
+ if (h == fixedHandle) return true;
+ if (h == handle) return true;
+ return false;
+}
+
+
+/*
+ * === GEOMETRY ===
+ */
+
+public Point _getLocation() {
+ GtkWidget widget = new GtkWidget();
+ OS.memmove (widget, shellHandle, GtkWidget.sizeof);
+ int [] x = new int [1], y = new int [1];
+ OS.gdk_window_get_origin(widget.window, x,y);
+ return new Point(x[0], y[0]);
+}
+
+public Rectangle _getClientArea () {
+ Point clientSize = UtilFuncs.getSize(eventBoxHandle);
+ return new Rectangle (0, 0, clientSize.x, clientSize.y);
+}
+
+boolean _setSize(int width, int height) {
+ boolean differentExtent = UtilFuncs.setSize(shellHandle, width,height);
+ Point clientSize = UtilFuncs.getSize(eventBoxHandle);
+ UtilFuncs.setSize(fixedHandle, clientSize.x, clientSize.y);
+ UtilFuncs.setSize(handle, clientSize.x, clientSize.y);
+ return differentExtent;
+}
+
+// Unreliable
+boolean _setLocation (int x, int y) {
+ OS.gtk_widget_set_uposition (shellHandle, x, y);
+ return true;
+}
+
+void setInitialSize() {
+ int width = OS.gdk_screen_width () * 5 / 8;
+ int height = OS.gdk_screen_height () * 5 / 8;
+ _setSize(width, height);
+ OS.gtk_window_set_policy (shellHandle, 1,1,0);
+}
+
+public Display getDisplay () {
+ if (display == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return display;
+}
+
+/*
+ * Return the control inside this shell that has the focus,
+ * if there is one. Return <code>null</code> if there is no
+ * such control - e.g., this shell is not active, or it is active
+ * but the user clicked in a no-entry widget (like Label).
+ */
+Control getFocusControl() {
+ GtkWindow shell = new GtkWindow();
+ OS.memmove(shell, shellHandle, GtkWindow.sizeof);
+ int focusHandle = shell.focus_widget;
+ if (focusHandle==0) return null;
+ return (Control)this.getDisplay().findWidget(focusHandle);
+}
+
+/**
+ * Returns the receiver's input method editor mode. This
+ * will be the result of bitwise OR'ing together one or
+ * more of the following constants defined in class
+ * <code>SWT</code>:
+ * <code>NONE</code>, <code>ROMAN</code>, <code>DBCS</code>,
+ * <code>PHONETIC</code>, <code>NATIVE</code>, <code>ALPHA</code>.
+ *
+ * @return the IME mode
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SWT
+ */
+public int getImeInputMode () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return SWT.NONE;
+}
+
+/**
+* Get the modal state.
+* <p>
+* @return the modal state
+*
+* @exception SWTError(ERROR_ERROR_INVALID_PARENT)
+* when the parent is invalid
+* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
+*/
+public int getModal () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return modal;
+}
+
+Shell _getShell () {
+ return this;
+}
+/**
+ * Returns an array containing all shells which are
+ * descendents of the receiver.
+ * <p>
+ * @return the dialog shells
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Shell [] getShells () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int count = 0;
+ Shell [] shells = display.getShells ();
+ for (int i=0; i<shells.length; i++) {
+ Control shell = shells [i];
+ do {
+ shell = shell.getParent ();
+ } while (shell != null && shell != this);
+ if (shell == this) count++;
+ }
+ int index = 0;
+ Shell [] result = new Shell [count];
+ for (int i=0; i<shells.length; i++) {
+ Control shell = shells [i];
+ do {
+ shell = shell.getParent ();
+ } while (shell != null && shell != this);
+ if (shell == this) {
+ result [index++] = shells [i];
+ }
+ }
+ return result;
+}
+
+boolean isModal () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+// GtkWindow window = new GtkWindow ();
+// OS.memmove (window, handle, GtkWindow.sizeof);
+// return window.modal != 0;
+ return false;
+}
+
+public void layout (boolean changed) {
+ checkWidget();
+// if (!resizedSinceLastLayout()) return;
+ lastClientArea=getClientArea();
+ if (layout == null) return;
+ layout.layout (this, changed);
+}
+
+/*
+ * Returns whether the shell has been resized since the last layout()
+ */
+boolean resizedSinceLastLayout() {
+ return !getClientArea().equals(lastClientArea);
+}
+
+/**
+ * Moves the receiver to the top of the drawing order for
+ * the display on which it was created (so that all other
+ * shells on that display, which are not the receiver's
+ * children will be drawn behind it), marks it visible,
+ * and sets focus to its default button (if it has one).
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Control#setVisible
+ * @see Decorations#setDefaultButton
+*/
+public void open () {
+ checkWidget();
+ bringToTop ();
+ setVisible (true);
+}
+
+int processDispose (int int0, int int1, int int2) {
+ closeWidget ();
+ return 1;
+}
+
+int processFocusIn(int int0, int int1, int int2) {
+ hasFocus=true;
+ postEvent(SWT.Activate);
+ return 0;
+}
+
+int processFocusOut(int int0, int int1, int int2) {
+ hasFocus=false;
+ postEvent(SWT.Deactivate);
+ return 0;
+}
+
+int processPaint (int callData, int int2, int int3) {
+ //if (!hooks (SWT.Paint)) return 1;
+
+ GdkEventExpose gdkEvent = new GdkEventExpose ();
+ OS.memmove (gdkEvent, callData, GdkEventExpose.sizeof);
+ Event event = new Event ();
+ event.count = gdkEvent.count;
+ event.x = gdkEvent.x; event.y = gdkEvent.y;
+ event.width = gdkEvent.width; event.height = gdkEvent.height;
+ GC gc = event.gc = new GC (this);
+ GdkRectangle rect = new GdkRectangle ();
+ rect.x = gdkEvent.x; rect.y = gdkEvent.y;
+ rect.width = gdkEvent.width; rect.height = gdkEvent.height;
+ OS.gdk_gc_set_clip_rectangle (gc.handle, rect);
+ gc.fillRectangle(rect.x, rect.y, rect.width, rect.height);
+ sendEvent (SWT.Paint, event);
+ gc.dispose ();
+ event.gc = null;
+ return 1;
+/*}else{
+ GdkRectangle gdkEvent = new GdkRectangle ();
+ OS.memmove (gdkEvent, callData, GdkRectangle.sizeof);
+ Event event = new Event ();
+// event.count = gdkEvent.count;
+ event.x = gdkEvent.x; event.y = gdkEvent.y;
+ event.width = gdkEvent.width; event.height = gdkEvent.height;
+ GC gc = event.gc = new GC (this);
+ OS.gdk_gc_set_clip_rectangle (gc.handle, gdkEvent);
+ sendEvent (SWT.Paint, event);
+ gc.dispose ();
+ event.gc = null;
+ return 1;
+} */
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when operations are performed on the receiver.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ShellListener
+ * @see #addShellListener
+ */
+public void removeShellListener (ShellListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Close, listener);
+ eventTable.unhook (SWT.Iconify,listener);
+ eventTable.unhook (SWT.Deiconify,listener);
+ eventTable.unhook (SWT.Activate, listener);
+ eventTable.unhook (SWT.Deactivate, listener);
+}
+
+/**
+ * Sets the input method editor mode to the argument which
+ * should be the result of bitwise OR'ing together one or more
+ * of the following constants defined in class <code>SWT</code>:
+ * <code>NONE</code>, <code>ROMAN</code>, <code>DBCS</code>,
+ * <code>PHONETIC</code>, <code>NATIVE</code>, <code>ALPHA</code>.
+ *
+ * @param mode the new IME mode
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SWT
+ */
+public void setImeInputMode (int mode) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+
+public void setMaximized (boolean maximized) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+// GtkWidget widget = new GtkWidget ();
+// OS.memmove (widget, shellHandle, GtkWidget.sizeof);
+// OS.gdk_window_set_functions (window, OS.GDK_FUNC_MAXIMIZE);
+}
+public void setMenuBar (Menu menu) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+
+ if (menuBar == menu) return;
+ if (menu != null) {
+ if ((menu.style & SWT.BAR) == 0) error (SWT.ERROR_MENU_NOT_BAR);
+ if (menu.parent != this) error (SWT.ERROR_INVALID_PARENT);
+ }
+ if (menu == null) {
+ if (menuBar != null) {
+ OS.gtk_object_ref (menuBar.handle);
+ OS.gtk_container_remove (vboxHandle, menuBar.handle);
+ }
+ }
+ menuBar = menu;
+ if (menuBar != null) {
+ int menuHandle = menu.handle;
+ OS.gtk_box_pack_start (vboxHandle, menuHandle, false, false, 0);
+ }
+}
+public void setMinimized (boolean minimized) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+// GtkWidget widget = new GtkWidget ();
+// OS.memmove (widget, shellHandle, GtkWidget.sizeof);
+// OS.gdk_window_set_functions (widget.window, OS.GDK_FUNC_MINIMIZE);
+}
+/**
+* Set the modal state.
+* <p>
+* @param modal the new modal state
+*
+* @exception SWTError(ERROR_ERROR_INVALID_PARENT)
+* when the parent is invalid
+* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
+*/
+public void setModal (int modal) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ this.modal = modal;
+}
+
+public void setText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ super.setText (string);
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ OS.gtk_window_set_title (shellHandle, buffer);
+}
+public void setVisible (boolean visible) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (visible) {
+ OS.gtk_widget_show_now (shellHandle);
+ display.update();
+ sendEvent (SWT.Show);
+ } else {
+ OS.gtk_widget_hide (shellHandle);
+ sendEvent (SWT.Hide);
+ }
+}
+
+
+/*
+ * === DESTRUCTION ===
+ */
+
+public void dispose () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+// Display display = this.display;
+ Composite parent = this.parent;
+ super.dispose ();
+// if (display != null) display.update ();
+ if (parent != null) {
+ Shell shell = parent.getShell ();
+ shell.bringToTop ();
+ }
+}
+
+void deregister () {
+ super.deregister ();
+ WidgetTable.remove (shellHandle);
+ WidgetTable.remove (vboxHandle);
+ WidgetTable.remove (eventBoxHandle);
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ shellHandle = vboxHandle = eventBoxHandle = 0;
+}
+
+void releaseShells () {
+ Shell [] shells = getShells ();
+ for (int i=0; i<shells.length; i++) {
+ Shell shell = shells [i];
+ if (!shell.isDisposed ()) {
+ shell.releaseWidget ();
+ shell.releaseHandle ();
+ }
+ }
+}
+void releaseWidget () {
+ releaseShells ();
+ super.releaseWidget ();
+ if (accelGroup != 0) OS.gtk_accel_group_unref (accelGroup);
+ accelGroup = 0;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java
new file mode 100644
index 0000000..167d3c6
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java
@@ -0,0 +1,527 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class are selectable user interface
+ * objects that represent a range of positive, numeric values.
+ * <p>
+ * At any given moment, a given slider will have a
+ * single <em>selection</em> that is considered to be its
+ * value, which is constrained to be within the range of
+ * values the slider represents (that is, between its
+ * <em>minimum</em> and <em>maximum</em> values).
+ * </p><p>
+ * Typically, sliders will be made up of five areas:
+ * <ol>
+ * <li>an arrow button for decrementing the value</li>
+ * <li>a page decrement area for decrementing the value by a larger amount</li>
+ * <li>a <em>thumb</em> for modifying the value by mouse dragging</li>
+ * <li>a page increment area for incrementing the value by a larger amount</li>
+ * <li>an arrow button for incrementing the value</li>
+ * </ol>
+ * Based on their style, sliders are either <code>HORIZONTAL</code>
+ * (which have left and right facing buttons for incrementing and
+ * decrementing the value) or <code>VERTICAL</code> (which have
+ * up and down facing buttons for incrementing and decrementing
+ * the value).
+ * </p><p>
+ * On some platforms, the size of the slider's thumb can be
+ * varied relative to the magnitude of the range of values it
+ * represents (that is, relative to the difference between its
+ * maximum and minimum values). Typically, this is used to
+ * indicate some proportional value such as the ratio of the
+ * visible area of a document to the total amount of space that
+ * it would take to display it. SWT supports setting the thumb
+ * size even if the underlying platform does not, but in this
+ * case the appearance of the slider will not change.
+ * </p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>HORIZONTAL, VERTICAL</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ *
+ * @see ScrollBar
+ */
+
+public class Slider extends Control {
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Slider (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's value changes, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * When <code>widgetSelected</code> is called, the event object detail field contains one of the following values:
+ * <code>0</code> - for the end of a drag.
+ * <code>SWT.DRAG</code>.
+ * <code>SWT.HOME</code>.
+ * <code>SWT.END</code>.
+ * <code>SWT.ARROW_DOWN</code>.
+ * <code>SWT.ARROW_UP</code>.
+ * <code>SWT.PAGE_DOWN</code>.
+ * <code>SWT.PAGE_UP</code>.
+ * <code>widgetDefaultSelected</code> is not called.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener (SelectionListener listener) {
+ checkWidget ();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+
+static int checkStyle (int style) {
+ return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+ int hAdjustment = OS.gtk_adjustment_new (0, 0, 100, 1, 10, 10);
+ if (hAdjustment == 0) error (SWT.ERROR_NO_HANDLES);
+ if ((style & SWT.HORIZONTAL) != 0) {
+ handle = OS.gtk_hscrollbar_new (hAdjustment);
+ } else {
+ handle = OS.gtk_vscrollbar_new (hAdjustment);
+ }
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void setHandleStyle() {}
+
+void showHandle() {
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void hookEvents () {
+ super.hookEvents ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ signal_connect (hAdjustment, "value_changed", SWT.Selection, 2);
+}
+
+void register () {
+ super.register ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ WidgetTable.put (hAdjustment, this);
+}
+
+void deregister () {
+ super.deregister ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ WidgetTable.remove (hAdjustment);
+ /*
+ * This code is intentionally commented.
+ */
+// OS.gtk_object_unref (hAdjustment);
+// OS.gtk_object_destroy (hAdjustment);
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ // We are interested in the preferred size.
+ // The native widget gives us what it thinks the minimum reasonable
+ // size; we'll say we prefer to be twice that long, and exactly
+ // that wide.
+ int x,y;
+ Point size = super.computeSize (wHint, hHint, changed);
+ if (hHint==SWT.DEFAULT) {
+ x = size.x;
+ if ((style & SWT.HORIZONTAL) != 0) x = 2*x;
+ } else x = hHint;
+ if (wHint==SWT.DEFAULT) {
+ y = size.y;
+ if ((style & SWT.VERTICAL) != 0) y = 2*y;
+ } else y = wHint;
+
+ return new Point(x,y);
+}
+
+/**
+ * Returns the amount that the receiver's value will be
+ * modified by when the up/down (or right/left) arrows
+ * are pressed.
+ *
+ * @return the increment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getIncrement () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.step_increment;
+}
+
+/**
+ * Returns the maximum value which the receiver will allow.
+ *
+ * @return the maximum
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getMaximum () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.upper;
+}
+
+/**
+ * Returns the minimum value which the receiver will allow.
+ *
+ * @return the minimum
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getMinimum () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.lower;
+}
+
+/**
+ * Returns the amount that the receiver's value will be
+ * modified by when the page increment/decrement areas
+ * are selected.
+ *
+ * @return the page increment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getPageIncrement () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.page_increment;
+}
+
+/**
+ * Returns the single <em>selection</em> that is the receiver's value.
+ *
+ * @return the selection
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelection () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.value;
+}
+
+/**
+ * Returns the size of the receiver's thumb relative to the
+ * difference between its maximum and minimum values.
+ *
+ * @return the thumb value
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getThumb () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.page_size;
+}
+
+int processSelection (int int0, int int1, int int2) {
+ postEvent (SWT.Selection);
+ return 0;
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's value changes.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener (SelectionListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+
+/**
+ * Sets the amount that the receiver's value will be
+ * modified by when the up/down (or right/left) arrows
+ * are pressed to the argument, which must be at least
+ * one.
+ *
+ * @param value the new increment (must be greater than zero)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setIncrement (int value) {
+ checkWidget();
+ if (value < 1) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.step_increment = (float) value;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+}
+
+/**
+ * Sets the maximum value which the receiver will allow
+ * to be the argument which must be greater than or
+ * equal to zero.
+ *
+ * @param value the new maximum (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMaximum (int value) {
+ checkWidget ();
+ if (value < 0) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.upper = (float) value;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+}
+
+/**
+ * Sets the minimum value which the receiver will allow
+ * to be the argument which must be greater than or
+ * equal to zero.
+ *
+ * @param value the new minimum (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMinimum (int value) {
+ checkWidget ();
+ if (value < 0) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.lower = (float) value;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+}
+
+/**
+ * Sets the amount that the receiver's value will be
+ * modified by when the page increment/decrement areas
+ * are selected to the argument, which must be at least
+ * one.
+ *
+ * @return the page increment (must be greater than zero)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setPageIncrement (int value) {
+ checkWidget ();
+ if (value < 1) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.page_increment = (float) value;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+}
+
+/**
+ * Sets the single <em>selection</em> that is the receiver's
+ * value to the argument which must be greater than or equal
+ * to zero.
+ *
+ * @param value the new selection (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (int value) {
+ checkWidget ();
+ if (value < 0) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
+ OS.gtk_adjustment_set_value (hAdjustment, value);
+ OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
+}
+
+/**
+ * Sets the size of the receiver's thumb relative to the
+ * difference between its maximum and minimum values to the
+ * argument which must be at least one.
+ *
+ * @param value the new thumb value (must be at least one)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ScrollBar
+ */
+public void setThumb (int value) {
+ checkWidget ();
+ if (value < 1) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.page_size = (float) value;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+}
+
+/**
+ * Sets the receiver's selection, minimum value, maximum
+ * value, thumb, increment and page increment all at once.
+ * <p>
+ * Note: This is equivalent to setting the values individually
+ * using the appropriate methods, but may be implemented in a
+ * more efficient fashion on some platforms.
+ * </p>
+ *
+ * @param selection the new selection value
+ * @param minimum the new minimum value
+ * @param maximum the new maximum value
+ * @param thumb the new thumb value
+ * @param increment the new increment value
+ * @param pageIncrement the new pageIncrement value
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setValues (int selection, int minimum, int maximum, int thumb, int increment, int pageIncrement) {
+ checkWidget ();
+ if (selection < 0) return;
+ if (minimum < 0) return;
+ if (maximum < 0) return;
+ if (thumb < 1) return;
+ if (maximum - minimum - thumb < 0) return;
+ if (increment < 1) return;
+ if (pageIncrement < 1) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.value = (float) selection;
+ adjustment.lower = (float) minimum;
+ adjustment.upper = (float) maximum;
+ adjustment.page_size = (float) thumb;
+ adjustment.step_increment = (float) increment;
+ adjustment.page_increment = (float) pageIncrement;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+ OS.gtk_adjustment_value_changed (hAdjustment);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
new file mode 100644
index 0000000..4338e7e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
@@ -0,0 +1,554 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class implement the notebook user interface
+ * metaphor. It allows the user to select a notebook page from
+ * set of pages.
+ * <p>
+ * The item children that may be added to instances of this class
+ * must be of type <code>TabItem</code>.
+ * <code>Control</code> children are created and then set into a
+ * tab item using <code>TabItem#setControl</code>.
+ * </p><p>
+ * Note that although this class is a subclass of <code>Composite</code>,
+ * it does not make sense to set a layout on it.
+ * </p><p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+public class TabFolder extends Composite {
+ int notebookHandle;
+ TabItem [] items;
+
+
+/*
+ * == CONSTRUCTORS ==
+ */
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TabFolder (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+/*
+ * == HANDLE DANCES, FIRST SPECIES ==
+ */
+
+void createHandle (int index) {
+ state |= HANDLE;
+ eventBoxHandle = OS.gtk_event_box_new();
+ fixedHandle = OS.gtk_fixed_new ();
+ notebookHandle = OS.gtk_notebook_new ();
+ handle = OS.gtk_fixed_new();
+}
+
+void configure () {
+ _connectParent();
+ OS.gtk_container_add(eventBoxHandle, fixedHandle);
+ OS.gtk_fixed_put (fixedHandle, notebookHandle, (short)0, (short)0);
+ OS.gtk_fixed_put (fixedHandle, handle, (short)2, (short)33);
+}
+
+void showHandle() {
+ OS.gtk_widget_show(eventBoxHandle);
+ OS.gtk_widget_show(fixedHandle);
+ OS.gtk_widget_show(notebookHandle);
+ OS.gtk_widget_show(handle);
+ OS.gtk_widget_realize (notebookHandle);
+ OS.gtk_widget_realize (handle);
+}
+
+void register () {
+ super.register ();
+ WidgetTable.put (notebookHandle, this);
+}
+
+void hookEvents () {
+ super.hookEvents ();
+ signal_connect (notebookHandle, "size_allocate", SWT.Resize, 3);
+ signal_connect (notebookHandle, "switch_page", SWT.Selection, 4);
+}
+
+void createWidget (int index) {
+ super.createWidget(index);
+ items = new TabItem [4];
+}
+
+int topHandle () { return eventBoxHandle; }
+int paintHandle () { return notebookHandle; }
+int parentingHandle () { return handle; }
+boolean isMyHandle(int h) {
+ if (h==eventBoxHandle) return true;
+ if (h==notebookHandle) return true;
+ if (h==fixedHandle) return true;
+ if (h==handle) return true;
+ return false;
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ //notebookHandle
+ int width = _computeSize(wHint, hHint, changed).x;
+ int height = 0;
+ Point size;
+ if (layout != null) {
+ size = layout.computeSize (this, wHint, hHint, changed);
+ } else {
+ size = minimumSize ();
+ }
+ if (size.x == 0) size.x = DEFAULT_WIDTH;
+ if (size.y == 0) size.y = DEFAULT_HEIGHT;
+ if (wHint != SWT.DEFAULT) size.x = wHint;
+ if (hHint != SWT.DEFAULT) size.y = hHint;
+ width = Math.max (width, size.x);
+ height = Math.max (height, size.y);
+ Rectangle trim = computeTrim (0, 0, width, height);
+ width = trim.width; height = trim.height;
+ return new Point (width, height);
+}
+
+/**
+* Computes the widget trim.
+*/
+public Rectangle computeTrim (int x, int y, int width, int height) {
+ checkWidget();
+ return new Rectangle(x-2, y-33, width+4, height+35);
+}
+
+/*
+ **** Layout code ****
+ */
+
+boolean _setSize(int width, int height) {
+ boolean differentExtent = UtilFuncs.setSize(eventBoxHandle, width,height);
+ UtilFuncs.setSize (fixedHandle, width,height);
+ UtilFuncs.setSize (notebookHandle, width,height);
+ UtilFuncs.setSize (handle, width-4, height-35);
+ layoutCurrent();
+ return differentExtent;
+}
+
+public Rectangle _getClientArea () {
+ org.eclipse.swt.graphics.Point size = _getSize();
+ int x = Math.max(size.x-4, 3);
+ int y = Math.max(size.y-35, 3);
+ return new Rectangle(0,0, x, y);
+}
+
+void layoutCurrent() {
+ int index=getSelectionIndex();
+ if (index==-1) return;
+ Control control = items[index].control;
+ if (control==null) return;
+ if (control.isDisposed()) return;
+ control.setBounds(getClientArea());
+}
+
+void createItem (TabItem item, int index) {
+ int list = OS.gtk_container_children (notebookHandle);
+ int itemCount = OS.g_list_length (list);
+ if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_ITEM_NOT_ADDED);
+ if (itemCount == items.length) {
+ TabItem [] newItems = new TabItem [items.length + 4];
+ System.arraycopy (items, 0, newItems, 0, items.length);
+ items = newItems;
+ }
+
+ // create a new label
+ byte [] buffer = new byte [] {0};
+ int labelHandle = OS.gtk_label_new (buffer);
+
+ // create a new fake page
+ int stubPage = OS.gtk_fixed_new();
+
+ // put the label and the fake page inside the notebook
+ OS.gtk_signal_handler_block_by_data (notebookHandle, SWT.Selection);
+ OS.gtk_notebook_append_page(notebookHandle, stubPage, labelHandle);
+ OS.gtk_signal_handler_unblock_by_data (notebookHandle, SWT.Selection);
+
+ OS.gtk_widget_show(labelHandle);
+ OS.gtk_widget_show(stubPage);
+
+ item.state |= HANDLE;
+ item.handle = labelHandle;
+ System.arraycopy (items, index, items, index + 1, itemCount++ - index);
+ items [index] = item;
+ OS.gtk_notebook_set_show_tabs (notebookHandle, true);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's selection changes, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * When <code>widgetSelected</code> is called, the item field of the event object is valid.
+ * <code>widgetDefaultSelected</code> is not called.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener(SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener(listener);
+ addListener(SWT.Selection,typedListener);
+ addListener(SWT.DefaultSelection,typedListener);
+}
+
+void destroyItem (TabItem item) {
+ int index = 0;
+ int itemCount = getItemCount();
+ while (index < itemCount) {
+ if (items [index] == item) break;
+ index++;
+ }
+ if (index == itemCount) error (SWT.ERROR_ITEM_NOT_REMOVED);
+ OS.gtk_notebook_remove_page (notebookHandle, index);
+ System.arraycopy (items, index + 1, items, index, --itemCount - index);
+ items [itemCount] = null;
+ item.handle = 0;
+}
+/**
+ * Returns the item at the given, zero-relative index in the
+ * receiver. Throws an exception if the index is out of range.
+ *
+ * @param index the index of the item to return
+ * @return the item at the given index
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+
+public TabItem getItem (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int list = OS.gtk_container_children (notebookHandle);
+ int itemCount = OS.g_list_length (list);
+ if (!(0 <= index && index < itemCount)) error (SWT.ERROR_CANNOT_GET_ITEM);
+ return items [index];
+}
+/**
+ * Returns the number of items contained in the receiver.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getItemCount () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ //return itemCount;
+ int list = OS.gtk_container_children (notebookHandle);
+ return OS.g_list_length (list);
+}
+/**
+ * Returns an array of <code>TabItem</code>s which are the items
+ * in the receiver.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the items in the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TabItem [] getItems () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int list = OS.gtk_container_children (notebookHandle);
+ int itemCount = OS.g_list_length (list);
+ TabItem [] result = new TabItem [itemCount];
+ System.arraycopy (items, 0, result, 0, itemCount);
+ return result;
+}
+/**
+ * Returns an array of <code>TabItem</code>s that are currently
+ * selected in the receiver. An empty array indicates that no
+ * items are selected.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its selection, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ * @return an array representing the selection
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TabItem [] getSelection () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int index = OS.gtk_notebook_get_current_page (notebookHandle);
+ if (index == -1) return new TabItem [0];
+ return new TabItem [] {items [index]};
+}
+/**
+ * Returns the zero-relative index of the item which is currently
+ * selected in the receiver, or -1 if no item is selected.
+ *
+ * @return the index of the selected item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelectionIndex () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return OS.gtk_notebook_get_current_page (notebookHandle);
+}
+
+/**
+ * Searches the receiver's list starting at the first item
+ * (index 0) until an item is found that is equal to the
+ * argument, and returns the index of that item. If no item
+ * is found, returns -1.
+ *
+ * @param item the search item
+ * @return the index of the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int indexOf (TabItem item) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
+ int list = OS.gtk_container_children (notebookHandle);
+ int itemCount = OS.g_list_length (list);
+ for (int i=0; i<itemCount; i++) {
+ if (items [i] == item) return i;
+ }
+ return -1;
+}
+
+int processSelection (int int0, int int1, int int2) {
+ int index = OS.gtk_notebook_get_current_page (notebookHandle);
+ if (index != -1) {
+ Control control = items [index].getControl ();
+ if (control != null && !control.isDisposed ()) {
+ control.setVisible (false);
+ }
+ }
+ Control control = items [int1].getControl ();
+ if (control != null && !control.isDisposed ()) {
+ control.setBounds(getClientArea());
+ control.setVisible (true);
+ }
+ Event event = new Event();
+ event.item = items[int1];
+ postEvent(SWT.Selection, event);
+ return 0;
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's selection changes.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener (SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+/**
+ * Selects the item at the given zero-relative index in the receiver.
+ * If the item at the index was already selected, it remains selected.
+ * The current selected is first cleared, then the new items are
+ * selected. Indices that are out of range are ignored.
+ *
+ * @param index the index of the item to select
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (int index) {
+ checkWidget();
+ if (index == -1) return;
+ OS.gtk_signal_handler_block_by_data (notebookHandle, SWT.Selection);
+ OS.gtk_notebook_set_page (notebookHandle, index);
+ OS.gtk_signal_handler_unblock_by_data (notebookHandle, SWT.Selection);
+}
+
+/**
+ * Sets the receiver's selection to be the given array of items.
+ * The current selected is first cleared, then the new items are
+ * selected.
+ *
+ * @param items the array of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (TabItem [] items) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (items.length == 0) {
+ setSelection (-1);
+ return;
+ }
+ for (int i=items.length-1; i>=0; --i) {
+ int index = indexOf (items [i]);
+ if (index != -1) setSelection (index);
+ }
+}
+
+/*
+ * == DESTRUCTION ===
+ */
+
+void deregister () {
+ super.deregister ();
+ WidgetTable.remove (notebookHandle);
+}
+
+void releaseChildren() {
+ int list = OS.gtk_container_children (notebookHandle);
+ int itemCount = OS.g_list_length (list);
+ for (int i=0; i<itemCount; i++) {
+ TabItem item = items [i];
+ if (!item.isDisposed ()) {
+ item.releaseWidget ();
+ item.releaseHandle ();
+ }
+ }
+
+ // Now, the non-item children
+ list = OS.gtk_container_children(parentingHandle());
+ int childCount = OS.g_list_length (list);
+ for (int i=0; i<childCount; i++) {
+ int childHandle = OS.g_list_nth_data(list, i);
+ if (!isMyHandle(childHandle)) {
+ Widget w = WidgetTable.get(childHandle);
+ if (!(w==null) && !(w.isDisposed())) {
+ w.releaseWidget();
+ w.releaseHandle();
+ }
+ }
+ }
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ notebookHandle = 0;
+}
+
+void releaseWidget () {
+ super.releaseWidget();
+ items = null;
+}
+
+/*
+ * == AS YET UNCLASSIFIED ===
+ */
+
+static int checkStyle (int style) {
+ /*
+ * Even though it is legal to create this widget
+ * with scroll bars, they serve no useful purpose
+ * because they do not automatically scroll the
+ * widget's client area. The fix is to clear
+ * the SWT style.
+ */
+ return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
new file mode 100644
index 0000000..8454cc3
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
@@ -0,0 +1,218 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class represent a selectable user interface object
+ * corresponding to a tab for a page in a tab folder.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+
+public class TabItem extends Item {
+ Control control;
+ TabFolder parent;
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>TabFolder</code>) and a style value
+ * describing its behavior and appearance. The item is added
+ * to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TabItem (TabFolder parent, int style) {
+ super (parent, style);
+ this.parent = parent;
+ parent.createItem (this, parent.getItemCount ());
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>TabFolder</code>), a style value
+ * describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TabItem (TabFolder parent, int style, int index) {
+ super (parent, style);
+ this.parent = parent;
+ parent.createItem (this, index);
+}
+/**
+ * Returns the control that is used to fill the client area of
+ * the tab folder when the user selects the tab item. If no
+ * control has been set, return <code>null</code>.
+ * <p>
+ * @return the control
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Control getControl () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return control;
+}
+public Display getDisplay () {
+ TabFolder parent = this.parent;
+ if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getDisplay ();
+}
+/**
+ * Returns the receiver's parent, which must be a <code>TabFolder</code>.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TabFolder getParent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent;
+}
+/**
+ * Returns the receiver's tool tip text, or null if it has
+ * not been set.
+ *
+ * @return the receiver's tool tip text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getToolTipText () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return "";
+}
+void releaseChild () {
+ super.releaseChild ();
+ parent.destroyItem (this);
+}
+void releaseWidget () {
+ super.releaseWidget ();
+ parent = null;
+}
+/**
+ * Sets the control that is used to fill the client area of
+ * the tab folder when the user selects the tab item.
+ * <p>
+ * @param control the new control (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
+ * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setControl (Control control) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ Control oldControl = this.control, newControl = control;
+ this.control = control;
+ int index = parent.indexOf (this);
+ if (index != parent.getSelectionIndex ()) return;
+ if (newControl != null) {
+ newControl.setBounds (parent.getClientArea ());
+ newControl.setVisible (true);
+ }
+ if (oldControl != null) oldControl.setVisible (false);
+}
+public void setImage (Image image) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ super.setImage (image);
+}
+public void setText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ super.setText (string);
+ byte [] buffer = string2bytesConvertMnemonic(string);
+ OS.gtk_label_parse_uline(handle, buffer);
+}
+/**
+ * Sets the receiver's tool tip text to the argument, which
+ * may be null indicating that no tool tip text should be shown.
+ *
+ * @param string the new tool tip text (or null)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setToolTipText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
new file mode 100644
index 0000000..e6a4d87
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
@@ -0,0 +1,1333 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class implement a selectable user interface
+ * object that displays a list of images and strings and issue
+ * notificiation when selected.
+ * <p>
+ * The item children that may be added to instances of this class
+ * must be of type <code>TableItem</code>.
+ * </p><p>
+ * Note that although this class is a subclass of <code>Composite</code>,
+ * it does not make sense to add <code>Control</code> children to it,
+ * or set a layout on it.
+ * </p><p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>SINGLE, MULTI, CHECK, FULL_SELECTION, HIDE_SELECTION</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection, DefaultSelection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+public class Table extends Composite {
+ int itemCount, columnCount;
+ TableItem [] items;
+ TableColumn [] columns;
+ TableItem itemBeingSelected;
+ TableItem[] selection = new TableItem[0];
+ public static int MAX_COLUMNS = 32;
+
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Table (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+
+
+
+/*
+ * === HANDLE CODE 1 ===
+ */
+
+void createHandle (int index) {
+ state |= HANDLE;
+
+ eventBoxHandle = OS.gtk_event_box_new();
+ if (eventBoxHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+
+ fixedHandle = OS.gtk_fixed_new();
+ if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ handle = OS.gtk_clist_new (MAX_COLUMNS);
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ scrolledHandle = OS.gtk_scrolled_window_new (0, 0);
+ if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+void setHandleStyle () {
+ /* Single or Multiple Selection */
+ int selectionMode;
+ if ((style & SWT.MULTI) != 0) selectionMode = OS.GTK_SELECTION_EXTENDED;
+ else selectionMode = OS.GTK_SELECTION_BROWSE;
+ OS.gtk_clist_set_selection_mode (handle, selectionMode);
+
+ /* We fake the number of columns, because we have to know beforehand.
+ * Initially all those fake columns are invisible
+ */
+ byte [] buffer = new byte [1];
+ OS.gtk_clist_set_column_title (handle, 0, buffer);
+ for (int i=1; i<MAX_COLUMNS; i++) {
+ OS.gtk_clist_set_column_visibility (handle, i, false);
+ }
+
+ /* Scrolling policy */
+ int hscrollbar_policy = (style & SWT.H_SCROLL) != 0 ? OS.GTK_POLICY_ALWAYS : OS.GTK_POLICY_AUTOMATIC;
+ int vscrollbar_policy = (style & SWT.V_SCROLL) != 0 ? OS.GTK_POLICY_ALWAYS : OS.GTK_POLICY_AUTOMATIC;
+ OS.gtk_scrolled_window_set_policy (scrolledHandle, hscrollbar_policy, vscrollbar_policy);
+}
+void configure() {
+ _connectParent();
+ OS.gtk_container_add(eventBoxHandle, fixedHandle);
+ OS.gtk_fixed_put (fixedHandle, scrolledHandle, (short)0, (short)0);
+ OS.gtk_container_add (scrolledHandle, handle);
+}
+
+static int checkStyle (int style) {
+ /*
+ * To be compatible with Windows, force the H_SCROLL
+ * and V_SCROLL style bits. On Windows, it is not
+ * possible to create a table without scroll bars.
+ */
+ style |= SWT.H_SCROLL | SWT.V_SCROLL;
+ return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ if (wHint == SWT.DEFAULT) wHint = 200;
+ return _computeSize (wHint, hHint, changed);
+}
+
+void showHandle() {
+ OS.gtk_widget_show (eventBoxHandle);
+ OS.gtk_widget_show (fixedHandle);
+ OS.gtk_widget_show (scrolledHandle);
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void hookEvents () {
+ //TO DO - get rid of enter/exit for mouse crossing border
+ super.hookEvents ();
+ signal_connect (handle, "select_row", SWT.Selection, 5);
+}
+
+void createWidget (int index) {
+ super.createWidget (index);
+ items = new TableItem [4];
+ columns = new TableColumn [4];
+ itemCount = columnCount = 0;
+}
+
+/*
+ * HANDLE CODE 2
+ */
+int topHandle() { return eventBoxHandle; }
+int parentingHandle() { return fixedHandle; }
+boolean isMyHandle(int h) {
+ if (h==eventBoxHandle) return true;
+ if (h==scrolledHandle) return true;
+ if (h==fixedHandle) return true;
+ if (h==handle) return true;
+ return false;
+
+}
+
+
+
+/*
+ * === GEOMETRY ===
+ */
+
+boolean _setSize(int width, int height) {
+ boolean different = UtilFuncs.setSize(eventBoxHandle, width, height);
+ if (different) UtilFuncs.setSize(fixedHandle, width, height);
+ if (different) UtilFuncs.setSize(scrolledHandle, width, height);
+ return different;
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's selection changes, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * When <code>widgetSelected</code> is called, the item field of the event object is valid.
+ * If the reciever has <code>SWT.CHECK</code> style set and the check selection changes,
+ * the event object detail field contains the value <code>SWT.CHECK</code>.
+ * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
+ * The item field of the event object is valid for default selection, but the detail field is not used.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener (SelectionListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+
+
+/* The real work to create a new column */
+void createItem (TableColumn column, int index) {
+ if (!(0 <= index && index <= columnCount)) error (SWT.ERROR_ITEM_NOT_ADDED);
+ if (columnCount == columns.length) {
+ TableColumn [] newColumns = new TableColumn [columns.length + 4];
+ System.arraycopy (columns, 0, newColumns, 0, columns.length);
+ columns = newColumns;
+ }
+ OS.gtk_clist_set_column_visibility (handle, index, true);
+ OS.gtk_clist_column_titles_passive(handle); // paranoia
+ System.arraycopy (columns, index, columns, index + 1, columnCount++ - index);
+ columns [index] = column;
+}
+void createItem (TableItem item, int index) {
+ if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_ITEM_NOT_ADDED);
+ if (itemCount == items.length) {
+ TableItem [] newItems = new TableItem [items.length + 4];
+ System.arraycopy (items, 0, newItems, 0, items.length);
+ items = newItems;
+ }
+// int ptr = OS.g_malloc (1);
+ int [] strings = new int [MAX_COLUMNS];
+// for (int i=0; i<strings.length; i++) strings [i] = ptr;
+ for (int i=0; i<strings.length; i++) strings [i] = 0;
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ int result = OS.gtk_clist_insert (handle, index, strings);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+// OS.g_free (ptr);
+ System.arraycopy (items, index, items, index + 1, itemCount++ - index);
+ items [index] = item;
+}
+
+/**
+ * Deselects the item at the given zero-relative index in the receiver.
+ * If the item at the index was already deselected, it remains
+ * deselected. Indices that are out of range are ignored.
+ *
+ * @param index the index of the item to deselect
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselect (int index) {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_unselect_row (handle, index, 0);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ selection = _getNativeSelection();
+}
+/**
+ * Deselects the items at the given zero-relative indices in the receiver.
+ * If the item at the given zero-relative index in the receiver
+ * is selected, it is deselected. If the item at the index
+ * was not selected, it remains deselected. The range of the
+ * indices is inclusive. Indices that are out of range are ignored.
+ *
+ * @param start the start index of the items to deselect
+ * @param end the end index of the items to deselect
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselect (int start, int end) {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ for (int i=start; i<=end; i++) {
+ OS.gtk_clist_unselect_row (handle, i, 0);
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ selection = _getNativeSelection();
+}
+/**
+ * Deselects the items at the given zero-relative indices in the receiver.
+ * If the item at the given zero-relative index in the receiver
+ * is selected, it is deselected. If the item at the index
+ * was not selected, it remains deselected. Indices that are out
+ * of range and duplicate indices are ignored.
+ *
+ * @param indices the array of indices for the items to deselect
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselect (int [] indices) {
+ checkWidget();
+ if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ for (int i=0; i<indices.length; i++) {
+ OS.gtk_clist_unselect_row (handle, indices [i], 0);
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Deselects all selected items in the receiver.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselectAll () {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_unselect_all (handle);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ selection = new TableItem[0];
+}
+
+void destroyItem (TableColumn column) {
+ int index = 0;
+ while (index < columnCount) {
+ if (columns [index] == column) break;
+ index++;
+ }
+ if (index == columnCount) return;
+ OS.gtk_clist_set_column_visibility (handle, index, false);
+ OS.gtk_clist_set_column_title (handle, index, new byte [1]);
+ System.arraycopy (columns, index + 1, columns, index, --columnCount - index);
+ columns [columnCount] = null;
+}
+void destroyItem (TableItem item) {
+ int index = 0;
+ while (index < itemCount) {
+ if (items [index] == item) break;
+ index++;
+ }
+ if (index == itemCount) return;
+ OS.gtk_clist_remove (handle, index);
+ System.arraycopy (items, index + 1, items, index, --itemCount - index);
+ items [itemCount] = null;
+}
+/**
+ * Returns the column at the given, zero-relative index in the
+ * receiver. Throws an exception if the index is out of range.
+ * If no <code>TableColumn</code>s were created by the programmer,
+ * this method will throw <code>ERROR_INVALID_RANGE</code> despite
+ * the fact that a single column of data may be visible in the table.
+ * This occurs when the programmer uses the table like a list, adding
+ * items but never creating a column.
+ *
+ * @param index the index of the column to return
+ * @return the column at the given index
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TableColumn getColumn (int index) {
+ checkWidget();
+ if (!(0 <= index && index < columnCount)) error (SWT.ERROR_CANNOT_GET_ITEM);
+ return columns [index];
+}
+/**
+ * Returns the number of columns contained in the receiver.
+ * If no <code>TableColumn</code>s were created by the programmer,
+ * this value is zero, despite the fact that visually, one column
+ * of items is may be visible. This occurs when the programmer uses
+ * the table like a list, adding items but never creating a column.
+ *
+ * @return the number of columns
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public int getColumnCount () {
+ checkWidget();
+ return columnCount;
+}
+/**
+ * Returns an array of <code>TableColumn</code>s which are the
+ * columns in the receiver. If no <code>TableColumn</code>s were
+ * created by the programmer, the array is empty, despite the fact
+ * that visually, one column of items may be visible. This occurs
+ * when the programmer uses the table like a list, adding items but
+ * never creating a column.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the items in the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TableColumn [] getColumns () {
+ checkWidget();
+ TableColumn [] result = new TableColumn [columnCount];
+ System.arraycopy (columns, 0, result, 0, columnCount);
+ return result;
+}
+/**
+ * Returns the width in pixels of a grid line.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getGridLineWidth () {
+ checkWidget();
+ /* FIXME */
+ return 0;
+}
+
+
+
+/**
+ * Returns the item at the given, zero-relative index in the
+ * receiver. Throws an exception if the index is out of range.
+ *
+ * @param index the index of the item to return
+ * @return the item at the given index
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TableItem getItem (int index) {
+ checkWidget();
+ if (!(0 <= index && index < itemCount)) error (SWT.ERROR_CANNOT_GET_ITEM);
+ return items [index];
+}
+
+/**
+ * Returns the item at the given point in the receiver
+ * or null if no such item exists. The point is in the
+ * coordinate system of the receiver.
+ *
+ * @param point the point used to locate the item
+ * @return the item at the given point
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TableItem getItem (Point pt) {
+ checkWidget();
+
+ GtkCList clist = new GtkCList ();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ int clientX = pt.x;
+ int clientY = pt.y - clist.column_title_area_height;
+ if (clientY <= 0) return null;
+
+ int[] row = new int[1], column = new int[1];
+ row[0] = -1;
+ OS.gtk_clist_get_selection_info(handle, clientX, clientY, row, column);
+ if (row[0] == -1) return null;
+ return items[row[0]];
+}
+
+/**
+ * Returns the number of items contained in the receiver.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getItemCount () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return itemCount;
+}
+/**
+ * Returns the height of the area which would be used to
+ * display <em>one</em> of the items in the receiver's.
+ *
+ * @return the height of one item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getItemHeight () {
+ checkWidget();
+ GtkCList clist = new GtkCList ();
+ OS.memmove (clist, handle, GtkCList.sizeof);
+ return clist.row_height;
+}
+/**
+ * Returns an array of <code>TableItem</code>s which are the items
+ * in the receiver.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the items in the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TableItem [] getItems () {
+ checkWidget();
+ TableItem [] result = new TableItem [itemCount];
+ System.arraycopy (items, 0, result, 0, itemCount);
+ return result;
+}
+
+
+
+/*
+ * === SELECTION STORY ===
+ */
+
+/**
+ * Returns an array of <code>TableItem</code>s that are currently
+ * selected in the receiver. An empty array indicates that no
+ * items are selected.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its selection, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ * @return an array representing the selection
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TableItem[] getSelection () {
+ checkWidget();
+ return selection;
+}
+
+/**
+ * Get the selection from the OS.
+ */
+private TableItem[] _getNativeSelection () {
+ GtkCList clist = new GtkCList ();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ switch (clist.selection_mode) {
+ case OS.GTK_SELECTION_SINGLE: return getSelection_single();
+ case OS.GTK_SELECTION_BROWSE: return getSelection_browse();
+ case OS.GTK_SELECTION_MULTIPLE: return getSelection_multiple();
+ case OS.GTK_SELECTION_EXTENDED: return getSelection_extended();
+ default: error(SWT.ERROR_UNSPECIFIED);
+ }
+ /* can never get here */
+ return null;
+}
+private TableItem[] getSelection_single () {
+ GtkCList clist = new GtkCList();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ if (clist.selection==0) return new TableItem[0];
+ int length = OS.g_list_length (clist.selection);
+ if (length == 0) return new TableItem[0];
+ int index = OS.g_list_nth_data (clist.selection, 0);
+ return new TableItem [] {items[index]};
+}
+private TableItem[] getSelection_browse () {
+ /* same as single */
+ GtkCList clist = new GtkCList();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ if (clist.selection==0) return new TableItem[0];
+ int length = OS.g_list_length (clist.selection);
+ if (length == 0) return new TableItem[0];
+ int index = OS.g_list_nth_data (clist.selection, 0);
+ return new TableItem [] {items[index]};
+}
+private TableItem[] getSelection_multiple () {
+ GtkCList clist = new GtkCList();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ if (clist.selection==0) return new TableItem[0];
+ int length = OS.g_list_length (clist.selection);
+ TableItem [] result = new TableItem [length];
+ for (int i=0; i<length; i++) {
+ int index = OS.g_list_nth_data (clist.selection, i);
+ result [i] = items [index];
+ }
+ return result;
+}
+private TableItem[] getSelection_extended () {
+ GtkCList clist = new GtkCList();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ if (clist.selection==0) return new TableItem[0];
+ int length = OS.g_list_length (clist.selection);
+ TableItem [] result = new TableItem [length];
+ for (int i=0; i<length; i++) {
+ int index = OS.g_list_nth_data (clist.selection, i);
+ result [i] = items [index];
+ }
+ return result;
+}
+
+/**
+ * Returns the number of selected items contained in the receiver.
+ *
+ * @return the number of selected items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelectionCount () {
+ checkWidget();
+ return selection.length;
+}
+private int _getNativeSelectionCount () {
+ GtkCList clist = new GtkCList ();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ int selectionList = clist.selection;
+ if (selectionList==0) return 0;
+ return OS.g_list_length (clist.selection);
+}
+/**
+ * Returns the zero-relative index of the item which is currently
+ * selected in the receiver, or -1 if no item is selected.
+ *
+ * @return the index of the selected item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelectionIndex () {
+ checkWidget();
+ GtkCList clist = new GtkCList ();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ int list = clist.selection;
+ if (OS.g_list_length (list) == 0) return -1;
+ return OS.g_list_nth_data (list, 0);
+}
+/**
+ * Returns the zero-relative indices of the items which are currently
+ * selected in the receiver. The array is empty if no items are selected.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its selection, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ * @return the array of indices of the selected items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int [] getSelectionIndices () {
+ checkWidget();
+ GtkCList widget = new GtkCList ();
+ OS.memmove (widget, handle, GtkCList.sizeof);
+ int list = widget.selection;
+ int length = OS.g_list_length (list);
+ int [] indices = new int [length];
+ for (int i=0; i<length; i++) {
+ indices [i] = OS.g_list_nth_data (list, i);
+ }
+ return indices;
+}
+
+/**
+ * Returns <code>true</code> if the item is selected,
+ * and <code>false</code> otherwise. Indices out of
+ * range are ignored.
+ *
+ * @param index the index of the item
+ * @return the visibility state of the item at the index
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isSelected (int index) {
+ checkWidget();
+ GtkCList widget = new GtkCList ();
+ OS.memmove (widget, handle, GtkCList.sizeof);
+ int list = widget.selection;
+ int length = OS.g_list_length (list);
+ for (int i=0; i<length; i++) {
+ if (index == OS.g_list_nth_data (list, i)) return true;
+ }
+ return false;
+}
+
+
+
+
+
+/**
+ * Returns the zero-relative index of the item which is currently
+ * at the top of the receiver. This index can change when items are
+ * scrolled or new items are added or removed.
+ *
+ * @return the index of the top item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getTopIndex () {
+ checkWidget();
+ GtkCList clist = new GtkCList ();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ return -clist.voffset / (clist.row_height + 1);
+}
+
+/**
+ * Searches the receiver's list starting at the first column
+ * (index 0) until a column is found that is equal to the
+ * argument, and returns the index of that column. If no column
+ * is found, returns -1.
+ *
+ * @param column the search column
+ * @return the index of the column
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int indexOf (TableColumn column) {
+ checkWidget();
+ if (column == null) error (SWT.ERROR_NULL_ARGUMENT);
+ for (int i=0; i<columnCount; i++) {
+ if (columns [i] == column) return i;
+ }
+ return -1;
+}
+/**
+ * Searches the receiver's list starting at the first item
+ * (index 0) until an item is found that is equal to the
+ * argument, and returns the index of that item. If no item
+ * is found, returns -1.
+ *
+ * @param item the search item
+ * @return the index of the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int indexOf (TableItem item) {
+ checkWidget();
+ if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
+ for (int i=0; i<itemCount; i++) {
+ if (items [i] == item) return i;
+ }
+ return -1;
+}
+
+void releaseWidget () {
+ int columnCount = 0;
+ for (int i=0; i<columnCount; i++) {
+ TableColumn column = columns [i];
+// if (!column.isDisposed ()) column.releaseWidget ();
+ if (column != null && !column.isDisposed ()) column.releaseWidget ();
+ }
+ columns = null;
+ int itemCount = 0;
+ for (int i=0; i<itemCount; i++) {
+ TableItem item = items [i];
+ if (!item.isDisposed ()) item.releaseWidget ();
+ }
+ items = null;
+ itemBeingSelected = null;
+ super.releaseWidget ();
+}
+/**
+ * Removes the item from the receiver at the given
+ * zero-relative index.
+ *
+ * @param index the index for the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (int index) {
+ checkWidget();
+ if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_ITEM_NOT_REMOVED);
+ OS.gtk_clist_remove (handle, index);
+ TableItem item = items [index];
+ System.arraycopy (items, index + 1, items, index, --itemCount - index);
+ items [itemCount] = null;
+ item.releaseWidget ();
+}
+/**
+ * Removes the items from the receiver which are
+ * between the given zero-relative start and end
+ * indices (inclusive).
+ *
+ * @param start the start of the range
+ * @param end the end of the range
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (int start, int end) {
+ checkWidget();
+ int index = end;
+ while (index >= start) {
+ OS.gtk_clist_remove (handle, index);
+ items [index].releaseWidget ();
+ --index;
+ }
+ int first = index + 1, last = end + 1;
+ System.arraycopy (items, last, items, first, itemCount - last);
+ for (int i=itemCount-(last-first); i<itemCount; i++) items [i] = null;
+ itemCount = itemCount - (last - first);
+ if (first > start) error (SWT.ERROR_ITEM_NOT_REMOVED);
+}
+/**
+ * Removes the items from the receiver's list at the given
+ * zero-relative indices.
+ *
+ * @param indices the array of indices of the items
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (int [] indices) {
+ checkWidget();
+ if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
+ int [] newIndices = new int [indices.length];
+ System.arraycopy (indices, 0, newIndices, 0, indices.length);
+ sort (newIndices);
+ int last = -1;
+ for (int i=0; i<newIndices.length; i++) {
+ int index = newIndices [i];
+ if (index != last || i == 0) {
+ OS.gtk_clist_remove (handle, index);
+ // BUG - disposed callback could remove an item
+ items [index].releaseWidget ();
+ System.arraycopy (items, index + 1, items, index, --itemCount - index);
+ items [itemCount] = null;
+ last = index;
+ }
+ }
+}
+/**
+ * Removes all of the items from the receiver.
+ * <p>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void removeAll () {
+ checkWidget();
+ OS.gtk_clist_clear (handle);
+ items = new TableItem [4];
+ itemCount = 0;
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's selection changes.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener(SelectionListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+/**
+ * Selects the item at the given zero-relative index in the receiver.
+ * If the item at the index was already selected, it remains
+ * selected. Indices that are out of range are ignored.
+ *
+ * @param index the index of the item to select
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void select (int index) {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_select_row (handle, index, 0);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ selection = _getNativeSelection();
+}
+
+/**
+ * Selects the items at the given zero-relative indices in the receiver.
+ * If the item at the index was already selected, it remains
+ * selected. The range of the indices is inclusive. Indices that are
+ * out of range are ignored.
+ *
+ * @param start the start of the range
+ * @param end the end of the range
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void select (int start, int end) {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ for (int i=start; i<=end; i++) {
+ OS.gtk_clist_select_row (handle, i, 0);
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ selection = _getNativeSelection();
+}
+/**
+ * Selects the items at the given zero-relative indices in the receiver.
+ * If the item at the given zero-relative index in the receiver
+ * is not selected, it is selected. If the item at the index
+ * was selected, it remains selected. Indices that are out
+ * of range and duplicate indices are ignored.
+ *
+ * @param indices the array of indices for the items to select
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void select (int [] indices) {
+ checkWidget();
+ if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ for (int i=0; i<indices.length; i++) {
+ OS.gtk_clist_select_row (handle, indices [i], 0);
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ selection = _getNativeSelection();
+}
+/**
+ * Selects all the items in the receiver.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void selectAll () {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_select_all (handle);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ selection = _getNativeSelection();
+}
+
+/**
+ * Returns <code>true</code> if the receiver's header is visible,
+ * and <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's header's visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getHeaderVisible () {
+ checkWidget();
+ return (OS.GTK_WIDGET_FLAGS(handle)&OS.GTK_CLIST_SHOW_TITLES) != 0;
+}
+
+/**
+ * Marks the receiver's header as visible if the argument is <code>true</code>,
+ * and marks it invisible otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, marking
+ * it visible may not actually cause it to be displayed.
+ * </p>
+ *
+ * @param visible the new visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setHeaderVisible (boolean show) {
+ /* FIXME
+ * We should investigate why this optimization is not working.
+ */
+// boolean isVisibleNow = getHeaderVisible();
+// if (show==isVisibleNow) return;
+ if (show) {
+ OS.gtk_clist_column_titles_show (handle);
+ OS.gtk_clist_column_titles_passive(handle);
+ } else {
+ OS.gtk_clist_column_titles_hide (handle);
+ }
+}
+/**
+ * Returns <code>true</code> if the receiver's lines are visible,
+ * and <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the visibility state of the lines
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getLinesVisible() {
+ checkWidget();
+ return false;
+}
+/**
+ * Marks the receiver's lines as visible if the argument is <code>true</code>,
+ * and marks it invisible otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, marking
+ * it visible may not actually cause it to be displayed.
+ * </p>
+ *
+ * @param visible the new visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLinesVisible (boolean show) {
+ checkWidget();
+}
+/**
+ * Selects the item at the given zero-relative index in the receiver.
+ * The current selected is first cleared, then the new item is selected.
+ *
+ * @param index the index of the item to select
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Table#deselectAll()
+ * @see Table#select(int)
+ */
+public void setSelection (int index) {
+ deselectAll ();
+ select (index);
+ selection = _getNativeSelection();
+}
+/**
+ * Selects the items at the given zero-relative indices in the receiver.
+ * The current selected if first cleared, then the new items are selected.
+ *
+ * @param start the start index of the items to select
+ * @param end the end index of the items to select
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Table#deselectAll()
+ * @see Table#select(int,int)
+ */
+public void setSelection (int start, int end) {
+ deselectAll ();
+ select (start, end);
+ selection = _getNativeSelection();
+}
+/**
+ * Selects the items at the given zero-relative indices in the receiver.
+ * The current selected is first cleared, then the new items are selected.
+ *
+ * @param indices the indices of the items to select
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Table#deselectAll()
+ * @see Table#select(int[])
+ */
+public void setSelection (int [] indices) {
+ deselectAll ();
+ select (indices);
+ selection = _getNativeSelection();
+}
+/**
+ * Sets the receiver's selection to be the given array of items.
+ * The current selected is first cleared, then the new items are
+ * selected.
+ *
+ * @param items the array of items
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if one of the item has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Table#deselectAll()
+ * @see Table#select(int)
+ */
+public void setSelection (TableItem [] items) {
+ checkWidget();
+ if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
+ deselectAll ();
+ int length = items.length;
+ if (length == 0) return;
+ if ((style & SWT.SINGLE) != 0) length = 1;
+ for (int i=length-1; i>=0; --i) {
+ int index = indexOf (items [i]);
+ if (index != -1) select (index);
+ }
+ selection = items; /* FIXME */
+}
+/**
+ * Sets the zero-relative index of the item which is currently
+ * at the top of the receiver. This index can change when items
+ * are scrolled or new items are added and removed.
+ *
+ * @param index the index of the top item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setTopIndex (int index) {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_moveto (handle, index, 0, 0.0f, 0.0f);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+
+/**
+ * Shows the item. If the item is already showing in the receiver,
+ * this method simply returns. Otherwise, the items are scrolled until
+ * the item is visible.
+ *
+ * @param item the item to be shown
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the item is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Table#showSelection()
+ */
+public void showItem (TableItem item) {
+// error(SWT.ERROR_NOT_IMPLEMENTED);
+}
+
+/**
+ * Shows the selection. If the selection is already showing in the receiver,
+ * this method simply returns. Otherwise, the items are scrolled until
+ * the selection is visible.
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Table#showItem(TableItem)
+ */
+public void showSelection () {
+ checkWidget();
+ setTopIndex (getSelectionIndex ());
+}
+
+int processSelection (int int0, int int1, int int2) {
+ selection = _getNativeSelection();
+ itemBeingSelected = items [int0];
+ Event event = new Event ();
+ event.item = itemBeingSelected;
+ sendEvent (SWT.Selection, event);
+ return 0;
+}
+
+int processMouseDown (int callData, int arg1, int int2) {
+ OS.gtk_widget_grab_focus(handle);
+
+ // First, see if we have a single or double click
+ GdkEventButton gdkEvent = new GdkEventButton ();
+ OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
+ boolean isDoubleClick = (gdkEvent.type == OS.GDK_2BUTTON_PRESS);
+
+ // We can't just use the x and y coordinates from the Gdk event,
+ // because the actual items are drawn on a special X window
+ Point where = _gdkWindowGetPointer();
+ int eventType;
+ if (isDoubleClick) {
+ eventType = SWT.MouseDoubleClick;
+ Event event = new Event ();
+ event.item=itemBeingSelected;
+ event.x = where.x; event.y = where.y;
+ sendEvent (SWT.DefaultSelection, event);
+ return 1;
+ }
+
+ eventType = SWT.MouseDown;
+ sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, where.x, where.y);
+ if (gdkEvent.button == 3 && menu != null) menu.setVisible (true);
+ return 1;
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java
new file mode 100644
index 0000000..eab13db
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java
@@ -0,0 +1,403 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class represent a column in a table widget.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>LEFT, RIGHT, CENTER</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd> Move, Resize, Selection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+
+public class TableColumn extends Item {
+ Table parent;
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Table</code>) and a style value
+ * describing its behavior and appearance. The item is added
+ * to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TableColumn (Table parent, int style) {
+ super (parent, checkStyle (style));
+ this.parent = parent;
+ createWidget (parent.getColumnCount ());
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Table</code>), a style value
+ * describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TableColumn (Table parent, int style, int index) {
+ super (parent, checkStyle (style));
+ this.parent = parent;
+ createWidget (index);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control is moved or resized, by sending
+ * it one of the messages defined in the <code>ControlListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ControlListener
+ * @see #removeControlListener
+ */
+public void addControlListener(ControlListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Resize,typedListener);
+ addListener (SWT.Move,typedListener);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control is selected, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * <code>widgetSelected</code> is called when the column header is selected.
+ * <code>widgetDefaultSelected</code> is not called.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener (SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+static int checkStyle (int style) {
+ return checkBits (style, SWT.LEFT, SWT.CENTER, SWT.RIGHT, 0, 0, 0);
+}
+void createWidget (int index) {
+ parent.createItem (this, index);
+ text = "";
+}
+/**
+ * Returns a value which describes the position of the
+ * text or image in the receiver. The value will be one of
+ * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>.
+ *
+ * @return the alignment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getAlignment () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & SWT.LEFT) != 0) return SWT.LEFT;
+ if ((style & SWT.CENTER) != 0) return SWT.CENTER;
+ if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
+ return SWT.LEFT;
+}
+public Display getDisplay () {
+ Table parent = this.parent;
+ if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getDisplay ();
+}
+/**
+ * Returns the receiver's parent, which must be a <code>Table</code>.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Table getParent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent;
+}
+/**
+ * Gets the resizable attribute. A column that is
+ * not resizable cannot be dragged by the user but
+ * may be resized by the programmer.
+ *
+ * @return the resizable attribute
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getResizable () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int index = parent.indexOf (this);
+ if (index == -1) return false;
+ GtkCList gtkclist = new GtkCList();
+ OS.memmove(gtkclist, parent.handle, GtkCList.sizeof);
+ int chandle=gtkclist.column;
+ GtkCListColumn gtkcolumn = new GtkCListColumn();
+ OS.memmove(gtkcolumn, chandle+index*GtkCListColumn.sizeof, GtkCListColumn.sizeof);
+ return (gtkcolumn.resizeable == 1) ? true : false;
+}
+/**
+ * Gets the width of the receiver.
+ *
+ * @return the width
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getWidth () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int index = parent.indexOf (this);
+ if (index == -1) return 0;
+ GtkCList gtkclist = new GtkCList();
+ OS.memmove(gtkclist, parent.handle, GtkCList.sizeof);
+ int chandle=gtkclist.column;
+ GtkCListColumn gtkcolumn = new GtkCListColumn();
+ OS.memmove(gtkcolumn, chandle+index*GtkCListColumn.sizeof, GtkCListColumn.sizeof);
+ return gtkcolumn.width;
+}
+/**
+ * Causes the receiver to be resized to its preferred size.
+ * For a composite, this involves computing the preferred size
+ * from its layout, if there is one.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ */
+public void pack () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+void releaseChild () {
+ super.releaseChild ();
+ parent.destroyItem (this);
+}
+void releaseWidget () {
+ super.releaseWidget ();
+ text = null;
+ parent = null;
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is moved or resized.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ControlListener
+ * @see #addControlListener
+ */
+public void removeControlListener (ControlListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Move, listener);
+ eventTable.unhook (SWT.Resize, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is selected.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener(SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+/**
+ * Controls how text and images will be displayed in the receiver.
+ * The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
+ * or <code>CENTER</code>.
+ *
+ * @param alignment the new alignment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setAlignment (int alignment) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
+ int index = parent.indexOf (this);
+ if (index == -1 || index == 0) return;
+ int table = parent.handle;
+ style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
+ style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
+ int justification = 0;
+ if ((style & SWT.LEFT) == SWT.LEFT) justification |= OS.GTK_JUSTIFY_LEFT;
+ if ((style & SWT.CENTER) == SWT.CENTER) justification |= OS.GTK_JUSTIFY_CENTER;
+ if ((style & SWT.RIGHT) == SWT.RIGHT) justification |= OS.GTK_JUSTIFY_RIGHT;
+ OS.gtk_clist_set_column_justification (table, index, justification);
+}
+/**
+ * Sets the resizable attribute. A column that is
+ * not resizable cannot be dragged by the user but
+ * may be resized by the programmer.
+ *
+ * @param resizable the resize attribute
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setResizable (boolean resizable) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int index = parent.indexOf (this);
+ if (index == -1) return;
+ int table = parent.handle;
+ OS.gtk_clist_set_column_resizeable (table, index, resizable);
+}
+public void setText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ super.setText (string);
+ int index = parent.indexOf (this);
+ if (index == -1) return;
+ int table = parent.handle;
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ OS.gtk_clist_set_column_title (table, index, buffer);
+}
+/**
+ * Sets the width of the receiver.
+ *
+ * @param width the new width
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setWidth (int width) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int index = parent.indexOf (this);
+ if (index == -1) return;
+ int table = parent.handle;
+ OS.gtk_clist_set_column_width (table, index, width);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java
new file mode 100644
index 0000000..2750823
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java
@@ -0,0 +1,483 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class represent a selectable user interface object
+ * that represents an item in a table.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+
+public class TableItem extends Item {
+ Table parent;
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Table</code>) and a style value
+ * describing its behavior and appearance. The item is added
+ * to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TableItem (Table parent, int style) {
+ super (parent, style);
+ this.parent = parent;
+ parent.createItem (this, parent.getItemCount ());
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Table</code>), a style value
+ * describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TableItem (Table parent, int style, int index) {
+ super (parent, style);
+ this.parent = parent;
+ parent.createItem (this, index);
+}
+/**
+ * Returns a rectangle describing the receiver's size and location
+ * relative to its parent at a column in the table.
+ *
+ * @param index the index that specifies the column
+ * @return the receiver's bounding column rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Rectangle getBounds (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int CELL_SPACING=1;
+ GtkCList table = new GtkCList();
+ OS.memmove(table, parent.handle, GtkCList.sizeof);
+ int columnHandle = table.column;
+ columnHandle= columnHandle+index*GtkCListColumn.sizeof;
+ GtkCListColumn column=new GtkCListColumn();
+ OS.memmove(column, columnHandle, GtkCListColumn.sizeof);
+ GtkAdjustment adjustment=new GtkAdjustment();
+ OS.memmove(adjustment, table.vadjustment, GtkAdjustment.sizeof);
+ float vaj = adjustment.value;
+ OS.memmove(adjustment, table.hadjustment, GtkAdjustment.sizeof);
+ float haj = adjustment.value;
+ int x=(short)column.area_x+table.hoffset;
+ int width=(short)column.area_width;
+ int height=parent.getItemHeight();
+ int row=parent.indexOf(this);
+ int y=table.column_title_area_height+height*row+(row+2)*CELL_SPACING-(int)vaj;
+ return new Rectangle (x, y, width, height);
+}
+/**
+ * Returns <code>true</code> if the receiver is checked,
+ * and false otherwise. When the parent does not have
+ * the <code>CHECK style, return false.
+ *
+ * @return the checked state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getChecked () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((parent.style & SWT.CHECK) == 0) return false;
+ int index = parent.indexOf (this);
+ if (index == -1) return false;
+ GtkCList gtkclist = new GtkCList();
+ OS.memmove(gtkclist, parent.handle, GtkCList.sizeof);
+ int chandle=gtkclist.row_list;
+ int data = OS.g_list_nth_data(chandle, index);
+ GtkCListRow gtkrow = new GtkCListRow();
+ OS.memmove(gtkrow, data, GtkCListRow.sizeof);
+ return (gtkrow.state == OS.GTK_STATE_SELECTED) ? true : false;
+}
+public Display getDisplay () {
+ Table parent = this.parent;
+ if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getDisplay ();
+}
+/**
+ * Returns <code>true</code> if the receiver is grayed,
+ * and false otherwise. When the parent does not have
+ * the <code>CHECK style, return false.
+ *
+ * @return the grayed state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getGrayed () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((parent.style & SWT.CHECK) == 0) return false;
+ return false;
+}
+
+/**
+* Gets the image at an index.
+* <p>
+* Indexing is zero based.
+*
+* This operation will fail when the index is out
+* of range or an item could not be queried from
+* the OS.
+*
+* @param index the index of the image
+* @return the image
+*
+* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
+* when called from the wrong thread
+* @exception SWTError(ERROR_WIDGET_DISPOSED)
+* when the widget has been disposed
+*/
+public Image getImage (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return null;
+}
+/**
+ * Returns a rectangle describing the size and location
+ * relative to its parent of an image at a column in the
+ * table.
+ *
+ * @param index the index that specifies the column
+ * @return the receiver's bounding image rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Rectangle getImageBounds (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return new Rectangle (0, 0, 0, 0);
+}
+/**
+ * Gets the image indent.
+ *
+ * @return the indent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getImageIndent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return 0;
+}
+/**
+ * Returns the receiver's parent, which must be a <code>Table</code>.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Table getParent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent;
+}
+/**
+* Gets the item text at an index.
+* <p>
+* Indexing is zero based.
+*
+* This operation will fail when the index is out
+* of range or an item could not be queried from
+* the OS.
+*
+* @param index the index of the item
+* @return the item
+*
+* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
+* when called from the wrong thread
+* @exception SWTError(ERROR_WIDGET_DISPOSED)
+* when the widget has been disposed
+* @exception SWTError(ERROR_CANNOT_GET_TEXT)
+* when the operation fails
+*/
+public String getText (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return "";
+}
+void releaseChild () {
+ super.releaseChild ();
+ parent.destroyItem (this);
+}
+void releaseWidget () {
+ super.releaseWidget ();
+ parent = null;
+}
+/**
+ * Sets the checked state of the receiver.
+ *
+ * @param checked the new checked state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setChecked (boolean checked) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((parent.style & SWT.CHECK) == 0) return;
+ int index = parent.indexOf (this);
+ if (index == -1) return;
+ if (checked)
+ OS.gtk_clist_select_row(parent.handle, index, 0);
+ else
+ OS.gtk_clist_unselect_row(parent.handle, index, 0);
+}
+/**
+ * Sets the grayed state of the receiver.
+ *
+ * @param checked the new grayed state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setGrayed (boolean grayed) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+/**
+ * Sets the receiver's image at a column.
+ *
+ * @param index the column index
+ * @param image the new image
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setImage (int index, Image image) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+// if (index == 0) {
+// setImage (image);
+// return;
+// }
+ int row = parent.indexOf (this);
+ if (row == -1) return;
+ int pixmap = 0, mask = 0;
+ if (image != null) {
+ pixmap = image.pixmap;
+ mask = image.mask;
+ }
+ int ctable = parent.handle;
+ if (text != null) {
+ byte [] buffer = Converter.wcsToMbcs (null, text, true);
+ OS.gtk_clist_set_pixtext (ctable, row, index, buffer, (byte) 2, pixmap, mask);
+ } else {
+ OS.gtk_clist_set_pixmap (ctable, row, index, pixmap, mask);
+ }
+}
+public void setImage (Image image) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int row = parent.indexOf (this);
+ if (row == -1) return;
+ super.setImage (image);
+ int ctable = parent.handle;
+ int pixmap = 0, mask = 0;
+ if (image != null) {
+ pixmap = image.pixmap;
+ mask = image.mask;
+ }
+ if (text != null) {
+ byte [] buffer = Converter.wcsToMbcs (null, text, true);
+ OS.gtk_clist_set_pixtext (ctable, row, 0, buffer, (byte) 2, pixmap, mask);
+ } else {
+ OS.gtk_clist_set_pixmap (ctable, row, 0, pixmap, mask);
+ }
+}
+/**
+ * Sets the image for multiple columns in the Table.
+ *
+ * @param images the array of new images
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the array of images is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if one of the images has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setImage (Image [] images) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (images == null) error (SWT.ERROR_NULL_ARGUMENT);
+ for (int i=0; i<images.length; i++) {
+ setImage (i, images [i]);
+ }
+}
+/**
+ * Sets the image indent.
+ *
+ * @param indent the new indent
+ *
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setImageIndent (int indent) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+/**
+ * Sets the receiver's text at a column
+ *
+ * @param index the column index
+ * @param string the new text
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setText (int index, String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (index == 0) {
+ setText (string);
+ return;
+ }
+ int row = parent.indexOf (this);
+ if (row == -1) return;
+ int ctree = parent.handle;
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ if (image != null) {
+ OS.gtk_clist_set_pixtext(ctree, row, index, buffer, (byte) 2, image.pixmap, image.mask);
+ } else {
+ OS.gtk_clist_set_text (ctree, row, index, buffer);
+ }
+}
+public void setText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ int row = parent.indexOf (this);
+ if (row == -1) return;
+ super.setText (string);
+ int ctree = parent.handle;
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ if (image != null) {
+ OS.gtk_clist_set_pixtext(ctree, row, 0, buffer, (byte) 2, image.pixmap, image.mask);
+ } else {
+ OS.gtk_clist_set_text (ctree, row, 0, buffer);
+ }
+}
+/**
+ * Sets the text for multiple columns in the table.
+ *
+ * @param strings the array of new strings
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setText (String [] strings) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (strings == null) error (SWT.ERROR_NULL_ARGUMENT);
+ for (int i=0; i<strings.length; i++) {
+ String string = strings [i];
+ if (string != null) setText (i, string);
+ }
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
new file mode 100644
index 0000000..05e502f
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
@@ -0,0 +1,1230 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class are selectable user interface
+ * objects that allow the user to enter and modify text.
+ * <p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>MULTI, SINGLE, READ_ONLY, WRAP</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>DefaultSelection, Modify, Verify</dd>
+ * </dl>
+ * </p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ */
+
+public class Text extends Scrollable {
+ int textLimit = LIMIT;
+ boolean visibility = true;
+ public final static int LIMIT;
+ public final static String DELIMITER;
+ /*
+ * These values can be different on different platforms.
+ * Therefore they are not initialized in the declaration
+ * to stop the compiler from inlining.
+ */
+ static {
+ LIMIT = 0x7FFFFFFF;
+ DELIMITER = "\n";
+ }
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Text (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+ if ((style & SWT.SINGLE) != 0) {
+ handle = OS.gtk_entry_new ();
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+ } else {
+ scrolledHandle = OS.gtk_scrolled_window_new (0, 0);
+ if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ handle = OS.gtk_text_new (0, 0);
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+ }
+}
+
+Point _computeSize (int a, int b, boolean c) {
+ return super._computeSize (a, b, c);
+}
+
+void setHandleStyle() {
+ OS.gtk_editable_set_editable (handle, (style & SWT.READ_ONLY) == 0);
+ if ((style & SWT.SINGLE) == 0)
+ OS.gtk_text_set_word_wrap (handle, (style & SWT.WRAP) != 0 ? 1 : 0);
+ if (scrolledHandle!=0) setScrollingPolicy();
+ // When 2.0 arrives, we'll be able to set the flat appearance
+
+}
+
+void configure() {
+ _connectParent();
+ if (scrolledHandle != 0) {
+ OS.gtk_container_add (scrolledHandle, handle);
+ }
+}
+
+void showHandle() {
+ if (scrolledHandle != 0) OS.gtk_widget_show (scrolledHandle);
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void hookEvents () {
+ //TO DO - get rid of enter/exit for mouse crossing border
+ super.hookEvents();
+ signal_connect_after(handle, "changed", SWT.Modify, 2);
+ signal_connect (handle, "insert_text", SWT.Verify, 5);
+ signal_connect (handle, "delete_text", SWT.Verify, 4);
+ signal_connect (handle, "activate", SWT.Selection, 2);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's text is modified, by sending
+ * it one of the messages defined in the <code>ModifyListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ModifyListener
+ * @see #removeModifyListener
+ */
+public void addModifyListener (ModifyListener listener) {
+ checkWidget ();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Modify, typedListener);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control is selected, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * <code>widgetSelected</code> is not called for texts.
+ * <code>widgetDefaultSelected</code> is typically called when ENTER is pressed in a single-line text.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener(SelectionListener listener) {
+ checkWidget ();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener(listener);
+ addListener(SWT.Selection,typedListener);
+ addListener(SWT.DefaultSelection,typedListener);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's text is verified, by sending
+ * it one of the messages defined in the <code>VerifyListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see VerifyListener
+ * @see #removeVerifyListener
+ */
+public void addVerifyListener (VerifyListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Verify, typedListener);
+}
+
+/**
+ * Appends a string.
+ * <p>
+ * The new text is appended to the text at
+ * the end of the widget.
+ * </p>
+ *
+ * @param string the string to be appended
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void append (String string) {
+ checkWidget ();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ byte [] buffer = Converter.wcsToMbcs (null, string);
+ if ((style & SWT.SINGLE) != 0) {
+ OS.gtk_entry_append_text(handle, buffer);
+ } else {
+ int length = getCharCount();
+ int [] position = new int [] {length};
+ OS.gtk_editable_insert_text (handle, buffer, buffer.length, position);
+ OS.gtk_editable_set_position (handle, position [0]);
+ }
+}
+
+static int checkStyle (int style) {
+ if ((style & SWT.SINGLE) != 0) style &= ~(SWT.H_SCROLL | SWT.V_SCROLL);
+ if ((style & (SWT.SINGLE | SWT.MULTI)) != 0) return style;
+ if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) != 0) {
+ return style | SWT.MULTI;
+ }
+ return style | SWT.SINGLE;
+}
+/**
+ * Clears the selection.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void clearSelection () {
+ checkWidget ();
+ int position = OS.gtk_editable_get_position (handle);
+ OS.gtk_editable_delete_selection(handle);
+ OS.gtk_editable_set_position (handle, position);
+}
+
+/**
+ * Copies the selected text.
+ * <p>
+ * The current selection is copied to the clipboard.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void copy () {
+ checkWidget ();
+ byte [] clipboard = Converter.wcsToMbcs (null, "CLIPBOARD", true);
+ OS.gtk_selection_owner_set(handle, OS.gdk_atom_intern(clipboard, 0), 0);
+ GtkEditable widget = new GtkEditable ();
+ OS.memmove(widget, handle, GtkEditable.sizeof);
+ int start = Math.min(widget.selection_start_pos, widget.selection_end_pos);
+ int end = Math.max(widget.selection_start_pos, widget.selection_end_pos);
+ widget.clipboard_text = OS.gtk_editable_get_chars(handle, start, end);
+ OS.memmove (handle, widget, GtkEditable.sizeof);
+}
+/**
+ * Cuts the selected text.
+ * <p>
+ * The current selection is first copied to the
+ * clipboard and then deleted from the widget.
+ * </p>
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void cut () {
+ checkWidget ();
+ byte [] clipboard = Converter.wcsToMbcs (null, "CLIPBOARD", true);
+ OS.gtk_selection_owner_set(handle, OS.gdk_atom_intern(clipboard, 0), 0);
+ GtkEditable widget = new GtkEditable ();
+ OS.memmove (widget, handle, GtkEditable.sizeof);
+ int start = Math.min(widget.selection_start_pos, widget.selection_end_pos);
+ int end = Math.max(widget.selection_start_pos, widget.selection_end_pos);
+ widget.clipboard_text = OS.gtk_editable_get_chars(handle, start, end);
+ OS.memmove (handle, widget, GtkEditable.sizeof);
+ OS.gtk_editable_delete_text(handle, start, end);
+}
+
+/**
+ * Gets the line number of the caret.
+ * <p>
+ * The line number of the caret is returned.
+ * </p>
+ *
+ * @return the line number
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getCaretLineNumber () {
+ checkWidget ();
+ int addr_index=getCaretPosition();
+ String tmpString= new String(getText(0,addr_index));
+ return getLineNumberInString(tmpString,'\n');
+}
+
+/**
+ * Gets the location the caret.
+ * <p>
+ * The location of the caret is returned.
+ * </p>
+ *
+ * @return a point, the location of the caret
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getCaretLocation () {
+ checkWidget ();
+ GtkText gtktext = new GtkText ();
+ OS.memmove (gtktext, handle, GtkText.sizeof);
+ return new Point (gtktext.cursor_pos_x, gtktext.cursor_pos_y);
+}
+
+/**
+ * Gets the position of the caret.
+ * <p>
+ * The character position of the caret is returned.
+ * </p>
+ *
+ * @return the position of the caret
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getCaretPosition () {
+ checkWidget ();
+ //return OS.gtk_text_get_point (handle);
+ return OS.gtk_editable_get_position (handle);
+}
+
+
+/**
+ * Gets the number of characters.
+ *
+ * @return number of characters in the widget
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getCharCount () {
+ checkWidget ();
+ if ((style & SWT.SINGLE) != 0) {
+ int address = OS.gtk_editable_get_chars (handle, 0, -1);
+ int length = OS.strlen (address);
+ OS.g_free (address);
+ return length;
+ }
+ return OS.gtk_text_get_length (handle);
+}
+
+/**
+ * Gets the line delimiter.
+ *
+ * @return a string that is the line delimiter
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getLineDelimiter () {
+ checkWidget ();
+ return "\n";
+}
+/**
+ * Gets the double click enabled flag.
+ * <p>
+ * The double click flag enables or disables the
+ * default action of the text widget when the user
+ * double clicks.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getDoubleClickEnabled () {
+ checkWidget ();
+ return true;
+}
+/**
+ * Gets the echo character.
+ * <p>
+ * The echo character is the character that is
+ * displayed when the user enters text or the
+ * text is changed by the programmer.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public char getEchoChar () {
+ checkWidget ();
+ return visibility ? '\0' : '*';
+}
+
+/**
+ * Gets the editable state.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getEditable () {
+ checkWidget ();
+ GtkEditable widget = new GtkEditable ();
+ OS.memmove (widget, handle, GtkEditable.sizeof);
+ return widget.editable!=0;
+}
+
+/**
+ * Gets the number of lines.
+ *
+ * @return the number of lines in the widget
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getLineCount () {
+ checkWidget ();
+ return getLineNumberInString(new String(getText()),'\n') + 1;
+}
+/**
+ * Gets the height of a line.
+ *
+ * @return the height of a row of text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getLineHeight () {
+ checkWidget ();
+ Font font = getFont();
+ GdkFont gdkfont = new GdkFont();
+ int fontHandle = font.handle;
+ OS.memmove(gdkfont, fontHandle, GdkFont.sizeof);
+ return gdkfont.ascent + gdkfont.descent;
+
+}
+/**
+ * Gets the position of the selected text.
+ * <p>
+ * Indexing is zero based. The range of
+ * a selection is from 0..N where N is
+ * the number of characters in the widget.
+ * </p>
+ *
+ * @return the start and end of the selection
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getSelection () {
+ checkWidget ();
+ GtkEditable widget = new GtkEditable ();
+ OS.memmove (widget, handle, GtkEditable.sizeof);
+ return new Point (widget.selection_start_pos, widget.selection_end_pos);
+}
+/**
+ * Gets the number of selected characters.
+ *
+ * @return the number of selected characters.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelectionCount () {
+ checkWidget ();
+ GtkEditable widget = new GtkEditable ();
+ OS.memmove (widget, handle, GtkEditable.sizeof);
+ int start = Math.min(widget.selection_start_pos, widget.selection_end_pos);
+ int end = Math.max(widget.selection_start_pos, widget.selection_end_pos);
+ return end - start;
+}
+/**
+ * Gets the selected text.
+ *
+ * @return the selected text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getSelectionText () {
+ checkWidget ();
+ GtkEditable widget = new GtkEditable ();
+ OS.memmove (widget, handle, GtkEditable.sizeof);
+ int start = Math.min(widget.selection_start_pos,widget.selection_end_pos);
+ int end = Math.max(widget.selection_start_pos,widget.selection_end_pos);
+ int address = OS.gtk_editable_get_chars (handle, start, end);
+ int length = OS.strlen (address);
+ byte [] buffer1 = new byte [length];
+ OS.memmove (buffer1, address, length);
+ OS.g_free (address);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ return new String (buffer2, 0, buffer2.length);
+}
+
+/**
+ * Gets the number of tabs.
+ * <p>
+ * Tab stop spacing is specified in terms of the
+ * space (' ') character. The width of a single
+ * tab stop is the pixel width of the spaces.
+ * </p>
+ *
+ * @return the number of tab characters
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getTabs () {
+ checkWidget ();
+ GtkText widget= new GtkText();
+ OS.memmove(widget, handle, GtkText.sizeof);
+ return widget.default_tab_width;
+}
+
+/**
+ * Gets the widget text.
+ * <p>
+ * The text for a text widget is the characters in the widget.
+ * </p>
+ *
+ * @return the widget text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getText () {
+ checkWidget ();
+ int address = OS.gtk_editable_get_chars (handle, 0, -1);
+ int length = OS.strlen (address);
+ byte [] buffer1 = new byte [length];
+ OS.memmove (buffer1, address, length);
+ OS.g_free (address);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ return new String (buffer2, 0, buffer2.length);
+}
+
+/**
+ * Gets a range of text.
+ * <p>
+ * Indexing is zero based. The range of
+ * a selection is from 0..N-1 where N is
+ * the number of characters in the widget.
+ * </p>
+ *
+ * @param start the start of the range
+ * @param end the end of the range
+ * @return the range of text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getText (int start, int end) {
+ checkWidget ();
+ int address = OS.gtk_editable_get_chars (handle, start, end);
+ if (address == 0) return null;
+ int length = OS.strlen (address);
+ byte [] buffer1 = new byte [length];
+ OS.memmove (buffer1, address, length);
+ OS.g_free (address);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ return new String (buffer2, 0, buffer2.length);
+}
+
+/**
+ * Returns the maximum number of characters that the receiver is capable of holding.
+ * <p>
+ * If this has not been changed by <code>setTextLimit()</code>,
+ * it will be the constant <code>Text.LIMIT</code>.
+ * </p>
+ *
+ * @return the text limit
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getTextLimit () {
+ checkWidget ();
+ if ((style & SWT.SINGLE) != 0) return textLimit;
+ return LIMIT;
+}
+
+/**
+ * Returns the zero-relative index of the line which is currently
+ * at the top of the receiver.
+ * <p>
+ * This index can change when lines are scrolled or new lines are added or removed.
+ * </p>
+ *
+ * @return the index of the top line
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getTopIndex () {
+ checkWidget ();
+ if ((style & SWT.SINGLE) != 0) return 0;
+ GtkText widget = new GtkText ();
+ OS.memmove (widget, handle, GtkText.sizeof);
+ int topCharIndex=widget.first_line_start_index;
+ return (getLineNumberInString(getText(0,topCharIndex), '\n'));
+ //Since getText uses substring (start, end + 1),so topCharIndex-1
+}
+
+/**
+ * Gets the top pixel.
+ * <p>
+ * The top pixel is the pixel position of the line
+ * that is currently at the top of the widget. On
+ * some platforms, a text widget can be scrolled by
+ * pixels instead of lines so that a partial line
+ * is displayed at the top of the widget.
+ * </p><p>
+ * The top pixel changes when the widget is scrolled.
+ * The top pixel does not include the widget trimming.
+ * </p>
+ *
+ * @return the pixel position of the top line
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getTopPixel () {
+ checkWidget ();
+ if ((style & SWT.SINGLE) != 0) return 0;
+ GtkText widget= new GtkText();
+ OS.memmove(widget, handle, GtkText.sizeof);
+ return widget.first_onscreen_ver_pixel;
+}
+
+boolean getWrap () {
+ checkWidget ();
+ return false;
+}
+
+/**
+ * Inserts a string.
+ * <p>
+ * The old selection is replaced with the new text.
+ * </p>
+ *
+ * @param string the string
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void insert (String string) {
+ checkWidget ();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ byte [] buffer = Converter.wcsToMbcs (null, string);
+ GtkEditable widget = new GtkEditable ();
+ OS.memmove (widget, handle, GtkEditable.sizeof);
+ int start = Math.min(widget.selection_start_pos, widget.selection_end_pos);
+ int end = Math.max(widget.selection_start_pos, widget.selection_end_pos);
+ OS.gtk_editable_delete_text (handle, start, end);
+ int [] position = new int [] {start};
+ OS.gtk_editable_insert_text (handle, buffer, buffer.length, position);
+}
+
+/**
+ * Pastes text from clipboard.
+ * <p>
+ * The selected text is deleted from the widget
+ * and new text inserted from the clipboard.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void paste () {
+ checkWidget ();
+ byte [] clipboard = Converter.wcsToMbcs (null, "CLIPBOARD", true);
+ byte [] compound = Converter.wcsToMbcs (null, "COMPOUND_TEXT", true);
+ int clipboard_atom = OS.gdk_atom_intern (clipboard, 0);
+ int compound_atom = OS.gdk_atom_intern (compound, 0);
+ OS.gtk_selection_convert(handle, clipboard_atom, compound_atom, 0);
+}
+
+int processModify (int arg0, int arg1, int int2) {
+ sendEvent (SWT.Modify);
+ return 0;
+}
+
+int processVerify (int int0, int int1, int int2) {
+ if (!hooks (SWT.Verify)) return 0;
+ if (int2 != 0) {
+ // Insert
+ if (int0 == 0 || int1==0){
+ return 0;
+ }
+// int length = OS.strlen (int0);
+ byte [] buffer1 = new byte [int1];
+ OS.memmove (buffer1, int0, buffer1.length);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ String oldText = new String (buffer2, 0, buffer2.length);
+ int [] position = new int [1];
+ OS.memmove (position, int2, 4);
+ if (position [0] == -1) position [0] = OS.gtk_text_get_length (handle);
+ String newText = verifyText (oldText, position [0], position [0]); //WRONG POSITION
+ if (newText == null) {
+ byte [] insert_text = Converter.wcsToMbcs (null, "insert-text", true);
+ OS.gtk_signal_emit_stop_by_name (handle, insert_text);
+ return 0;
+ }
+ if (newText != oldText) {
+ int windowProc5 = getDisplay ().windowProc5;
+ byte [] buffer3 = Converter.wcsToMbcs (null, newText);
+ OS.gtk_signal_handler_block_by_func (handle, windowProc5, SWT.Verify);
+ OS.gtk_editable_insert_text (handle, buffer3, buffer3.length, position);
+ OS.gtk_signal_handler_unblock_by_func (handle, windowProc5, SWT.Verify);
+ byte [] insert_text = Converter.wcsToMbcs (null, "insert-text", true);
+ OS.gtk_signal_emit_stop_by_name (handle, insert_text);
+ return 0;
+ }
+ } else {
+ // Delete
+ int address = OS.gtk_editable_get_chars (handle, int0, int1);
+ int length = OS.strlen (address);
+ byte [] buffer1 = new byte [length];
+ OS.memmove (buffer1, address, length);
+ OS.g_free (address);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ String oldText = new String (buffer2, 0, buffer2.length);
+ String newText = verifyText (oldText, int0, int1);
+ if (newText == null) {
+ byte [] delete_text = Converter.wcsToMbcs (null, "delete-text", true);
+ OS.gtk_signal_emit_stop_by_name (handle, delete_text);
+ return 0;
+ }
+ }
+ return 0;
+}
+
+int processSelection (int int0, int int1, int int2) {
+ postEvent (SWT.DefaultSelection);
+ return 0;
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's text is modified.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ModifyListener
+ * @see #addModifyListener
+ */
+public void removeModifyListener (ModifyListener listener) {
+ checkWidget ();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Modify, listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is selected.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener(SelectionListener listener) {
+ checkWidget ();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook(SWT.Selection, listener);
+ eventTable.unhook(SWT.DefaultSelection,listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is verified.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see VerifyListener
+ * @see #addVerifyListener
+ */
+public void removeVerifyListener (VerifyListener listener) {
+ checkWidget ();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Verify, listener);
+}
+
+/**
+ * Selects all the text in the receiver.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void selectAll () {
+ checkWidget ();
+ OS.gtk_editable_select_region (handle, 0, -1);
+}
+
+/**
+ * Sets the double click enabled flag.
+ * <p>
+ * The double click flag enables or disables the
+ * default action of the text widget when the user
+ * double clicks.
+ * </p>
+ *
+ * @param doubleClick the new double click flag
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setDoubleClickEnabled (boolean doubleClick) {
+ checkWidget ();
+}
+
+/**
+ * Sets the echo character.
+ * <p>
+ * The echo character is the character that is
+ * displayed when the user enters text or the
+ * text is changed by the programmer.
+ * </p>
+ *
+ * @param echo the new echo character
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setEchoChar (char echo) {
+ checkWidget ();
+ if ((style & SWT.SINGLE) != 0) {
+ OS.gtk_entry_set_visibility (handle, visibility = echo == '\0');
+ }
+}
+
+/**
+ * Sets the editable state.
+ *
+ * @param editable the new editable state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setEditable (boolean editable) {
+ checkWidget ();
+ OS.gtk_editable_set_editable (handle, editable);
+}
+
+/**
+ * Sets the selection.
+ * <p>
+ * Indexing is zero based. The range of
+ * a selection is from 0..N where N is
+ * the number of characters in the widget.
+ * </p><p>
+ * Text selections are specified in terms of
+ * caret positions. In a text widget that
+ * contains N characters, there are N+1 caret
+ * positions, ranging from 0..N. This differs
+ * from other functions that address character
+ * position such as getText () that use the
+ * regular array indexing rules.
+ * </p>
+ *
+ * @param start new caret position
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (int start) {
+ checkWidget ();
+ OS.gtk_editable_set_position (handle, start);
+}
+
+/**
+ * Sets the selection.
+ * <p>
+ * Indexing is zero based. The range of
+ * a selection is from 0..N where N is
+ * the number of characters in the widget.
+ * </p><p>
+ * Text selections are specified in terms of
+ * caret positions. In a text widget that
+ * contains N characters, there are N+1 caret
+ * positions, ranging from 0..N. This differs
+ * from other functions that address character
+ * position such as getText () that use the
+ * usual array indexing rules.
+ * </p>
+ *
+ * @param start the start of the range
+ * @param end the end of the range
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (int start, int end) {
+ checkWidget ();
+ OS.gtk_editable_set_position (handle, start);
+ OS.gtk_editable_select_region (handle, start, end);
+}
+
+/**
+ * Sets the selection.
+ * <p>
+ * Indexing is zero based. The range of
+ * a selection is from 0..N where N is
+ * the number of characters in the widget.
+ * </p><p>
+ * Text selections are specified in terms of
+ * caret positions. In a text widget that
+ * contains N characters, there are N+1 caret
+ * positions, ranging from 0..N. This differs
+ * from other functions that address character
+ * position such as getText () that use the
+ * usual array indexing rules.
+ * </p>
+ *
+ * @param selection the point
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (Point selection) {
+ checkWidget ();
+ if (selection == null) error (SWT.ERROR_NULL_ARGUMENT);
+ OS.gtk_editable_set_position (handle, selection.x);
+ OS.gtk_editable_select_region (handle, selection.x, selection.y);
+}
+
+ /**
+ * Sets the number of tabs.
+ * <p>
+ * Tab stop spacing is specified in terms of the
+ * space (' ') character. The width of a single
+ * tab stop is the pixel width of the spaces.
+ * </p>
+ *
+ * @param tabs the number of tabs
+ *
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+*/
+public void setTabs (int tabs) {
+ checkWidget ();
+ GtkText widget= new GtkText();
+ widget.default_tab_width=tabs;
+ OS.memmove(handle, widget, GtkText.sizeof);
+}
+
+/**
+ * Sets the contents of the receiver to the given string.
+ *
+ * @param text the new text
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setText (String string) {
+ checkWidget ();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ OS.gtk_editable_delete_text (handle, 0, -1);
+ int [] position = new int [1];
+ byte [] buffer = Converter.wcsToMbcs (null, string);
+ OS.gtk_editable_insert_text (handle, buffer, buffer.length, position);
+ OS.gtk_editable_set_position (handle, 0);
+}
+
+/**
+ * Sets the maximum number of characters that the receiver
+ * is capable of holding to be the argument.
+ *
+ * @param limit new text limit
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_CANNOT_BE_ZERO - if the limit is zero</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setTextLimit (int limit) {
+ checkWidget ();
+ if (limit == 0) error (SWT.ERROR_CANNOT_BE_ZERO);
+ if ((style & SWT.SINGLE) != 0) {
+ textLimit = (short) limit;
+ OS.gtk_entry_set_max_length (handle, (short) limit);
+ }
+}
+
+/**
+ * Sets the zero-relative index of the line which is currently
+ * at the top of the receiver. This index can change when lines
+ * are scrolled or new lines are added and removed.
+ *
+ * @param index the index of the top item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setTopIndex (int index) {
+ checkWidget ();
+ if ((style & SWT.SINGLE) != 0) return;
+ if (index > getLineCount()) return;
+ GtkAdjustment adjustment = new GtkAdjustment();
+ int adjustmentHandle = OS.gtk_scrolled_window_get_vadjustment(scrolledHandle);
+ OS.memmove(adjustment, adjustmentHandle, GtkAdjustment.sizeof);
+ int adjust = (int)(index*adjustment.upper/getLineCount());
+ if (adjust <= 0) {
+ adjust = 0;
+ verticalBar.setSelection(0);
+ } else {
+ verticalBar.setSelection(adjust);
+ }
+ OS.gtk_adjustment_value_changed(verticalBar.handle);
+ int topindex=getTopIndex();
+ int lineheight = getLineHeight();
+ while( topindex != index) {
+ adjust=adjust+lineheight;
+ verticalBar.setSelection(adjust+lineheight);
+ OS.gtk_adjustment_value_changed(verticalBar.handle);
+ topindex=getTopIndex();
+ }
+}
+
+void setWrap (boolean wrap) {
+ checkWidget ();
+ OS.gtk_text_set_word_wrap(handle, wrap ? 1 : 0);
+}
+
+/**
+ * Shows the selection.
+ * <p>
+ * If the selection is already showing
+ * in the receiver, this method simply returns. Otherwise,
+ * lines are scrolled until the selection is visible.
+ * </p>
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void showSelection () {
+ checkWidget ();
+ if ((style & SWT.SINGLE) != 0) return;
+ int start_pos, end_pos, pos;
+ pos = OS.gtk_editable_get_position (handle);
+ GtkEditable widget = new GtkEditable ();
+ OS.memmove (widget, handle, GtkEditable.sizeof);
+ start_pos = Math.min(widget.selection_start_pos, widget.selection_end_pos) ;
+ end_pos = Math.max(widget.selection_start_pos, widget.selection_end_pos) ;
+ GtkText gtktext = new GtkText ();
+ OS.memmove (gtktext, handle, GtkText.sizeof);
+ int topCharIndex=gtktext.first_line_start_index;
+ if ( (topCharIndex > start_pos && topCharIndex < end_pos) || topCharIndex==start_pos ||
+ topCharIndex == end_pos) return;
+ if (pos < start_pos || pos > end_pos) {
+ GtkAdjustment adjustment = new GtkAdjustment();
+ int adjustmentHandle = OS.gtk_scrolled_window_get_vadjustment(scrolledHandle);
+ OS.memmove(adjustment, adjustmentHandle, GtkAdjustment.sizeof);
+ String tmpString= new String(getText(0,start_pos));
+ int currentln=getLineNumberInString(tmpString, '\n');
+ int adjust = (int)(currentln*adjustment.upper/getLineCount()-adjustment.page_increment);
+ if (adjust <= 0)
+ OS.gtk_adjustment_set_value (verticalBar.handle, 0);
+ else
+ OS.gtk_adjustment_set_value (verticalBar.handle, adjust);
+ OS.gtk_adjustment_value_changed(verticalBar.handle);
+ OS.gtk_editable_set_position (handle, widget.selection_end_pos);
+ OS.gtk_editable_select_region (handle, widget.selection_start_pos, widget.selection_end_pos);
+ }
+
+}
+
+String verifyText (String string, int start, int end) {
+ Event event = new Event ();
+ event.text = string;
+ event.start = start;
+ event.end = end;
+ sendEvent (SWT.Verify, event);
+ if (!event.doit) return null;
+ return event.text;
+}
+
+int getLineNumberInString( String string,char delimiter) {
+ int count=0;
+ for (int i=0; i<string.length (); i++) {
+ if (string.charAt (i) == delimiter) count++;
+ }
+ return count;
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
new file mode 100644
index 0000000..b06c11a
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
@@ -0,0 +1,361 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class support the layout of selectable
+ * tool bar items.
+ * <p>
+ * The item children that may be added to instances of this class
+ * must be of type <code>ToolItem</code>.
+ * </p><p>
+ * Note that although this class is a subclass of <code>Composite</code>,
+ * it does not make sense to add <code>Control</code> children to it,
+ * or set a layout on it.
+ * </p><p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>FLAT, WRAP, RIGHT, HORIZONTAL, VERTICAL</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+
+public class ToolBar extends Composite {
+ int boxHandle, tempHandle;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public ToolBar (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+
+ /* FIXME
+ * We do not need an event box here, as event boxes
+ * have real X windows.
+ */
+ boxHandle = OS.gtk_event_box_new ();
+ if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ int orientation = ((style&SWT.VERTICAL)!=0)?
+ OS.GTK_ORIENTATION_VERTICAL : OS.GTK_ORIENTATION_HORIZONTAL;
+ handle = OS.gtk_toolbar_new (orientation, OS.GTK_TOOLBAR_BOTH);
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ tempHandle = OS.gtk_fixed_new();
+ if (tempHandle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void setHandleStyle() {
+ int relief = ((style&SWT.FLAT)!=0)? OS.GTK_RELIEF_NONE : OS.GTK_RELIEF_NORMAL;
+ OS.gtk_toolbar_set_button_relief(handle, relief);
+}
+
+void configure() {
+ _connectParent();
+ OS.gtk_container_add (boxHandle, handle);
+ // invisible handle to temporarily hold control (non-item) items
+ OS.gtk_toolbar_insert_widget (handle,tempHandle,new byte[1], new byte[1],0);
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ if (layout != null) super.computeSize(wHint, hHint, changed);
+ return _computeSize (wHint, hHint, changed);
+}
+
+int eventHandle () {
+ return boxHandle;
+}
+
+void showHandle() {
+ OS.gtk_widget_show (boxHandle);
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+ // don't show the temp fixed
+}
+
+void register() {
+ super.register ();
+ WidgetTable.put (boxHandle, this);
+}
+
+void deregister() {
+ super.deregister ();
+ WidgetTable.remove (boxHandle);
+}
+
+int topHandle() { return boxHandle; }
+int parentingHandle() { return handle; } // event though we override connectChild, we still need this for getChildren
+
+/**
+ * Returns whether the argument points to an OS widget that is
+ * implementing the receiver, i.e., one of my own handles
+ */
+boolean isMyHandle(int h) {
+ if (h==handle) return true;
+ if (h==tempHandle) return true;
+ if (h==boxHandle) return true;
+ return false;
+}
+void _connectChild (int h) {
+ // When we put a widget as a tool item, we don't know which item it is, yet.
+ OS.gtk_fixed_put(tempHandle, h, (short)0, (short)0);
+}
+
+
+/*
+ * === GEOMETRY ===
+ */
+
+boolean _setSize (int width, int height) { UtilFuncs.setSize(boxHandle, width, height); return true; }
+
+
+
+/**
+ * Returns the item at the given, zero-relative index in the
+ * receiver. Throws an exception if the index is out of range.
+ *
+ * @param index the index of the item to return
+ * @return the item at the given index
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public ToolItem getItem (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return getItems()[index];
+}
+
+
+
+/**
+ * Returns the item at the given point in the receiver
+ * or null if no such item exists. The point is in the
+ * coordinate system of the receiver.
+ *
+ * @param point the point used to locate the item
+ * @return the item at the given point
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public ToolItem getItem (Point point) {
+ return null;
+}
+/**
+ * Returns the number of items contained in the receiver.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getItemCount () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ /* FIXME
+ * This code will return the wrong count for items,
+ * as list includes Window children
+ */
+// int list = OS.gtk_container_children (handle);
+// return OS.g_list_length (list);
+ // TEMPORARY CODE
+ return getItems ().length;
+}
+/**
+ * Returns an array of <code>TabItem</code>s which are the items
+ * in the receiver.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the items in the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public ToolItem [] getItems () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int count = 0;
+ int list = OS.gtk_container_children (handle);
+ int length = OS.g_list_length (list);
+ ToolItem [] result = new ToolItem [length];
+ for (int i=0; i<length; i++) {
+ int data = OS.g_list_nth_data (list, i);
+ Widget widget = WidgetTable.get (data);
+ if (widget instanceof ToolItem) {
+ result [count++] = (ToolItem) widget;
+ }
+ }
+ if (length == count) return result;
+ ToolItem [] newResult = new ToolItem [count];
+ System.arraycopy (result, 0, newResult, 0, count);
+ return newResult;
+}
+/**
+ * Returns the number of rows in the receiver. When
+ * the receiver has the <code>WRAP</code> style, the
+ * number of rows can be greater than one. Otherwise,
+ * the number of rows is always one.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+
+public int getRowCount () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return 1;
+}
+
+Control _childFromHandle(int h) {
+ Widget child = WidgetTable.get(h);
+ if (child==null) return null;
+ if (child instanceof ToolItem) return null; // ToolItems are not our children
+ return (Control)child;
+}
+
+/**
+ * Searches the receiver's list starting at the first item
+ * (index 0) until an item is found that is equal to the
+ * argument, and returns the index of that item. If no item
+ * is found, returns -1.
+ *
+ * @param item the search item
+ * @return the index of the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the tool item is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the tool item has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int indexOf (ToolItem item) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
+
+ // TEMPORARY CODE
+ ToolItem [] items = getItems ();
+ for (int i=0; i<items.length; i++) {
+ if (item == items[i]) return i;
+ }
+ return -1;
+}
+int processResize (int int0, int int1, int int2) {
+ ToolItem [] items = getItems ();
+ for (int i=0; i<items.length; i++) {
+ Control control = items [i].control;
+ if (control != null && !control.isDisposed ()) {
+ control.setBounds (items [i].getBounds ());
+ }
+ }
+ return 0;
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ boxHandle = tempHandle = 0;
+}
+
+void releaseWidget () {
+ ToolItem [] items = getItems ();
+ for (int i=0; i<items.length; i++) {
+ ToolItem item = items [i];
+ if (!item.isDisposed ()) {
+ item.releaseWidget ();
+ item.releaseHandle ();
+ }
+ }
+ items = null;
+ super.releaseWidget ();
+}
+
+static int checkStyle (int style) {
+ /*
+ * Even though it is legal to create this widget
+ * with scroll bars, they serve no useful purpose
+ * because they do not automatically scroll the
+ * widget's client area. The fix is to clear
+ * the SWT style.
+ */
+ return style; // & ~(SWT.H_SCROLL | SWT.V_SCROLL);
+}
+
+/*
+ * TEMPORARY CODE. Hack for Eclipse.
+ */
+public void setData (Object data) {
+ super.setData(data);
+ if (data == null) return;
+ if (data.getClass().getName().indexOf("org.eclipse.ui.internal.ShortcutBarPart") != -1)
+ OS.gtk_toolbar_set_orientation(handle, OS.GTK_ORIENTATION_VERTICAL);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
new file mode 100644
index 0000000..e24667e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
@@ -0,0 +1,732 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class represent a selectable user interface object
+ * that represents a button in a tool bar.
+ * <p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>PUSH, CHECK, RADIO, SEPARATOR, DROP_DOWN</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection</dd>
+ * </dl>
+ * </p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ */
+
+public class ToolItem extends Item {
+ int boxHandle;
+ ToolBar parent;
+ Control control;
+ Image hotImage, disabledImage;
+ int currentpixmap;
+ boolean drawHotImage;
+ int position;
+ boolean configured=false;
+ boolean shown=false;
+ private int tooltipsHandle;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>ToolBar</code>) and a style value
+ * describing its behavior and appearance. The item is added
+ * to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public ToolItem (ToolBar parent, int style) {
+ super (parent, checkStyle (style));
+ this.parent = parent;
+ position = parent.getItemCount ();
+ createWidget (position);
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>ToolBar</code>), a style value
+ * describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public ToolItem (ToolBar parent, int style, int index) {
+ super (parent, checkStyle (style));
+ this.parent = parent;
+ int count = parent.getItemCount ();
+ if (!(0 <= index && index <= count)) {
+ error (SWT.ERROR_ITEM_NOT_ADDED);
+ }
+ position = index;
+ createWidget (index);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control is selected, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * When <code>widgetSelected</code> is called when the mouse is over the arrow portion of a drop-down tool,
+ * the event object detail field contains the value <code>SWT.ARROW</code>.
+ * <code>widgetDefaultSelected</code> is not called.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener(SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+static int checkStyle (int style) {
+ return checkBits (style, SWT.PUSH, SWT.CHECK, SWT.RADIO, SWT.SEPARATOR, SWT.DROP_DOWN, 0);
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+ int bits = SWT.SEPARATOR | SWT.RADIO | SWT.CHECK | SWT.PUSH;
+ switch (style & bits) {
+ case SWT.RADIO:
+ case SWT.CHECK:
+ _createToggleHandle(index); return;
+ case SWT.SEPARATOR:
+ _createSeparatorHandle(index); return;
+ case SWT.PUSH:
+ default:
+ _createPushHandle(index); return;
+ }
+}
+
+private void _createSeparatorHandle(int index) {
+ boxHandle = OS.gtk_event_box_new();
+ if (boxHandle==0) error(SWT.ERROR_NO_HANDLES);
+ boolean isVertical = (parent.getStyle()&SWT.VERTICAL) != 0;
+ handle = isVertical? OS.gtk_hseparator_new() : OS.gtk_vseparator_new();
+ if (handle==0) error(SWT.ERROR_NO_HANDLES);
+}
+private void _createPushHandle(int index) {
+ handle = OS.gtk_toolbar_insert_element (parent.handle,
+ OS.GTK_TOOLBAR_CHILD_BUTTON,
+ 0, new byte[1], null, null,
+ 0, 0, 0,
+ index);
+ configured=true;
+ shown=true;
+}
+private void _createToggleHandle(int index) {
+ handle = OS.gtk_toolbar_insert_element (parent.handle,
+ OS.GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
+ 0, new byte[1], null, null,
+ 0, 0, 0,
+ index);
+ configured=true;
+ shown=true;
+}
+
+
+void configure() {
+ // configure is done for non-separators
+ if (configured) return;
+ OS.gtk_toolbar_insert_widget (
+ parent.handle,
+ topHandle(),
+ new byte[1], new byte[1],
+ position);
+ OS.gtk_container_add(boxHandle, handle);
+}
+
+void showHandle() {
+ if (shown) return;
+ if ((parent.getStyle()&SWT.VERTICAL)!=0) OS.gtk_widget_set_usize(handle, 15, 3);
+ else OS.gtk_widget_set_usize(handle, 3, 15);
+ OS.gtk_widget_show(boxHandle);
+ OS.gtk_widget_show(handle);
+}
+
+void register() {
+ super.register ();
+ if (boxHandle != 0) WidgetTable.put (boxHandle, this);
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ boxHandle = 0;
+}
+
+void deregister() {
+ super.deregister ();
+ if (boxHandle != 0) WidgetTable.remove (boxHandle);
+}
+
+int topHandle() {
+ return (boxHandle==0)? handle : boxHandle;
+}
+
+
+/**
+ * Returns a rectangle describing the receiver's size and location
+ * relative to its parent.
+ *
+ * @return the receiver's bounding rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Rectangle getBounds () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return new Rectangle (widget.alloc_x, widget.alloc_y, widget.alloc_width, widget.alloc_height);
+}
+/**
+ * Returns the control that is used to fill the bounds of
+ * the item when the items is a <code>SEPARATOR</code>.
+ *
+ * @return the control
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Control getControl () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return control;
+}
+
+/**
+ * Returns the receiver's disabled image if it has one, or null
+ * if it does not.
+ * <p>
+ * The disabled image is displayed when the receiver is disabled.
+ * </p>
+ *
+ * @return the receiver's disabled image
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Image getDisabledImage () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ error(SWT.ERROR_NOT_IMPLEMENTED);
+ return null;
+}
+
+public Display getDisplay () {
+ ToolBar parent = this.parent;
+ if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getDisplay ();
+}
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise.
+ * <p>
+ * A disabled control is typically not selectable from the
+ * user interface and draws with an inactive or "grayed" look.
+ * </p>
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getEnabled () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return (widget.flags & OS.GTK_SENSITIVE) != 0;
+}
+/**
+ * Returns the receiver's hot image if it has one, or null
+ * if it does not.
+ * <p>
+ * The hot image is displayed when the mouse enters the receiver.
+ * </p>
+ *
+ * @return the receiver's hot image
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Image getHotImage () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return null;
+}
+/**
+ * Returns the receiver's parent, which must be a <code>ToolBar</code>.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public ToolBar getParent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent;
+}
+/**
+ * Returns <code>true</code> if the receiver is selected,
+ * and false otherwise.
+ * <p>
+ * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
+ * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
+ * it is selected when it is pushed.
+ * </p>
+ *
+ * @return the selection state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getSelection () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return false;
+ return OS.gtk_toggle_button_get_active (handle);
+}
+/**
+ * Returns the receiver's tool tip text, or null if it has not been set.
+ *
+ * @return the receiver's tool tip text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getToolTipText () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return "";
+}
+/**
+ * Gets the width of the receiver.
+ *
+ * @return the width
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getWidth () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return widget.alloc_width;
+}
+void hookEvents () {
+ if ((style & SWT.SEPARATOR) != 0) return;
+ signal_connect(handle, "clicked", SWT.Selection, 2);
+ signal_connect(handle, "enter-notify-event", SWT.MouseEnter, 3);
+ signal_connect(handle, "leave-notify-event", SWT.MouseExit, 3);
+}
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise.
+ * <p>
+ * A disabled control is typically not selectable from the
+ * user interface and draws with an inactive or "grayed" look.
+ * </p>
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isEnabled () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return getEnabled () && parent.isEnabled ();
+}
+
+int processMouseEnter (int int0, int int1, int int2) {
+ drawHotImage = (parent.style & SWT.FLAT) != 0 && hotImage != null;
+ if ( drawHotImage && (currentpixmap != 0) ) {
+ OS.gtk_pixmap_set (currentpixmap, hotImage.pixmap, hotImage.mask);
+ }
+ return 0;
+}
+
+int processMouseExit (int int0, int int1, int int2) {
+ if (drawHotImage) {
+ drawHotImage = false;
+ if (currentpixmap != 0 && image != null){
+ OS.gtk_pixmap_set (currentpixmap, image.pixmap, image.mask);
+ }
+ }
+ return 0;
+}
+/*
+int processPaint (int int0, int int1, int int2) {
+ if (ignorePaint) return 0;
+ Image currentImage = drawHotImage ? hotImage : image;
+ if (!getEnabled()) {
+ Display display = getDisplay ();
+ currentImage = disabledImage;
+ if (currentImage == null) {
+ currentImage = new Image (display, image, SWT.IMAGE_DISABLE);
+ }
+ }
+ if (currentpixmap != 0 && currentImage != null)
+ OS.gtk_pixmap_set (currentpixmap, currentImage.pixmap, currentImage.mask);
+ return 0;
+}
+*/
+int processSelection (int int0, int int1, int int2) {
+ if ((style & SWT.RADIO) != 0) {
+ this.setSelection (true);
+ ToolItem [] items = parent.getItems ();
+ int index = 0;
+ while (index < items.length && items [index] != this) index++;
+ ToolItem item;
+ int i = index;
+ while (--i >= 0 && ((item = items [i]).style & SWT.RADIO) != 0) {
+ item.setSelection (false);
+ }
+ i = index;
+ while (++i < items.length && ((item = items [i]).style & SWT.RADIO) != 0) {
+ item.setSelection (false);
+ }
+ }
+ Event event = new Event ();
+ postEvent (SWT.Selection, event);
+ return 0;
+}
+void releaseWidget () {
+ super.releaseWidget ();
+ tooltipsHandle = 0;
+ parent = null;
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is selected.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener(SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+/**
+ * Sets the control that is used to fill the bounds of
+ * the item when the items is a <code>SEPARATOR</code>.
+ *
+ * @param control the new control
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
+ * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setControl (Control control) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & SWT.SEPARATOR) == 0) return;
+
+ this.control = control;
+ if (control==null) return;
+
+ // first, remove the current control from the box and throw it away
+ WidgetTable.remove(handle);
+ OS.gtk_widget_destroy(handle);
+ WidgetTable.remove(boxHandle);
+
+ // put the specified control in the box
+ handle = control.topHandle();
+ OS.gtk_widget_reparent(handle, boxHandle);
+ OS.gtk_widget_show(handle);
+ WidgetTable.put(handle, control);
+ WidgetTable.put(boxHandle, control);
+}
+/**
+ * Sets the receiver's disabled image to the argument, which may be
+ * null indicating that no disabled image should be displayed.
+ * <p>
+ * The disbled image is displayed when the receiver is disabled.
+ * </p>
+ *
+ * @param image the disabled image to display on the receiver (may be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setDisabledImage (Image image) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & SWT.SEPARATOR) != 0) return;
+ disabledImage = image;
+}
+/**
+ * Enables the receiver if the argument is <code>true</code>,
+ * and disables it otherwise.
+ * <p>
+ * A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ * </p>
+ *
+ * @param enabled the new enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setEnabled (boolean enabled) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_widget_set_sensitive (handle, enabled);
+}
+/**
+ * Sets the receiver's hot image to the argument, which may be
+ * null indicating that no hot image should be displayed.
+ * <p>
+ * The hot image is displayed when the mouse enters the receiver.
+ * </p>
+ *
+ * @param image the hot image to display on the receiver (may be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setHotImage (Image image) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & SWT.SEPARATOR) != 0) return;
+ hotImage = image;
+}
+public void setImage (Image image) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ super.setImage (image);
+ if ((style & SWT.SEPARATOR) != 0) return;
+ int list = OS.gtk_container_children (handle);
+ if (list != 0) {
+ int widget = OS.g_list_nth_data (list, 0);
+ if (widget != 0) OS.gtk_widget_destroy (widget);
+ }
+ if (image != null) {
+ int pixmap = OS.gtk_pixmap_new (image.pixmap, image.mask);
+ OS.gtk_container_add (handle, pixmap);
+ OS.gtk_widget_show (pixmap);
+ currentpixmap = pixmap;
+ }
+}
+/**
+ * Sets the selection state of the receiver.
+ * <p>
+ * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
+ * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
+ * it is selected when it is pushed.
+ * </p>
+ *
+ * @param selected the new selection state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (boolean selected) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return;
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_toggle_button_set_active (handle, selected);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+public void setText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if ((style & SWT.SEPARATOR) != 0) return;
+ text = string;
+ if ((style & SWT.ARROW) != 0) return;
+ int length = string.length ();
+ char [] text = new char [length + 1];
+ char [] pattern = new char [length + 1];
+ string.getChars (0, length, text, 0);
+ int i = 0, j = 0;
+ while (i < length) {
+ pattern [j] = ' ';
+ if (text [i] == '&') {
+ i++;
+ if (i < length && text [i] != '&') {
+ pattern [j] = '_';
+ }
+ }
+ text [j++] = text [i++];
+ }
+ while (j < i) {
+ text [j] = pattern [j] = '\0';
+ j++;
+ }
+ int list = OS.gtk_container_children (handle);
+ if (list != 0) {
+ int widget = OS.g_list_nth_data (list, 0);
+ if (widget != 0) OS.gtk_widget_destroy (widget);
+ }
+ byte [] buffer1 = Converter.wcsToMbcs (null, text);
+ int label = OS.gtk_label_new (buffer1);
+ byte [] buffer2 = Converter.wcsToMbcs (null, pattern);
+ OS.gtk_label_set_pattern (label, buffer2);
+ OS.gtk_container_add (handle, label);
+ OS.gtk_widget_show (label);
+}
+/**
+ * Sets the receiver's tool tip text to the argument, which
+ * may be null indicating that no tool tip text should be shown.
+ *
+ * @param string the new tool tip text (or null)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setToolTipText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (tooltipsHandle == 0) tooltipsHandle = OS.gtk_tooltips_new();
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ OS.gtk_tooltips_set_tip(tooltipsHandle, handle, buffer, null);
+}
+/**
+ * Sets the width of the receiver.
+ *
+ * @param width the new width
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setWidth (int width) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & SWT.SEPARATOR) == 0) return;
+
+ Point size = control.computeSize(width, SWT.DEFAULT);
+ control.setSize(size);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
new file mode 100644
index 0000000..dfc7b30
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java
@@ -0,0 +1,388 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class implement rubber banding rectangles.
+ *
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Move</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+public class Tracker extends Widget {
+ Composite parent;
+ Display display;
+ boolean tracking, stippled;
+ Rectangle [] rectangles = new Rectangle [0];
+
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a widget which will be the parent of the new instance (cannot be null)
+ * @param style the style of widget to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Tracker (Composite parent, int style) {
+ super (parent, style);
+ this.parent = parent;
+ display = parent.getDisplay ();
+}
+
+/**
+ * Constructs a new instance of this class given the display
+ * to create it on and a style value describing its behavior
+ * and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p><p>
+ * Note: Currently, null can be passed in for the display argument.
+ * This has the effect of creating the tracker on the currently active
+ * display if there is one. If there is no current display, the
+ * tracker is created on a "default" display. <b>Passing in null as
+ * the display argument is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param display the display to create the tracker on
+ * @param style the style of control to construct
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public Tracker (Display display, int style) {
+ if (display == null) display = Display.getCurrent ();
+ if (display == null) display = Display.getDefault ();
+ if (!display.isValidThread ()) {
+ error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ }
+ this.style = style;
+ this.display = display;
+}
+
+
+
+/*
+ * === ADD / REMOVE LISTENERS ===
+ */
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control is moved or resized, by sending
+ * it one of the messages defined in the <code>ControlListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ControlListener
+ * @see #removeControlListener
+ */
+public void addControlListener(ControlListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Move,typedListener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is moved or resized.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ControlListener
+ * @see #addControlListener
+ */
+public void removeControlListener (ControlListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Move, listener);
+}
+
+
+
+
+/*
+ * === PUBLIC ACCESSORS ===
+ */
+
+public Display getDisplay () {
+ return display;
+}
+
+/**
+ * Returns the bounds of the Rectangles being drawn.
+ *
+ * @return the bounds of the Rectangles being drawn
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Rectangle [] getRectangles () {
+ checkWidget();
+ return rectangles;
+}
+
+/**
+ * Returns <code>true</code> if the rectangles are drawn with a stippled line, <code>false</code> otherwise.
+ *
+ * @return the stippled effect of the rectangles
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getStippled () {
+ checkWidget();
+ return stippled;
+}
+
+/**
+ * Specify the rectangles that should be drawn.
+ *
+ * @param rectangles the bounds of the rectangles to be drawn
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setRectangles (Rectangle [] rectangles) {
+ checkWidget();
+ this.rectangles = rectangles;
+}
+
+/**
+ * Change the appearance of the line used to draw the rectangles.
+ *
+ * @param stippled <code>true</code> if rectangle should appear stippled
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setStippled (boolean stippled) {
+ checkWidget();
+ this.stippled = stippled;
+}
+
+
+
+/*
+ * === PUBLIC FUNCTIONALITY ===
+ */
+
+/**
+ * Stop displaying the tracker rectangles.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void close () {
+ checkWidget();
+ tracking = false;
+}
+
+/**
+ * Start displaying the Tracker rectangles.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean open () {
+ checkWidget();
+ int xWindow = calculateWindow();
+ boolean cancelled=false;
+ tracking = true;
+ drawRectangles ();
+
+ int[] newX = new int[1];
+ int[] newY = new int[1];
+ int[] oldX = new int[1];
+ int[] oldY = new int[1];
+ OS.gdk_window_get_pointer(xWindow, oldX,oldY, 0);
+
+ while (tracking) {
+ if (parent != null && parent.isDisposed ()) break;
+ int eventType = waitEvent();
+ switch (eventType) {
+ case OS.GDK_BUTTON_RELEASE:
+ case OS.GDK_MOTION_NOTIFY:
+ OS.gdk_window_get_pointer(xWindow, newX,newY, 0);
+ if (oldX [0] != newX [0] || oldY [0] != newY [0]) {
+ drawRectangles ();
+ for (int i=0; i<rectangles.length; i++) {
+ rectangles [i].x += newX [0] - oldX [0];
+ rectangles [i].y += newY [0] - oldY [0];
+ }
+ Event event = new Event();
+ event.x = newX[0];
+ event.y = newY[0];
+ sendEvent (SWT.Move,event);
+ drawRectangles ();
+ oldX [0] = newX [0]; oldY [0] = newY [0];
+ }
+ tracking = (eventType != OS.GDK_BUTTON_RELEASE);
+ break;
+ case OS.GDK_KEY_PRESS:
+// error(SWT.ERROR_NOT_IMPLEMENTED);
+ /*
+ XKeyEvent keyEvent = new XKeyEvent ();
+ OS.memmove (keyEvent, xEvent, XKeyEvent.sizeof);
+ if (keyEvent.keycode != 0) {
+ int [] keysym = new int [1];
+ OS.XLookupString (keyEvent, null, 0, keysym, null);
+ keysym [0] &= 0xFFFF;
+ tracking = keysym [0] != OS.XK_Escape && keysym [0] != OS.XK_Cancel;
+ cancelled = !tracking;
+ }*/
+ break;
+ } // switch
+ } // while
+ drawRectangles(); // clean up our mess
+ tracking = false;
+ return !cancelled;
+}
+
+
+
+private void drawRectangles () {
+ int xWindow = calculateWindow();
+ if (parent != null) {
+ if (parent.isDisposed ()) return;
+ parent.getShell ().update ();
+ } else {
+ display.update ();
+ }
+
+ int gc = OS.gdk_gc_new(xWindow);
+ if (gc==0) error(SWT.ERROR_UNSPECIFIED);
+
+ /* White foreground */
+ int colormap = OS.gdk_colormap_get_system();
+ GdkColor color = new GdkColor();
+ OS.gdk_color_white(colormap, color);
+ OS.gdk_gc_set_foreground(gc, color);
+
+ /* Draw on top of inferior widgets */
+ OS.gdk_gc_set_subwindow(gc, OS.GDK_INCLUDE_INFERIORS);
+
+ /* XOR */
+ OS.gdk_gc_set_function(gc, OS.GDK_XOR);
+
+ for (int i=0; i<rectangles.length; i++) {
+ Rectangle rect = rectangles [i];
+ OS.gdk_draw_rectangle(xWindow, gc, 0, rect.x, rect.y, rect.width, rect.height);
+ }
+ OS.gdk_gc_destroy(gc);
+}
+/*
+ * Wait for an event to show up.
+ * Return the event's type as a GdkEventType.
+ */
+private int waitEvent() {
+ int[] eventType = new int[1];
+ int eventPtr;
+
+ while (true) {
+ eventPtr = OS.gdk_event_get();
+ if (eventPtr != 0) {
+ // hack, must implement memmove properly
+ // GdkEvent event = new GdkEvent(eventPtr);
+ OS.memmove(eventType, eventPtr, 4);
+ OS.gdk_event_free(eventPtr);
+ return eventType[0];
+ }
+ else {
+ try { Thread.sleep(50); } catch (Exception ex) {}
+ }
+ }
+}
+
+/*
+ * Figure which GdkWindow we'll draw on.
+ * That's normally the root X window, or the parent's GdkWindow if we have a parent.
+ */
+private int calculateWindow() {
+ int answer;
+ if (parent == null) {
+ answer = OS.GDK_ROOT_PARENT();
+ } else {
+ answer = parent._gdkWindow();
+ }
+ if (answer==0) error(SWT.ERROR_UNSPECIFIED);
+ return answer;
+}
+
+public void setCursor (Cursor value) {
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
new file mode 100644
index 0000000..0bc4953
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
@@ -0,0 +1,820 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+
+/**
+ * Instances of this class provide a selectable user interface object
+ * that displays a hierarchy of items and issue notificiation when an
+ * item in the hierarchy is selected.
+ * <p>
+ * The item children that may be added to instances of this class
+ * must be of type <code>TreeItem</code>.
+ * </p><p>
+ * Note that although this class is a subclass of <code>Composite</code>,
+ * it does not make sense to add <code>Control</code> children to it,
+ * or set a layout on it.
+ * </p><p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>SINGLE, MULTI, CHECK</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection, DefaultSelection, Collapse, Expand</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+public class Tree extends Composite {
+ TreeItem [] items;
+ TreeItem selectedItem;
+
+ boolean ignoreExpand, ignoreCollapse;
+ TreeItem itemInInsertion;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Tree (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+static int checkStyle (int style) {
+ /*
+ * To be compatible with Windows, force the H_SCROLL
+ * and V_SCROLL style bits. On Windows, it is not
+ * possible to create a tree without scroll bars.
+ */
+ style |= SWT.H_SCROLL | SWT.V_SCROLL;
+ return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+
+ eventBoxHandle = OS.gtk_fixed_new(); // false for homogeneous; doesn't really matter
+ if (eventBoxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ scrolledHandle = OS.gtk_scrolled_window_new (0, 0);
+ if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ handle = OS.gtk_ctree_new (1, 0);
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void setHandleStyle() {
+ setSelectionPolicy();
+ if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) != 0) {
+ }
+ setScrollingPolicy();
+}
+
+void setSelectionPolicy() {
+ int selectionPolicy = ((style & SWT.MULTI) != 0)?
+ OS.GTK_SELECTION_EXTENDED :
+ OS.GTK_SELECTION_BROWSE;
+ OS.gtk_clist_set_selection_mode (handle, selectionPolicy);
+}
+
+void configure() {
+ _connectParent();
+ OS.gtk_container_add (eventBoxHandle, scrolledHandle);
+ OS.gtk_container_add (scrolledHandle, handle);
+}
+
+void showHandle() {
+ OS.gtk_widget_show (eventBoxHandle);
+ OS.gtk_widget_show (scrolledHandle);
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void hookEvents () {
+ //TO DO - get rid of enter/exit for mouse crossing border
+ super.hookEvents ();
+ signal_connect (handle, "tree_select_row", SWT.Selection, 4);
+ signal_connect (handle, "tree_expand", SWT.Expand, 3);
+ signal_connect (handle, "tree_collapse", SWT.Collapse, 3);
+}
+
+void createWidget (int index) {
+ super.createWidget (index);
+ items = new TreeItem [4];
+}
+
+int topHandle() { return eventBoxHandle; }
+int parentingHandle() { return eventBoxHandle; } // FIXME - Temporary placeholder
+boolean isMyHandle(int h) {
+ if (h==eventBoxHandle) return true;
+ if (h==scrolledHandle) return true;
+ if (h==handle) return true;
+ return false;
+}
+void _connectChild() {
+ error(SWT.ERROR_UNSPECIFIED);
+}
+Control[] _getChildren() {
+ return new Control[0];
+}
+
+
+/*
+ * === GEOMETRY ===
+ */
+
+
+protected Point _getClientAreaSize () {
+ return UtilFuncs.getSize(handle);
+}
+
+boolean _setSize(int width, int height) {
+ boolean differentExtent = UtilFuncs.setSize (eventBoxHandle, width,height);
+ UtilFuncs.setSize (scrolledHandle, width, height);
+ return differentExtent;
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ if (wHint == SWT.DEFAULT) wHint = 200;
+ //scrolledHandle
+ return _computeSize (wHint, hHint, changed);
+}
+
+
+/*
+ * === ADD/REMOVE LISTENERS ===
+ */
+
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's selection changes, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * When <code>widgetSelected</code> is called, the item field of the event object is valid.
+ * If the reciever has <code>SWT.CHECK</code> style set and the check selection changes,
+ * the event object detail field contains the value <code>SWT.CHECK</code>.
+ * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener(SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection, typedListener);
+ addListener (SWT.DefaultSelection, typedListener);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when an item in the receiver is expanded or collapsed
+ * by sending it one of the messages defined in the <code>TreeListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see TreeListener
+ * @see #removeTreeListener
+ */
+public void addTreeListener(TreeListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Expand, typedListener);
+ addListener (SWT.Collapse, typedListener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's selection changes.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener (SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when items in the receiver are expanded or collapsed..
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see TreeListener
+ * @see #addTreeListener
+ */
+public void removeTreeListener(TreeListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Expand, listener);
+ eventTable.unhook (SWT.Collapse, listener);
+}
+
+/*
+ * === WIDGET SPECIFIC LOGIC ===
+ */
+
+void createItem (TreeItem item, int node, int index) {
+ int id = 0;
+ while (id < items.length && items [id] != null) id++;
+ if (id == items.length) {
+ TreeItem [] newItems = new TreeItem [items.length + 4];
+ System.arraycopy (items, 0, newItems, 0, items.length);
+ items = newItems;
+ }
+
+ /* Feature in GTK.
+ * When the selection policy is BROWSE (which is what we use for SINGLE),
+ * the first item added gets automatically selected. This leads to some
+ * nontrivial complications which one better avoid. The hack is to
+ * temporarily put a value other than GTK_SELECTION_BROWSE into the
+ * selectionMode field just for the insertion. Do not use the policy
+ * changing API because this will cause a selection callback.
+ */
+ int[] sm = new int[1];
+ OS.memmove(sm, handle+148, 1);
+ int selectionMode = sm[0];
+ sm[0] = OS.GTK_SELECTION_MULTIPLE;
+ OS.memmove(handle+148, sm, 1);
+
+ itemInInsertion = item;
+ item.handle = OS.gtk_ctree_insert_node (handle,
+ node, // parent
+ 0, // sibling
+ null, // text
+ (byte) 2, // extra space between icon and text
+ 0, 0, 0, 0, // open/close pixmap/mask
+ false, // isLeaf
+ false); // expanded
+ itemInInsertion = null;
+ OS.gtk_ctree_node_set_row_data (handle, item.handle, id + 1);
+
+ sm[0] = selectionMode;
+ OS.memmove(handle+148, sm, 1);
+
+ items [id] = item;
+}
+
+/*
+ * === SELECTION STORY ===
+ */
+
+/**
+ * Returns an array of <code>TreeItem</code>s that are currently
+ * selected in the receiver. An empty array indicates that no
+ * items are selected.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its selection, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ * @return an array representing the selection
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TreeItem[] getSelection () {
+ checkWidget();
+ return _getNativeSelection();
+}
+private TreeItem[] _getNativeSelection() {
+ GtkCList clist = new GtkCList ();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ switch (clist.selection_mode) {
+// case OS.GTK_SELECTION_SINGLE: return getSelection_single();
+ case OS.GTK_SELECTION_BROWSE: return getSelection_browse();
+// case OS.GTK_SELECTION_MULTIPLE: return getSelection_multiple();
+ case OS.GTK_SELECTION_EXTENDED: return getSelection_extended();
+ default: error(SWT.ERROR_UNSPECIFIED);
+ }
+ /* can never get here */
+ return null;
+}
+
+private TreeItem[] getSelection_browse () {
+ GtkCList clist = new GtkCList();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ if (clist.selection==0) return new TreeItem[0];
+ int length = OS.g_list_length (clist.selection);
+ if (length == 0) return new TreeItem[0];
+ int node = OS.g_list_nth_data (clist.selection, 0);
+ TreeItem[] answer = new TreeItem[1];
+ int index = OS.gtk_ctree_node_get_row_data(handle, node) - 1;
+ if ((index<0) && (itemInInsertion!=null)) answer[0] = itemInInsertion;
+ else answer[0] = items[index];
+ return answer;
+}
+private TreeItem[] getSelection_extended () {
+ GtkCList clist = new GtkCList();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ if (clist.selection==0) return new TreeItem[0];
+ int length = OS.g_list_length (clist.selection);
+ TreeItem[] result = new TreeItem[length];
+ for (int i=0; i<length; i++) {
+ int node = OS.g_list_nth_data (clist.selection, i);
+ int index = OS.gtk_ctree_node_get_row_data(handle, node) - 1;
+ result [i] = items [index];
+ }
+ return result;
+}
+
+/**
+ * Returns the number of selected items contained in the receiver.
+ *
+ * @return the number of selected items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelectionCount () {
+ checkWidget();
+ // Native way:
+ GtkCList clist = new GtkCList ();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ int selectionList = clist.selection;
+ if (selectionList==0) return 0;
+ return OS.g_list_length (clist.selection);
+}
+/**
+ * Sets the receiver's selection to be the given array of items.
+ * The current selected is first cleared, then the new items are
+ * selected.
+ *
+ * @param items the array of items
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if one of the item has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Tree#deselectAll()
+ */
+public void setSelection (TreeItem [] items) {
+ checkWidget();
+ if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
+ _deselectAll();
+ for (int i=0; i<items.length; i++) {
+ TreeItem item = items [i];
+ OS.gtk_ctree_select (handle, item.handle);
+ }
+}
+/**
+ * Selects all the items in the receiver.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void selectAll () {
+ checkWidget();
+ int rootNode = OS.gtk_ctree_node_nth(handle, 0);
+ if (rootNode==0) return; // empty
+ OS.gtk_ctree_select_recursive (handle, rootNode);
+}
+/**
+ * Deselects all selected items in the receiver.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselectAll() {
+ checkWidget();
+ _deselectAll();
+}
+private void _deselectAll() {
+ int rootNode = OS.gtk_ctree_node_nth(handle, 0);
+ if (rootNode==0) return; // empty
+ OS.gtk_ctree_unselect_recursive (handle, rootNode);
+}
+
+
+/**
+ * Shows the selection. If the selection is already showing in the receiver,
+ * this method simply returns. Otherwise, the items are scrolled until
+ * the selection is visible.
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Tree#showItem(TreeItem)
+ */
+public void showSelection () {
+ checkWidget();
+ if (selectedItem != null) showItem (selectedItem);
+}
+
+void destroyItem (TreeItem item) {
+ int node = item.handle;
+ Callback GtkCTreeFunc = new Callback (this, "GtkCTreeDispose", 3);
+ int address = GtkCTreeFunc.getAddress ();
+ OS.gtk_ctree_post_recursive (handle, node, address, 0);
+ GtkCTreeFunc.dispose ();
+ ignoreCollapse = true;
+ OS.gtk_ctree_remove_node (handle, node);
+ ignoreCollapse = false;
+}
+
+/**
+ * Returns the item at the given point in the receiver
+ * or null if no such item exists. The point is in the
+ * coordinate system of the receiver.
+ *
+ * @param point the point used to locate the item
+ * @return the item at the given point
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TreeItem getItem(Point point) {
+ int itemHeight = getItemHeight();
+ int hitItemIndex = point.y / itemHeight;
+ TreeItem hitItem;
+ GtkCTree tree = new GtkCTree();
+ OS.memmove(tree, handle, GtkCTree.sizeof);
+ int [] row = new int [1];
+ int [] column = new int [1];
+ OS.gtk_clist_get_selection_info(handle, point.x, point.y, row, column);
+ int data=OS.g_list_nth(tree.row_list, row[0]);
+ for (int i = 0; i< items.length; i++)
+ if (items[i].handle==data)
+ return items[i];
+
+ return null;
+}
+
+public boolean forceFocus () {
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ boolean result = super.forceFocus();
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ return result;
+}
+/**
+ * Returns the number of items contained in the receiver
+ * that are direct item children of the receiver. The
+ * number that is returned is the number of roots in the
+ * tree.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getItemCount () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int root = OS.gtk_ctree_node_nth (handle, 0);
+ if (root == 0) return 0;
+ int data = OS.g_list_nth_data (root, 0);
+ GtkCTreeRow row = new GtkCTreeRow ();
+ OS.memmove (row, data, GtkCTreeRow.sizeof);
+ int glist = row.sibling;
+ if (glist == 0) return 0;
+ return OS.g_list_length (glist);
+}
+/**
+ * Returns the height of the area which would be used to
+ * display <em>one</em> of the items in the tree.
+ *
+ * @return the height of one item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getItemHeight () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkCList clist = new GtkCList ();
+ OS.memmove (clist, handle, GtkCList.sizeof);
+ return clist.row_height;
+}
+/**
+ * Returns the number of items contained in the receiver
+ * that are direct item children of the receiver. These
+ * are the roots of the tree.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TreeItem [] getItems () {
+ checkWidget();
+
+ // The node corresponding to the 0th row
+ int root = OS.gtk_ctree_node_nth (handle, 0);
+ if (root == 0) return new TreeItem [0];
+
+ // The 0th row
+ int data = OS.g_list_nth_data (root, 0);
+ GtkCTreeRow row = new GtkCTreeRow ();
+ OS.memmove (row, data, GtkCTreeRow.sizeof);
+
+ int index = OS.gtk_ctree_node_get_row_data(handle, root) - 1;
+
+ int glist = row.sibling;
+ int count = OS.g_list_length (glist);
+ TreeItem [] result = new TreeItem [count+1];
+ result[0] = items[index];
+ for (int i=0; i<count; i++) {
+ int node = OS.g_list_nth (glist, i);
+ index = OS.gtk_ctree_node_get_row_data (handle, node) - 1;
+ result [i+1] = items [index];
+ }
+ return result;
+}
+
+/**
+ * Returns the receiver's parent item, which must be a
+ * <code>TreeItem</code> or null when the receiver is a
+ * root.
+ *
+ * @return the receiver's parent item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TreeItem getParentItem () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return null;
+}
+
+int processCollapse (int int0, int int1, int int2) {
+ if (ignoreCollapse) return 0;
+ int index = OS.gtk_ctree_node_get_row_data (handle, int0) - 1;
+ Event event = new Event ();
+ event.item = items [index];
+// OS.gtk_clist_freeze (handle);
+ sendEvent (SWT.Collapse, event);
+// OS.gtk_clist_thaw (handle);
+ return 0;
+}
+int processExpand (int int0, int int1, int int2) {
+ if (ignoreExpand) return 0;
+ int index = OS.gtk_ctree_node_get_row_data (handle, int0) - 1;
+ Event event = new Event ();
+ event.item = items [index];
+ OS.gtk_clist_freeze (handle);
+ sendEvent (SWT.Expand, event);
+ OS.gtk_clist_thaw (handle);
+ boolean [] expanded = new boolean [1];
+ OS.gtk_ctree_get_node_info (handle, int0, null, null, null, null, null, null, null, expanded);
+ if (!expanded [0]) {
+ ignoreExpand = true;
+ OS.gtk_ctree_expand (handle, int0);
+ ignoreExpand = false;
+ }
+ return 0;
+}
+int processSelection (int int0, int int1, int int2) {
+ if (itemInInsertion != null) selectedItem = itemInInsertion;
+ else {
+ int index = OS.gtk_ctree_node_get_row_data (handle, int0) - 1;
+ selectedItem = items [index];
+ }
+ Event event = new Event ();
+ event.item = selectedItem;
+ sendEvent (SWT.Selection, event);
+ return 0;
+}
+int processMouseDown (int callData, int arg1, int int2) {
+ OS.gtk_widget_grab_focus(handle);
+ GdkEventButton gdkEvent = new GdkEventButton ();
+ OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
+ int eventType = SWT.MouseDown;
+ if (gdkEvent.type == OS.GDK_2BUTTON_PRESS) {
+ GtkCTree tree = new GtkCTree();
+ OS.memmove(tree, handle, GtkCTree.sizeof);
+ int row=((int)gdkEvent.y-tree.voffset)/(tree.row_height+1);
+ int count = OS.g_list_length (tree.row_list);
+ if (row >= count) return 1;
+ int node = OS.g_list_nth(tree.row_list, row);
+ int data = OS.g_list_nth_data(node, 0);
+ GtkCTreeRow treerow = new GtkCTreeRow();
+ OS.memmove (treerow, data, GtkCTreeRow.sizeof);
+ if (OS.gtk_ctree_is_hot_spot(handle, (int)gdkEvent.x, (int)gdkEvent.y)){
+ sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
+ return 1;
+ }
+ if (treerow.children != 0) {
+ eventType = SWT.MouseDoubleClick;
+ sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
+ return 1;
+ }
+ int index = OS.gtk_ctree_node_get_row_data (handle, node) - 1;
+ selectedItem = items [index];
+ Event event = new Event ();
+ event.item=selectedItem;
+ if (selectedItem != null)
+ sendEvent (SWT.DefaultSelection, event);
+ }else{
+ sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
+ }
+ if (gdkEvent.button == 3 && menu != null) {
+ menu.setVisible (true);
+ }
+ return 1;
+}
+
+/**
+ * Removes all of the items from the receiver.
+ * <p>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void removeAll () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_ctree_remove_node (handle, 0);
+ for (int i=0; i<items.length; i++) {
+ TreeItem item = items [i];
+ if (item != null && !item.isDisposed ()) {
+ item.releaseWidget ();
+ item.releaseHandle ();
+ }
+ }
+ items = new TreeItem [4];
+ selectedItem = null;
+}
+
+/**
+ * Shows the item. If the item is already showing in the receiver,
+ * this method simply returns. Otherwise, the items are scrolled
+ * and expanded until the item is visible.
+ *
+ * @param item the item to be shown
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the item is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Tree#showSelection()
+ */
+public void showItem (TreeItem item) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
+ int node = item.handle;
+ if (OS.gtk_ctree_node_is_visible (handle, node) != OS.GTK_VISIBILITY_NONE) {
+ return;
+ }
+ if (!OS.gtk_ctree_is_viewable (handle, node)) {
+ ignoreExpand = true;
+ int parent = node;
+ GtkCTreeRow row = new GtkCTreeRow ();
+ do {
+ int data = OS.g_list_nth_data (parent, 0);
+ OS.memmove (row, data, GtkCTreeRow.sizeof);
+ if ((parent = row.parent) == 0) break;
+ OS.gtk_ctree_expand (handle, parent);
+ } while (true);
+ ignoreExpand = false;
+ }
+ OS.gtk_ctree_node_moveto (handle, node, 0, 0.0f, 0.0f);
+}
+
+int GtkCTreeDispose (int ctree, int node, int data) {
+ int index = OS.gtk_ctree_node_get_row_data (ctree, node) - 1;
+ OS.gtk_ctree_node_set_row_data (ctree, node, 0);
+ TreeItem item = items [index];
+ if (item == selectedItem) selectedItem = null;
+ item.releaseWidget ();
+ item.releaseHandle ();
+ items [index] = null;
+ return 0;
+}
+void releaseWidget () {
+ for (int i=0; i<items.length; i++) {
+ TreeItem item = items [i];
+ if (item != null && !item.isDisposed ()) {
+ item.releaseWidget ();
+ item.releaseHandle ();
+ }
+ }
+ items = null;
+ selectedItem = null;
+ super.releaseWidget ();
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
new file mode 100644
index 0000000..d1eaeee
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
@@ -0,0 +1,518 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import java.util.Vector;
+
+/**
+ * Instances of this class represent a selectable user interface object
+ * that represents a hierarchy of tree items in a tree widget.
+ *
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+public class TreeItem extends Item {
+ Tree parent;
+ int index;
+
+/*
+ * === CONSTRUCTORS ===
+ */
+
+
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Tree</code> or a <code>TreeItem</code>)
+ * and a style value describing its behavior and appearance.
+ * The item is added to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TreeItem (Tree parent, int style) {
+ super (parent, style);
+ this.parent = parent;
+ parent.createItem (this, 0, -1);
+}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Tree</code> or a <code>TreeItem</code>),
+ * a style value describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TreeItem (Tree parent, int style, int index) {
+ super (parent, style);
+ if (index < 0) error (SWT.ERROR_INVALID_RANGE);
+ this.parent=parent;
+ parent.createItem (this, 0, -1);
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Tree</code> or a <code>TreeItem</code>)
+ * and a style value describing its behavior and appearance.
+ * The item is added to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parentItem a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TreeItem (TreeItem parentItem, int style) {
+ super ( (checkNull(parentItem)).getParent(), style );
+ this.parent = parentItem.getParent ();
+ parent.createItem (this, parentItem.handle, -1);
+}
+private static TreeItem checkNull (TreeItem item) {
+ if (item == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ return item;
+}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Tree</code> or a <code>TreeItem</code>),
+ * a style value describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parentItem a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TreeItem (TreeItem parentItem, int style, int position) {
+ super (parentItem.getParent (), style);
+ if (position < 0) error (SWT.ERROR_ITEM_NOT_ADDED);
+ this.parent = parentItem.getParent ();
+ parent.createItem (this, parentItem.handle, -1);
+}
+
+/**
+ * Returns a rectangle describing the receiver's size and location
+ * relative to its parent.
+ *
+ * @return the receiver's bounding rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Rectangle getBounds () {
+ checkWidget();
+ int CELL_SPACING=1;
+ int ctree = parent.handle;
+ GtkCTree tree = new GtkCTree();
+ OS.memmove(tree, ctree, GtkCTree.sizeof);
+
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, tree.vadjustment, GtkAdjustment.sizeof);
+ float vaj = adjustment.value;
+ OS.memmove (adjustment, tree.hadjustment, GtkAdjustment.sizeof);
+ float haj = adjustment.value;
+ int columnHandle = tree.column;
+
+ int height=parent.getItemHeight();
+
+ int row_list = tree.row_list; int level=0;
+ int count = OS.g_list_length (row_list);
+ int index=0;
+ while (index<count) {
+ int data = OS.g_list_nth (row_list, index);
+ if (handle == data){
+ int rowHandle = OS.g_list_nth_data (row_list, index);
+ GtkCTreeRow row = new GtkCTreeRow();
+ OS.memmove(row, rowHandle, GtkCTreeRow.sizeof);
+ level = row.level;
+ break;
+ }
+ index++;
+ }
+ int y=height*index+(index+1)*CELL_SPACING+tree.voffset+2;
+
+ int [] buffer = new int [1]; byte [] spacing = new byte [1];
+ boolean [] is_leaf = new boolean [1], expanded = new boolean [1];
+ int [] pixmap_closed = new int [1], mask_closed= new int [1], pixmap_opened= new int [1], mask_opened= new int [1];
+ OS.gtk_ctree_get_node_info (ctree, handle, buffer, spacing, pixmap_closed, mask_closed, pixmap_opened, mask_opened, is_leaf, expanded);
+ int length = OS.strlen (buffer[0]);
+ byte [] buffer1 = new byte [length];
+ OS.memmove (buffer1, buffer[0], length);
+ int styleHandle = OS.gtk_ctree_node_get_row_style(ctree, handle);
+ if (styleHandle == 0)
+ styleHandle = OS.gtk_widget_get_style(ctree);
+ GtkStyle style = new GtkStyle();
+ OS.memmove(style, styleHandle, GtkStyle.sizeof);
+ int width = OS.gdk_string_width(style.font, buffer1);
+
+// x = (short)column.area_x+tree.tree_indent*(level-1)+spacing[0]+tree.hoffset;
+ int x = 33+tree.tree_indent*(level-1)+spacing[0]+tree.hoffset;
+
+ return new Rectangle (x, y, width, height);
+}
+
+/**
+ * Returns <code>true</code> if the receiver is checked,
+ * and false otherwise. When the parent does not have
+ * the <code>CHECK style, return false.
+ * <p>
+ *
+ * @return the checked state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getChecked () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((parent.style & SWT.CHECK) == 0) return false;
+ return false;
+}
+public Display getDisplay () {
+ if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getDisplay ();
+}
+/**
+ * Returns <code>true</code> if the receiver is expanded,
+ * and false otherwise.
+ * <p>
+ *
+ * @return the expanded state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getExpanded () {
+ checkWidget();
+ int treeHandle = parent.handle;
+ boolean [] buffer = new boolean [1];
+ OS.gtk_ctree_get_node_info (treeHandle, handle, null, null, null, null, null, null, null, buffer);
+ return buffer [0];
+}
+
+/**
+ * Returns <code>true</code> if the receiver is grayed,
+ * and false otherwise. When the parent does not have
+ * the <code>CHECK style, return false.
+ * <p>
+ *
+ * @return the grayed state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getGrayed() {
+
+ // NOT_IMPLEMENTED
+ return false;
+}
+
+/**
+ * Returns the number of items contained in the receiver
+ * that are direct item children of the receiver.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getItemCount () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int data = OS.g_list_nth_data (handle, 0);
+ GtkCTreeRow row = new GtkCTreeRow ();
+ OS.memmove (row, data, GtkCTreeRow.sizeof);
+ int glist = row.children;
+ if (glist == 0) return 0;
+ return OS.g_list_length (glist);
+}
+/**
+ * Returns an array of <code>TreeItem</code>s which are the
+ * direct item children of the receiver.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the receiver's items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TreeItem [] getItems () {
+ checkWidget();
+ Vector items = _getItemsVector();
+ int s = items.size();
+ TreeItem[] answer = new TreeItem[s];
+ items.toArray(answer);
+ return answer;
+}
+private Vector _getItemsVector() {
+ Vector answer = new Vector();
+
+
+ int data = OS.g_list_nth_data (handle, 0);
+ GtkCTreeRow row = new GtkCTreeRow ();
+ OS.memmove (row, data, GtkCTreeRow.sizeof);
+ int glist = row.children;
+ if (glist == 0) return answer;
+ int ctree = parent.handle;
+ int count = OS.g_list_length (glist);
+
+ for (int i=0; i<count; i++) {
+ int node = OS.g_list_nth (glist, i);
+ int index = OS.gtk_ctree_node_get_row_data (ctree, node) - 1;
+ TreeItem item = parent.items [index];
+ if (item._getParentItem() == this) answer.add(item);
+ }
+
+ return answer;
+}
+
+/**
+ * Returns the receiver's parent, which must be a <code>Tree</code>.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Tree getParent () {
+ checkWidget();
+ return parent;
+}
+/**
+ * Returns the receiver's parent item, which must be a
+ * <code>TreeItem</code> or null when the receiver is a
+ * root.
+ *
+ * @return the receiver's parent item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TreeItem getParentItem () {
+ checkWidget();
+ return _getParentItem();
+}
+private TreeItem _getParentItem () {
+ int data = OS.g_list_nth_data (handle, 0);
+ GtkCTreeRow row = new GtkCTreeRow ();
+ OS.memmove (row, data, GtkCTreeRow.sizeof);
+ if (row.parent == 0) return null;
+ int ctree = parent.handle;
+ int index = OS.gtk_ctree_node_get_row_data (ctree, row.parent) - 1;
+ return parent.items [index];
+}
+
+void releaseChild () {
+ super.releaseChild ();
+ parent.destroyItem (this);
+}
+void releaseWidget () {
+ super.releaseWidget ();
+ parent = null;
+}
+/**
+ * Sets the checked state of the receiver.
+ * <p>
+ *
+ * @param checked the new checked state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setChecked (boolean checked) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((parent.style & SWT.CHECK) == 0) return;
+}
+
+/**
+ * Sets the grayed state of the receiver.
+ * <p>
+ *
+ * @param checked the new grayed state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setGrayed(boolean grayed) { // NOT_IMPLEMENTED
+}
+
+/**
+ * Sets the expanded state of the receiver.
+ * <p>
+ *
+ * @param expanded the new expanded state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setExpanded (boolean expanded) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int treeHandle = parent.handle;
+ if (expanded) {
+ parent.ignoreExpand = true;
+ OS.gtk_ctree_expand (treeHandle, handle);
+ parent.ignoreExpand = false;
+ } else {
+ parent.ignoreCollapse = true;
+ OS.gtk_ctree_collapse (treeHandle, handle);
+ parent.ignoreCollapse = false;
+ }
+}
+public void setImage (Image image) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ super.setImage (image);
+ int pixmap = 0, mask = 0;
+ if (image != null) {
+ pixmap = image.pixmap;
+ mask = image.mask;
+ }
+ int ctree = parent.handle;
+ byte [] buffer = Converter.wcsToMbcs (null, text, true);
+ byte [] spacing = new byte [1];
+ boolean [] is_leaf = new boolean [1], expanded = new boolean [1];
+ OS.gtk_ctree_get_node_info (ctree, handle, null, spacing, null, null, null, null, is_leaf, expanded);
+ OS.gtk_ctree_set_node_info (ctree, handle, buffer, spacing [0], pixmap, mask, pixmap, mask, is_leaf [0], expanded [0]);
+}
+/**
+ * This label will be displayed to the right of the bitmap,
+ * or, if the receiver doesn't have a bitmap to the right of
+ * the horizontal hierarchy connector line.
+ */
+public void setText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ super.setText (string);
+ int ctree = parent.handle;
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ byte [] spacing = new byte [1];
+ boolean [] is_leaf = new boolean [1], expanded = new boolean [1];
+ int [] pixmap_closed = new int [1], mask_closed= new int [1], pixmap_opened= new int [1], mask_opened= new int [1];
+ OS.gtk_ctree_get_node_info (ctree, handle, null, spacing, pixmap_closed, mask_closed, pixmap_opened, mask_opened, is_leaf, expanded);
+ OS.gtk_ctree_set_node_info (ctree, handle, buffer, spacing [0], pixmap_closed [0], mask_closed [0], pixmap_opened [0], mask_opened [0], is_leaf [0], expanded [0]);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Trim.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Trim.java
new file mode 100644
index 0000000..8f37202
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Trim.java
@@ -0,0 +1,10 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+class Trim {
+ int top=0, bottom=0, left=0, right=0;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/UtilFuncs.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/UtilFuncs.java
new file mode 100644
index 0000000..a956c28
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/UtilFuncs.java
@@ -0,0 +1,141 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ * This class contains static helpers wrapping some common
+ * widget-inspecific operations like get the size of a gtk widget.
+ */
+class UtilFuncs {
+
+/*
+ * === GEOMETRY ===
+ */
+
+static Point getLocation (int handle) {
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return new Point (widget.alloc_x, widget.alloc_y);
+}
+
+static boolean setLocation(int parentHandle, int handle, int x, int y) {
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ boolean sameOrigin = (widget.alloc_x == x && widget.alloc_y == y);
+
+ // GtkFixed does not leave us alone.
+ // Instead, it maintains its own list of geometries for the children.
+ // Moreover, it will post a RESIZE on the queue that will cause
+ // disturbance to all our brother; to avoid that, we temporarily
+ // clear the VISIBLE flag, and do the synchronous update ourselves
+ GtkObject gtkChild = new GtkObject();
+ OS.memmove (gtkChild, handle, GtkObject.sizeof);
+ OS.GTK_WIDGET_UNSET_FLAGS(handle, OS.GTK_VISIBLE);
+ OS.gtk_fixed_move(parentHandle, handle, (short)x, (short)y );
+ OS.memmove(handle, gtkChild, GtkObject.sizeof);
+
+
+// OS.gtk_widget_set_uposition(handle, (short)x, (short)y);
+ /*
+ byte[] aux_info_id = org.eclipse.swt.internal.Converter.wcsToMbcs (null, "gtk-aux-info", true);
+ int aux_info_key_id = OS.g_quark_from_static_string(aux_info_id);
+ if (aux_info_key_id == 0) SWT.error(SWT.ERROR_UNSPECIFIED);
+ int aux_info = OS.gtk_object_get_data_by_id(handle, aux_info_key_id);
+ int[] xy = new int[1];
+ // ???
+ OS.memmove(aux_info, xy, 4);
+ */
+
+ // force allocation update NOW
+ GtkAllocation alloc = new GtkAllocation();
+ alloc.x = (short) x;
+ alloc.y = (short) y;
+ alloc.width = (short) widget.alloc_width;
+ alloc.height = (short) widget.alloc_height;
+ OS.memmove(handle, widget, GtkWidget.sizeof);
+ OS.gtk_widget_size_allocate(handle, alloc);
+
+ return (!sameOrigin);
+}
+
+static Point getSize (int handle) {
+ if (handle==0) {
+ SWT.error(SWT.ERROR_UNSPECIFIED);
+ }
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return new Point (widget.alloc_width, widget.alloc_height);
+}
+
+
+static boolean setSize(int handle, int width, int height) {
+ if (handle==0) {
+ SWT.error(SWT.ERROR_UNSPECIFIED);
+ }
+
+ /* Feature in Gtk.
+ * Gtk will refuse to set the size of any widget to anything smaller than 3x3.
+ */
+ if (height <= 3) height = 3;
+ if (width <= 3) width = 3;
+
+ // first, see if we actually need to change anything
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ int alloc_width = widget.alloc_width & 0xFFFF;
+ int alloc_height = widget.alloc_height & 0xFFFF;
+ if (alloc_width == width && alloc_height == height) {
+ return false;
+ }
+
+ OS.gtk_widget_set_usize (handle, width, height);
+ // force child allocation update
+ GtkAllocation alloc = new GtkAllocation();
+ alloc.x = (short) widget.alloc_x;
+ alloc.y = (short) widget.alloc_y;
+ alloc.width = (short) width;
+ alloc.height = (short) height;
+ OS.gtk_widget_size_allocate(handle, alloc);
+ return true;
+}
+
+static void setZeroSize(int handle) {
+ // CHEATING. For some reason,
+ // the it will refuse to change its size to anything smaller
+ setSize(handle, 3,3);
+}
+
+static int getFont(int widget) {
+ int hStyle = OS.gtk_widget_get_style(widget);
+ GtkStyle style = new GtkStyle();
+ OS.memmove(style, hStyle, GtkStyle.sizeof);
+ return style.font;
+}
+
+static void setFont(int handle, int font) {
+ OS.gtk_widget_ensure_style(handle);
+ // We can't just get the widget's style and set
+ // its font, because the style slot may point to the
+ // default font; therefore we have to obtain a clone
+ // of the style
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ int hStyle = OS.gtk_style_copy(widget.style);
+ GtkStyle style = new GtkStyle();
+ OS.memmove(style, hStyle, GtkStyle.sizeof);
+
+ OS.gdk_font_unref(style.font);
+ style.font = font;
+ OS.memmove (hStyle, style, GtkStyle.sizeof);
+ OS.gtk_widget_set_style (handle, hStyle);
+}
+
+}
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
new file mode 100644
index 0000000..11d68ee
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
@@ -0,0 +1,885 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * This class is the abstract superclass of all user interface objects.
+ * Widgets are created, disposed and issue notification to listeners
+ * when events occur which affect them.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Dispose</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation. However, it has not been marked
+ * final to allow those outside of the SWT development team to implement
+ * patched versions of the class in order to get around specific
+ * limitations in advance of when those limitations can be addressed
+ * by the team. Any class built using subclassing to access the internals
+ * of this class will likely fail to compile or run between releases and
+ * may be strongly platform specific. Subclassing should not be attempted
+ * without an intimate and detailed understanding of the workings of the
+ * hierarchy. No support is provided for user-written classes which are
+ * implemented as subclasses of this class.
+ * </p>
+ *
+ * @see #checkSubclass
+ */
+
+public abstract class Widget {
+
+ public int handle;
+ int style, state;
+ EventTable eventTable;
+ Object data;
+ String [] keys;
+ Object [] values;
+
+ /* Global state flags */
+// static final int AUTOMATIC = 0x00000001;
+// static final int ACTIVE = 0x00000002;
+// static final int AUTOGRAB = 0x00000004;
+// static final int MULTIEXPOSE = 0x00000008;
+// static final int RESIZEREDRAW = 0x00000010;
+// static final int WRAP = 0x00000020;
+// static final int DISABLED = 0x00000040;
+// static final int HIDDEN = 0x00000080;
+// static final int FOREGROUND = 0x00000100;
+// static final int BACKGROUND = 0x00000200;
+ static final int DISPOSED = 0x00000400;
+ static final int HANDLE = 0x00000800;
+
+ static final int DEFAULT_WIDTH = 64;
+ static final int DEFAULT_HEIGHT = 64;
+ static final char Mnemonic = '&';
+
+/**
+ * Prevents uninitialized instances from being created outside the package.
+ */
+Widget () {}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a widget which will be the parent of the new instance (cannot be null)
+ * @param style the style of widget to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see #checkSubclass
+ * @see #getStyle
+ */
+public Widget (Widget parent, int style) {
+ if (parent == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (!parent.isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ this.style = style;
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notifed when an event of the given type occurs. When the
+ * event does occur in the widget, the listener is notified by
+ * sending it the <code>handleEvent()</code> message.
+ *
+ * @param eventType the type of event to listen for
+ * @param listener the listener which should be notified when the event occurs
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Listener
+ * @see #removeListener
+ */
+public void addListener (int eventType, Listener handler) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) eventTable = new EventTable ();
+ eventTable.hook (eventType, handler);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notifed when the widget is disposed. When the widget is
+ * disposed, the listener is notified by sending it the
+ * <code>widgetDisposed()</code> message.
+ *
+ * @param listener the listener which should be notified when the receiver is disposed
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see DisposeListener
+ * @see #removeDisposeListener
+ */
+public void addDisposeListener (DisposeListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Dispose, typedListener);
+}
+static int checkBits (int style, int int0, int int1, int int2, int int3, int int4, int int5) {
+ int mask = int0 | int1 | int2 | int3 | int4 | int5;
+ if ((style & mask) == 0) style |= int0;
+ if ((style & int0) != 0) style = (style & ~mask) | int0;
+ if ((style & int1) != 0) style = (style & ~mask) | int1;
+ if ((style & int2) != 0) style = (style & ~mask) | int2;
+ if ((style & int3) != 0) style = (style & ~mask) | int3;
+ if ((style & int4) != 0) style = (style & ~mask) | int4;
+ if ((style & int5) != 0) style = (style & ~mask) | int5;
+ return style;
+}
+/**
+ * Throws an <code>SWTException</code> if the receiver can not
+ * be accessed by the caller. This may include both checks on
+ * the state of the receiver and more generally on the entire
+ * execution context. This method <em>should</em> be called by
+ * widget implementors to enforce the standard SWT invariants.
+ * <p>
+ * Currently, it is an error to invoke any method (other than
+ * <code>isDisposed()</code>) on a widget that has had its
+ * <code>dispose()</code> method called. It is also an error
+ * to call widget methods from any thread that is different
+ * from the thread that created the widget.
+ * </p><p>
+ * In future releases of SWT, there may be more or fewer error
+ * checks and exceptions may be thrown for different reasons.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+protected void checkWidget () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+
+/*
+ * HANDLE CODE
+ *
+ * HANDLE CODE 1: HANDLE CREATION CODE - The createWidget() cycle.
+ */
+
+void createWidget (int index) {
+ createHandle (index);
+ hookEvents ();
+ configure ();
+ setHandleStyle ();
+ register ();
+ setInitialSize ();
+ showHandle ();
+}
+
+void register () {
+ if (handle == 0) return;
+ if ((state & HANDLE) != 0) WidgetTable.put (handle, this);
+}
+
+void createHandle (int index) {}
+void configure () {}
+void setHandleStyle () {}
+void setInitialSize () {}
+void hookEvents () {}
+void showHandle () {}
+int paintHandle () { return 0; }
+
+/* HANDLE CODE 3:
+ * Handle Destruction
+ */
+
+void deregister () {
+ if (handle == 0) return;
+ if ((state & HANDLE) != 0) WidgetTable.remove (handle);
+}
+void destroyWidget () {
+ int topHandle = topHandle ();
+ releaseHandle ();
+ if (topHandle != 0 && (state & HANDLE) != 0) {
+ OS.gtk_widget_destroy (topHandle);
+ }
+}
+/**
+ * Disposes of the operating system resources associated with
+ * the receiver and all its descendents. After this method has
+ * been invoked, the receiver and all descendents will answer
+ * <code>true</code> when sent the message <code>isDisposed()</code>.
+ * Any internal connections between the widgets in the tree will
+ * have been removed to facilitate garbage collection.
+ * <p>
+ * NOTE: This method is not called recursively on the descendents
+ * of the receiver. This means that, widget implementers can not
+ * detect when a widget is being disposed of by re-implementing
+ * this method, but should instead listen for the <code>Dispose</code>
+ * event.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #addDisposeListener
+ * @see #removeDisposeListener
+ * @see #checkWidget
+ */
+public void dispose () {
+ /*
+ * Note: It is valid to attempt to dispose a widget
+ * more than once. If this happens, fail silently.
+ */
+ if (isDisposed()) return;
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ releaseChild ();
+ releaseWidget ();
+ destroyWidget ();
+}
+
+void error (int code) {
+ throw new SWTError (code);
+}
+
+
+
+/**
+ * Returns the application defined widget data associated
+ * with the receiver, or null if it has not been set. The
+ * <em>widget data</em> is a single, unnamed field that is
+ * stored with every widget.
+ * <p>
+ * Applications may put arbitrary objects in this field. If
+ * the object stored in the widget data needs to be notified
+ * when the widget is disposed of, it is the application's
+ * responsibility to hook the Dispose event on the widget and
+ * do so.
+ * </p>
+ *
+ * @return the widget data
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - when the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
+ * </ul>
+ *
+ * @see #setData
+ */
+public Object getData () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return data;
+}
+/**
+ * Returns the application defined property of the receiver
+ * with the specified name, or null if it has not been set.
+ * <p>
+ * Applications may have associated arbitrary objects with the
+ * receiver in this fashion. If the objects stored in the
+ * properties need to be notified when the widget is disposed
+ * of, it is the application's responsibility to hook the
+ * Dispose event on the widget and do so.
+ * </p>
+ *
+ * @param key the name of the property
+ * @return the value of the property or null if it has not been set
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setData
+ */
+public Object getData (String key) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (keys == null) return null;
+ for (int i=0; i<keys.length; i++) {
+ if (keys [i].equals (key)) return values [i];
+ }
+ return null;
+}
+/**
+ * Returns the <code>Display</code> that is associated with
+ * the receiver.
+ * <p>
+ * A widget's display is either provided when it is created
+ * (for example, top level <code>Shell</code>s) or is the
+ * same as its parent's display.
+ * </p>
+ *
+ * @return the receiver's display
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public abstract Display getDisplay ();
+String getName () {
+// String string = getClass ().getName ();
+// int index = string.lastIndexOf ('.');
+// if (index == -1) return string;
+ String string = getClass ().getName ();
+ int index = string.length ();
+ while ((--index > 0) && (string.charAt (index) != '.'));
+ return string.substring (index + 1, string.length ());
+}
+String getNameText () {
+ return "";
+}
+/**
+ * Returns the receiver's style information.
+ * <p>
+ * Note that the value which is returned by this method <em>may
+ * not match</em> the value which was provided to the constructor
+ * when the receiver was created. This can occur when the underlying
+ * operating system does not support a particular combination of
+ * requested styles. For example, if the platform widget used to
+ * implement a particular SWT widget always has scroll bars, the
+ * result of calling this method would always have the
+ * <code>SWT.H_SCROLL</code> and <code>SWT.V_SCROLL</code> bits set.
+ * </p>
+ *
+ * @return the style bits
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getStyle () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return style;
+}
+
+/**
+ * Returns <code>true</code> if the widget has been disposed,
+ * and <code>false</code> otherwise.
+ * <p>
+ * This method gets the dispose state for the widget.
+ * When a widget has been disposed, it is an error to
+ * invoke any other method using the widget.
+ * </p>
+ *
+ * @return <code>true</code> when the widget is disposed and <code>false</code> otherwise
+ */
+public boolean isDisposed () {
+ if (handle != 0) return false;
+ if ((state & HANDLE) != 0) return true;
+ return (state & DISPOSED) != 0;
+}
+
+/**
+ * Returns <code>true</code> if there are any listeners
+ * for the specified event type associated with the receiver,
+ * and <code>false</code> otherwise.
+ *
+ * @param eventType the type of event
+ * @return true if the event is hooked
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+protected boolean isListening (int eventType) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return hooks (eventType);
+}
+
+
+/*
+ * Returns <code>true</code> if the specified eventType is
+ * hooked, and <code>false</code> otherwise. Implementations
+ * of SWT can avoid creating objects and sending events
+ * when an event happens in the operating system but
+ * there are no listeners hooked for the event.
+ *
+ * @param eventType the event to be checked
+ *
+ * @return <code>true</code> when the eventType is hooked and <code>false</code> otherwise
+ *
+ * @see #isListening
+ */
+boolean hooks (int eventType) {
+ if (eventTable == null) return false;
+ return eventTable.hooks (eventType);
+}
+
+boolean isValidThread () {
+ return getDisplay ().isValidThread ();
+}
+public boolean isValidWidget () {
+ if (handle != 0) return true;
+ if ((state & HANDLE) != 0) return false;
+ return (state & DISPOSED) == 0;
+}
+
+boolean isValidSubclass() {
+ return Display.isValidClass(getClass());
+}
+
+char mbcsToWcs (char ch) {
+ int key = ch & 0xFFFF;
+ if (key <= 0x7F) return ch;
+ byte [] buffer;
+ if (key <= 0xFF) {
+ buffer = new byte [1];
+ buffer [0] = (byte) key;
+ } else {
+ buffer = new byte [2];
+ buffer [0] = (byte) ((key >> 8) & 0xFF);
+ buffer [1] = (byte) (key & 0xFF);
+ }
+ char [] result = Converter.mbcsToWcs (null, buffer);
+ if (result.length == 0) return 0;
+ return result [0];
+}
+/**
+ * Notifies all of the receiver's listeners for events
+ * of the given type that one such event has occurred by
+ * invoking their <code>handleEvent()</code> method.
+ *
+ * @param eventType the type of event which has occurred
+ * @param event the event data
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the event is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void notifyListeners (int eventType, Event event) {
+ checkWidget();
+ if (event == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ event.type = eventType;
+ event.widget = this;
+ eventTable.sendEvent (event);
+}
+void postEvent (int eventType) {
+ if (eventTable == null) return;
+ postEvent (eventType, new Event ());
+}
+void postEvent (int eventType, Event event) {
+ if (eventTable == null) return;
+ event.type = eventType;
+ event.widget = this;
+ getDisplay ().postEvent (event);
+}
+
+int processEvent (int eventNumber, int int0, int int1, int int2) {
+ switch (eventNumber) {
+ case SWT.Arm: return processArm (int0, int1, int2);
+ case SWT.Collapse: return processCollapse (int0, int1, int2);
+ case SWT.Expand: return processExpand (int0, int1, int2);
+ case SWT.Dispose: return processDispose (int0, int1, int2);
+ case SWT.DefaultSelection: return processDoubleSelection (int0, int1, int2);
+ case SWT.FocusIn: return processFocusIn (int0, int1, int2);
+ case SWT.FocusOut: return processFocusOut (int0, int1, int2);
+ case SWT.Help: return processHelp (int0, int1, int2);
+ case SWT.Hide: return processHide (int0, int1, int2);
+ case SWT.KeyDown: return processKeyDown (int0, int1, int2);
+ case SWT.KeyUp: return processKeyUp (int0, int1, int2);
+ case SWT.Iconify: return processIconify (int0, int1, int2);
+ case SWT.Deiconify: return processDeiconify (int0, int1, int2);
+ case SWT.Modify: return processModify (int0, int1, int2);
+ case SWT.MouseDown: return processMouseDown (int0, int1, int2);
+ case SWT.MouseEnter: return processMouseEnter (int0, int1, int2);
+ case SWT.MouseExit: return processMouseExit (int0, int1, int2);
+ case SWT.MouseHover: return processMouseHover (int0, int1, int2);
+ case SWT.MouseMove: return processMouseMove (int0, int1, int2);
+ case SWT.MouseUp: return processMouseUp (int0, int1, int2);
+ case SWT.Paint: return processPaint (int0, int1, int2);
+ case SWT.Resize: return processResize (int0, int1, int2);
+ case SWT.Show: return processShow (int0, int1, int2);
+ case SWT.Selection: return processSelection (int0, int1, int2);
+ case SWT.Verify: return processVerify (int0, int1, int2);
+ }
+ return 0;
+}
+
+int processArm (int int0, int int1, int int2) {
+ return 0;
+}
+
+/*
+ * Item expand/collapse in a tree.
+ */
+int processCollapse (int int0, int int1, int int2) {
+ return 1; // stop emission
+}
+int processExpand (int int0, int int1, int int2) {
+ return 1; // stop emission
+}
+
+/*
+ * Close a Shell, triggered by delete_event
+ */
+int processDispose (int arg0, int arg1, int int2) {
+ return 1;
+}
+
+/*
+ * The WM has Iconified/Deiconified a Shell.
+ * The Gtk event is map_event/unmap_event
+ */
+int processIconify (int int0, int int1, int int2) {
+ return 0;
+}
+int processDeiconify (int int0, int int1, int int2) {
+ return 0;
+}
+
+int processHelp (int int0, int int1, int int2) {
+ return 0;
+}
+int processHide (int int0, int int1, int int2) {
+ return 0;
+}
+int processFocusIn(int int0, int int1, int int2) {
+ return 0;
+}
+int processFocusOut(int int0, int int1, int int2) {
+ return 0;
+}
+int processKeyDown (int arg0, int arg1, int int2) {
+ return 0;
+}
+int processKeyUp (int arg0, int arg1, int int2) {
+ return 0;
+}
+int processModify (int arg0, int arg1, int int2) {
+ return 0;
+}
+int processMouseDown (int arg0, int arg1, int int2) {
+ return 0;
+}
+int processMouseEnter (int arg0, int arg1, int int2) {
+ return 0;
+}
+int processMouseExit (int arg0, int arg1, int int2) {
+ /* Do nothing */
+ return 0;
+}
+int processMouseHover (int arg0, int arg1, int int2) {
+ /* Do nothing */
+ return 0;
+}
+int processMouseMove (int arg0, int arg1, int int2) {
+ /* Do nothing */
+ /* Even though we do nothing, we still need to at least
+ * motify the X Server we are ready to process more events.
+ * However, only OS controls can receive this event.
+ */
+ return 0;
+}
+
+int processMouseUp (int arg0, int arg1, int int2) {
+ return 0;
+}
+int processPaint (int int0, int int1, int int2) {
+ return 0;
+}
+int processResize (int int0, int int1, int int2) {
+ return 0;
+}
+int processSelection (int int0, int int1, int int2) {
+ return 0;
+}
+int processShow (int int0, int int1, int int2) {
+ return 0;
+}
+int processDoubleSelection (int int0, int int1, int int2) {
+ return 0;
+}
+int processVerify (int int0, int int1, int int2) {
+ sendEvent (SWT.Verify);
+ return 0;
+}
+
+void signal_connect (int handle, String eventName, int swtEvent, int numArgs) {
+ byte [] buffer = Converter.wcsToMbcs (null, eventName, true);
+ int proc=0;
+ switch (numArgs) {
+ case 2: proc=getDisplay().windowProc2; break;
+ case 3: proc=getDisplay().windowProc3; break;
+ case 4: proc=getDisplay().windowProc4; break;
+ case 5: proc=getDisplay().windowProc5; break;
+ default: error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ OS.gtk_signal_connect (handle, buffer, proc, swtEvent);
+}
+void signal_connect_after (int handle, String eventName, int swtEvent, int numArgs) {
+ byte [] buffer = Converter.wcsToMbcs (null, eventName, true);
+ int proc=0;
+ switch (numArgs) {
+ case 2: proc=getDisplay().windowProc2; break;
+ case 3: proc=getDisplay().windowProc3; break;
+ case 4: proc=getDisplay().windowProc4; break;
+ case 5: proc=getDisplay().windowProc5; break;
+ default: error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ OS.gtk_signal_connect_after (handle, buffer, proc, swtEvent);
+}
+
+void releaseChild () {
+ /* Do nothing */
+}
+void releaseHandle () {
+ handle = 0;
+ state |= DISPOSED;
+}
+void releaseWidget () {
+ sendEvent (SWT.Dispose);
+ deregister ();
+ eventTable = null;
+ data = null;
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notifed when an event of the given type occurs.
+ *
+ * @param eventType the type of event to listen for
+ * @param listener the listener which should no longer be notified when the event occurs
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Listener
+ * @see #addListener
+ */
+public void removeListener (int eventType, Listener handler) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (eventType, handler);
+}
+/**
+* Warning: API under construction.
+*/
+protected void removeListener (int eventType, SWTEventListener handler) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (eventType, handler);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notifed when the widget is disposed.
+ *
+ * @param listener the listener which should no longer be notified when the receiver is disposed
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see DisposeListener
+ * @see #removeDisposeListener
+ */
+public void removeDisposeListener (DisposeListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Dispose, listener);
+}
+void sendEvent (int eventType) {
+ if (eventTable == null) return;
+ sendEvent (eventType, new Event ());
+}
+void sendEvent (int eventType, Event event) {
+ if (eventTable == null) return;
+ event.widget = this;
+ event.type = eventType;
+ eventTable.sendEvent (event);
+}
+/**
+ * Sets the application defined widget data associated
+ * with the receiver to be the argument. The <em>widget
+ * data</em> is a single, unnamed field that is stored
+ * with every widget.
+ * <p>
+ * Applications may put arbitrary objects in this field. If
+ * the object stored in the widget data needs to be notified
+ * when the widget is disposed of, it is the application's
+ * responsibility to hook the Dispose event on the widget and
+ * do so.
+ * </p>
+ *
+ * @param data the widget data
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - when the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
+ * </ul>
+ */
+public void setData (Object data) {
+ checkWidget();
+ this.data = data;
+}
+/**
+ * Sets the application defined property of the receiver
+ * with the specified name to the given value.
+ * <p>
+ * Applications may associate arbitrary objects with the
+ * receiver in this fashion. If the objects stored in the
+ * properties need to be notified when the widget is disposed
+ * of, it is the application's responsibility to hook the
+ * Dispose event on the widget and do so.
+ * </p>
+ *
+ * @param key the name of the property
+ * @param value the new value for the property
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #getData
+ */
+public void setData (String key, Object value) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
+
+ /* Remove the key/value pair */
+ if (value == null) {
+ if (keys == null) return;
+ int index = 0;
+ while (index < keys.length && !keys [index].equals (key)) index++;
+ if (index == keys.length) return;
+ if (keys.length == 1) {
+ keys = null;
+ values = null;
+ } else {
+ String [] newKeys = new String [keys.length - 1];
+ Object [] newValues = new Object [values.length - 1];
+ System.arraycopy (keys, 0, newKeys, 0, index);
+ System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index);
+ System.arraycopy (values, 0, newValues, 0, index);
+ System.arraycopy (values, index + 1, newValues, index, newValues.length - index);
+ keys = newKeys;
+ values = newValues;
+ }
+ return;
+ }
+
+ /* Add the key/value pair */
+ if (keys == null) {
+ keys = new String [] {key};
+ values = new Object [] {value};
+ return;
+ }
+ for (int i=0; i<keys.length; i++) {
+ if (keys [i].equals (key)) {
+ values [i] = value;
+ return;
+ }
+ }
+ String [] newKeys = new String [keys.length + 1];
+ Object [] newValues = new Object [values.length + 1];
+ System.arraycopy (keys, 0, newKeys, 0, keys.length);
+ System.arraycopy (values, 0, newValues, 0, values.length);
+ newKeys [keys.length] = key;
+ newValues [values.length] = value;
+ keys = newKeys;
+ values = newValues;
+}
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the receiver
+ */
+public String toString () {
+ String string = "*Disposed*";
+ if (!isDisposed ()) {
+ string = "*Wrong Thread*";
+ if (isValidThread ()) string = getNameText ();
+ }
+ return getName () + " {" + string + "}";
+}
+int topHandle () {
+ return handle;
+}
+char wcsToMbcs (char ch) {
+ int key = ch & 0xFFFF;
+ if (key <= 0x7F) return ch;
+ byte [] buffer = Converter.wcsToMbcs (null, new char [] {ch}, false);
+ if (buffer.length == 1) return (char) buffer [0];
+ if (buffer.length == 2) {
+ return (char) (((buffer [0] & 0xFF) << 8) | (buffer [1] & 0xFF));
+ }
+ return 0;
+}
+
+byte[] string2bytesConvertMnemonic(String string) {
+ //FIXME need to double _'s
+ char [] t = new char [string.length ()];
+ string.getChars (0, t.length, t, 0);
+ for (int i=0; i<t.length; i++) {if (t [i] == '&') t [i] = '_';}
+ return Converter.wcsToMbcs (null, t, true);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/WidgetTable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/WidgetTable.java
new file mode 100644
index 0000000..df50651
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/WidgetTable.java
@@ -0,0 +1,89 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.gtk.*;
+
+class WidgetTable {
+ static int FreeSlot = 0;
+ static int GrowSize = 1024;
+ static int [] IndexTable = new int [GrowSize];
+ static Widget [] WidgetTable = new Widget [GrowSize];
+ static {
+ for (int i=0; i<GrowSize-1; i++) IndexTable [i] = i + 1;
+ IndexTable [GrowSize - 1] = -1;
+ }
+
+public static synchronized Widget get (int handle) {
+ if (handle == 0) return null;
+ int index = OS.gtk_object_get_user_data (handle) - 1;
+ if (0 <= index && index < WidgetTable.length) return WidgetTable [index];
+ return null;
+}
+
+public synchronized static void put(int handle, Widget widget) {
+ if (handle == 0) return;
+ if (FreeSlot == -1) {
+ int length = (FreeSlot = IndexTable.length) + GrowSize;
+ int[] newIndexTable = new int[length];
+ Widget[] newWidgetTable = new Widget [length];
+ System.arraycopy (IndexTable, 0, newIndexTable, 0, FreeSlot);
+ System.arraycopy (WidgetTable, 0, newWidgetTable, 0, FreeSlot);
+ for (int i = FreeSlot; i < length - 1; i++) {
+ newIndexTable[i] = i + 1;
+ }
+ newIndexTable[length - 1] = -1;
+ IndexTable = newIndexTable;
+ WidgetTable = newWidgetTable;
+ }
+ int index = FreeSlot + 1;
+ OS.gtk_object_set_user_data (handle, index);
+ int oldSlot = FreeSlot;
+ FreeSlot = IndexTable[oldSlot];
+ IndexTable [oldSlot] = -2;
+ WidgetTable [oldSlot] = widget;
+}
+
+public static synchronized Widget remove (int handle) {
+ if (handle == 0) return null;
+ Widget widget = null;
+ int index = OS.gtk_object_get_user_data (handle) - 1;
+ if (0 <= index && index < WidgetTable.length) {
+ widget = WidgetTable [index];
+ WidgetTable [index] = null;
+ IndexTable [index] = FreeSlot;
+ FreeSlot = index;
+ OS.gtk_object_set_user_data (handle, 0);
+ }
+ return widget;
+}
+
+public static synchronized Shell [] shells () {
+ int length = 0;
+ for (int i=0; i<WidgetTable.length; i++) {
+ Widget widget = WidgetTable [i];
+ if (widget != null && widget instanceof Shell) length++;
+ }
+ int index = 0;
+ Shell [] result = new Shell [length];
+ for (int i=0; i<WidgetTable.length; i++) {
+ Widget widget = WidgetTable [i];
+ if (widget != null && widget instanceof Shell) {
+ result [index++] = (Shell) widget;
+ }
+ }
+ return result;
+}
+
+public static synchronized int size () {
+ int size = 0;
+ for (int i=0; i<WidgetTable.length; i++) {
+ if (WidgetTable [i] != null) size++;
+ }
+ return size;
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Color.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Color.java
new file mode 100644
index 0000000..e796d21
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Color.java
@@ -0,0 +1,257 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ * Instances of this class manage the operating system resources that
+ * implement SWT's RGB color model. To create a color you can either
+ * specify the individual color components as integers in the range
+ * 0 to 255 or provide an instance of an <code>RGB</code>.
+ * <p>
+ * Application code must explicitly invoke the <code>Color.dispose()</code>
+ * method to release the operating system resources managed by each instance
+ * when those instances are no longer required.
+ * </p>
+ *
+ * @see RGB
+ */
+public final class Color {
+ /**
+ * the handle to the OS color resource
+ * (Warning: This field is platform dependent)
+ */
+ public GdkColor handle;
+ Device display;
+Color() {
+}
+/**
+ * Constructs a new instance of this class given a device and the
+ * desired red, green and blue values expressed as ints in the range
+ * 0 to 255 (where 0 is black and 255 is full brightness). On limited
+ * color devices, the color instance created by this call may not have
+ * the same RGB values as the ones specified by the arguments. The
+ * RGB values on the returned instance will be the color values of
+ * the operating system color.
+ * <p>
+ * You must dispose the color when it is no longer required.
+ * </p>
+ *
+ * @param device the device on which to allocate the color
+ * @param red the amount of red in the color
+ * @param green the amount of green in the color
+ * @param blue the amount of blue in the color
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the red, green or blue argument is not between 0 and 255</li>
+ * </ul>
+ *
+ * @see #dispose
+ */
+public Color(Device display, int red, int green, int blue) {
+ init(display, red, green, blue);
+}
+/**
+ * Constructs a new instance of this class given a device and an
+ * <code>RGB</code> describing the desired red, green and blue values.
+ * On limited color devices, the color instance created by this call
+ * may not have the same RGB values as the ones specified by the
+ * argument. The RGB values on the returned instance will be the color
+ * values of the operating system color.
+ * <p>
+ * You must dispose the color when it is no longer required.
+ * </p>
+ *
+ * @param device the device on which to allocate the color
+ * @param RGB the RGB values of the desired color
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the red, green or blue components of the argument are not between 0 and 255</li>
+ * <li>ERROR_NULL_ARGUMENT - if the rgb argument is null</li>
+ * </ul>
+ *
+ * @see #dispose
+ */
+public Color(Device display, RGB rgb) {
+ if (rgb == null) error(SWT.ERROR_NULL_ARGUMENT);
+ init(display, rgb.red, rgb.green, rgb.blue);
+}
+/**
+ * Disposes of the operating system resources associated with
+ * the color. Applications must dispose of all colors which
+ * they allocate.
+ */
+public void dispose() {
+ /**
+ * If this is a palette-based display,
+ * Decrease the reference count for this color.
+ * If the reference count reaches 0, the slot may
+ * be reused when another color is allocated.
+ */
+ if (display.colorRefCount != null) {
+ if (--display.colorRefCount[handle.pixel] == 0) {
+ display.gdkColors[handle.pixel] = null;
+ }
+ }
+ int colormap = OS.gdk_colormap_get_system();
+ OS.gdk_colors_free(colormap, new int[] { handle.pixel }, 1, 0);
+ this.display = null;
+ this.handle = null;
+}
+/**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the <em>same</em> object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
+ *
+ * @see #hashCode
+ */
+public boolean equals(Object object) {
+ if (object == this) return true;
+ if (!(object instanceof Color)) return false;
+ Color color = (Color)object;
+ GdkColor xColor = color.handle;
+ return (handle.pixel == xColor.pixel)&&(handle.red == xColor.red) && (handle.green == xColor.green) && (handle.blue == xColor.blue) && (this.display == color.display);
+}
+void error(int code) {
+ throw new SWTError(code);
+}
+/**
+ * Returns the amount of blue in the color, from 0 to 255.
+ *
+ * @return the blue component of the color
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public int getBlue() {
+ return (handle.blue >> 8) & 0xFF;
+}
+/**
+ * Returns the amount of green in the color, from 0 to 255.
+ *
+ * @return the green component of the color
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public int getGreen() {
+ return (handle.green >> 8) & 0xFF;
+}
+/**
+ * Returns the amount of red in the color, from 0 to 255.
+ *
+ * @return the red component of the color
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public int getRed() {
+ return (handle.red >> 8) & 0xFF;
+}
+
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects which return <code>true</code> when passed to
+ * <code>equals</code> must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals
+ */
+public int hashCode() {
+ return handle.red ^ handle.green ^ handle.blue;
+}
+/**
+ * Returns an <code>RGB</code> representing the receiver.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public RGB getRGB () {
+ return new RGB(getRed(), getGreen(), getBlue());
+}
+
+void init(Device display, int red, int green, int blue) {
+ if (display == null) display = Display.getDefault();
+ this.display = display;
+ handle = new GdkColor();
+ handle.red = (short)((red & 0xFF) | ((red & 0xFF) << 8));
+ handle.green = (short)((green & 0xFF) | ((green & 0xFF) << 8));
+ handle.blue = (short)((blue & 0xFF) | ((blue & 0xFF) << 8));
+ int colormap = OS.gdk_colormap_get_system();
+ OS.gdk_color_alloc(colormap, handle);
+ if (display.colorRefCount != null) {
+ // Make a copy of the color to put in the colors array
+ GdkColor colorCopy = new GdkColor();
+ colorCopy.red = handle.red;
+ colorCopy.green = handle.green;
+ colorCopy.blue = handle.blue;
+ colorCopy.pixel = handle.pixel;
+ display.gdkColors[colorCopy.pixel] = colorCopy;
+ display.colorRefCount[colorCopy.pixel]++;
+ }
+}
+/**
+ * Returns <code>true</code> if the color has been disposed,
+ * and <code>false</code> otherwise.
+ * <p>
+ * This method gets the dispose state for the color.
+ * When a color has been disposed, it is an error to
+ * invoke any other method using the color.
+ *
+ * @return <code>true</code> when the color is disposed and <code>false</code> otherwise
+ */
+public boolean isDisposed() {
+ return handle == null;
+}
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the receiver
+ */
+public String toString () {
+ return "Color {" + getRed() + ", " + getGreen() + ", " + getBlue() + "}";
+}
+
+public static Color gtk_new(GdkColor gdkColor) {
+ Color color = new Color(null, gtk_getRGBIntensities(gdkColor));
+ return color;
+}
+
+static RGB gtk_getRGBIntensities(GdkColor gdkColor) {
+ boolean intensitiesAreZero = (gdkColor.red==0) && (gdkColor.green==0) && (gdkColor.blue==0);
+ if (!intensitiesAreZero) return new RGB ((gdkColor.red&0xFF00)>>8,
+ (gdkColor.green&0xFF00)>>8,
+ (gdkColor.blue&0xFF00)>>8 );
+ GdkVisual visual = new GdkVisual();
+ OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
+
+ int r = (gdkColor.pixel&visual.red_mask) >> visual.red_shift;
+ if (visual.red_prec<8) r = r << (8 - visual.red_prec);
+ else r = r >> (visual.red_prec - 8);
+ int g = (gdkColor.pixel&visual.green_mask) >> visual.green_shift;
+ if (visual.green_prec<8) g = g << (8 - visual.green_prec);
+ else g = g >> (visual.green_prec - 8);
+ int b = (gdkColor.pixel&visual.blue_mask) >> visual.blue_shift;
+ if (visual.blue_prec<8) b = b << (8 - visual.blue_prec);
+ else b = b >> (visual.blue_prec - 8);
+
+ return new RGB(r, g, b);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Cursor.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Cursor.java
new file mode 100644
index 0000000..216957b
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Cursor.java
@@ -0,0 +1,291 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.internal.image.*;
+
+/**
+ * Instances of this class manage operating system resources that
+ * specify the appearance of the on-screen pointer. To create a
+ * cursor you specify the device and either a simple cursor style
+ * describing one of the standard operating system provided cursors
+ * or the image and mask data for the desired appearance.
+ * <p>
+ * Application code must explicitly invoke the <code>Cursor.dispose()</code>
+ * method to release the operating system resources managed by each instance
+ * when those instances are no longer required.
+ * </p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>
+ * CURSOR_ARROW, CURSOR_WAIT, CURSOR_CROSS, CURSOR_APPSTARTING, CURSOR_HELP,
+ * CURSOR_SIZEALL, CURSOR_SIZENESW, CURSOR_SIZENS, CURSOR_SIZENWSE, CURSOR_SIZEWE,
+ * CURSOR_SIZEN, CURSOR_SIZES, CURSOR_SIZEE, CURSOR_SIZEW, CURSOR_SIZENE, CURSOR_SIZESE,
+ * CURSOR_SIZESW, CURSOR_SIZENW, CURSOR_UPARROW, CURSOR_IBEAM, CURSOR_NO, CURSOR_HAND
+ * </dd>
+ * </dl>
+ */
+public final class Cursor {
+ /**
+ * the handle to the OS cursor resource
+ * (Warning: This field is platform dependent)
+ */
+ public int handle;
+Cursor () {
+}
+/**
+ * Constructs a new cursor given a device and a style
+ * constant describing the desired cursor appearance.
+ * <p>
+ * You must dispose the cursor when it is no longer required.
+ * </p>
+ *
+ * @param device the device on which to allocate the cursor
+ * @param style the style of cursor to allocate
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - when an unknown style is specified</li>
+ * </ul>
+ *
+ * @see Cursor for the supported style values
+ */
+public Cursor(Device display, int style) {
+ int osFlag = 0;
+ switch (style) {
+ case SWT.CURSOR_ARROW:
+ osFlag = OS.GDK_LEFT_PTR;
+ break;
+ case SWT.CURSOR_WAIT:
+ osFlag = OS.GDK_WATCH;
+ break;
+ case SWT.CURSOR_CROSS:
+ osFlag = OS.GDK_CROSS;
+ break;
+ case SWT.CURSOR_APPSTARTING:
+ osFlag = OS.GDK_WATCH;
+ break;
+ case SWT.CURSOR_HAND:
+ osFlag = OS.GDK_HAND1;
+ break;
+ case SWT.CURSOR_HELP:
+ osFlag = OS.GDK_QUESTION_ARROW;
+ break;
+ case SWT.CURSOR_SIZEALL:
+ osFlag = OS.GDK_DIAMOND_CROSS;
+ break;
+ case SWT.CURSOR_SIZENESW:
+ osFlag = OS.GDK_SIZING;
+ break;
+ case SWT.CURSOR_SIZENS:
+ osFlag = OS.GDK_DOUBLE_ARROW;
+ break;
+ case SWT.CURSOR_SIZENWSE:
+ osFlag = OS.GDK_SIZING;
+ break;
+ case SWT.CURSOR_SIZEWE:
+ osFlag = OS.GDK_SB_H_DOUBLE_ARROW;
+ break;
+ case SWT.CURSOR_SIZEN:
+ osFlag = OS.GDK_TOP_SIDE;
+ break;
+ case SWT.CURSOR_SIZES:
+ osFlag = OS.GDK_BOTTOM_SIDE;
+ break;
+ case SWT.CURSOR_SIZEE:
+ osFlag = OS.GDK_RIGHT_SIDE;
+ break;
+ case SWT.CURSOR_SIZEW:
+ osFlag = OS.GDK_LEFT_SIDE;
+ break;
+ case SWT.CURSOR_SIZENE:
+ osFlag = OS.GDK_TOP_RIGHT_CORNER;
+ break;
+ case SWT.CURSOR_SIZESE:
+ osFlag = OS.GDK_BOTTOM_RIGHT_CORNER;
+ break;
+ case SWT.CURSOR_SIZESW:
+ osFlag = OS.GDK_BOTTOM_LEFT_CORNER;
+ break;
+ case SWT.CURSOR_SIZENW:
+ osFlag = OS.GDK_TOP_LEFT_CORNER;
+ break;
+ case SWT.CURSOR_UPARROW:
+ osFlag = OS.GDK_SB_UP_ARROW;
+ break;
+ case SWT.CURSOR_IBEAM:
+ osFlag = OS.GDK_XTERM;
+ break;
+ case SWT.CURSOR_NO:
+ osFlag = OS.GDK_X_CURSOR;
+ break;
+ default:
+ error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ this.handle = OS.gdk_cursor_new(osFlag);
+}
+/**
+ * Constructs a new cursor given a device, image and mask
+ * data describing the desired cursor appearance, and the x
+ * and y co-ordinates of the <em>hotspot</em> (that is, the point
+ * within the area covered by the cursor which is considered
+ * to be where the on-screen pointer is "pointing").
+ * <p>
+ * The mask data is allowed to be null, but in this case the source
+ * must be an ImageData representing an icon that specifies both
+ * color data and mask data.
+ * <p>
+ * You must dispose the cursor when it is no longer required.
+ * </p>
+ *
+ * @param device the device on which to allocate the cursor
+ * @param source the color data for the cursor
+ * @param mask the mask data for the cursor (or null)
+ * @param hotspotX the x coordinate of the cursor's hotspot
+ * @param hotspotY the y coordinate of the cursor's hotspot
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - when a null argument is passed that is not allowed</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the source and the mask are not the same
+ * size, or either is not of depth one, or if the hotspot is outside
+ * the bounds of the image</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_NO_HANDLES - if an error occurred constructing the cursor</li>
+ * </ul>
+ */
+public Cursor(Device display, ImageData source, ImageData mask, int hotspotX, int hotspotY) {
+ if (source == null) error(SWT.ERROR_NULL_ARGUMENT);
+ if (mask == null) {
+ if (!(source.getTransparencyType() == SWT.TRANSPARENCY_MASK)) error(SWT.ERROR_NULL_ARGUMENT);
+ mask = source.getTransparencyMask();
+ }
+ /* Check the bounds. Mask must be the same size as source */
+ if (mask.width != source.width || mask.height != source.height) {
+ error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ /* Check depths */
+ if (mask.depth != 1) error(SWT.ERROR_INVALID_ARGUMENT);
+ if (source.depth != 1) error(SWT.ERROR_INVALID_ARGUMENT);
+ /* Check the hotspots */
+ if (hotspotX >= source.width || hotspotX < 0 ||
+ hotspotY >= source.height || hotspotY < 0) {
+ error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+
+ /* Swap the bits if necessary */
+ byte[] sourceData = new byte[source.data.length];
+ byte[] maskData = new byte[mask.data.length];
+ /* Swap the bits in each byte */
+ byte[] data = source.data;
+ for (int i = 0; i < data.length; i++) {
+ byte s = data[i];
+ sourceData[i] = (byte)(((s & 0x80) >> 7) |
+ ((s & 0x40) >> 5) |
+ ((s & 0x20) >> 3) |
+ ((s & 0x10) >> 1) |
+ ((s & 0x08) << 1) |
+ ((s & 0x04) << 3) |
+ ((s & 0x02) << 5) |
+ ((s & 0x01) << 7));
+ sourceData[i] = (byte) ~sourceData[i];
+ }
+ data = mask.data;
+ for (int i = 0; i < data.length; i++) {
+ byte s = data[i];
+ maskData[i] = (byte)(((s & 0x80) >> 7) |
+ ((s & 0x40) >> 5) |
+ ((s & 0x20) >> 3) |
+ ((s & 0x10) >> 1) |
+ ((s & 0x08) << 1) |
+ ((s & 0x04) << 3) |
+ ((s & 0x02) << 5) |
+ ((s & 0x01) << 7));
+ maskData[i] = (byte) ~maskData[i];
+ }
+
+ int sourcePixmap = OS.gdk_bitmap_create_from_data(0, sourceData, source.width, source.height);
+ if (sourcePixmap==0) SWT.error(SWT.ERROR_NO_HANDLES);
+ int maskPixmap = OS.gdk_bitmap_create_from_data(0, maskData, source.width, source.height);
+ if (maskPixmap==0) SWT.error(SWT.ERROR_NO_HANDLES);
+
+ /* Get the colors */
+ GdkColor foreground = new GdkColor();
+ foreground.red = 0;
+ foreground.green = 0;
+ foreground.blue = 0;
+ GdkColor background = new GdkColor();
+ background.red = (short)65535;
+ background.green = (short)65535;
+ background.blue = (short)65535;
+
+ /* Create the cursor */
+ /* For some reason, mask and source take reverse roles, both here and on Motif */
+ handle = OS.gdk_cursor_new_from_pixmap (maskPixmap, sourcePixmap, foreground, background, hotspotX, hotspotY);
+ /* Dispose the pixmaps */
+ OS.gdk_pixmap_unref (sourcePixmap);
+ OS.gdk_pixmap_unref (maskPixmap);
+ if (handle == 0) error(SWT.ERROR_NO_HANDLES);
+}
+/**
+ * Disposes of the operating system resources associated with
+ * the cursor. Applications must dispose of all cursors which
+ * they allocate.
+ */
+public void dispose() {
+ if (handle != 0) OS.gdk_cursor_destroy(handle);
+ handle = 0;
+}
+/**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the <em>same</em> object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
+ *
+ * @see #hashCode
+ */
+public boolean equals(Object object) {
+ return (object == this) || ((object instanceof Cursor) && (handle == ((Cursor)object).handle));
+}
+void error(int code) {
+ throw new SWTError(code);
+}
+public static Cursor gtk_new(int handle) {
+ Cursor cursor = new Cursor();
+ cursor.handle = handle;
+ return cursor;
+}
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects which return <code>true</code> when passed to
+ * <code>equals</code> must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals
+ */
+public int hashCode() {
+ return handle;
+}
+/**
+ * Returns <code>true</code> if the cursor has been disposed,
+ * and <code>false</code> otherwise.
+ * <p>
+ * This method gets the dispose state for the cursor.
+ * When a cursor has been disposed, it is an error to
+ * invoke any other method using the cursor.
+ *
+ * @return <code>true</code> when the cursor is disposed and <code>false</code> otherwise
+ */
+public boolean isDisposed() {
+ return handle == 0;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/DefaultGtkStyle.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/DefaultGtkStyle.java
new file mode 100644
index 0000000..952fa9d
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/DefaultGtkStyle.java
@@ -0,0 +1,116 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.gtk.*;
+
+class DefaultGtkStyle {
+
+ private static DefaultGtkStyle instance = null;
+ private GtkStyle style = null;
+ private int defaultFont;
+
+ public Color foregroundColorNORMAL() {
+ return new Color(null,
+ ((short)0xFF00 & style.fg0_red)>>8,
+ ((short)0xFF00 & style.fg0_green)>>8,
+ ((short)0xFF00 & style.fg0_blue)>>8);
+ }
+
+ public Color backgroundColorNORMAL() {
+ return new Color(null,
+ ((short)0xFF00 & style.bg0_red)>>8,
+ ((short)0xFF00 & style.bg0_green)>>8,
+ ((short)0xFF00 & style.bg0_blue)>>8);
+ }
+
+ public Color foregroundColorACTIVE() {
+ return new Color(null,
+ ((short)0xFF00 & style.fg1_red)>>8,
+ ((short)0xFF00 & style.fg1_green)>>8,
+ ((short)0xFF00 & style.fg1_blue)>>8);
+ }
+
+ public Color backgroundColorACTIVE() {
+ return new Color(null,
+ ((short)0xFF00 & style.bg1_red)>>8,
+ ((short)0xFF00 & style.bg1_green)>>8,
+ ((short)0xFF00 & style.bg1_blue)>>8);
+ }
+
+ public Color foregroundColorPRELIGHT() {
+ return new Color(null,
+ ((short)0xFF00 & style.fg2_red)>>8,
+ ((short)0xFF00 & style.fg2_green)>>8,
+ ((short)0xFF00 & style.fg2_blue)>>8);
+ }
+
+ public Color backgroundColorPRELIGHT() {
+ return new Color(null,
+ ((short)0xFF00 & style.bg2_red)>>8,
+ ((short)0xFF00 & style.bg2_green)>>8,
+ ((short)0xFF00 & style.bg2_blue)>>8);
+ }
+
+ public Color foregroundColorSELECTED() {
+ return new Color(null,
+ ((short)0xFF00 & style.fg3_red)>>8,
+ ((short)0xFF00 & style.fg3_green)>>8,
+ ((short)0xFF00 & style.fg3_blue)>>8);
+ }
+
+ public Color backgroundColorSELECTED() {
+ return new Color(null,
+ ((short)0xFF00 & style.bg3_red)>>8,
+ ((short)0xFF00 & style.bg3_green)>>8,
+ ((short)0xFF00 & style.bg3_blue)>>8);
+ }
+
+ public Color foregroundColorINSENSITIVE() {
+ return new Color(null,
+ ((short)0xFF00 & style.fg4_red)>>8,
+ ((short)0xFF00 & style.fg4_green)>>8,
+ ((short)0xFF00 & style.fg4_blue)>>8);
+ }
+
+ public Color backgroundColorINSENSITIVE() {
+ return new Color(null,
+ ((short)0xFF00 & style.bg4_red)>>8,
+ ((short)0xFF00 & style.bg4_green)>>8,
+ ((short)0xFF00 & style.bg4_blue)>>8);
+ }
+
+ public int loadDefaultFont() {
+ if (defaultFont == 0) {
+ int fnames = Font.getFontNameList(style.font);
+ int slength = OS.g_slist_length(fnames);
+ if (slength < 1) SWT.error(SWT.ERROR_UNSPECIFIED);
+ int name1 = OS.g_slist_nth_data(fnames, 0);
+ int length = OS.strlen(name1);
+ byte [] buffer1 = new byte[length];
+ OS.memmove(buffer1, name1, length);
+ defaultFont = OS.gdk_font_load(buffer1);
+ if (defaultFont==0) SWT.error(SWT.ERROR_UNSPECIFIED);
+ GdkFont gdkFont = new GdkFont();
+ OS.memmove(gdkFont, defaultFont, GdkFont.sizeof);
+ if (gdkFont.type != OS.GDK_FONT_FONT) SWT.error(SWT.ERROR_UNSPECIFIED);
+ }
+ return defaultFont;
+ }
+
+ public static DefaultGtkStyle instance() {
+ if (instance==null) instance = new DefaultGtkStyle();
+ return instance;
+ }
+
+ private DefaultGtkStyle() {
+ style = new GtkStyle();
+ OS.memmove(style, OS.gtk_widget_get_default_style(), GtkStyle.sizeof);
+ }
+
+}
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Device.java
new file mode 100644
index 0000000..f98cf11
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Device.java
@@ -0,0 +1,482 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+
+public abstract class Device implements Drawable {
+
+ /* Debugging */
+ public static boolean DEBUG;
+ boolean debug = DEBUG;
+ boolean tracking = DEBUG;
+ Error [] errors;
+ Object [] objects;
+
+ /* Colormap and reference count */
+ GdkColor [] gdkColors;
+ int [] colorRefCount;
+
+ /* Disposed flag */
+ boolean disposed;
+
+ /*
+ * The following colors are listed in the Windows
+ * Programmer's Reference as the colors in the default
+ * palette.
+ */
+ Color COLOR_BLACK, COLOR_DARK_RED, COLOR_DARK_GREEN, COLOR_DARK_YELLOW, COLOR_DARK_BLUE;
+ Color COLOR_DARK_MAGENTA, COLOR_DARK_CYAN, COLOR_GRAY, COLOR_DARK_GRAY, COLOR_RED;
+ Color COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE;
+
+ /*
+ * TEMPORARY CODE. When a graphics object is
+ * created and the device parameter is null,
+ * the current Display is used. This presents
+ * a problem because SWT graphics does not
+ * reference classes in SWT widgets. The correct
+ * fix is to remove this feature. Unfortunately,
+ * too many application programs rely on this
+ * feature.
+ *
+ * This code will be removed in the future.
+ */
+ protected static Device CurrentDevice;
+ protected static Runnable DeviceFinder;
+ static {
+ try {
+ Class.forName ("org.eclipse.swt.widgets.Display");
+ } catch (Throwable e) {}
+ }
+
+/*
+* TEMPORARY CODE.
+*/
+static Device getDevice () {
+ if (DeviceFinder != null) DeviceFinder.run();
+ Device device = CurrentDevice;
+ CurrentDevice = null;
+ return device;
+}
+
+/**
+ * Constructs a new instance of this class.
+ * <p>
+ * You must dispose the device when it is no longer required.
+ * </p>
+ *
+ * @param data the DeviceData which describes the receiver
+ *
+ * @see #create
+ * @see #init
+ * @see DeviceData
+ */
+public Device(DeviceData data) {
+ if (data != null) {
+ debug = data.debug;
+ tracking = data.tracking;
+ }
+ create (data);
+ init ();
+ if (tracking) {
+ errors = new Error [128];
+ objects = new Object [128];
+ }
+}
+
+protected void checkDevice () {
+ if (disposed) SWT.error(SWT.ERROR_DEVICE_DISPOSED);
+}
+
+protected void create (DeviceData data) {
+}
+
+/**
+ * Disposes of the operating system resources associated with
+ * the receiver. After this method has been invoked, the receiver
+ * will answer <code>true</code> when sent the message
+ * <code>isDisposed()</code>.
+ *
+ * @see #release
+ * @see #destroy
+ * @see #checkDevice
+ */
+public void dispose () {
+ if (isDisposed()) return;
+ checkDevice ();
+ release ();
+ destroy ();
+ disposed = true;
+ if (tracking) {
+ objects = null;
+ errors = null;
+ }
+}
+
+void dispose_Object (Object object) {
+ for (int i=0; i<objects.length; i++) {
+ if (objects [i] == object) {
+ objects [i] = null;
+ errors [i] = null;
+ return;
+ }
+ }
+}
+
+protected void destroy () {
+}
+
+/**
+ * Returns a rectangle describing the receiver's size and location.
+ *
+ * @return the bounding rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Rectangle getBounds () {
+ checkDevice ();
+ SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
+ return new Rectangle(0, 0, 0, 0);
+}
+
+/**
+ * Returns a <code>DeviceData</code> based on the receiver.
+ * Modifications made to this <code>DeviceData</code> will not
+ * affect the receiver.
+ *
+ * @return a <code>DeviceData</code> containing the device's data and attributes
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see DeviceData
+ */
+public DeviceData getDeviceData () {
+ checkDevice();
+ DeviceData data = new DeviceData ();
+ data.debug = debug;
+ data.tracking = tracking;
+ int count = 0, length = 0;
+ if (tracking) length = objects.length;
+ for (int i=0; i<length; i++) {
+ if (objects [i] != null) count++;
+ }
+ int index = 0;
+ data.objects = new Object [count];
+ data.errors = new Error [count];
+ for (int i=0; i<length; i++) {
+ if (objects [i] != null) {
+ data.objects [index] = objects [i];
+ data.errors [index] = errors [i];
+ index++;
+ }
+ }
+ return data;
+}
+
+/**
+ * Returns a rectangle which describes the area of the
+ * receiver which is capable of displaying data.
+ *
+ * @return the client area
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #getBounds
+ */
+public Rectangle getClientArea () {
+ checkDevice ();
+ return getBounds ();
+}
+
+/**
+ * Returns the bit depth of the screen, which is the number of
+ * bits it takes to represent the number of unique colors that
+ * the screen is currently capable of displaying. This number
+ * will typically be one of 1, 8, 15, 16, 24 or 32.
+ *
+ * @return the depth of the screen
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public int getDepth () {
+ checkDevice ();
+ SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
+ return 0;
+}
+
+/**
+ * Returns a point whose x coordinate is the horizontal
+ * dots per inch of the display, and whose y coordinate
+ * is the vertical dots per inch of the display.
+ *
+ * @return the horizontal and vertical DPI
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Point getDPI () {
+ checkDevice ();
+ SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
+ return new Point (72, 72);
+}
+
+/**
+ * Returns <code>FontData</code> objects which describe
+ * the fonts which match the given arguments. If the
+ * <code>faceName</code> is null, all fonts will be returned.
+ *
+ * @param faceName the name of the font to look for, or null
+ * @param scalable true if scalable fonts should be returned.
+ * @return the matching font data
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public FontData [] getFontList (String faceName, boolean scalable) {
+ checkDevice ();
+ String xlfd;
+ if (faceName == null) {
+ xlfd = "-*";
+ } else {
+ int dashIndex = faceName.indexOf('-');
+ if (dashIndex < 0) {
+ xlfd = "-*-" + faceName + "-*";
+ } else {
+ xlfd = "-" + faceName + "-*";
+ }
+ }
+ /* Use the character encoding for the default locale */
+ byte [] buffer1 = Converter.wcsToMbcs (null, xlfd, true);
+ int [] ret = new int [1];
+ int listPtr = OS.XListFonts (buffer1, 65535, ret);
+ int ptr = listPtr;
+ int [] intBuf = new int [1];
+ FontData [] fd = new FontData [ret [0]];
+ int fdIndex = 0;
+ for (int i = 0; i < ret [0]; i++) {
+ OS.memmove (intBuf, ptr, 4);
+ int charPtr = intBuf [0];
+ int length = OS.strlen (charPtr);
+ byte [] buffer2 = new byte [length];
+ OS.memmove (buffer2, charPtr, length);
+ /* Use the character encoding for the default locale */
+ char [] chars = Converter.mbcsToWcs (null, buffer2);
+ FontData data = FontData.gtk_new (new String (chars));
+ boolean isScalable = data.averageWidth == 0 && data.pixels == 0 && data.points == 0;
+ if (isScalable == scalable) {
+ fd [fdIndex++] = data;
+ }
+ ptr += 4;
+ }
+ // FIXME, leaking font list
+// OS.XFreeFontNames (listPtr);
+ if (fdIndex == ret [0]) return fd;
+ FontData [] result = new FontData [fdIndex];
+ System.arraycopy (fd, 0, result, 0, fdIndex);
+ return result;
+}
+
+/**
+ * Returns the matching standard color for the given
+ * constant, which should be one of the color constants
+ * specified in class <code>SWT</code>. Any value other
+ * than one of the SWT color constants which is passed
+ * in will result in the color black. This color should
+ * not be free'd because it was allocated by the system,
+ * not the application.
+ *
+ * @param id the color constant
+ * @return the matching color
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see SWT
+ */
+public Color getSystemColor (int id) {
+ checkDevice ();
+ switch (id) {
+ case SWT.COLOR_BLACK: return COLOR_BLACK;
+ case SWT.COLOR_DARK_RED: return COLOR_DARK_RED;
+ case SWT.COLOR_DARK_GREEN: return COLOR_DARK_GREEN;
+ case SWT.COLOR_DARK_YELLOW: return COLOR_DARK_YELLOW;
+ case SWT.COLOR_DARK_BLUE: return COLOR_DARK_BLUE;
+ case SWT.COLOR_DARK_MAGENTA: return COLOR_DARK_MAGENTA;
+ case SWT.COLOR_DARK_CYAN: return COLOR_DARK_CYAN;
+ case SWT.COLOR_GRAY: return COLOR_GRAY;
+ case SWT.COLOR_DARK_GRAY: return COLOR_DARK_GRAY;
+ case SWT.COLOR_RED: return COLOR_RED;
+ case SWT.COLOR_GREEN: return COLOR_GREEN;
+ case SWT.COLOR_YELLOW: return COLOR_YELLOW;
+ case SWT.COLOR_BLUE: return COLOR_BLUE;
+ case SWT.COLOR_MAGENTA: return COLOR_MAGENTA;
+ case SWT.COLOR_CYAN: return COLOR_CYAN;
+ case SWT.COLOR_WHITE: return COLOR_WHITE;
+ }
+ return COLOR_BLACK;
+}
+
+/**
+ * Returns a reasonable font for applications to use.
+ * On some platforms, this will match the "default font"
+ * or "system font" if such can be found. This font
+ * should not be free'd because it was allocated by the
+ * system, not the application.
+ * <p>
+ * Typically, applications which want the default look
+ * should simply not set the font on the widgets they
+ * create. Widgets are always created with the correct
+ * default font for the class of user-interface component
+ * they represent.
+ * </p>
+ *
+ * @return a font
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Font getSystemFont () {
+ checkDevice ();
+ return null;
+}
+
+protected void init () {
+ COLOR_BLACK = new Color (this, 0,0,0);
+ COLOR_DARK_RED = new Color (this, 0x80,0,0);
+ COLOR_DARK_GREEN = new Color (this, 0,0x80,0);
+ COLOR_DARK_YELLOW = new Color (this, 0x80,0x80,0);
+ COLOR_DARK_BLUE = new Color (this, 0,0,0x80);
+ COLOR_DARK_MAGENTA = new Color (this, 0x80,0,0x80);
+ COLOR_DARK_CYAN = new Color (this, 0,0x80,0x80);
+ COLOR_GRAY = new Color (this, 0xC0,0xC0,0xC0);
+ COLOR_DARK_GRAY = new Color (this, 0x80,0x80,0x80);
+ COLOR_RED = new Color (this, 0xFF,0,0);
+ COLOR_GREEN = new Color (this, 0,0xFF,0);
+ COLOR_YELLOW = new Color (this, 0xFF,0xFF,0);
+ COLOR_BLUE = new Color (this, 0,0,0xFF);
+ COLOR_MAGENTA = new Color (this, 0xFF,0,0xFF);
+ COLOR_CYAN = new Color (this, 0,0xFF,0xFF);
+ COLOR_WHITE = new Color (this, 0xFF,0xFF,0xFF);
+}
+
+/**
+ * Invokes platform specific functionality to allocate a new GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Device</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param data the platform specific GC data
+ * @return the platform specific GC handle
+ *
+ * @private
+ */
+public abstract int internal_new_GC (GCData data);
+
+/**
+ * Invokes platform specific functionality to dispose a GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Device</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param handle the platform specific GC handle
+ * @param data the platform specific GC data
+ *
+ * @private
+ */
+public abstract void internal_dispose_GC (int handle, GCData data);
+
+/**
+ * Returns <code>true</code> if the device has been disposed,
+ * and <code>false</code> otherwise.
+ * <p>
+ * This method gets the dispose state for the device.
+ * When a device has been disposed, it is an error to
+ * invoke any other method using the device.
+ *
+ * @return <code>true</code> when the device is disposed and <code>false</code> otherwise
+ */
+public boolean isDisposed () {
+ return disposed;
+}
+
+void new_Object (Object object) {
+ for (int i=0; i<objects.length; i++) {
+ if (objects [i] == null) {
+ objects [i] = object;
+ errors [i] = new Error ();
+ return;
+ }
+ }
+ Object [] newObjects = new Object [objects.length + 128];
+ System.arraycopy (objects, 0, newObjects, 0, objects.length);
+ newObjects [objects.length] = object;
+ objects = newObjects;
+ Error [] newErrors = new Error [errors.length + 128];
+ System.arraycopy (errors, 0, newErrors, 0, errors.length);
+ newErrors [errors.length] = new Error ();
+ errors = newErrors;
+}
+
+protected void release () {
+ if (gdkColors != null) {
+ int colormap = OS.gdk_colormap_get_system();
+ int [] pixel = new int [1];
+ for (int i = 0; i < gdkColors.length; i++) {
+ GdkColor color = gdkColors [i];
+ if (color != null) {
+ while (colorRefCount [i] > 0) {
+ OS.gdk_color_free(color);
+ --colorRefCount [i];
+ }
+ }
+ }
+ }
+ gdkColors = null;
+ colorRefCount = null;
+ COLOR_BLACK = COLOR_DARK_RED = COLOR_DARK_GREEN = COLOR_DARK_YELLOW = COLOR_DARK_BLUE =
+ COLOR_DARK_MAGENTA = COLOR_DARK_CYAN = COLOR_GRAY = COLOR_DARK_GRAY = COLOR_RED =
+ COLOR_GREEN = COLOR_YELLOW = COLOR_BLUE = COLOR_MAGENTA = COLOR_CYAN = COLOR_WHITE = null;
+}
+
+/**
+ * If the underlying window system supports printing warning messages
+ * to the console, setting warnings to <code>true</code> prevents these
+ * messages from being printed. If the argument is <code>false</code>
+ * message printing is not blocked.
+ *
+ * @param warnings <code>true</code>if warnings should be handled, and <code>false</code> otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setWarnings (boolean warnings) {
+ checkDevice ();
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/DeviceData.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/DeviceData.java
new file mode 100644
index 0000000..4ed07eb
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/DeviceData.java
@@ -0,0 +1,24 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+public class DeviceData {
+ /*
+ * Motif only fields.
+ */
+ public String display_name;
+ public String application_name;
+ public String application_class;
+
+ /*
+ * Debug fields - may not be honoured
+ * on some SWT platforms.
+ */
+ public boolean debug;
+ public boolean tracking;
+ public Error [] errors;
+ public Object [] objects;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Font.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Font.java
new file mode 100644
index 0000000..89d6132
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Font.java
@@ -0,0 +1,209 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Instances of this class manage operating system resources that
+ * define how text looks when it is displayed. Fonts may be constructed
+ * by providing a device and either name, size and style information
+ * or a <code>FontData</code> object which encapsulates this data.
+ * <p>
+ * Application code must explicitly invoke the <code>Font.dispose()</code>
+ * method to release the operating system resources managed by each instance
+ * when those instances are no longer required.
+ * </p>
+ *
+ * @see FontData
+ */
+public final class Font {
+ /**
+ * the handle to the OS font resource
+ * (Warning: This field is platform dependent)
+ */
+ public int handle;
+Font() {
+}
+/**
+ * Constructs a new font given a device and font data
+ * which describes the desired font's appearance.
+ * <p>
+ * You must dispose the font when it is no longer required.
+ * </p>
+ *
+ * @param device the device to create the font on
+ * @param fd the FontData that describes the desired font (must not be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the fd argument is null</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_NO_HANDLES - if a font could not be created from the given font data</li>
+ * </ul>
+ */
+public Font(Device display, FontData fd) {
+ if (fd == null) error(SWT.ERROR_NULL_ARGUMENT);
+
+ String xlfd = fd.getXlfd();
+ byte[] buffer = Converter.wcsToMbcs(null, xlfd, true);
+ handle = OS.gdk_font_load(buffer);
+ if (handle == 0) {
+ int hStyle = OS.gtk_widget_get_default_style();
+ GtkStyle gtkStyle = new GtkStyle();
+ OS.memmove(gtkStyle, hStyle, GtkStyle.sizeof);
+ handle = OS.gdk_font_ref(gtkStyle.font);
+ }
+}
+/**
+ * Constructs a new font given a device, a font name,
+ * the height of the desired font in points, and a font
+ * style.
+ * <p>
+ * You must dispose the font when it is no longer required.
+ * </p>
+ *
+ * @param device the device to create the font on
+ * @param name the name of the font (must not be null)
+ * @param height the font height in points
+ * @param style a bit or combination of NORMAL, BOLD, ITALIC
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the name argument is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_NO_HANDLES - if a font could not be created from the given arguments</li>
+ * </ul>
+ */
+public Font(Device display, String fontFamily, int height, int style) {
+ if (fontFamily == null) error(SWT.ERROR_NULL_ARGUMENT);
+ FontData fd = new FontData(fontFamily, height, style);
+ byte[] buffer = Converter.wcsToMbcs(null, fd.getXlfd(), true);
+ handle = OS.gdk_font_load(buffer);
+ if (handle == 0) {
+ int hStyle = OS.gtk_widget_get_default_style();
+ GtkStyle gtkStyle = new GtkStyle();
+ OS.memmove(gtkStyle, hStyle, GtkStyle.sizeof);
+ handle = OS.gdk_font_ref(gtkStyle.font);
+ }
+}
+/**
+ * Disposes of the operating system resources associated with
+ * the font. Applications must dispose of all fonts which
+ * they allocate.
+ */
+public void dispose() {
+ if (handle != 0) OS.gdk_font_unref(handle);
+ handle = 0;
+}
+/**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the <em>same</em> object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
+ *
+ * @see #hashCode
+ */
+public boolean equals(Object object) {
+ if (object == this) return true;
+ if (!(object instanceof Font)) return false;
+ return OS.gdk_font_equal(handle, ((Font)object).handle);
+}
+void error(int code) {
+ throw new SWTError (code);
+}
+
+/**
+ * Returns an array of <code>FontData</code>s representing the receiver.
+ * On Windows, only one FontData will be returned per font. On X however,
+ * a <code>Font</code> object <em>may</em> be composed of multiple X
+ * fonts. To support this case, we return an array of font data objects.
+ *
+ * @return an array of font data objects describing the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public FontData[] getFontData() {
+ int index=0;
+ int fnames = getFontNameList(handle);
+ int nfonts = OS.g_slist_length(fnames);
+ FontData[] answer = new FontData[nfonts];
+ for (int i=0; i<nfonts; i++) {
+ FontData data = new FontData();
+
+ int name = OS.g_slist_nth_data(fnames, index);
+ int length = OS.strlen(name);
+ byte [] buffer1 = new byte[length];
+ OS.memmove(buffer1, name, length);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ String fontname = new String (buffer2, 0, buffer2.length);
+ data.setXlfd(fontname);
+
+ // Wild guess, 'a' looks average enough
+ data.averageWidth = OS.gdk_char_width(handle, (byte)'a');
+
+ // Wild guess, a progressive font should probably have A wider than l
+ int widthA = OS.gdk_char_width(handle, (byte)'A');
+ int widthl = OS.gdk_char_width(handle, (byte)'l');
+ if (widthA == widthl) data.spacing = "m";
+ else data.spacing = "p";
+
+ answer[i] = data;
+ }
+ return answer;
+}
+static int getFontNameList(int handle) {
+ int[] mem = new int[7];
+ OS.memmove(mem, handle, 7*4);
+ int type = mem[0];
+ int ascent = mem[1];
+ int descent = mem[2];
+ int xfont =mem [3];
+ int xdisplay = mem[4];
+ int ref_count = mem[5];
+ int names = mem[6];
+ return names;
+}
+public static Font gtk_new(int handle) {
+ Font font = new Font();
+ font.handle = handle;
+ return font;
+}
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects which return <code>true</code> when passed to
+ * <code>equals</code> must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals
+ */
+public int hashCode() {
+ return handle;
+}
+/**
+ * Returns <code>true</code> if the font has been disposed,
+ * and <code>false</code> otherwise.
+ * <p>
+ * This method gets the dispose state for the font.
+ * When a font has been disposed, it is an error to
+ * invoke any other method using the font.
+ *
+ * @return <code>true</code> when the font is disposed and <code>false</code> otherwise
+ */
+public boolean isDisposed() {
+ return handle == 0;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/FontData.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/FontData.java
new file mode 100644
index 0000000..f179499
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/FontData.java
@@ -0,0 +1,546 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+
+/**
+ * Instances of this class describe operating system fonts.
+ * Only the public API of this type is platform independent.
+ * <p>
+ * For platform-independent behaviour, use the get and set methods
+ * corresponding to the following properties:
+ * <dl>
+ * <dt>height</dt><dd>the height of the font in points</dd>
+ * <dt>name</dt><dd>the face name of the font, which may include the foundry</dd>
+ * <dt>style</dt><dd>A bitwise combination of NORMAL, ITALIC and BOLD</dd>
+ * </dl>
+ * If extra, platform-dependent functionality is required:
+ * <ul>
+ * <li>On <em>Windows</em>, the data member of the <code>FontData</code>
+ * corresponds to a Windows <code>LOGFONT</code> structure whose fields
+ * may be retrieved and modified.</li>
+ * <li>On <em>X</em>, the fields of the <code>FontData</code> correspond
+ * to the entries in the font's XLFD name and may be retrieved and modified.
+ * </ul>
+ * Application code does <em>not</em> need to explicitly release the
+ * resources managed by each instance when those instances are no longer
+ * required, and thus no <code>dispose()</code> method is provided.
+ *
+ * @see Font
+ */
+public final class FontData {
+ /**
+ * The company that produced the font
+ * Warning: This field is platform dependent.
+ */
+ public String foundry;
+ /**
+ * The common name of the font
+ * Warning: This field is platform dependent.
+ */
+ public String fontFamily;
+ /**
+ * The weight ("normal", "bold")
+ * Warning: This field is platform dependent.
+ */
+ public String weight;
+ /**
+ * The slant ("o" for oblique, "i" for italic)
+ * Warning: This field is platform dependent.
+ */
+ public String slant;
+ /**
+ * The set width of the font
+ * Warning: This field is platform dependent.
+ */
+ public String setWidth;
+ /**
+ * Additional font styles
+ * Warning: This field is platform dependent.
+ */
+ public String addStyle;
+ /**
+ * The height of the font in pixels
+ * Warning: This field is platform dependent.
+ */
+ public int pixels;
+ /**
+ * The height of the font in tenths of a point
+ * Warning: This field is platform dependent.
+ */
+ public int points;
+ /**
+ * The horizontal screen resolution for which the font was designed
+ * Warning: This field is platform dependent.
+ */
+ public int horizontalResolution;
+ /**
+ * The vertical screen resolution for which the font was designed
+ * Warning: This field is platform dependent.
+ */
+ public int verticalResolution;
+ /**
+ * The font spacing ("m" for monospace, "p" for proportional)
+ * Warning: This field is platform dependent.
+ */
+ public String spacing;
+ /**
+ * The average character width for the font
+ * Warning: This field is platform dependent.
+ */
+ public int averageWidth;
+ /**
+ * The ISO character set registry
+ * Warning: This field is platform dependent.
+ */
+ public String characterSetRegistry;
+ /**
+ * The ISO character set name
+ * Warning: This field is platform dependent.
+ */
+ public String characterSetName;
+ /**
+ * The locales of the font
+ * (Warning: These fields are platform dependent)
+ */
+ String lang, country, variant;
+
+/**
+ * Constructs a new un-initialized font data.
+ */
+public FontData () {
+}
+/**
+ * Constructs a new FontData given a string representation
+ * in the form generated by the <code>FontData.toString</code>
+ * method.
+ * <p>
+ * Note that the representation varies between platforms,
+ * and a FontData can only be created from a string that was
+ * generated on the same platform.
+ * </p>
+ *
+ * @param string the string representation of a <code>FontData</code> (must not be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the argument does not represent a valid description</li>
+ * </ul>
+ *
+ * @see #toString
+ */
+public FontData(String string) {
+ if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
+ int start = 0;
+ int end = string.indexOf('|');
+ if (end == -1) error(SWT.ERROR_NULL_ARGUMENT);
+ String version1 = string.substring(start, end);
+
+ start = end + 1;
+ end = string.indexOf('|', start);
+ if (end == -1) error(SWT.ERROR_NULL_ARGUMENT);
+ String name = string.substring(start, end);
+
+ start = end + 1;
+ end = string.indexOf('|', start);
+ if (end == -1) error(SWT.ERROR_NULL_ARGUMENT);
+ int height = 0;
+ try {
+ height = Integer.parseInt(string.substring(start, end));
+ } catch (NumberFormatException e) {
+ error(SWT.ERROR_NULL_ARGUMENT);
+ }
+
+ start = end + 1;
+ end = string.indexOf('|', start);
+ if (end == -1) error(SWT.ERROR_NULL_ARGUMENT);
+ int style = 0;
+ try {
+ style = Integer.parseInt(string.substring(start, end));
+ } catch (NumberFormatException e) {
+ error(SWT.ERROR_NULL_ARGUMENT);
+ }
+
+ start = end + 1;
+ end = string.indexOf('|', start);
+ if (end == -1) {
+ setName(name);
+ setHeight(height);
+ setStyle(style);
+ return;
+ }
+ String platform = string.substring(start, end);
+
+ start = end + 1;
+ end = string.indexOf('|', start);
+ if (end == -1) {
+ setName(name);
+ setHeight(height);
+ setStyle(style);
+ return;
+ }
+ String version2 = string.substring(start, end);
+
+ if (platform.equals("MOTIF") && version2.equals("1")) {
+ start = end + 1;
+ end = string.length();
+ if (end == -1) {
+ setName(name);
+ setHeight(height);
+ setStyle(style);
+ return;
+ }
+ String xlfd = string.substring(start, end);
+ setXlfd(xlfd);
+ return;
+ }
+ setName(name);
+ setHeight(height);
+ setStyle(style);
+}
+/**
+ * Constructs a new font data given a font name,
+ * the height of the desired font in points,
+ * and a font style.
+ *
+ * @param name the name of the font (must not be null)
+ * @param height the font height in points
+ * @param style a bit or combination of NORMAL, BOLD, ITALIC
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - when the font name is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
+ * </ul>
+ */
+public FontData(String name, int height, int style) {
+ if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (height < 0) error(SWT.ERROR_INVALID_ARGUMENT);
+ int dash = name.indexOf('-');
+ if (dash != -1) {
+ foundry = name.substring(0, dash);
+ fontFamily = name.substring(dash + 1);
+ } else {
+ fontFamily = name;
+ }
+ points = height * 10;
+ if ((style & SWT.BOLD) != 0) {
+ weight = "bold";
+ } else {
+ weight = "medium";
+ }
+ if ((style & SWT.ITALIC) != 0) {
+ slant = "i";
+ } else {
+ slant = "r";
+ }
+}
+
+
+
+/*
+ * Public getters
+ */
+
+/**
+ * Returns the height of the receiver in points.
+ *
+ * @return the height of this FontData
+ *
+ * @see #setHeight
+ */
+public int getHeight() {
+ return points / 10;
+}
+
+/**
+ * Returns the name of the receiver.
+ * On platforms that support font foundries, the return value will
+ * be the foundry followed by a dash ("-") followed by the face name.
+ *
+ * @return the name of this <code>FontData</code>
+ *
+ * @see #setName
+ */
+public String getName() {
+ StringBuffer buffer = new StringBuffer();
+ if (foundry != null) {
+ buffer.append(foundry);
+ buffer.append("-");
+ }
+ if (fontFamily != null) buffer.append(fontFamily);
+ return buffer.toString();
+}
+
+/**
+ * Returns the style of the receiver which is a bitwise OR of
+ * one or more of the <code>SWT</code> constants NORMAL, BOLD
+ * and ITALIC.
+ *
+ * @return the style of this <code>FontData</code>
+ *
+ * @see #setStyle
+ */
+public int getStyle() {
+ int style = 0;
+ if (weight.equals("bold"))
+ style |= SWT.BOLD;
+ if (slant.equals("i"))
+ style |= SWT.ITALIC;
+ return style;
+}
+
+/**
+ * WARNING: This method is only public on GTK.
+ * We need this in FontDialog, so we can't just get rid of it or make it private.
+ */
+public String getXlfd() {
+ String s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
+ s1 = s2 = s3 = s4 = s5 = s6 = s7 = s8 = s9 = s10 = s11 = s12 = s13 = s14 = "*";
+
+ if (foundry != null) s1 = foundry;
+ if (fontFamily != null) s2 = fontFamily;
+ if (weight != null) s3 = weight;
+ if (slant != null) s4 = slant;
+ if (setWidth != null) s5 = setWidth;
+ if (addStyle != null) s6 = addStyle;
+ if (pixels != 0) s7 = Integer.toString(pixels);
+ if (points != 0) s8 = Integer.toString(points);
+ if (horizontalResolution != 0) s9 = Integer.toString(horizontalResolution);
+ if (verticalResolution != 0) s10 = Integer.toString(verticalResolution);
+ if (spacing != null) s11 = spacing;
+// The following line has been intentionally commented.
+// we don not know the exact average width as in the font definition,
+// so if someone tries to get a similar font, they'd get something weird
+// if (averageWidth != 0) s12 = Integer.toString(averageWidth);
+ if (characterSetRegistry != null) s13 = characterSetRegistry;
+ if (characterSetName != null) s14 = characterSetName;
+
+ String xlfd = "-" + s1+ "-" + s2 + "-" + s3 + "-" + s4 + "-" + s5 + "-" + s6 + "-" + s7 + "-" + s8 + "-"
+ + s9 + "-" + s10 + "-" + s11 + "-" + s12 + "-" + s13 + "-" + s14;
+ return xlfd;
+}
+public static FontData gtk_new(String xlfd) {
+ FontData fontData = new FontData();
+ fontData.setXlfd(xlfd);
+ return fontData;
+}
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects which return <code>true</code> when passed to
+ * <code>equals</code> must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals
+ */
+public int hashCode () {
+ return getXlfd().hashCode();
+}
+/**
+ * Sets the height of the receiver. The parameter is
+ * specified in terms of points, where a point is one
+ * seventy-second of an inch.
+ *
+ * @param height the height of the <code>FontData</code>
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
+ * </ul>
+ *
+ * @see #getHeight
+ */
+public void setHeight(int height) {
+ if (height < 0) error(SWT.ERROR_INVALID_ARGUMENT);
+ points = height * 10;
+}
+
+/**
+ * Sets the locale of the receiver.
+ * <p>
+ * The locale determines which platform character set this
+ * font is going to use. Widgets and graphics operations that
+ * use this font will convert UNICODE strings to the platform
+ * character set of the specified locale.
+ * </p>
+ * <p>
+ * On platforms which there are multiple character sets for a
+ * given language/country locale, the variant portion of the
+ * locale will determine the character set.
+ * </p>
+ *
+ * @param locale the <code>String</code> representing a Locale object
+ * @see java.util.Locale#toString
+ */
+public void setLocale(String locale) {
+ lang = country = variant = null;
+ if (locale != null) {
+ char sep = '_';
+ int length = locale.length();
+ int firstSep, secondSep;
+
+ firstSep = locale.indexOf(sep);
+ if (firstSep == -1) {
+ firstSep = secondSep = length;
+ } else {
+ secondSep = locale.indexOf(sep, firstSep + 1);
+ if (secondSep == -1) secondSep = length;
+ }
+ if (firstSep > 0) lang = locale.substring(0, firstSep);
+ if (secondSep > firstSep + 1) country = locale.substring(firstSep + 1, secondSep);
+ if (length > secondSep + 1) variant = locale.substring(secondSep + 1);
+ }
+}
+/**
+ * Sets the name of the receiver.
+ * <p>
+ * Some platforms support font foundries. On these platforms, the name
+ * of the font specified in setName() may have one of the following forms:
+ * <ol>
+ * <li>a face name (for example, "courier")</li>
+ * <li>a foundry followed by a dash ("-") followed by a face name (for example, "adobe-courier")</li>
+ * </ol>
+ * In either case, the name returned from getName() will include the
+ * foundry.
+ * </p>
+ * <p>
+ * On platforms that do not support font foundries, only the face name
+ * (for example, "courier") is used in <code>setName()</code> and
+ * <code>getName()</code>.
+ * </p>
+ *
+ * @param name the name of the font data (must not be null)
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - when the font name is null</li>
+ * </ul>
+ *
+ * @see #getName
+ */
+public void setName(String name) {
+ if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ int dash = name.indexOf('-');
+ if (dash != -1) {
+ foundry = name.substring(0, dash);
+ fontFamily = name.substring(dash + 1);
+ } else {
+ fontFamily = name;
+ }
+}
+/**
+ * Sets the style of the receiver to the argument which must
+ * be a bitwise OR of one or more of the <code>SWT</code>
+ * constants NORMAL, BOLD and ITALIC.
+ *
+ * @param style the new style for this <code>FontData</code>
+ *
+ * @see #getStyle
+ */
+public void setStyle(int style) {
+ if ((style & SWT.BOLD) == SWT.BOLD)
+ weight = "bold";
+ else
+ weight = "medium";
+ if ((style & SWT.ITALIC) == SWT.ITALIC)
+ slant = "i";
+ else
+ slant = "r";
+}
+void setXlfd(String xlfd) {
+ int start, stop;
+ start = 1;
+ stop = xlfd.indexOf ("-", start);
+ foundry = xlfd.substring(start, stop);
+ if (foundry.equals("*")) foundry = null;
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ fontFamily = xlfd.substring(start, stop);
+ if (fontFamily.equals("*")) fontFamily = null;
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ weight = xlfd.substring(start, stop);
+ if (weight.equals("*")) weight = null;
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ slant = xlfd.substring(start, stop);
+ if (slant.equals("*")) slant = null;
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ setWidth = xlfd.substring(start, stop);
+ if (setWidth.equals("*")) setWidth = null;
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ addStyle = xlfd.substring(start, stop);
+ if (addStyle.equals("*")) addStyle = null;
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ String s = xlfd.substring(start, stop);
+ if (!s.equals("") && !s.equals("*"))
+ pixels = Integer.parseInt(s);
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ s = xlfd.substring(start, stop);
+ if (!s.equals("") && !s.equals("*"))
+ points = Integer.parseInt(s);
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ s = xlfd.substring(start, stop);
+ if (!s.equals("") && !s.equals("*"))
+ horizontalResolution = Integer.parseInt(s);
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ s = xlfd.substring(start, stop);
+ if (!s.equals("") && !s.equals("*"))
+ verticalResolution = Integer.parseInt(s);
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ spacing = xlfd.substring(start, stop);
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ s = xlfd.substring(start, stop);
+ if (!s.equals("") && !s.equals("*"))
+ averageWidth = Integer.parseInt(s);
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ characterSetRegistry = xlfd.substring(start, stop);
+ if (characterSetRegistry.equals("*")) characterSetRegistry = null;
+ start = stop + 1;
+ stop = xlfd.indexOf ("-", start);
+ characterSetName = xlfd.substring(start);
+ if (characterSetName.equals("*")) characterSetName = null;
+}
+/**
+ * Returns a string representation of the receiver which is suitable
+ * for constructing an equivalent instance using the
+ * <code>FontData(String)</code> constructor.
+ *
+ * @return a string representation of the FontData
+ *
+ * @see FontData
+ */
+public String toString() {
+ return "1|" + fontFamily + "|" + getHeight() + "|" + getStyle() + "|" +
+ "GTK|1|" + getXlfd();
+}
+
+/**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the <em>same</em> object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
+ *
+ * @see #hashCode
+ */
+public boolean equals (Object object) {
+ return (object == this) || ((object instanceof FontData) &&
+ getXlfd().equals(((FontData)object).getXlfd()));
+}
+void error(int code) {
+ throw new SWTError(code);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/FontMetrics.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/FontMetrics.java
new file mode 100644
index 0000000..b1bd432
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/FontMetrics.java
@@ -0,0 +1,122 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ * Instances of this class provide measurement information
+ * about fonts including ascent, descent, height, leading
+ * space between rows, and average character width.
+ * <code>FontMetrics</code> are obtained from <code>GC</code>s
+ * using the <code>getFontMetrics()</code> method.
+ *
+ * @see GC#getFontMetrics
+ */
+
+public final class FontMetrics {
+ int ascent, descent, averageCharWidth, leading, height;
+FontMetrics() {
+}
+/**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the <em>same</em> object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
+ *
+ * @see #hashCode
+ */
+public boolean equals (Object object) {
+ if (object == this) return true;
+ if (!(object instanceof FontMetrics)) return false;
+ FontMetrics metrics = (FontMetrics)object;
+ return ascent == metrics.ascent && descent == metrics.descent &&
+ averageCharWidth == metrics.averageCharWidth && leading == metrics.leading &&
+ height == metrics.height;
+}
+/**
+ * Returns the ascent of the font described by the receiver. A
+ * font's <em>ascent</em> is the distance from the baseline to the
+ * top of actual characters, not including any of the leading area,
+ * measured in pixels.
+ *
+ * @return the ascent of the font
+ */
+public int getAscent() {
+ return ascent;
+}
+/**
+ * Returns the average character width, measured in pixels,
+ * of the font described by the receiver.
+ *
+ * @return the average character width of the font
+ */
+public int getAverageCharWidth() {
+ return averageCharWidth;
+}
+/**
+ * Returns the descent of the font described by the receiver. A
+ * font's <em>descent</em> is the distance from the baseline to the
+ * bottom of actual characters, not including any of the leading area,
+ * measured in pixels.
+ *
+ * @return the descent of the font
+ */
+public int getDescent() {
+ return descent;
+}
+/**
+ * Returns the height of the font described by the receiver,
+ * measured in pixels. A font's <em>height</em> is the sum of
+ * its ascent, descent and leading area.
+ *
+ * @return the height of the font
+ *
+ * @see #getAscent
+ * @see #getDescent
+ * @see #getLeading
+ */
+public int getHeight() {
+ return height;
+}
+/**
+ * Returns the leading area of the font described by the
+ * receiver. A font's <em>leading area</em> is the space
+ * above its ascent which may include accents or other marks.
+ *
+ * @return the leading space of the font
+ */
+public int getLeading() {
+ return leading;
+}
+public static FontMetrics gtk_new(int fontHandle) {
+ GdkFont f = new GdkFont();
+ OS.memmove (f, fontHandle, GdkFont.sizeof);
+
+ FontMetrics fontMetrics = new FontMetrics();
+ fontMetrics.ascent = f.ascent;
+ fontMetrics.descent = f.descent;
+ fontMetrics.averageCharWidth = OS.gdk_char_width(fontHandle, (byte)'a');
+ fontMetrics.leading = 3;
+ fontMetrics.height = fontMetrics.ascent+fontMetrics.descent+3;
+ return fontMetrics;
+}
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects which return <code>true</code> when passed to
+ * <code>equals</code> must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals
+ */
+public int hashCode() {
+ return ascent ^ descent ^ averageCharWidth ^ leading ^ height;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/GC.java
new file mode 100644
index 0000000..6b9b89e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/GC.java
@@ -0,0 +1,1697 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.*;
+
+
+/**
+ * Class <code>GC</code> is where all of the drawing capabilities that are
+ * supported by SWT are located. Instances are used to draw on either an
+ * <code>Image</code>, a <code>Control</code>, or directly on a <code>Display</code>.
+ * <p>
+ * Application code must explicitly invoke the <code>GC.dispose()</code>
+ * method to release the operating system resources managed by each instance
+ * when those instances are no longer required. This is <em>particularly</em>
+ * important on Windows95 and Windows98 where the operating system has a limited
+ * number of device contexts available.
+ * </p>
+ *
+ * @see org.eclipse.swt.events.PaintEvent
+ */
+public final class GC {
+ /**
+ * the handle to the OS device context
+ * (Warning: This field is platform dependent)
+ */
+ public int handle;
+ Drawable drawable;
+ GCData data;
+
+
+/*
+ * === Constructors ===
+ */
+
+GC() {
+}
+
+/**
+ * Constructs a new instance of this class which has been
+ * configured to draw on the specified drawable. Sets the
+ * foreground and background color in the GC to match those
+ * in the drawable.
+ * <p>
+ * You must dispose the graphics context when it is no longer required.
+ * </p>
+ * @param drawable the drawable to draw on
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the drawable is null</li>
+ * <li>ERROR_INVALID_ARGUMENT
+ * - if the drawable is an image that is not a bitmap or an icon
+ * - if the drawable is an image or printer that is already selected
+ * into another graphics context</li>
+ * </ul>
+ */
+public GC(Drawable drawable) {
+ if (drawable == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+
+ data = new GCData();
+ handle = drawable.internal_new_GC(data);
+ this.drawable = drawable;
+
+ // The colors we get from the widget are not always right.
+ // Get the default GTK_STATE_NORMAL colors
+ setBackground( DefaultGtkStyle.instance().backgroundColorNORMAL() );
+ setForeground( DefaultGtkStyle.instance().foregroundColorNORMAL() );
+
+
+ // Feature in GDK.
+ // Sometimes, gdk_gc_new() doesn't get the font from the control,
+ // and also, some controls don't contain a font; so when the GC
+ // was created in internal_new_gc(), the font might or might not
+ // be set; if the font isn't there, just fall back to default.
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ if (values.font == 0) {
+ OS.gdk_gc_set_font(handle, DefaultGtkStyle.instance().loadDefaultFont() );
+ }
+
+ if (data.image != null) {
+ data.image.memGC = this;
+ /*
+ * The transparent pixel mask might change when drawing on
+ * the image. Destroy it so that it is regenerated when
+ * necessary.
+ */
+ //if (image.transparentPixel != -1) image.destroyMask();
+ }
+
+}
+
+
+
+/**
+ * Returns the background color.
+ *
+ * @return the receiver's background color
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+/*
+ * === Access - Get/Set ===
+ */
+
+public Color getBackground() {
+ if (handle == 0) error(SWT.ERROR_WIDGET_DISPOSED);
+ GdkColor gdkColor = _getBackgroundGdkColor();
+ return Color.gtk_new(gdkColor);
+}
+/**
+ * Sets the background color. The background color is used
+ * for fill operations and as the background color when text
+ * is drawn.
+ *
+ * @param color the new background color for the receiver
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setBackground(Color color) {
+ if (color == null) error(SWT.ERROR_NULL_ARGUMENT);
+ if (color.handle == null) error(SWT.ERROR_NULL_ARGUMENT);
+ if (handle == 0) error(SWT.ERROR_WIDGET_DISPOSED);
+ OS.gdk_gc_set_background(handle, color.handle);
+}
+
+/**
+ * Returns the receiver's foreground color.
+ *
+ * @return the color used for drawing foreground things
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Color getForeground() {
+ if (handle == 0) error(SWT.ERROR_WIDGET_DISPOSED);
+ GdkColor gdkColor = _getForegroundGdkColor();
+ return Color.gtk_new(gdkColor);
+}
+
+/**
+ * Sets the foreground color. The foreground color is used
+ * for drawing operations including when text is drawn.
+ *
+ * @param color the new foreground color for the receiver
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setForeground(Color color) {
+ if (handle == 0) error(SWT.ERROR_WIDGET_DISPOSED);
+ if (color == null) error(SWT.ERROR_NULL_ARGUMENT);
+ if (color.handle == null) error(SWT.ERROR_NULL_ARGUMENT);
+ OS.gdk_gc_set_foreground(handle, color.handle);
+}
+
+
+
+
+
+
+
+/**
+ * Returns the <em>advance width</em> of the specified character in
+ * the font which is currently selected into the receiver.
+ * <p>
+ * The advance width is defined as the horizontal distance the cursor
+ * should move after printing the character in the selected font.
+ * </p>
+ *
+ * @param ch the character to measure
+ * @return the distance in the x direction to move past the character before painting the next
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+/*
+ * === Access - Get - Calculated ===
+ */
+
+public int getAdvanceWidth(char ch) {
+ byte[] charBuffer = Converter.wcsToMbcs(null, new char[] { ch });
+ return OS.gdk_char_width(_getGCFont(), charBuffer[0]);
+}
+/**
+ * Returns the width of the specified character in the font
+ * selected into the receiver.
+ * <p>
+ * The width is defined as the space taken up by the actual
+ * character, not including the leading and tailing whitespace
+ * or overhang.
+ * </p>
+ *
+ * @param ch the character to measure
+ * @return the width of the character
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public int getCharWidth(char ch) {
+ byte[] charBuffer = Converter.wcsToMbcs(null, new char[] { ch });
+ int[] lbearing = new int[1];
+ int[] rbearing = new int[1];
+ int[] unused = new int[1];
+ OS.gdk_string_extents(_getGCFont(), charBuffer, lbearing, rbearing, unused, unused, unused);
+ return rbearing[0] - lbearing[0];
+}
+/**
+ * Returns the bounding rectangle of the receiver's clipping
+ * region. If no clipping region is set, the return value
+ * will be a rectangle which covers the entire bounds of the
+ * object the receiver is drawing on.
+ *
+ * @return the bounding rectangle of the clipping region
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Rectangle getClipping() {
+ if (data.clipRgn == 0) {
+ int[] width = new int[1]; int[] height = new int[1];
+ int[] unused = new int[1];
+ OS.gdk_window_get_geometry(data.drawable, unused, unused, width, height, unused);
+ return new Rectangle(0, 0, width[0], height[0]);
+ }
+ GdkRectangle rect = new GdkRectangle();
+ OS.gdk_region_get_clipbox(data.clipRgn, rect);
+ return new Rectangle(rect.x, rect.y, rect.width, rect.height);
+}
+/**
+ * Sets the region managed by the argument to the current
+ * clipping region of the receiver.
+ *
+ * @param region the region to fill with the clipping region
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the region is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void getClipping(Region region) {
+ if (region == null) error(SWT.ERROR_NULL_ARGUMENT);
+ int hRegion = region.handle;
+ if (data.clipRgn == 0) {
+ int[] width = new int[1]; int[] height = new int[1];
+ int[] unused = new int[1];
+ OS.gdk_window_get_geometry(data.drawable, unused, unused, width, height, unused);
+ hRegion = OS.gdk_region_new();
+ GdkRectangle rect = new GdkRectangle();
+ rect.x = 0; rect.y = 0;
+ rect.width = (short)width[0]; rect.height = (short)height[0];
+ region.handle = OS.gdk_region_union_with_rect(hRegion, rect);
+ return;
+ }
+ hRegion = OS.gdk_region_new();
+ region.handle = OS.gdk_regions_union(data.clipRgn, hRegion);
+}
+/**
+ * Returns the font currently being used by the receiver
+ * to draw and measure text.
+ *
+ * @return the receiver's font
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Font getFont() {
+ return Font.gtk_new(_getGCFont());
+}
+/**
+ * Returns a FontMetrics which contains information
+ * about the font currently being used by the receiver
+ * to draw and measure text.
+ *
+ * @return font metrics for the receiver's font
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+// Not done
+public FontMetrics getFontMetrics() {
+ int fontHandle = _getGCFont();
+ if (fontHandle==0) {
+ error(SWT.ERROR_UNSPECIFIED);
+ }
+ GdkFont gdkFont = new GdkFont();
+ OS.memmove(gdkFont, fontHandle, GdkFont.sizeof);
+ byte [] w = Converter.wcsToMbcs (null, "w", true);
+ return FontMetrics.gtk_new(fontHandle);
+}
+
+/**
+ * Returns the receiver's line style, which will be one
+ * of the constants <code>SWT.LINE_SOLID</code>, <code>SWT.LINE_DASH</code>,
+ * <code>SWT.LINE_DOT</code>, <code>SWT.LINE_DASHDOT</code> or
+ * <code>SWT.LINE_DASHDOTDOT</code>.
+ *
+ * @return the style used for drawing lines
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public int getLineStyle() {
+ return data.lineStyle;
+}
+/**
+ * Returns the width that will be used when drawing lines
+ * for all of the figure drawing operations (that is,
+ * <code>drawLine</code>, <code>drawRectangle</code>,
+ * <code>drawPolyline</code>, and so forth.
+ *
+ * @return the receiver's line width
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public int getLineWidth() {
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ return values.line_width;
+}
+/**
+ * Returns <code>true</code> if this GC is drawing in the mode
+ * where the resulting color in the destination is the
+ * <em>exclusive or</em> of the color values in the source
+ * and the destination, and <code>false</code> if it is
+ * drawing in the mode where the destination color is being
+ * replaced with the source color value.
+ *
+ * @return <code>true</code> true if the receiver is in XOR mode, and false otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public boolean getXORMode() {
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ return values.function == OS.GDK_XOR;
+}
+/**
+ * Returns <code>true</code> if the receiver has a clipping
+ * region set into it, and <code>false</code> otherwise.
+ * If this method returns false, the receiver will draw on all
+ * available space in the destination. If it returns true,
+ * it will draw only in the area that is covered by the region
+ * that can be accessed with <code>getClipping(region)</code>.
+ *
+ * @return <code>true</code> if the GC has a clipping region, and <code>false</code> otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public boolean isClipped() {
+ return data.clipRgn != 0;
+}
+
+
+/**
+ * Sets the area of the receiver which can be changed
+ * by drawing operations to the rectangular area specified
+ * by the arguments.
+ *
+ * @param x the x coordinate of the clipping rectangle
+ * @param y the y coordinate of the clipping rectangle
+ * @param width the width of the clipping rectangle
+ * @param height the height of the clipping rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setClipping(int x, int y, int width, int height) {
+ if (data.clipRgn == 0) data.clipRgn = OS.gdk_region_new();
+ GdkRectangle rect = new GdkRectangle();
+ rect.x = (short)x; rect.y = (short)y;
+ rect.width = (short)width; rect.height = (short)height;
+ OS.gdk_gc_set_clip_rectangle(handle, rect);
+ data.clipRgn = OS.gdk_regions_subtract(data.clipRgn, data.clipRgn);
+ data.clipRgn = OS.gdk_region_union_with_rect(data.clipRgn, rect);
+}
+/**
+ * Sets the area of the receiver which can be changed
+ * by drawing operations to the rectangular area specified
+ * by the argument.
+ *
+ * @param rect the clipping rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setClipping(Rectangle rect) {
+ if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
+ setClipping (rect.x, rect.y, rect.width, rect.height);
+}
+/**
+ * Sets the area of the receiver which can be changed
+ * by drawing operations to the region specified
+ * by the argument.
+ *
+ * @param rect the clipping region.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setClipping(Region region) {
+ if (data.clipRgn == 0) data.clipRgn = OS.gdk_region_new();
+ if (region == null) {
+ data.clipRgn = OS.gdk_regions_subtract(data.clipRgn, data.clipRgn);
+ OS.gdk_gc_set_clip_mask(handle, OS.GDK_NONE);
+ } else {
+ data.clipRgn = OS.gdk_regions_subtract(data.clipRgn, data.clipRgn);
+ data.clipRgn = OS.gdk_regions_union(region.handle, data.clipRgn);
+ OS.gdk_gc_set_clip_region(handle, region.handle);
+ }
+}
+/**
+ * Sets the font which will be used by the receiver
+ * to draw and measure text to the argument. If the
+ * argument is null, then a default font appropriate
+ * for the platform will be used instead.
+ *
+ * @param font the new font for the receiver, or null to indicate a default font
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the font has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setFont(Font font) {
+ int fontHandle = 0;
+ if (font == null) {
+ GtkStyle gtkStyle = new GtkStyle();
+ int style = OS.gtk_widget_get_default_style();
+ OS.memmove(gtkStyle, style, GtkStyle.sizeof);
+ fontHandle = gtkStyle.font;
+ } else {
+ fontHandle = font.handle;
+ }
+ OS.gdk_gc_set_font(handle, fontHandle);
+}
+
+/**
+ * Sets the receiver's line style to the argument, which must be one
+ * of the constants <code>SWT.LINE_SOLID</code>, <code>SWT.LINE_DASH</code>,
+ * <code>SWT.LINE_DOT</code>, <code>SWT.LINE_DASHDOT</code> or
+ * <code>SWT.LINE_DASHDOTDOT</code>.
+ *
+ * @param lineStyle the style to be used for drawing lines
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setLineStyle(int lineStyle) {
+ switch (lineStyle) {
+ case SWT.LINE_SOLID:
+ this.data.lineStyle = lineStyle;
+ OS.gdk_gc_set_line_attributes(handle, 0, OS.GDK_LINE_SOLID, OS.GDK_CAP_BUTT, OS.GDK_JOIN_MITER);
+ return;
+ case SWT.LINE_DASH:
+ OS.gdk_gc_set_dashes(handle, 0, new byte[] {6, 2}, 2);
+ break;
+ case SWT.LINE_DOT:
+ OS.gdk_gc_set_dashes(handle, 0, new byte[] {3, 1}, 2);
+ break;
+ case SWT.LINE_DASHDOT:
+ OS.gdk_gc_set_dashes(handle, 0, new byte[] {6, 2, 3, 1}, 4);
+ break;
+ case SWT.LINE_DASHDOTDOT:
+ OS.gdk_gc_set_dashes(handle, 0, new byte[] {6, 2, 3, 1, 3, 1}, 6);
+ break;
+ default:
+ error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ this.data.lineStyle = lineStyle;
+ OS.gdk_gc_set_line_attributes(handle, 0, OS.GDK_LINE_DOUBLE_DASH, OS.GDK_CAP_BUTT, OS.GDK_JOIN_MITER);
+}
+/**
+ * Sets the width that will be used when drawing lines
+ * for all of the figure drawing operations (that is,
+ * <code>drawLine</code>, <code>drawRectangle</code>,
+ * <code>drawPolyline</code>, and so forth.
+ *
+ * @param lineWidth the width of a line
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setLineWidth(int width) {
+ if (data.lineStyle == SWT.LINE_SOLID) {
+ OS.gdk_gc_set_line_attributes(handle, width, OS.GDK_LINE_SOLID, OS.GDK_CAP_BUTT, OS.GDK_JOIN_MITER);
+ } else {
+ OS.gdk_gc_set_line_attributes(handle, width, OS.GDK_LINE_DOUBLE_DASH, OS.GDK_CAP_BUTT, OS.GDK_JOIN_MITER);
+ }
+}
+/**
+ * If the argument is <code>true</code>, puts the receiver
+ * in a drawing mode where the resulting color in the destination
+ * is the <em>exclusive or</em> of the color values in the source
+ * and the destination, and if the argument is <code>false</code>,
+ * puts the receiver in a drawing mode where the destination color
+ * is replaced with the source color value.
+ *
+ * @param xor if <code>true</code>, then <em>xor</em> mode is used, otherwise <em>source copy</em> mode is used
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setXORMode(boolean val) {
+ if (val) {
+ OS.gdk_gc_set_function(handle, OS.GDK_XOR);
+ } else {
+ OS.gdk_gc_set_function(handle, OS.GDK_COPY);
+ }
+}
+/**
+ * Returns the extent of the given string. No tab
+ * expansion or carriage return processing will be performed.
+ * <p>
+ * The <em>extent</em> of a string is the width and height of
+ * the rectangular area it would cover if drawn in a particular
+ * font (in this case, the current font in the receiver).
+ * </p>
+ *
+ * @param string the string to measure
+ * @return a point containing the extent of the string
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Point stringExtent(String string) {
+ if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
+ byte[] buffer = Converter.wcsToMbcs(null, string, true);
+ int width = OS.gdk_string_width(_getGCFont(), buffer);
+ int height = OS.gdk_string_height(_getGCFont(), buffer);
+ return new Point(width, height);
+}
+/**
+ * Returns the extent of the given string. Tab expansion and
+ * carriage return processing are performed.
+ * <p>
+ * The <em>extent</em> of a string is the width and height of
+ * the rectangular area it would cover if drawn in a particular
+ * font (in this case, the current font in the receiver).
+ * </p>
+ *
+ * @param string the string to measure
+ * @return a point containing the extent of the string
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Point textExtent(String string) {
+ if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
+ byte[] buffer = Converter.wcsToMbcs(null, string, true);
+ int width = OS.gdk_string_width(_getGCFont(), buffer);
+ int height = OS.gdk_string_height(_getGCFont(), buffer);
+ return new Point(width, height);
+}
+
+
+
+/*
+ * === Access - Internal utils ===
+ */
+
+private GdkGCValues _getGCValues() {
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ return values;
+}
+private GdkColor _getForegroundGdkColor() {
+ GdkGCValues values = _getGCValues();
+ GdkColor color = new GdkColor();
+ color.pixel = values.foreground_pixel;
+ color.red = values.foreground_red;
+ color.green = values.foreground_green;
+ color.blue = values.foreground_blue;
+ return color;
+}
+private GdkColor _getBackgroundGdkColor() {
+ GdkGCValues values = _getGCValues();
+ GdkColor color = new GdkColor();
+ color.pixel = values.background_pixel;
+ color.red = values.background_red;
+ color.green = values.background_green;
+ color.blue = values.background_blue;
+ return color;
+}
+private int _getGCFont() {
+ GdkGCValues values = _getGCValues();
+ if (values.font==0) {
+ SWT.error(SWT.ERROR_UNSPECIFIED);
+ }
+ return values.font;
+}
+
+
+
+/**
+ * Copies a rectangular area of the receiver at the source
+ * position onto the receiver at the destination position.
+ *
+ * @param srcX the x coordinate in the receiver of the area to be copied
+ * @param srcY the y coordinate in the receiver of the area to be copied
+ * @param width the width of the area to copy
+ * @param height the height of the area to copy
+ * @param destX the x coordinate in the receiver of the area to copy to
+ * @param destY the y coordinate in the receiver of the area to copy to
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+/*
+ * === Drawing operations proper ===
+ */
+
+public void copyArea(int srcX, int srcY, int width, int height, int destX, int destY) {
+ OS.gdk_window_copy_area(data.drawable, handle, destX, destY, data.drawable, srcX, srcY, width, height);
+}
+
+/**
+ * Draws the outline of a circular or elliptical arc
+ * within the specified rectangular area.
+ * <p>
+ * The resulting arc begins at <code>startAngle</code> and extends
+ * for <code>arcAngle</code> degrees, using the current color.
+ * Angles are interpreted such that 0 degrees is at the 3 o'clock
+ * position. A positive value indicates a counter-clockwise rotation
+ * while a negative value indicates a clockwise rotation.
+ * </p><p>
+ * The center of the arc is the center of the rectangle whose origin
+ * is (<code>x</code>, <code>y</code>) and whose size is specified by the
+ * <code>width</code> and <code>height</code> arguments.
+ * </p><p>
+ * The resulting arc covers an area <code>width + 1</code> pixels wide
+ * by <code>height + 1</code> pixels tall.
+ * </p>
+ *
+ * @param x the x coordinate of the upper-left corner of the arc to be drawn
+ * @param y the y coordinate of the upper-left corner of the arc to be drawn
+ * @param width the width of the arc to be drawn
+ * @param height the height of the arc to be drawn
+ * @param startAngle the beginning angle
+ * @param arcAngle the angular extent of the arc, relative to the start angle
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if any of the width, height or endAngle is zero.</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawArc(int x, int y, int width, int height, int startAngle, int endAngle) {
+ if (width < 0) {
+ x = x + width;
+ width = -width;
+ }
+ if (height < 0) {
+ y = y + height;
+ height = -height;
+ }
+ if (width == 0 || height == 0 || endAngle == 0) {
+ error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ OS.gdk_draw_arc(data.drawable, handle, 0, x, y, width, height, startAngle * 64, endAngle * 64);
+}
+/**
+ * Draws a rectangle, based on the specified arguments, which has
+ * the appearance of the platform's <em>focus rectangle</em> if the
+ * platform supports such a notion, and otherwise draws a simple
+ * rectangle in the receiver's forground color.
+ *
+ * @param x the x coordinate of the rectangle
+ * @param y the y coordinate of the rectangle
+ * @param width the width of the rectangle
+ * @param height the height of the rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #drawRectangle
+ */
+public void drawFocus(int x, int y, int width, int height) {
+ GtkStyle style = new GtkStyle();
+ int hStyle = OS.gtk_widget_get_default_style();
+ OS.memmove(style, hStyle, GtkStyle.sizeof);
+ GdkColor color = new GdkColor();
+ color.pixel = style.fg0_pixel;
+ color.red = style.fg0_red;
+ color.green = style.fg0_green;
+ color.blue = style.fg0_blue;
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ OS.gdk_gc_set_foreground(handle, color);
+ OS.gdk_draw_rectangle(data.drawable, handle, 0, x, y, width, height);
+ color.pixel = values.foreground_pixel;
+ color.red = values.foreground_red;
+ color.green = values.foreground_green;
+ color.blue = values.foreground_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+}
+/**
+ * Draws the given image in the receiver at the specified
+ * coordinates.
+ *
+ * @param image the image to draw
+ * @param x the x coordinate of where to draw
+ * @param y the y coordinate of where to draw
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the image is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the given coordinates are outside the bounds of the image</li>
+ * @exception SWTError <ul>
+ * <li>ERROR_NO_HANDLES - if no handles are available to perform the operation</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawImage(Image image, int x, int y) {
+ if (image == null) error(SWT.ERROR_NULL_ARGUMENT);
+ int pixmap = image.pixmap;
+ int [] unused = new int [1]; int [] width = new int [1]; int [] height = new int [1];
+ OS.gdk_window_get_geometry(pixmap, unused, unused, width, height, unused);
+ drawImage(image, 0, 0, width[0], height[0], x, y, width[0], height[0]);
+}
+
+/**
+ * Copies a rectangular area from the source image into a (potentially
+ * different sized) rectangular area in the receiver. If the source
+ * and destination areas are of differing sizes, then the source
+ * area will be stretched or shrunk to fit the destination area
+ * as it is copied. The copy fails if any of the given coordinates
+ * are negative or lie outside the bounds of their respective images.
+ *
+ * @param image the source image
+ * @param srcX the x coordinate in the source image to copy from
+ * @param srcY the y coordinate in the source image to copy from
+ * @param srcWidth the width in pixels to copy from the source
+ * @param srcHeight the height in pixels to copy from the source
+ * @param destX the x coordinate in the destination to copy to
+ * @param destY the y coordinate in the destination to copy to
+ * @param destWidth the width in pixels of the destination rectangle
+ * @param destHeight the height in pixels of the destination rectangle
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the image is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the given coordinates are outside the bounds of their respective images</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_NO_HANDLES - if no handles are available to perform the operation</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight) {
+ /* basic sanity checks */
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (srcWidth == 0 || srcHeight == 0 || destWidth == 0 || destHeight == 0) return;
+ if (srcX < 0 || srcY < 0 || srcWidth < 0 || srcHeight < 0 || destWidth < 0 || destHeight < 0) {
+ SWT.error (SWT.ERROR_INVALID_ARGUMENT);
+ }
+ if (srcImage == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (srcImage.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+
+ /* source image properties */
+ int[] width = new int[1];
+ int[] height = new int[1];
+ int[] unused = new int[1];
+ OS.gdk_window_get_geometry(srcImage.pixmap, unused, unused, width, height, unused);
+ if ((srcY + srcWidth > width[0]) ||
+ (srcY + srcHeight > height[0])) {
+ error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+
+ /* Special case: If we don't need to scale, and there is no alpha/mask,
+ * then we can just blit the image inside the X server - no net traffic
+ */
+ boolean needScaling = (srcWidth != destWidth) || (srcHeight != destHeight);
+ boolean simple = !needScaling & (srcImage.mask == 0);
+
+ if (simple) {
+ OS.gdk_draw_pixmap(data.drawable, handle, srcImage.pixmap,
+ srcX, srcY,
+ destX, destY,
+ width[0], height[0]);
+ return;
+ }
+
+
+ /* Fetch a local GdkPixbuf from server */
+ Pixbuffer pixbuf = new Pixbuffer(srcImage);
+
+ /* Scale if necessary */
+ if ((srcWidth != destWidth) || (srcHeight != destHeight)) {
+ double scale_x = (double)destWidth / (double)srcWidth;
+ double scale_y = (double)destHeight / (double)srcHeight;
+ double offset_x = - srcX * scale_x;
+ double offset_y = - srcY * scale_y;
+
+ int destSizePixbuf = GDKPIXBUF.gdk_pixbuf_new (
+ GDKPIXBUF.GDK_COLORSPACE_RGB,
+ true, 8, destWidth, destHeight);
+ GDKPIXBUF.gdk_pixbuf_scale(
+ pixbuf.handle, // src,
+ destSizePixbuf,
+ 0,
+ 0,
+ destWidth, destHeight,
+ offset_x, offset_y,
+ scale_x, scale_y,
+ GDKPIXBUF.GDK_INTERP_BILINEAR);
+ pixbuf.handle = destSizePixbuf;
+ }
+
+ /* Paint it */
+ GDKPIXBUF.gdk_pixbuf_render_to_drawable_alpha(
+ pixbuf.handle,
+ data.drawable,
+ 0, 0,
+ destX, destY,
+ destWidth, destHeight,
+ GDKPIXBUF.GDK_PIXBUF_ALPHA_BILEVEL, 128,
+ GDKPIXBUF.GDK_RGB_DITHER_NORMAL,
+ 0, 0
+ );
+}
+
+/**
+ * Draws a line, using the foreground color, between the points
+ * (<code>x1</code>, <code>y1</code>) and (<code>x2</code>, <code>y2</code>).
+ *
+ * @param x1 the first point's x coordinate
+ * @param y1 the first point's y coordinate
+ * @param x2 the second point's x coordinate
+ * @param y2 the second point's y coordinate
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawLine(int x1, int y1, int x2, int y2) {
+ OS.gdk_draw_line (data.drawable, handle, x1, y1, x2, y2);
+}
+/**
+ * Draws the outline of an oval, using the foreground color,
+ * within the specified rectangular area.
+ * <p>
+ * The result is a circle or ellipse that fits within the
+ * rectangle specified by the <code>x</code>, <code>y</code>,
+ * <code>width</code>, and <code>height</code> arguments.
+ * </p><p>
+ * The oval covers an area that is <code>width + 1</code>
+ * pixels wide and <code>height + 1</code> pixels tall.
+ * </p>
+ *
+ * @param x the x coordinate of the upper left corner of the oval to be drawn
+ * @param y the y coordinate of the upper left corner of the oval to be drawn
+ * @param width the width of the oval to be drawn
+ * @param height the height of the oval to be drawn
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawOval(int x, int y, int width, int height) {
+ if (width < 0) {
+ x = x + width;
+ width = -width;
+ }
+ if (height < 0) {
+ y = y + height;
+ height = -height;
+ }
+ OS.gdk_draw_arc(data.drawable, handle, 0, x, y, width, height, 0, 23040);
+}
+/**
+ * Draws the closed polygon which is defined by the specified array
+ * of integer coordinates, using the receiver's foreground color. The array
+ * contains alternating x and y values which are considered to represent
+ * points which are the vertices of the polygon. Lines are drawn between
+ * each consecutive pair, and between the first pair and last pair in the
+ * array.
+ *
+ * @param pointArray an array of alternating x and y values which are the vertices of the polygon
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT if pointArray is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawPolygon(int[] pointArray) {
+ if (pointArray == null) error(SWT.ERROR_NULL_ARGUMENT);
+ short[] points = new short[pointArray.length];
+ for (int i = 0; i < pointArray.length; i++) {
+ points[i] = (short)pointArray[i];
+ }
+ OS.gdk_draw_polygon(data.drawable, handle, 0, points, points.length / 2);
+}
+/**
+ * Draws the polyline which is defined by the specified array
+ * of integer coordinates, using the receiver's foreground color. The array
+ * contains alternating x and y values which are considered to represent
+ * points which are the corners of the polyline. Lines are drawn between
+ * each consecutive pair, but not between the first pair and last pair in
+ * the array.
+ *
+ * @param pointArray an array of alternating x and y values which are the corners of the polyline
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the point array is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawPolyline(int[] pointArray) {
+ if (pointArray == null) error(SWT.ERROR_NULL_ARGUMENT);
+ short[] points = new short[pointArray.length];
+ for (int i = 0; i < pointArray.length; i++) {
+ points[i] = (short)pointArray[i];
+ }
+ OS.gdk_draw_lines(data.drawable, handle, points, points.length / 2);
+}
+/**
+ * Draws the outline of the rectangle specified by the arguments,
+ * using the receiver's foreground color. The left and right edges
+ * of the rectangle are at <code>x</code> and <code>x + width</code>.
+ * The top and bottom edges are at <code>y</code> and <code>y + height</code>.
+ *
+ * @param x the x coordinate of the rectangle to be drawn
+ * @param y the y coordinate of the rectangle to be drawn
+ * @param width the width of the rectangle to be drawn
+ * @param height the height of the rectangle to be drawn
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawRectangle(int x, int y, int width, int height) {
+ if (width < 0) {
+ x = x + width;
+ width = -width;
+ }
+ if (height < 0) {
+ y = y + height;
+ height = -height;
+ }
+ OS.gdk_draw_rectangle(data.drawable, handle, 0, x, y, width, height);
+}
+/**
+ * Draws the outline of the specified rectangle, using the receiver's
+ * foreground color. The left and right edges of the rectangle are at
+ * <code>rect.x</code> and <code>rect.x + rect.width</code>. The top
+ * and bottom edges are at <code>rect.y</code> and
+ * <code>rect.y + rect.height</code>.
+ *
+ * @param rect the rectangle to draw
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the rectangle is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawRectangle(Rectangle rect) {
+ if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
+ drawRectangle (rect.x, rect.y, rect.width, rect.height);
+}
+/**
+ * Draws the outline of the round-cornered rectangle specified by
+ * the arguments, using the receiver's foreground color. The left and
+ * right edges of the rectangle are at <code>x</code> and <code>x + width</code>.
+ * The top and bottom edges are at <code>y</code> and <code>y + height</code>.
+ * The <em>roundness</em> of the corners is specified by the
+ * <code>arcWidth</code> and <code>arcHeight</code> arguments.
+ *
+ * @param x the x coordinate of the rectangle to be drawn
+ * @param y the y coordinate of the rectangle to be drawn
+ * @param width the width of the rectangle to be drawn
+ * @param height the height of the rectangle to be drawn
+ * @param arcWidth the horizontal diameter of the arc at the four corners
+ * @param arcHeight the vertical diameter of the arc at the four corners
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight) {
+ int nx = x;
+ int ny = y;
+ int nw = width;
+ int nh = height;
+ int naw = arcWidth;
+ int nah = arcHeight;
+
+ if (nw < 0) {
+ nw = 0 - nw;
+ nx = nx - nw;
+ }
+ if (nh < 0) {
+ nh = 0 - nh;
+ ny = ny -nh;
+ }
+ if (naw < 0) naw = 0 - naw;
+ if (nah < 0) nah = 0 - nah;
+
+ int naw2 = Compatibility.floor(naw, 2);
+ int nah2 = Compatibility.floor(nah, 2);
+
+ OS.gdk_draw_arc(data.drawable, handle, 0, nx, ny, naw, nah, 5760, 5760);
+ OS.gdk_draw_arc(data.drawable, handle, 0, nx, ny + nh - nah, naw, nah, 11520, 5760);
+ OS.gdk_draw_arc(data.drawable, handle, 0, nx + nw - naw, ny + nh - nah, naw, nah, 17280, 5760);
+ OS.gdk_draw_arc(data.drawable, handle, 0, nx + nw - naw, ny, naw, nah, 0, 5760);
+ OS.gdk_draw_line(data.drawable, handle, nx + naw2, ny, nx + nw - naw2, ny);
+ OS.gdk_draw_line(data.drawable, handle, nx,ny + nah2, nx, ny + nh - nah2);
+ OS.gdk_draw_line(data.drawable, handle, nx + naw2, ny + nh, nx + nw - naw2, ny + nh);
+ OS.gdk_draw_line(data.drawable, handle, nx + nw, ny + nah2, nx + nw, ny + nh - nah2);
+}
+/**
+ * Draws the given string, using the receiver's current font and
+ * foreground color. No tab expansion or carriage return processing
+ * will be performed. The background of the rectangular area where
+ * the string is being drawn will be filled with the receiver's
+ * background color.
+ *
+ * @param string the string to be drawn
+ * @param x the x coordinate of the top left corner of the rectangular area where the string is to be drawn
+ * @param y the y coordinate of the top left corner of the rectangular area where the string is to be drawn
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawString (String string, int x, int y) {
+ drawString(string, x, y, false);
+}
+/**
+ * Draws the given string, using the receiver's current font and
+ * foreground color. No tab expansion or carriage return processing
+ * will be performed. If <code>isTransparent</code> is <code>true</code>,
+ * then the background of the rectangular area where the string is being
+ * drawn will not be modified, otherwise it will be filled with the
+ * receiver's background color.
+ *
+ * @param string the string to be drawn
+ * @param x the x coordinate of the top left corner of the rectangular area where the string is to be drawn
+ * @param y the y coordinate of the top left corner of the rectangular area where the string is to be drawn
+ * @param isTransparent if <code>true</code> the background will be transparent, otherwise it will be opaque
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawString(String string, int x, int y, boolean isTransparent) {
+ if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
+ byte[] buffer = Converter.wcsToMbcs(null, string, true);
+ byte[] buffer1 = Converter.wcsToMbcs(null, "Y", true);
+ int[] unused = new int[1];
+ int[] width = new int[1];
+ int[] ascent = new int[1];
+ int[] average_ascent = new int [1];
+ int fontHandle = _getGCFont();
+ OS.gdk_string_extents(fontHandle, buffer, unused, unused, width, ascent, unused);
+ OS.gdk_string_extents(fontHandle, buffer1, unused, unused, unused, average_ascent, unused);
+ if (ascent[0]<average_ascent[0]) ascent[0] = average_ascent[0];
+ if (!isTransparent) {
+ int height = OS.gdk_string_height(fontHandle, buffer);
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ GdkColor color = new GdkColor();
+ color.pixel = values.background_pixel;
+ color.red = values.background_red;
+ color.green = values.background_green;
+ color.blue = values.background_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+ OS.gdk_draw_rectangle(data.drawable, handle, 1, x, y, width[0], height);
+ color.pixel = values.foreground_pixel;
+ color.red = values.foreground_red;
+ color.green = values.foreground_green;
+ color.blue = values.foreground_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+ }
+ OS.gdk_draw_string(data.drawable, fontHandle, handle, x, y + ascent[0], buffer);
+}
+/**
+ * Draws the given string, using the receiver's current font and
+ * foreground color. Tab expansion and carriage return processing
+ * are performed. The background of the rectangular area where
+ * the text is being drawn will be filled with the receiver's
+ * background color.
+ *
+ * @param string the string to be drawn
+ * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
+ * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawText(String string, int x, int y) {
+ drawText(string, x, y, false);
+}
+/**
+ * Draws the given string, using the receiver's current font and
+ * foreground color. Tab expansion and carriage return processing
+ * are performed. If <code>isTransparent</code> is <code>true</code>,
+ * then the background of the rectangular area where the text is being
+ * drawn will not be modified, otherwise it will be filled with the
+ * receiver's background color.
+ *
+ * @param string the string to be drawn
+ * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
+ * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
+ * @param isTransparent if <code>true</code> the background will be transparent, otherwise it will be opaque
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawText(String string, int x, int y, boolean isTransparent) {
+ if (string == null) error(SWT.ERROR_NULL_ARGUMENT);
+ byte[] buffer = Converter.wcsToMbcs(null, string, true);
+ byte[] buffer1 = Converter.wcsToMbcs(null, "Y", true);
+ int fontHandle = _getGCFont();
+ int[] unused = new int[1];
+ int[] width = new int[1];
+ int[] ascent = new int[1];
+ int[] average_ascent = new int [1];
+ OS.gdk_string_extents(fontHandle, buffer, unused, unused, width, ascent, unused);
+ OS.gdk_string_extents(fontHandle, buffer1, unused, unused, unused, average_ascent, unused);
+ if (ascent[0]<average_ascent[0]) ascent[0] = average_ascent[0];
+ if (!isTransparent) {
+ int height = OS.gdk_string_height(fontHandle, buffer);
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ GdkColor color = new GdkColor();
+ color.pixel = values.background_pixel;
+ color.red = values.background_red;
+ color.green = values.background_green;
+ color.blue = values.background_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+ OS.gdk_draw_rectangle(data.drawable, handle, 1, x, y, width[0], height);
+ color.pixel = values.foreground_pixel;
+ color.red = values.foreground_red;
+ color.green = values.foreground_green;
+ color.blue = values.foreground_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+ }
+ OS.gdk_draw_string(data.drawable, fontHandle, handle, x, y + ascent[0], buffer);
+}
+
+/**
+ * Draws the given string, using the receiver's current font and
+ * foreground color. Tab expansion, line delimiter and mnemonic
+ * processing are performed according to the specified flags. If
+ * <code>flags</code> includes <code>DRAW_TRANSPARENT</code>,
+ * then the background of the rectangular area where the text is being
+ * drawn will not be modified, otherwise it will be filled with the
+ * receiver's background color.
+ * <p>
+ * The parameter <code>flags</code> may be a combination of:
+ * <dl>
+ * <dt><b>DRAW_DELIMITER</b></dt>
+ * <dd>draw multiple lines</dd>
+ * <dt><b>DRAW_TAB</b></dt>
+ * <dd>expand tabs</dd>
+ * <dt><b>DRAW_MNEMONIC</b></dt>
+ * <dd>underline the mnemonic character</dd>
+ * <dt><b>DRAW_TRANSPARENT</b></dt>
+ * <dd>transparent background</dd>
+ * </dl>
+ * </p>
+ *
+ * @param string the string to be drawn
+ * @param x the x coordinate of the top left corner of the rectangular area where the text is to be drawn
+ * @param y the y coordinate of the top left corner of the rectangular area where the text is to be drawn
+ * @param flags the flags specifing how to process the text
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void drawText (String string, int x, int y, int flags) {
+ // NOT IMPLEMENTED
+ drawText(string, x, y, (flags & SWT.DRAW_TRANSPARENT) != 0);
+}
+
+/**
+ * Fills the interior of a circular or elliptical arc within
+ * the specified rectangular area, with the receiver's background
+ * color.
+ * <p>
+ * The resulting arc begins at <code>startAngle</code> and extends
+ * for <code>arcAngle</code> degrees, using the current color.
+ * Angles are interpreted such that 0 degrees is at the 3 o'clock
+ * position. A positive value indicates a counter-clockwise rotation
+ * while a negative value indicates a clockwise rotation.
+ * </p><p>
+ * The center of the arc is the center of the rectangle whose origin
+ * is (<code>x</code>, <code>y</code>) and whose size is specified by the
+ * <code>width</code> and <code>height</code> arguments.
+ * </p><p>
+ * The resulting arc covers an area <code>width + 1</code> pixels wide
+ * by <code>height + 1</code> pixels tall.
+ * </p>
+ *
+ * @param x the x coordinate of the upper-left corner of the arc to be filled
+ * @param y the y coordinate of the upper-left corner of the arc to be filled
+ * @param width the width of the arc to be filled
+ * @param height the height of the arc to be filled
+ * @param startAngle the beginning angle
+ * @param arcAngle the angular extent of the arc, relative to the start angle
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if any of the width, height or endAngle is zero.</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #drawArc
+ */
+public void fillArc(int x, int y, int width, int height, int startAngle, int endAngle) {
+ if (width < 0) {
+ x = x + width;
+ width = -width;
+ }
+ if (height < 0) {
+ y = y + height;
+ height = -height;
+ }
+ if (width == 0 || height == 0 || endAngle == 0) {
+ error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ GdkColor color = new GdkColor();
+ color.pixel = values.background_pixel;
+ color.red = values.background_red;
+ color.green = values.background_green;
+ color.blue = values.background_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+ OS.gdk_draw_arc(data.drawable, handle, 1, x, y, width, height, startAngle * 64, endAngle * 64);
+ color.pixel = values.foreground_pixel;
+ color.red = values.foreground_red;
+ color.green = values.foreground_green;
+ color.blue = values.foreground_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+}
+
+/**
+ * Fills the interior of the specified rectangle with a gradient
+ * sweeping from left to right or top to bottom progressing
+ * from the receiver's foreground color to its background color.
+ *
+ * @param x the x coordinate of the rectangle to be filled
+ * @param y the y coordinate of the rectangle to be filled
+ * @param width the width of the rectangle to be filled, may be negative
+ * (inverts direction of gradient if horizontal)
+ * @param height the height of the rectangle to be filled, may be negative
+ * (inverts direction of gradient if vertical)
+ * @param vertical if true sweeps from top to bottom, else
+ * sweeps from left to right
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #drawRectangle
+ */
+public void fillGradientRectangle(int x, int y, int width, int height, boolean vertical) {
+ if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if ((width == 0) || (height == 0)) return;
+
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ GdkColor foregroundGdkColor = new GdkColor();
+
+ RGB backgroundRGB, foregroundRGB;
+ backgroundRGB = Color.gtk_getRGBIntensities(_getBackgroundGdkColor());
+ foregroundRGB = Color.gtk_getRGBIntensities(_getForegroundGdkColor());
+
+ RGB fromRGB, toRGB;
+ fromRGB = foregroundRGB;
+ toRGB = backgroundRGB;
+ boolean swapColors = false;
+ if (width < 0) {
+ x += width; width = -width;
+ if (! vertical) swapColors = true;
+ }
+ if (height < 0) {
+ y += height; height = -height;
+ if (vertical) swapColors = true;
+ }
+ if (swapColors) {
+ fromRGB = backgroundRGB;
+ toRGB = foregroundRGB;
+ }
+ if (fromRGB == toRGB) {
+ fillRectangle(x, y, width, height);
+ return;
+ }
+ ImageData.fillGradientRectangle(this, Display.getCurrent(),
+ x, y, width, height, vertical, fromRGB, toRGB,
+ 8, 8, 8);
+}
+
+/**
+ * Fills the interior of an oval, within the specified
+ * rectangular area, with the receiver's background
+ * color.
+ *
+ * @param x the x coordinate of the upper left corner of the oval to be filled
+ * @param y the y coordinate of the upper left corner of the oval to be filled
+ * @param width the width of the oval to be filled
+ * @param height the height of the oval to be filled
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #drawOval
+ */
+public void fillOval(int x, int y, int width, int height) {
+ if (width < 0) {
+ x = x + width;
+ width = -width;
+ }
+ if (height < 0) {
+ y = y + height;
+ height = -height;
+ }
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ GdkColor color = new GdkColor();
+ color.pixel = values.background_pixel;
+ color.red = values.background_red;
+ color.green = values.background_green;
+ color.blue = values.background_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+ OS.gdk_draw_arc(data.drawable, handle, 1, x, y, width, height, 0, 23040);
+ color.pixel = values.foreground_pixel;
+ color.red = values.foreground_red;
+ color.green = values.foreground_green;
+ color.blue = values.foreground_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+}
+/**
+ * Fills the interior of the closed polygon which is defined by the
+ * specified array of integer coordinates, using the receiver's
+ * background color. The array contains alternating x and y values
+ * which are considered to represent points which are the vertices of
+ * the polygon. Lines are drawn between each consecutive pair, and
+ * between the first pair and last pair in the array.
+ *
+ * @param pointArray an array of alternating x and y values which are the vertices of the polygon
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT if pointArray is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #drawPolygon
+ */
+public void fillPolygon(int[] pointArray) {
+ if (pointArray == null) error(SWT.ERROR_NULL_ARGUMENT);
+ short[] points = new short[pointArray.length];
+ for (int i = 0; i < pointArray.length; i++) {
+ points[i] = (short)pointArray[i];
+ }
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ GdkColor color = new GdkColor();
+ color.pixel = values.background_pixel;
+ color.red = values.background_red;
+ color.green = values.background_green;
+ color.blue = values.background_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+ OS.gdk_draw_polygon(data.drawable, handle, 1, points, points.length / 2);
+ color.pixel = values.foreground_pixel;
+ color.red = values.foreground_red;
+ color.green = values.foreground_green;
+ color.blue = values.foreground_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+}
+/**
+ * Fills the interior of the rectangle specified by the arguments,
+ * using the receiver's background color.
+ *
+ * @param x the x coordinate of the rectangle to be filled
+ * @param y the y coordinate of the rectangle to be filled
+ * @param width the width of the rectangle to be filled
+ * @param height the height of the rectangle to be filled
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #drawRectangle
+ */
+public void fillRectangle(int x, int y, int width, int height) {
+ if (width < 0) {
+ x = x + width;
+ width = -width;
+ }
+ if (height < 0) {
+ y = y + height;
+ height = -height;
+ }
+
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ GdkColor color = new GdkColor();
+ color.pixel = values.background_pixel;
+ color.red = values.background_red;
+ color.green = values.background_green;
+ color.blue = values.background_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+ OS.gdk_draw_rectangle(data.drawable, handle, 1, x, y, width, height);
+ color.pixel = values.foreground_pixel;
+ color.red = values.foreground_red;
+ color.green = values.foreground_green;
+ color.blue = values.foreground_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+}
+/**
+ * Fills the interior of the specified rectangle, using the receiver's
+ * background color.
+ *
+ * @param rectangle the rectangle to be filled
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the rectangle is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #drawRectangle
+ */
+public void fillRectangle(Rectangle rect) {
+ if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
+ fillRectangle(rect.x, rect.y, rect.width, rect.height);
+}
+/**
+ * Fills the interior of the round-cornered rectangle specified by
+ * the arguments, using the receiver's background color.
+ *
+ * @param x the x coordinate of the rectangle to be filled
+ * @param y the y coordinate of the rectangle to be filled
+ * @param width the width of the rectangle to be filled
+ * @param height the height of the rectangle to be filled
+ * @param arcWidth the horizontal diameter of the arc at the four corners
+ * @param arcHeight the vertical diameter of the arc at the four corners
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #drawRoundRectangle
+ */
+public void fillRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight) {
+ int nx = x;
+ int ny = y;
+ int nw = width;
+ int nh = height;
+ int naw = arcWidth;
+ int nah = arcHeight;
+
+ if (nw < 0) {
+ nw = 0 - nw;
+ nx = nx - nw;
+ }
+ if (nh < 0) {
+ nh = 0 - nh;
+ ny = ny -nh;
+ }
+ if (naw < 0)
+ naw = 0 - naw;
+ if (nah < 0)
+ nah = 0 - nah;
+
+ naw = Math.min(naw,nw);
+ nah = Math.min(nah, nh);
+
+ int naw2 = Compatibility.round(naw, 2);
+ int nah2 = Compatibility.round(nah, 2);
+
+ GdkGCValues values = new GdkGCValues();
+ OS.gdk_gc_get_values(handle, values);
+ GdkColor color = new GdkColor();
+ color.pixel = values.background_pixel;
+ color.red = values.background_red;
+ color.green = values.background_green;
+ color.blue = values.background_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+ OS.gdk_draw_arc(data.drawable, handle, 1, nx, ny, naw, nah, 5760, 5760);
+ OS.gdk_draw_arc(data.drawable, handle, 1, nx, ny + nh - nah, naw, nah, 11520, 5760);
+ OS.gdk_draw_arc(data.drawable, handle, 1, nx + nw - naw, ny + nh - nah, naw, nah, 17280, 5760);
+ OS.gdk_draw_arc(data.drawable, handle, 1, nx + nw - naw, ny, naw, nah, 0, 5760);
+ OS.gdk_draw_rectangle(data.drawable, handle, 1, nx + naw2, ny, nw - naw, nh);
+ OS.gdk_draw_rectangle(data.drawable, handle, 1, nx, ny + nah2, naw2, nh - nah);
+ OS.gdk_draw_rectangle(data.drawable, handle, 1, nx + nw - (naw / 2), ny + nah2, naw2, nh -nah);
+ color.pixel = values.foreground_pixel;
+ color.red = values.foreground_red;
+ color.green = values.foreground_green;
+ color.blue = values.foreground_blue;
+ OS.gdk_gc_set_foreground(handle, color);
+}
+
+/**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the <em>same</em> object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
+ *
+ * @see #hashCode
+ */
+/*
+ * === As yet unclassified ===
+ */
+
+public boolean equals(Object object) {
+ return (object == this) || ((object instanceof GC) && (handle == ((GC)object).handle));
+}
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects which return <code>true</code> when passed to
+ * <code>equals</code> must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see #equals
+ */
+public int hashCode() {
+ return handle;
+}
+void error(int code) {
+ throw new SWTError(code);
+}
+/**
+ * Returns <code>true</code> if the GC has been disposed,
+ * and <code>false</code> otherwise.
+ * <p>
+ * This method gets the dispose state for the GC.
+ * When a GC has been disposed, it is an error to
+ * invoke any other method using the GC.
+ *
+ * @return <code>true</code> when the GC is disposed and <code>false</code> otherwise
+ */
+public boolean isDisposed() {
+ return handle == 0;
+}
+/**
+ * Disposes of the operating system resources associated with
+ * the graphics context. Applications must dispose of all GCs
+ * which they allocate.
+ */
+public void dispose() {
+ if (handle == 0) return;
+
+ /* Free resources */
+ int clipRgn = data.clipRgn;
+ if (clipRgn != 0) OS.gdk_region_destroy(clipRgn);
+ Image image = data.image;
+ if (image != null) image.memGC = null;
+
+ /* Dispose the GC */
+ if(drawable == null)
+ OS.gdk_gc_unref(handle);
+ else
+ drawable.internal_dispose_GC(handle, data);
+
+ data.drawable = // data.colormap = data.fontList =
+ data.clipRgn = data.renderTable = 0;
+ drawable = null;
+ data.image = null;
+ data = null;
+ handle = 0;
+
+}
+
+/**
+ * Returns the extent of the given string. Tab expansion, line
+ * delimiter and mnemonic processing are performed according to
+ * the specified flags, which can be a combination of:
+ * <dl>
+ * <dt><b>DRAW_DELIMITER</b></dt>
+ * <dd>draw multiple lines</dd>
+ * <dt><b>DRAW_TAB</b></dt>
+ * <dd>expand tabs</dd>
+ * <dt><b>DRAW_MNEMONIC</b></dt>
+ * <dd>underline the mnemonic character</dd>
+ * <dt><b>DRAW_TRANSPARENT</b></dt>
+ * <dd>transparent background</dd>
+ * </dl>
+ * <p>
+ * The <em>extent</em> of a string is the width and height of
+ * the rectangular area it would cover if drawn in a particular
+ * font (in this case, the current font in the receiver).
+ * </p>
+ *
+ * @param string the string to measure
+ * @param flags the flags specifing how to process the text
+ * @return a point containing the extent of the string
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Point textExtent(String string, int flags) {
+ //NOT IMPLEMENTED
+ return textExtent(string);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/GCData.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/GCData.java
new file mode 100644
index 0000000..0b3a703
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/GCData.java
@@ -0,0 +1,28 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+
+/**
+ * Instances of this class are descriptions of GCs in terms
+ * of unallocated platform-specific data fields.
+ * <p>
+ * <b>IMPORTANT:</b> This class is <em>not</em> part of the public
+ * API for SWT. It is marked public only so that it can be shared
+ * within the packages provided by SWT. It is not available on all
+ * platforms, and should never be called from application code.
+ * </p>
+ *
+ * @private
+ */
+public class GCData {
+ public Image image;
+ public int drawable;
+ public int clipRgn;
+ public int lineStyle = SWT.LINE_SOLID;
+ public int renderTable;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Image.java
new file mode 100644
index 0000000..c8d5f3f
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Image.java
@@ -0,0 +1,638 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.*;
+import java.io.*;
+
+/**
+ * Instances of this class are graphics which have been prepared
+ * for display on a specific device. That is, they are ready
+ * to paint using methods such as <code>GC.drawImage()</code>
+ * and display on widgets with, for example, <code>Button.setImage()</code>.
+ * <p>
+ * If loaded from a file format that supports it, an
+ * <code>Image</code> may have transparency, meaning that certain
+ * pixels are specified as being transparent when drawn. Examples
+ * of file formats that support transparency are GIF and PNG.
+ * </p><p>
+ * There are two primary ways to use <code>Images</code>.
+ * The first is to load a graphic file from disk and create an
+ * <code>Image</code> from it. This is done using an <code>Image</code>
+ * constructor, for example:
+ * <pre>
+ * Image i = new Image(device, "C:\\graphic.bmp");
+ * </pre>
+ * A graphic file may contain a color table specifying which
+ * colors the image was intended to possess. In the above example,
+ * these colors will be mapped to the closest available color in
+ * SWT. It is possible to get more control over the mapping of
+ * colors as the image is being created, using code of the form:
+ * <pre>
+ * ImageData data = new ImageData("C:\\graphic.bmp");
+ * RGB[] rgbs = data.getRGBs();
+ * // At this point, rgbs contains specifications of all
+ * // the colors contained within this image. You may
+ * // allocate as many of these colors as you wish by
+ * // using the Color constructor Color(RGB), then
+ * // create the image:
+ * Image i = new Image(device, data);
+ * </pre>
+ * <p>
+ * Applications which require even greater control over the image
+ * loading process should use the support provided in class
+ * <code>ImageLoader</code>.
+ * </p><p>
+ * Application code must explicitely invoke the <code>Image.dispose()</code>
+ * method to release the operating system resources managed by each instance
+ * when those instances are no longer required.
+ * </p>
+ *
+ * @see Color
+ * @see ImageData
+ * @see ImageLoader
+ */
+public final class Image implements Drawable{
+
+ /**
+ * specifies whether the receiver is a bitmap or an icon
+ * (one of <code>SWT.BITMAP</code>, <code>SWT.ICON</code>)
+ */
+ public int type;
+
+ /**
+ * The handle to the OS pixmap resource.
+ * Warning: This field is platform dependent.
+ */
+ public int pixmap;
+
+ /**
+ * The handle to the OS mask resource.
+ * Warning: This field is platform dependent.
+ */
+ public int mask;
+
+ /**
+ * The device where this image was created.
+ */
+ Device device;
+
+ /**
+ * specifies the transparent pixel
+ * (Warning: This field is platform dependent)
+ */
+ int transparentPixel = -1;
+
+ /**
+ * The GC the image is currently selected in.
+ * Warning: This field is platform dependent.
+ */
+ GC memGC;
+
+ /**
+ * The alpha data of the image.
+ * Warning: This field is platform dependent.
+ */
+ byte[] alphaData;
+
+ /**
+ * The global alpha value to be used for every pixel.
+ * Warning: This field is platform dependent.
+ */
+ int alpha = -1;
+
+ /**
+ * Specifies the default scanline padding.
+ * Warning: This field is platform dependent.
+ */
+ static final int DEFAULT_SCANLINE_PAD = 4;
+
+
+
+/*
+ * CONSTRUCTORS
+ */
+
+Image() {
+}
+
+/**
+ * Constructs an empty instance of this class with the
+ * specified width and height. The result may be drawn upon
+ * by creating a GC and using any of its drawing operations,
+ * as shown in the following example:
+ * <pre>
+ * Image i = new Image(device, width, height);
+ * GC gc = new GC(i);
+ * gc.drawRectangle(0, 0, 50, 50);
+ * gc.dispose();
+ * </pre>
+ *
+ * @param device the device on which to create the image
+ * @param width the width of the new image
+ * @param height the height of the new image
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if either the width or height is negative</li>
+ * </ul>
+ */
+public Image(Device display, int width, int height) {
+ init(display, width, height);
+}
+
+/**
+ * Constructs a new instance of this class based on the
+ * provided image, with an appearance that varies depending
+ * on the value of the flag. The possible flag values are:
+ * <dl>
+ * <dt><b>IMAGE_COPY</b></dt>
+ * <dd>the result is an identical copy of srcImage</dd>
+ * <dt><b>IMAGE_DISABLE</b></dt>
+ * <dd>the result is a copy of srcImage which has a <em>disabled</em> look</dd>
+ * <dt><b>IMAGE_GRAY</b></dt>
+ * <dd>the result is a copy of srcImage which has a <em>gray scale</em> look</dd>
+ * </dl>
+ *
+ * @param device the device on which to create the image
+ * @param srcImage the image to use as the source
+ * @param flag the style, either <code>IMAGE_COPY</code>, <code>IMAGE_DISABLE</code> or <code>IMAGE_GRAY</code>
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if srcImage is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the flag is not one of <code>IMAGE_COPY</code>, <code>IMAGE_DISABLE</code> or <code>IMAGE_GRAY</code></li>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon, or
+ * is otherwise in an invalid state</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_NO_HANDLES if a handle could not be obtained for image creation</li>
+ * </ul>
+ */
+public Image(Device device, Image srcImage, int flag) {
+ /* basic sanity */
+ if (device == null) device = Device.getDevice();
+ if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ this.device = device;
+ if (srcImage == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (srcImage.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ this.type = srcImage.type;
+ this.mask = 0;
+
+ /* this is somewhat ugly, because this dilutes the encapsulation
+ * of knowledge about what the cloning operations do (e.g., the
+ * following lines assume graying and disabling don't change alpha)
+ */
+ this.alphaData = srcImage.alphaData;
+ this.alpha = srcImage.alpha;
+ this.transparentPixel = srcImage.transparentPixel;
+ // bogus - are we sure about memGC?
+
+ /* Special case:
+ * If all we want is just a clone of the existing pixmap, it can
+ * be done entirely in the X server, without copying across the net.
+ */
+ if (flag == SWT.IMAGE_COPY) {
+ int[] unused = new int[1];
+ int[] width = new int[1]; int[] height = new int[1];
+ int[] depth = new int[1];
+ OS.gdk_window_get_geometry(pixmap, unused, unused, width, height, depth);
+ pixmap = OS.gdk_pixmap_new (0, width[0], height[0], depth[0]);
+ int gc = OS.gdk_gc_new (pixmap);
+ OS.gdk_draw_pixmap(pixmap, gc, srcImage.pixmap,
+ 0,0,0,0, width[0], height[0]);
+ OS.gdk_gc_destroy(gc);
+ transparentPixel = srcImage.transparentPixel;
+ alpha = srcImage.alpha;
+ if (srcImage.alphaData != null) {
+ alphaData = new byte[srcImage.alphaData.length];
+ System.arraycopy(srcImage.alphaData, 0, alphaData, 0, alphaData.length);
+ }
+
+ /* we are not quite done yet. Need to copy the maskData */
+ if (srcImage.mask != 0) {
+ /* Generate the mask if necessary. */
+// if (srcImage.transparentPixel != -1) srcImage.createMask();
+ mask = OS.gdk_pixmap_new(0, width[0], height[0], 1);
+ gc = OS.gdk_gc_new(mask);
+ OS.gdk_draw_pixmap(mask, gc, srcImage.mask,
+ 0,0,0,0, width[0], height[0]);
+ OS.gdk_gc_destroy(gc);
+ /* Destroy the image mask if the there is a GC created on the image */
+ if (srcImage.transparentPixel != -1 && srcImage.memGC != null) srcImage.destroyMask();
+ }
+
+
+ return;
+ }
+
+
+
+
+ Pixbuffer pb = new Pixbuffer(srcImage);
+ Pixbuffer pb2 = new Pixbuffer(pb, flag);
+ pb2.toImage(this);
+
+
+}
+
+/**
+ * Constructs an empty instance of this class with the
+ * width and height of the specified rectangle. The result
+ * may be drawn upon by creating a GC and using any of its
+ * drawing operations, as shown in the following example:
+ * <pre>
+ * Image i = new Image(device, boundsRectangle);
+ * GC gc = new GC(i);
+ * gc.drawRectangle(0, 0, 50, 50);
+ * gc.dispose();
+ * </pre>
+ *
+ * @param device the device on which to create the image
+ * @param bounds a rectangle specifying the image's width and height (must not be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the bounds rectangle is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if either the rectangle's width or height is negative</li>
+ * </ul>
+ */
+public Image(Device display, Rectangle bounds) {
+ if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ init(display, bounds.width, bounds.height);
+}
+
+/**
+ * Constructs an instance of this class from the given
+ * <code>ImageData</code>.
+ *
+ * @param device the device on which to create the image
+ * @param data the image data to create the image from (must not be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the image data is null</li>
+ * </ul>
+ */
+public Image(Device display, ImageData image) {
+ if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (display == null) display = Display.getDefault();
+ init(display, image);
+}
+
+/**
+ * Constructs an instance of this class, whose type is
+ * <code>SWT.ICON</code>, from the two given <code>ImageData</code>
+ * objects. The two images must be the same size, and the mask image
+ * must have a color depth of 1. Pixel transparency in either image
+ * will be ignored. If either image is an icon to begin with, an
+ * exception is thrown.
+ * <p>
+ * The mask image should contain white wherever the icon is to be visible,
+ * and black wherever the icon is to be transparent. In addition,
+ * the source image should contain black wherever the icon is to be
+ * transparent.
+ * </p>
+ *
+ * @param device the device on which to create the icon
+ * @param source the color data for the icon
+ * @param mask the mask data for the icon
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if either the source or mask is null </li>
+ * <li>ERROR_INVALID_ARGUMENT - if source and mask are different sizes or
+ * if the mask is not monochrome, or if either the source or mask
+ * is already an icon</li>
+ * </ul>
+ */
+public Image(Device display, ImageData source, ImageData mask) {
+ if (source == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (mask == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (display == null) display = Display.getDefault();
+ if (source.width != mask.width || source.height != mask.height) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ if (mask.depth != 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ ImageData image;
+ if (source.depth != 1)
+ image = new ImageData(source.width, source.height, source.depth, source.palette, source.scanlinePad, source.data);
+ else {
+ image = source.getTransparencyMask(); //create an imagedata with scanlinepad == 1 and invalid data
+ int[] row = new int[source.width];
+ for (int y = 0; y < source.height; y++) {
+ source.getPixels(0, y, source.width, row, 0);
+ image.setPixels(0, y, source.width, row, 0);
+ }//change source data format from scanlinePad == 4 to scanlinePad == 1;
+
+ }
+ image.type = SWT.ICON;
+ image.maskPad = mask.scanlinePad;
+ image.maskData = mask.data;
+ init(display, image);
+}
+
+/**
+ * Constructs an instance of this class by loading its representation
+ * from the specified input stream. Throws an error if an error
+ * occurs while loading the image, or if the result is an image
+ * of an unsupported type.
+ * <p>
+ * This constructor is provided for convenience when loading a single
+ * image only. If the stream contains multiple images, only the first
+ * one will be loaded. To load multiple images, use
+ * <code>ImageLoader.load()</code>.
+ * </p><p>
+ * This constructor may be used to load a resource as follows:
+ * </p>
+ * <pre>
+ * new Image(device, clazz.getResourceAsStream("file.gif"));
+ * </pre>
+ *
+ * @param device the device on which to create the image
+ * @param stream the input stream to load the image from
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data </li>
+ * <li>ERROR_IO - if an IO error occurs while reading data</li>
+ * </ul>
+ */
+public Image(Device display, InputStream stream) {
+ if (stream == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (display == null) display = Display.getDefault();
+ init(display, new ImageData(stream));
+}
+
+/**
+ * Constructs an instance of this class by loading its representation
+ * from the file with the specified name. Throws an error if an error
+ * occurs while loading the image, or if the result is an image
+ * of an unsupported type.
+ * <p>
+ * This constructor is provided for convenience when loading
+ * a single image only. If the specified file contains
+ * multiple images, only the first one will be used.
+ *
+ * @param device the device on which to create the image
+ * @param filename the name of the file to load the image from
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data </li>
+ * <li>ERROR_IO - if an IO error occurs while reading data</li>
+ * </ul>
+ */
+public Image(Device display, String filename) {
+ if (filename == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (display == null) display = Display.getDefault();
+ init(display, new ImageData(filename));
+}
+
+/**
+ * Destroy the receiver's mask if it exists.
+ */
+void destroyMask() {
+ if (mask == 0) return;
+ OS.gdk_bitmap_unref(mask);
+ mask = 0;
+}
+
+/**
+ * Disposes of the operating system resources associated with
+ * the image. Applications must dispose of all images which
+ * they allocate.
+ */
+public void dispose () {
+ if (pixmap != 0) OS.gdk_pixmap_unref(pixmap);
+ if (mask != 0) OS.gdk_pixmap_unref(mask);
+ pixmap = mask = 0;
+ memGC = null;
+}
+/**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the <em>same</em> object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
+ *
+ * @see #hashCode
+ */
+public boolean equals (Object object) {
+ return (object == this) || ((object instanceof Image) &&
+ (pixmap == ((Image)object).pixmap) &&
+ (mask == ((Image)object).mask));
+}
+
+/**
+ * Returns the color to which to map the transparent pixel, or null if
+ * the receiver has no transparent pixel.
+ * <p>
+ * There are certain uses of Images that do not support transparency
+ * (for example, setting an image into a button or label). In these cases,
+ * it may be desired to simulate transparency by using the background
+ * color of the widget to paint the transparent pixels of the image.
+ * Use this method to check which color will be used in these cases
+ * in place of transparency. This value may be set with setBackground().
+ * <p>
+ *
+ * @return the background color of the image, or null if there is no transparency in the image
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public Color getBackground() {
+ return null;
+}
+
+/**
+ * Sets the color to which to map the transparent pixel.
+ * <p>
+ * There are certain uses of <code>Images</code> that do not support
+ * transparency (for example, setting an image into a button or label).
+ * In these cases, it may be desired to simulate transparency by using
+ * the background color of the widget to paint the transparent pixels
+ * of the image. This method specifies the color that will be used in
+ * these cases. For example:
+ * <pre>
+ * Button b = new Button();
+ * image.setBackground(b.getBackground());>
+ * b.setImage(image);
+ * </pre>
+ * </p><p>
+ * The image may be modified by this operation (in effect, the
+ * transparent regions may be filled with the supplied color). Hence
+ * this operation is not reversible and it is not legal to call
+ * this function twice or with a null argument.
+ * </p><p>
+ * This method has no effect if the receiver does not have a transparent
+ * pixel value.
+ * </p>
+ *
+ * @param color the color to use when a transparent pixel is specified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the color is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the color has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void setBackground(Color color) {
+ if (color == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+}
+
+/**
+ * Returns the bounds of the receiver. The rectangle will always
+ * have x and y values of 0, and the width and height of the
+ * image.
+ *
+ * @return a rectangle specifying the image's bounds
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li>
+ * </ul>
+ */
+public Rectangle getBounds() {
+ int[] unused = new int[1]; int[] width = new int[1]; int[] height = new int[1];
+ OS.gdk_window_get_geometry(pixmap, unused, unused, width, height, unused);
+ return new Rectangle(0, 0, width[0], height[0]);
+
+}
+/**
+ * Returns an <code>ImageData</code> based on the receiver
+ * Modifications made to this <code>ImageData</code> will not
+ * affect the Image.
+ *
+ * @return an <code>ImageData</code> containing the image's data and attributes
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li>
+ * </ul>
+ *
+ * @see ImageData
+ */
+public ImageData getImageData() {
+ return new Pixbuffer(this).getImageData();
+}
+
+public static Image gtk_new(int type, int pixmap, int mask) {
+ Image image = new Image();
+ image.type = type;
+ image.pixmap = pixmap;
+ image.mask = mask;
+ return image;
+}
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects which return <code>true</code> when passed to
+ * <code>equals</code> must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals
+ */
+public int hashCode () {
+ return pixmap;
+}
+/**
+ * Invokes platform specific functionality to allocate a new GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Image</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param data the platform specific GC data
+ * @return the platform specific GC handle
+ *
+ * @private
+ */
+public int internal_new_GC (GCData data) {
+ if (pixmap == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (data == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ if (type != SWT.BITMAP || memGC != null) {
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+
+ data.image = this;
+ int gc = OS.gdk_gc_new(pixmap);
+ data.drawable = pixmap;
+ return gc;
+}
+/**
+ * Invokes platform specific functionality to dispose a GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Image</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param handle the platform specific GC handle
+ * @param data the platform specific GC data
+ *
+ * @private
+ */
+public void internal_dispose_GC (int gc, GCData data) {
+ OS.gdk_gc_unref(gc);
+}
+
+void init(Device display, int width, int height) {
+ device = display;
+ GdkVisual visual = new GdkVisual ();
+ OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
+ this.pixmap = OS.gdk_pixmap_new(0, width, height, visual.depth);
+ if (pixmap == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ /* Fill the bitmap with white */
+ GdkColor white = new GdkColor();
+ int colormap = OS.gdk_colormap_get_system();
+ OS.gdk_color_white(colormap, white);
+ int gc = OS.gdk_gc_new(pixmap);
+ OS.gdk_gc_set_foreground(gc, white);
+ OS.gdk_draw_rectangle(pixmap, gc, 1, 0, 0, width, height);
+ OS.gdk_gc_destroy(gc);
+ OS.gdk_colors_free(colormap, new int[] { white.pixel }, 1, 0);
+ this.type = SWT.BITMAP;
+}
+
+void init(Device display, ImageData image) {
+ if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (display == null) display = Display.getCurrent();
+ device = display;
+
+ /*
+ * We don't really care about the real depth of the ImageData we are
+ * given. We stretch everything to 24bpp which is the native GdkPixbuffer
+ * depth. HOWEVER, there is one situation where this is not acceptable,
+ * namely bitmaps (1bpp), because they may be used in contexts that are
+ * sensitive to pixmap depth.
+ */
+ Pixbuffer buff = new Pixbuffer(image);
+ buff.toImage(this);
+ return;
+}
+
+/**
+ * Returns <code>true</code> if the image has been disposed,
+ * and <code>false</code> otherwise.
+ * <p>
+ * This method gets the dispose state for the image.
+ * When an image has been disposed, it is an error to
+ * invoke any other method using the image.
+ *
+ * @return <code>true</code> when the image is disposed and <code>false</code> otherwise
+ */
+public boolean isDisposed() {
+ return pixmap == 0;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Pixbuffer.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Pixbuffer.java
new file mode 100644
index 0000000..460a3bb
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Pixbuffer.java
@@ -0,0 +1,492 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ * This class is <strong>not</strong> part of the SWT API,
+ * and its existence is not relevant for application programmers.
+ *
+ * Pixbuffer represents local GdkPixbuf images on the client.
+ */
+final class Pixbuffer {
+
+ /* the handle to the OS resource.
+ All state is kept in the OS */
+ int handle;
+
+ /* pointer to the actual pixel array */
+ int data;
+
+ /* whether the alpha data in the pixbuf is due to
+ a transparency mask or an alpha channel */
+ boolean hasMask = false;
+ boolean hasAlpha = false;
+ int constantAlpha = -1;
+ int transparentPixel = -1;
+
+
+ /*
+ * Constructors.
+ * There are three ways to create a Pixbuffer:
+ * pull one from a Drawable, create from ImageData,
+ * or clone an existing Pixbuffer.
+ */
+
+ private Pixbuffer() {}
+
+ /**
+ * Pull a Pixbuffer from an Image living on the X Server
+ * (making this operation expensive).
+ */
+ Pixbuffer (Image src) {
+ if (src == null || src.pixmap == 0) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+
+ // get the geometry
+ int[] unused = new int[1];
+ int[] w = new int[1];
+ int[] h = new int[1];
+ int[] d = new int[1];
+ OS.gdk_window_get_geometry(src.pixmap, unused, unused, w, h, unused);
+ int width = w[0];
+ int height = h[0];
+
+ // create the actual OS resource
+ createHandle(width, height);
+
+ // pull the color data
+ int cmap = OS.gdk_colormap_get_system();
+ GDKPIXBUF.gdk_pixbuf_get_from_drawable(
+ handle,
+ src.pixmap,
+ cmap,
+ 0,0,0,0,
+ width, height);
+
+ // the tricky part is alpha
+ if (src.alphaData != null) fillAlphaFromAlphaBytes(src.alphaData);
+ else if (src.alpha != -1) fillConstantAlpha(src.alpha);
+ else if (src.mask != 0) fillAlphaFromPixmapMask(src.mask);
+ else if (src.transparentPixel != -1) fillAlphaFromTransparentPixel(src.pixmap, src.transparentPixel);
+ else fillOpaque();
+ }
+
+ /**
+ * Create a Pixbuffer from image data.
+ */
+ Pixbuffer (ImageData src) {
+ if (src == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+
+ createHandle(src.width, src.height);
+
+ // populate the pixbuf with data
+ int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
+ int dataSize = src.height*stride;
+ byte[] bytes = new byte[dataSize];
+ switch (src.getTransparencyType()) {
+ case SWT.TRANSPARENCY_ALPHA: _blit2platformAlpha(bytes, src, src.width, src.height, stride); break;
+ case SWT.TRANSPARENCY_MASK: _blit2platformMask (bytes, src, src.width, src.height, stride); break;
+ case SWT.TRANSPARENCY_PIXEL: _blit2platformPixel(bytes, src, src.width, src.height, stride); break;
+ case SWT.TRANSPARENCY_NONE: _blit2platformNone (bytes, src, src.width, src.height, stride); break;
+ }
+ OS.memmove(data, bytes, dataSize);
+ }
+
+ /**
+ * Clone an existing Pixbuffer (possibly making it look
+ * grayed out or disabled)
+ */
+ Pixbuffer (Pixbuffer src, int flag) {
+ if (src == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (src.handle==0) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ this.hasAlpha = src.hasAlpha;
+ this.constantAlpha = src.constantAlpha;
+ this.hasMask = src.hasMask;
+
+ /* First, get a copy all our own */
+ handle = GDKPIXBUF.gdk_pixbuf_copy(src.handle);
+ data = GDKPIXBUF.gdk_pixbuf_get_pixels(this.handle);
+
+ // simplest case - just clone what we have
+ if (flag==SWT.IMAGE_COPY) return;
+
+ // gather some information we will need for disabling or graying
+ int width = getWidth();
+ int height = getHeight();
+ int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(this.handle);
+ int dataSize = height * stride;
+ byte[] bytes = new byte[dataSize];
+ OS.memmove(bytes,data,dataSize);
+ int lineAddress = 0;
+ int pixelAddress;
+
+ if (flag==SWT.IMAGE_DISABLE) {
+ for (int y=0; y<height; y++) {
+ for (int x=0; x<width; x++) {
+ pixelAddress = lineAddress+x*4;
+
+ int intensity =
+ bytes[pixelAddress+0] * bytes[pixelAddress+0] +
+ bytes[pixelAddress+1] * bytes[pixelAddress+1] +
+ bytes[pixelAddress+2] * bytes[pixelAddress+2];
+ byte value = (intensity < 9000)?
+ (byte)0 : (byte) 255;
+ bytes[pixelAddress+0] = bytes[pixelAddress+1] = bytes[pixelAddress+2] = value;
+ // no change to alpha
+ }
+ lineAddress += stride;
+ }
+ /* move it back */
+ OS.memmove(data, bytes, dataSize);
+ return;
+ }
+
+ if (flag==SWT.IMAGE_GRAY) {
+ for (int y=0; y<height; y++) {
+ for (int x=0; x<width; x++) {
+ pixelAddress = lineAddress+x*4;
+ int intensity =
+ (bytes[pixelAddress+0] +
+ bytes[pixelAddress+1] +
+ bytes[pixelAddress+2] ) / 3;
+ bytes[pixelAddress+0] = (byte)intensity;
+ bytes[pixelAddress+1] = (byte)intensity;
+ bytes[pixelAddress+2] = (byte)intensity;
+ // no change to alpha
+ }
+ lineAddress += stride;
+ }
+ /* move it back */
+ OS.memmove(data, bytes, dataSize);
+ return;
+ }
+
+ // flag is neither COPY nor DISABLE nor GRAY
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+
+
+ /**
+ * Push the pixbuf to the X Server
+ */
+ void toImage (Image dest) {
+ if (dest==null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ int w = getWidth();
+ int h = getHeight();
+ GdkVisual visual = new GdkVisual();
+ OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
+ dest.pixmap = OS.gdk_pixmap_new (0, w, h, visual.depth);
+ dest.mask = 0; // for now; we fill it later in this method
+ GDKPIXBUF.gdk_pixbuf_render_to_drawable_alpha(handle, // src
+ dest.pixmap, // dest drawable
+ 0,0, 0,0,
+ w, h,
+ GDKPIXBUF.GDK_PIXBUF_ALPHA_BILEVEL, 128,
+ GDKPIXBUF.GDK_RGB_DITHER_NORMAL, 0,0);
+
+ // now the mask, if any
+ if (hasMask) {
+ // bring the pixel data into Java memory
+ int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
+ byte[] srcBytes = new byte[h*stride];
+ OS.memmove(srcBytes, data, h*stride);
+
+ // the mask lines are padded to 4 bytes, that is 32 pixels
+ int maskwpl = w/32; if (w%32!=0) maskwpl+=1;
+ int maskBpl = maskwpl*4; // Bytes per line for the mask
+ byte[] bytes = new byte[h * maskBpl];
+ for (int y=0; y<h; y++) {
+ int lineAddress = y * maskBpl;
+ for (int x=0; x<w; x++)
+ if (srcBytes[y*stride + x*4 + 3] != 0) {
+ int byteAddress = lineAddress + x/8;
+ int bit = 1<<(x%8);
+ bytes[byteAddress] |= (byte)bit;
+ } // if
+ } // for y
+ dest.mask = OS.gdk_bitmap_create_from_data(0, bytes, maskBpl*8, h);
+ } // hasMask
+
+ else if (hasAlpha) {
+ SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
+ }
+
+ else if (constantAlpha!=-1) {
+ SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
+ }
+ }
+
+ /**
+ * Return the ImageData for the receiver.
+ */
+ ImageData getImageData() {
+ int width = getWidth();
+ int height = getHeight();
+ int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
+ byte[] bytes = _getDataBytes();
+ ImageData answer = new ImageData(width, height, 24, new PaletteData(0xFF0000, 0x00FF00, 0x0000FF));
+
+ if (hasMask) {
+ answer.maskData = new byte[((width+7)/8)*height];
+ answer.maskPad = 1;
+ }
+
+ for (int y=0; y<height; y++)
+ for (int x=0; x<width; x++) {
+ int address = y*stride + x*4;
+ byte r = bytes[address+0];
+ byte g = bytes[address+1];
+ byte b = bytes[address+2];
+ answer.setPixel(x,y, r<<16+g<<8+b);
+ byte alpha = bytes[address+3];
+ if (hasAlpha) {
+ answer.setAlpha(x,y, alpha);
+ }
+ if (hasMask && (alpha!=0)) {
+ // Find out where to stab the bit
+ int mask_bytes_per_line = (width+7) / 8;
+ int x_inside_line = x / 8;
+ int shift_inside_byte = x - (x_inside_line*8);
+ answer.maskData[x_inside_line + (y*mask_bytes_per_line)] |= (128 >> shift_inside_byte);
+ }
+ }
+ if (constantAlpha!=-1) answer.alpha = constantAlpha;
+ return answer;
+ }
+
+ int getWidth() {
+ return GDKPIXBUF.gdk_pixbuf_get_width (handle);
+ }
+
+ int getHeight() {
+ return GDKPIXBUF.gdk_pixbuf_get_height (handle);
+ }
+
+
+ /**
+ * Actually create the OS resource.
+ * No matter what, the GdkPixbuf we create always has
+ * an alpha channel.
+ */
+ private void createHandle(int width, int height) {
+ handle = GDKPIXBUF.gdk_pixbuf_new(GDKPIXBUF.GDK_COLORSPACE_RGB,
+ true,
+ 8,
+ width, height);
+ if (this.handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+ data = GDKPIXBUF.gdk_pixbuf_get_pixels(handle);
+ }
+
+ private void fillAlphaFromPixmapMask(int mask) {
+ hasMask = true;
+
+ /* pull the mask data from the X Server */
+ // get the geometry
+ int[] unused = new int[1];
+ int[] w = new int[1];
+ int[] h = new int[1];
+ int[] d = new int[1];
+ OS.gdk_window_get_geometry(mask, unused, unused, w, h, unused);
+ int width = Math.min(w[0], getWidth());
+ int height = Math.min(h[0], getHeight());
+ /* Get the data */
+ int xMaskPtr = OS.gdk_image_get(mask, 0, 0, width, height);
+ if (xMaskPtr == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+
+ /* stuff the alpha values */
+ byte[] bytes = _getDataBytes();
+ int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
+ for (int y=0; y<height; y++)
+ for (int x=0; x<width; x++) {
+ int pixel_value = OS.gdk_image_get_pixel(xMaskPtr, x, y);
+ if (pixel_value==0) bytes[y*stride + x*4 +3] = 0;
+ else if (pixel_value==1) bytes[y*stride + x*4 +3] = (byte)255;
+ else { System.out.println("GDK insanity: bitmap contains bits other than 0 or 1"); SWT.error(SWT.ERROR_UNSPECIFIED); }
+ }
+ /* move it back */
+ OS.memmove(data, bytes, bytes.length);
+ }
+
+ private void fillAlphaFromTransparentPixel(int pm, int pixel) {
+ transparentPixel = pixel;
+
+ /* pull the data from the X Server */
+ // get the geometry
+ int[] unused = new int[1];
+ int[] w = new int[1];
+ int[] h = new int[1];
+ int[] d = new int[1];
+ OS.gdk_window_get_geometry(pm, unused, unused, w, h, unused);
+ int width = Math.min(w[0], getWidth());
+ int height = Math.min(h[0], getHeight());
+ /* Get the data */
+ int xImage = OS.gdk_image_get(pm, 0, 0, width, height);
+ if (xImage == 0) SWT.error(SWT.ERROR_NO_HANDLES);
+
+ /* stuff the alpha values */
+ byte[] bytes = _getDataBytes();
+ int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
+ for (int y=0; y<height; y++)
+ for (int x=0; x<width; x++) {
+ int pixel_value = OS.gdk_image_get_pixel(xImage, x, y);
+ if (pixel_value==pixel) bytes[y*stride + x*4 +3] = 0;
+ else bytes[y*stride + x*4 +3] = (byte)255;
+ }
+ /* move it back */
+ OS.memmove(data, bytes, bytes.length);
+ }
+
+ private void fillAlphaFromAlphaBytes(byte[] alpha) {
+ hasAlpha = true;
+ SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
+ }
+
+ private void fillConstantAlpha(int alpha) {
+ if ((alpha<0)||(alpha>255)) SWT.error (SWT.ERROR_INVALID_ARGUMENT);
+ constantAlpha = alpha;
+ _fillConstantAlpha((byte)alpha);
+ }
+
+ private void fillOpaque() {
+ _fillConstantAlpha((byte)255);
+ }
+
+ /**
+ * Assume the handle represents a valid GdkPixbuf,
+ * and data is pointing to the correct location in memory.
+ * Fill all alpha bytes with the specified value.
+ */
+ private void _fillConstantAlpha (byte value) {
+ // first, get some technical info
+ int width = getWidth();
+ int height = getHeight();
+ int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(this.handle);
+ int dataSize = height * stride;
+ byte[] bytes = new byte[dataSize];
+ OS.memmove(bytes,data,dataSize);
+ int lineAddress = 0;
+ int pixelAddress;
+
+ // set all alpha bytes to 255
+ for (int y=0; y<height; y++) {
+ for (int x=0; x<width; x++) {
+ pixelAddress = lineAddress+x*4;
+ bytes[pixelAddress+3] = value;
+ }
+ lineAddress += stride;
+ }
+ /* move it back */
+ OS.memmove(data, bytes, dataSize);
+ }
+
+ private void _blit2platformNone (byte[] bytes,
+ ImageData source,
+ int width,
+ int height,
+ int stride)
+ {
+ int lineAddress = 0;
+ for (int y=0; y<height; y++) {
+ for (int x=0; x<width; x++) {
+ RGB rgb = source.palette.getRGB(source.getPixel(x,y));
+ bytes[lineAddress + x*4 + 0] = (byte)rgb.red;
+ bytes[lineAddress + x*4 + 1] = (byte)rgb.green;
+ bytes[lineAddress + x*4 + 2] = (byte)rgb.blue;
+ bytes[lineAddress + x*4 + 3] = (byte)255;
+ }
+ lineAddress += stride;
+ }
+ }
+
+ private void _blit2platformAlpha (byte[] bytes,
+ ImageData source,
+ int width,
+ int height,
+ int stride)
+ {
+ hasAlpha = true;
+ int lineAddress = 0;
+ for (int y=0; y<height; y++) {
+ for (int x=0; x<width; x++) {
+ RGB rgb = source.palette.getRGB(source.getPixel(x,y));
+ bytes[lineAddress + x*4 + 0] = (byte)rgb.red;
+ bytes[lineAddress + x*4 + 1] = (byte)rgb.green;
+ bytes[lineAddress + x*4 + 2] = (byte)rgb.blue;
+ bytes[lineAddress + x*4 + 3] = (byte)source.getAlpha(x,y);
+ }
+ lineAddress += stride;
+ }
+ }
+
+ private void _blit2platformPixel (byte[] bytes,
+ ImageData source,
+ int width,
+ int height,
+ int stride
+ )
+ {
+ hasMask = true;
+ int lineAddress = 0;
+ for (int y=0; y<height; y++) {
+ for (int x=0; x<width; x++) {
+ int pixel = source.getPixel(x,y);
+ if (pixel==source.transparentPixel) {
+ bytes[lineAddress + x*4 + 0] = (byte)0;
+ bytes[lineAddress + x*4 + 1] = (byte)0;
+ bytes[lineAddress + x*4 + 2] = (byte)0;
+ bytes[lineAddress + x*4 + 3] = (byte)0;
+ } else {
+ RGB rgb = source.palette.getRGB(pixel);
+ bytes[lineAddress + x*4 + 0] = (byte)rgb.red;
+ bytes[lineAddress + x*4 + 1] = (byte)rgb.green;
+ bytes[lineAddress + x*4 + 2] = (byte)rgb.blue;
+ bytes[lineAddress + x*4 + 3] = (byte)255;
+ }
+ }
+ lineAddress += stride;
+ }
+ }
+
+ private void _blit2platformMask (byte[] bytes,
+ ImageData source,
+ int width,
+ int height,
+ int stride
+ )
+ {
+ hasMask = true;
+ ImageData maskData = source.getTransparencyMask();
+ int lineAddress = 0;
+ for (int y=0; y<height; y++) {
+ for (int x=0; x<width; x++) {
+ RGB rgb = source.palette.getRGB(source.getPixel(x,y));
+ bytes[lineAddress + x*4 + 0] = (byte)rgb.red;
+ bytes[lineAddress + x*4 + 1] = (byte)rgb.green;
+ bytes[lineAddress + x*4 + 2] = (byte)rgb.blue;
+ int alpha = 0;
+ if (maskData.getPixel(x,y) !=0) alpha=255;
+ bytes[lineAddress + x*4 + 3] = (byte)alpha;
+ }
+ lineAddress += stride;
+ }
+ }
+
+ /**
+ * Transfer the pixel data from OS memory to Java memory
+ * and return the Java byte array
+ */
+ private byte[] _getDataBytes() {
+ int height = GDKPIXBUF.gdk_pixbuf_get_height (handle);
+ int stride = GDKPIXBUF.gdk_pixbuf_get_rowstride(handle);
+ int size = height*stride;
+ byte[] bytes = new byte[size];
+ OS.memmove(bytes, data, size);
+ return bytes;
+ }
+}
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Region.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Region.java
new file mode 100644
index 0000000..2b80dd5
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Region.java
@@ -0,0 +1,263 @@
+package org.eclipse.swt.graphics;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.*;
+
+/**
+ * Instances of this class represent areas of an x-y coordinate
+ * system that are aggregates of the areas covered by a number
+ * of rectangles.
+ * <p>
+ * Application code must explicitly invoke the <code>Region.dispose()</code>
+ * method to release the operating system resources managed by each instance
+ * when those instances are no longer required.
+ * </p>
+ */
+public final class Region {
+ /**
+ * the OS resource for the region
+ * (Warning: This field is platform dependent)
+ */
+ public int handle;
+/**
+ * Constructs a new empty region.
+ */
+public Region() {
+ handle = OS.gdk_region_new();
+}
+Region(int handle) {
+ this.handle = handle;
+}
+/**
+ * Adds the given rectangle to the collection of rectangles
+ * the receiver maintains to describe its area.
+ *
+ * @param rect the rectangle to merge with the receiver
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the rectangle's width or height is negative</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void add(Rectangle rect) {
+ if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
+ if (rect.width < 0 || rect.height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ GdkRectangle gdkRect = new GdkRectangle();
+ gdkRect.x = (short)rect.x;
+ gdkRect.y = (short)rect.y;
+ gdkRect.width = (short)rect.width;
+ gdkRect.height = (short)rect.height;
+ int hOld = handle;
+ /**
+ * Feature in GDK. Due to the way the GDK region calls work,
+ * we have to reassign the handle and destroy the old one.
+ */
+ handle = OS.gdk_region_union_with_rect(handle, gdkRect);
+ OS.gdk_region_destroy(hOld);
+}
+/**
+ * Adds all of the rectangles which make up the area covered
+ * by the argument to the collection of rectangles the receiver
+ * maintains to describe its area.
+ *
+ * @param region the region to merge
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public void add(Region region) {
+ if (region == null) error(SWT.ERROR_NULL_ARGUMENT);
+ /**
+ * Feature in GDK. Due to the way the GDK region calls work,
+ * we have to reassign the handle and destroy the old one.
+ */
+ int hOld = handle;
+ handle = OS.gdk_regions_union(handle, region.handle);
+ OS.gdk_region_destroy(hOld);
+}
+/**
+ * Returns <code>true</code> if the point specified by the
+ * arguments is inside the area specified by the receiver,
+ * and <code>false</code> otherwise.
+ *
+ * @param x the x coordinate of the point to test for containment
+ * @param y the y coordinate of the point to test for containment
+ * @return <code>true</code> if the region contains the point and <code>false</code> otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public boolean contains(int x, int y) {
+ return OS.gdk_region_point_in(handle, x, y);
+}
+/**
+ * Returns <code>true</code> if the given point is inside the
+ * area specified by the receiver, and <code>false</code>
+ * otherwise.
+ *
+ * @param pt the point to test for containment
+ * @return <code>true</code> if the region contains the point and <code>false</code> otherwise
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public boolean contains(Point pt) {
+ if (pt == null) error(SWT.ERROR_NULL_ARGUMENT);
+ return contains(pt.x, pt.y);
+}
+/**
+ * Disposes of the operating system resources associated with
+ * the region. Applications must dispose of all regions which
+ * they allocate.
+ */
+public void dispose() {
+ if (handle != 0) OS.gdk_region_destroy(handle);
+ handle = 0;
+}
+/**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the <em>same</em> object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
+ *
+ * @see #hashCode
+ */
+public boolean equals(Object object) {
+ if (this == object) return true;
+ if (!(object instanceof Region)) return false;
+ int xRegion = ((Region)object).handle;
+ if (handle == xRegion) return true;
+ if (xRegion == 0) return false;
+ return OS.gdk_region_equal(handle, xRegion);
+}
+void error(int code) {
+ throw new SWTError(code);
+}
+/**
+ * Returns a rectangle which represents the rectangular
+ * union of the collection of rectangles the receiver
+ * maintains to describe its area.
+ *
+ * @return a bounding rectangle for the region
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see Rectangle#union
+ */
+public Rectangle getBounds() {
+ GdkRectangle rect = new GdkRectangle();
+ OS.gdk_region_get_clipbox(handle, rect);
+ return new Rectangle(rect.x, rect.y, rect.width, rect.height);
+}
+public static Region gtk_new(int handle) {
+ return new Region(handle);
+}
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects which return <code>true</code> when passed to
+ * <code>equals</code> must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals
+ */
+public int hashCode() {
+ return handle;
+}
+/**
+ * Returns <code>true</code> if the rectangle described by the
+ * arguments intersects with any of the rectangles the receiver
+ * mainains to describe its area, and <code>false</code> otherwise.
+ *
+ * @param x the x coordinate of the origin of the rectangle
+ * @param y the y coordinate of the origin of the rectangle
+ * @param width the width of the rectangle
+ * @param height the height of the rectangle
+ * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see Rectangle#intersects
+ */
+public boolean intersects (int x, int y, int width, int height) {
+ GdkRectangle osRect = new GdkRectangle();
+ osRect.x = (short)x;
+ osRect.y = (short)y;
+ osRect.width = (short)width;
+ osRect.height = (short)height;
+ return OS.gdk_region_rect_in(handle, osRect) != OS.GDK_OVERLAP_RECTANGLE_OUT;
+}
+/**
+ * Returns <code>true</code> if the given rectangle intersects
+ * with any of the rectangles the receiver mainains to describe
+ * its area and <code>false</code> otherwise.
+ *
+ * @param rect the rectangle to test for intersection
+ * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the argument is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ *
+ * @see Rectangle#intersects
+ */
+public boolean intersects(Rectangle rect) {
+ if (rect == null) error(SWT.ERROR_NULL_ARGUMENT);
+ return intersects(rect.x, rect.y, rect.width, rect.height);
+}
+/**
+ * Returns <code>true</code> if the region has been disposed,
+ * and <code>false</code> otherwise.
+ * <p>
+ * This method gets the dispose state for the region.
+ * When a region has been disposed, it is an error to
+ * invoke any other method using the region.
+ *
+ * @return <code>true</code> when the region is disposed, and <code>false</code> otherwise
+ */
+public boolean isDisposed() {
+ return handle == 0;
+}
+/**
+ * Returns <code>true</code> if the receiver does not cover any
+ * area in the (x, y) coordinate plane, and <code>false</code> if
+ * the receiver does cover some area in the plane.
+ *
+ * @return <code>true</code> if the receiver is empty, and <code>false</code> otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ */
+public boolean isEmpty() {
+ return OS.gdk_region_empty(handle);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/internal/Converter.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/internal/Converter.java
new file mode 100644
index 0000000..66d9149
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/internal/Converter.java
@@ -0,0 +1,85 @@
+package org.eclipse.swt.internal;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+/**
+ * This class implements the conversions between unicode characters
+ * and the <em>platform supported</em> representation for characters.
+ * <p>
+ * Note that, unicode characters which can not be found in the platform
+ * encoding will be converted to an arbitrary platform specific character.
+ * </p>
+ */
+public final class Converter {
+ public static final byte [] NullByteArray = new byte [1];
+ public static final char [] NullCharArray = new char [1];
+ public static final byte [] EmptyByteArray = new byte [0];
+ public static final char [] EmptyCharArray = new char [0];
+/**
+ * Returns the default code page for the platform where the
+ * application is currently running.
+ *
+ * @return the default code page
+ */
+public static String defaultCodePage () {
+ /*
+ | ptr cp |
+ DefaultCodePage == nil ifFalse: [^DefaultCodePage].
+ cp := ''. "$NON-NLS$"
+ (ptr := OSStringZ address: (NlLanginfo callWith: 49)) isNull
+ ifFalse: [cp := String copyFromOSMemory: ptr].
+ cp isEmpty ifFalse: [
+ IsSunOS ifTrue: [
+ (cp size > 3 and: [(cp copyFrom: 1 to: 3) = 'ISO'])
+ ifTrue: [cp := cp copyFrom: 4 to: cp size]].
+ ^DefaultCodePage := cp].
+ IsAIX ifTrue: [^DefaultCodePage := 'ISO8859-1'].
+ IsSunOS ifTrue: [^DefaultCodePage := '8859-1'].
+ ^DefaultCodePage := 'iso8859_1'
+ */
+ return null;
+}
+static boolean is7BitAscii (byte [] buffer) {
+ for (int i=0; i<buffer.length; i++) {
+ if ((buffer [i] & 0xFF) > 0x7F) return false;
+ }
+ return true;
+}
+static boolean is7BitAscii (char [] buffer) {
+ for (int i=0; i<buffer.length; i++) {
+ if (buffer [i] > 0x7F) return false;
+ }
+ return true;
+}
+public static char [] mbcsToWcs (String codePage, byte [] buffer) {
+ //SLOW AND BOGUS
+ return new String (buffer).toCharArray ();
+}
+/* TEMPORARY CODE */
+public static byte [] wcsToMbcs (String codePage, String string) {
+ return wcsToMbcs (codePage, string, false);
+}
+public static byte [] wcsToMbcs (String codePage, String string, boolean terminate) {
+ //SLOW AND BOGUS
+ int count = string.length ();
+ if (terminate) count++;
+ char [] buffer = new char [count];
+ string.getChars (0, string.length (), buffer, 0);
+ return wcsToMbcs (codePage, buffer, false);
+}
+/* TEMPORARY CODE */
+public static byte [] wcsToMbcs (String codePage, char [] buffer) {
+ return wcsToMbcs (codePage, buffer, false);
+}
+public static byte [] wcsToMbcs (String codePage, char [] buffer, boolean terminate) {
+ //SLOW AND BOGUS
+ if (!terminate) return new String (buffer).getBytes ();
+ byte [] buffer1 = new String (buffer).getBytes ();
+ byte [] buffer2 = new byte [buffer1.length + 1];
+ System.arraycopy (buffer1, 0, buffer2, 0, buffer1.length);
+ return buffer2;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Button.java
new file mode 100644
index 0000000..c08b892
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Button.java
@@ -0,0 +1,493 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class represent a selectable user interface object that
+ * issues notification when pressed and released.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>ARROW, CHECK, PUSH, RADIO, TOGGLE, FLAT</dd>
+ * <dd>LEFT, RIGHT, CENTER</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+public class Button extends Control {
+ int boxHandle;
+ Image image;
+ String text;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Button (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+static int checkStyle (int style) {
+ style = checkBits (style, SWT.PUSH, SWT.ARROW, SWT.CHECK, SWT.RADIO, SWT.TOGGLE, 0);
+ if ((style & SWT.PUSH) != 0) {
+ return checkBits (style, SWT.CENTER, SWT.LEFT, SWT.RIGHT, 0, 0, 0);
+ }
+ if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) != 0) {
+ return checkBits (style, SWT.LEFT, SWT.RIGHT, SWT.CENTER, 0, 0, 0);
+ }
+ if ((style & SWT.ARROW) != 0) {
+ return checkBits (style, SWT.UP, SWT.DOWN, SWT.LEFT, SWT.RIGHT, 0, 0);
+ }
+ return style;
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control is selected, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * <code>widgetSelected</code> is called when the control is selected.
+ * <code>widgetDefaultSelected</code> is not called.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener (SelectionListener listener) {
+ checkWidget ();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+ int bits = SWT.ARROW | SWT.TOGGLE | SWT.CHECK | SWT.RADIO | SWT.PUSH;
+
+ boxHandle = OS.gtk_event_box_new ();
+ if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ switch (style & bits) {
+ case SWT.ARROW:
+ handle = OS.gtk_button_new ();
+ int arrow = OS.gtk_arrow_new (OS.GTK_ARROW_UP, OS.GTK_SHADOW_OUT);
+ OS.gtk_container_add (handle, arrow);
+ OS.gtk_widget_show (arrow);
+ break;
+ case SWT.TOGGLE:
+ handle = OS.gtk_toggle_button_new ();
+ break;
+ case SWT.CHECK:
+ handle = OS.gtk_check_button_new ();
+ break;
+ case SWT.RADIO:
+ handle = OS.gtk_radio_button_new (parent.radioGroup());
+ break;
+ case SWT.PUSH:
+ default:
+ handle = OS.gtk_button_new ();
+ break;
+ }
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void setHandleStyle() {}
+
+void configure() {
+ _connectParent();
+ OS.gtk_container_add (boxHandle, handle);
+}
+
+void showHandle() {
+ OS.gtk_widget_show (boxHandle);
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void hookEvents () {
+ super.hookEvents();
+ /*
+ * Feature in GTK. For some reason, when the widget
+ * is a check or radio button, mouse move and key
+ * release events are not signaled. The fix is to
+ * look for them on the parent.
+ */
+ if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
+ int mask = OS.GDK_POINTER_MOTION_MASK | OS.GDK_KEY_RELEASE_MASK;
+ OS.gtk_widget_add_events (boxHandle, mask);
+ signal_connect_after (boxHandle, "motion_notify_event", SWT.MouseMove, 3);
+ signal_connect_after (boxHandle, "key_release_event", SWT.KeyUp, 3);
+ }
+ signal_connect (handle, "clicked", SWT.Selection, 2);
+}
+
+void register () {
+ super.register ();
+ WidgetTable.put (boxHandle, this);
+}
+
+void createWidget (int index) {
+ super.createWidget (index);
+ text = "";
+}
+
+int topHandle () { return boxHandle; }
+
+/**
+ * Returns a value which describes the position of the
+ * text or image in the receiver. The value will be one of
+ * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
+ * unless the receiver is an <code>ARROW</code> button, in
+ * which case, the alignment will indicate the direction of
+ * the arrow (one of <code>LEFT</code>, <code>RIGHT</code>,
+ * <code>UP</code> or <code>DOWN</code>.
+ *
+ * @return the alignment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getAlignment () {
+ checkWidget ();
+ if ((style & SWT.ARROW) != 0) {
+ if ((style & SWT.UP) != 0) return SWT.UP;
+ if ((style & SWT.DOWN) != 0) return SWT.DOWN;
+ if ((style & SWT.LEFT) != 0) return SWT.LEFT;
+ if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
+ return SWT.UP;
+ }
+ if ((style & SWT.LEFT) != 0) return SWT.LEFT;
+ if ((style & SWT.CENTER) != 0) return SWT.CENTER;
+ if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
+ return SWT.LEFT;
+}
+
+/**
+ * Returns the receiver's image if it has one, or null
+ * if it does not.
+ *
+ * @return the receiver's image
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Image getImage () {
+ checkWidget ();
+ return image;
+}
+
+String getNameText () {
+ return getText ();
+}
+
+/**
+ * Returns <code>true</code> if the receiver is selected,
+ * and false otherwise.
+ * <p>
+ * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
+ * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
+ * it is selected when it is pushed. If the receiver is of any other type,
+ * this method returns false.
+ *
+ * @return the selection state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getSelection () {
+ checkWidget ();
+ if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return false;
+ return OS.gtk_toggle_button_get_active (handle);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is selected.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener (SelectionListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+
+/**
+ * Controls how text, images and arrows will be displayed
+ * in the receiver. The argument should be one of
+ * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
+ * unless the receiver is an <code>ARROW</code> button, in
+ * which case, the argument indicates the direction of
+ * the arrow (one of <code>LEFT</code>, <code>RIGHT</code>,
+ * <code>UP</code> or <code>DOWN</code>.
+ *
+ * @param alignment the new alignment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setAlignment (int alignment) {
+ checkWidget ();
+ if ((style & SWT.ARROW) != 0) {
+ if ((style & (SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT)) == 0) return;
+ style &= ~(SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT);
+ style |= alignment & (SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT);
+ int arrow_type = OS.GTK_ARROW_UP;
+ switch (alignment) {
+ case SWT.UP:
+ arrow_type = OS.GTK_ARROW_UP;
+ break;
+ case SWT.DOWN:
+ arrow_type = OS.GTK_ARROW_DOWN;
+ break;
+ case SWT.LEFT:
+ arrow_type = OS.GTK_ARROW_LEFT;
+ break;
+ case SWT.RIGHT:
+ arrow_type = OS.GTK_ARROW_RIGHT;
+ break;
+ }
+ int list = OS.gtk_container_children (handle);
+ int arrow = OS.g_list_nth_data (list, 0);
+ OS.gtk_arrow_set (arrow, arrow_type, OS.GTK_SHADOW_OUT);
+ return;
+ }
+ if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
+ style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
+ style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
+ int list = OS.gtk_container_children (handle);
+ int label = OS.g_list_nth_data (list, 0);
+ if (label == 0) return;
+ boolean isText = OS.GTK_WIDGET_TYPE (handle) == OS.gtk_label_get_type ();
+ if ((style & SWT.LEFT) != 0) {
+ OS.gtk_misc_set_alignment (label, 0.0f, 0.5f);
+ if (isText) OS.gtk_label_set_justify (label, OS.GTK_JUSTIFY_LEFT);
+ return;
+ }
+ if ((style & SWT.CENTER) != 0) {
+ OS.gtk_misc_set_alignment (label, 0.5f, 0.5f);
+ if (isText) OS.gtk_label_set_justify (label, OS.GTK_JUSTIFY_CENTER);
+ return;
+ }
+ if ((style & SWT.RIGHT) != 0) {
+ OS.gtk_misc_set_alignment (label, 1.0f, 0.5f);
+ if (isText) OS.gtk_label_set_justify (label, OS.GTK_JUSTIFY_RIGHT);
+ return;
+ }
+}
+
+/**
+ * Sets the receiver's image to the argument, which may be
+ * null indicating that no image should be displayed.
+ *
+ * @param image the image to display on the receiver (may be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setImage (Image image) {
+ checkWidget ();
+ this.image = image;
+ if ((style & SWT.ARROW) != 0) return;
+ int list = OS.gtk_container_children (handle);
+ if (list != 0) {
+ int widget = OS.g_list_nth_data (list, 0);
+ if (widget != 0) OS.gtk_widget_destroy (widget);
+ }
+ if (image != null) {
+ int pixmap = OS.gtk_pixmap_new (image.pixmap, image.mask);
+ OS.gtk_container_add (handle, pixmap);
+ OS.gtk_widget_show (pixmap);
+ }
+}
+
+/**
+ * Returns the receiver's text, which will be an empty
+ * string if it has never been set.
+ *
+ * @return the receiver's text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getText () {
+ checkWidget();
+ return text;
+}
+
+/**
+ * Sets the selection state of the receiver, if it is of type <code>CHECK</code>,
+ * <code>RADIO</code>, or <code>TOGGLE</code>.
+ *
+ * <p>
+ * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
+ * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
+ * it is selected when it is pushed.
+ *
+ * @param selected the new selection state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (boolean selected) {
+ checkWidget();
+ if ((style & (SWT.CHECK | SWT.RADIO | SWT.TOGGLE)) == 0) return;
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_toggle_button_set_active (handle, selected);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+
+/**
+ * Sets the receiver's text.
+ * <p>
+ * This method sets the button label. The label may include
+ * the mnemonic character but must not contain line delimiters.
+ * </p>
+ *
+ * @param string the new text
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setText (String string) {
+ checkWidget ();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ text = string;
+ if ((style & SWT.ARROW) != 0) return;
+ int length = string.length ();
+ char [] text = new char [length + 1];
+ char [] pattern = new char [length + 1];
+ string.getChars (0, length, text, 0);
+ int i = 0, j = 0;
+ while (i < length) {
+ pattern [j] = ' ';
+ if (text [i] == '&') {
+ i++;
+ if (i < length && text [i] != '&') {
+ pattern [j] = '_';
+ }
+ }
+ text [j++] = text [i++];
+ }
+ while (j < i) {
+ text [j] = pattern [j] = '\0';
+ j++;
+ }
+ int list = OS.gtk_container_children (handle);
+ if (list != 0) {
+ int widget = OS.g_list_nth_data (list, 0);
+ if (widget != 0) OS.gtk_widget_destroy (widget);
+ }
+ byte [] buffer1 = Converter.wcsToMbcs (null, text);
+ int label = OS.gtk_label_new (buffer1);
+ byte [] buffer2 = Converter.wcsToMbcs (null, pattern);
+ OS.gtk_label_set_pattern (label, buffer2);
+ OS.gtk_container_add (handle, label);
+ OS.gtk_widget_show (label);
+}
+
+int processSelection (int int0, int int1, int int2) {
+ postEvent(SWT.Selection);
+ return 0;
+}
+
+void deregister () {
+ super.deregister ();
+ WidgetTable.remove (boxHandle);
+}
+
+void releaseWidget () {
+ super.releaseWidget ();
+ image = null;
+ text = null;
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ boxHandle = 0;
+}
+
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Canvas.java
new file mode 100644
index 0000000..3374e5c
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Canvas.java
@@ -0,0 +1,264 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class provide a surface for drawing
+ * arbitrary graphics.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * This class may be subclassed by custom control implementors
+ * who are building controls that are <em>not</em> constructed
+ * from aggregates of other controls. That is, they are either
+ * painted using SWT graphics calls or are handled by native
+ * methods.
+ * </p>
+ *
+ * @see Composite
+ */
+public class Canvas extends Composite {
+
+ Caret caret;
+
+/*
+ * === CONSTRUCTORS ===
+ */
+
+
+Canvas () {}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Canvas (Composite parent, int style) {
+ super (parent, style);
+}
+
+/**
+ * Returns the caret.
+ * <p>
+ * The caret for the control is automatically hidden
+ * and shown when the control is painted or resized,
+ * when focus is gained or lost and when an the control
+ * is scrolled. To avoid drawing on top of the caret,
+ * the programmer must hide and show the caret when
+ * drawing in the window any other time.
+ * </p>
+ *
+ * @return the caret
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Caret getCaret () {
+ checkWidget();
+ return caret;
+}
+
+/**
+ * Scrolls a rectangular area of the receiver by first copying
+ * the source area to the destination and then causing the area
+ * of the source which is not covered by the destination to
+ * be repainted. Children that intersect the rectangle are
+ * optionally moved during the operation. In addition, outstanding
+ * paint events are flushed before the source area is copied to
+ * ensure that the contents of the canvas are drawn correctly.
+ *
+ * @param destX the x coordinate of the destination
+ * @param destY the y coordinate of the destination
+ * @param x the x coordinate of the source
+ * @param y the y coordinate of the source
+ * @param width the width of the area
+ * @param height the height of the area
+ * @param all <code>true</code>if children should be scrolled, and <code>false</code> otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void scroll (int destX, int destY, int x, int y, int width, int height, boolean all) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+
+ if (width <= 0 || height <= 0) return;
+ int deltaX = destX - x, deltaY = destY - y;
+ if (deltaX == 0 && deltaY == 0) return;
+ if (!isVisible ()) return;
+
+ /* Hide the caret */
+ boolean isVisible = (caret != null) && (caret.isVisible ());
+ if (isVisible) caret.hideCaret ();
+
+ GtkWidget widget = new GtkWidget();
+ OS.memmove (widget, paintHandle(), GtkWidget.sizeof);
+ int window = widget.window;
+ if (window == 0) return;
+
+ /* Emit a NoExpose Event */
+ int gc = OS.gdk_gc_new (window);
+ OS.gdk_gc_set_exposures(gc, true);
+ OS.gdk_window_copy_area (window, gc, x, y, window, x, y, width, height);
+ OS.gdk_gc_destroy (gc);
+
+ /* Flush outstanding Exposes */
+ int eventHandle=0;
+ while ((eventHandle = OS.gdk_event_get_graphics_expose(window)) != 0) {
+ OS.gtk_widget_event(handle, eventHandle);
+ OS.gdk_event_free(eventHandle);
+ }
+
+ /* Scroll the window */
+ int gc1 = OS.gdk_gc_new (window);
+ OS.gdk_gc_set_exposures(gc1, true);
+ OS.gdk_window_copy_area (window, gc1, destX, destY, window, x, y, width, height);
+ OS.gdk_gc_destroy (gc1);
+ boolean disjoint = (destX + width < x) || (x + width < destX) || (destY + height < y) || (y + height < destY);
+ if (disjoint) {
+ OS.gdk_window_clear_area(window, x, y, width, height);
+ } else {
+ if (deltaX != 0) {
+ int newX = destX - deltaX;
+ if (deltaX < 0) newX = destX + width;
+ OS.gdk_window_clear_area_e(window, newX, y, Math.abs (deltaX), height);
+ }
+ if (deltaY != 0) {
+ int newY = destY - deltaY;
+ if (deltaY < 0) newY = destY + height;
+ OS.gdk_window_clear_area_e (window, x, newY, width, Math.abs (deltaY));
+ }
+ }
+
+ /* Show the caret */
+ if (isVisible) caret.showCaret ();
+}
+/**
+ * Sets the receiver's caret.
+ * <p>
+ * The caret for the control is automatically hidden
+ * and shown when the control is painted or resized,
+ * when focus is gained or lost and when an the control
+ * is scrolled. To avoid drawing on top of the caret,
+ * the programmer must hide and show the caret when
+ * drawing in the window any other time.
+ * </p>
+ * @param caret the new caret for the receiver, may be null
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the caret has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setCaret (Caret caret) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ Caret newCaret = caret;
+ Caret oldCaret = this.caret;
+ this.caret = newCaret;
+ if (isFocusControl()) {
+ if (oldCaret != null) oldCaret.killFocus ();
+ if (newCaret != null) newCaret.setFocus ();
+ }
+}
+public boolean setFocus () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & SWT.NO_FOCUS) != 0) return false;
+ return super.setFocus ();
+}
+int processFocusIn (int int0, int int1, int int2) {
+ int result = super.processFocusIn (int0, int1, int2);
+ if (caret != null) caret.setFocus ();
+ return result;
+}
+int processFocusOut(int int0, int int1, int int2) {
+ int result = super.processFocusOut (int0, int1, int2);
+ if (caret != null) caret.killFocus ();
+ return result;
+}
+/*
+int processMouseDown (int callData, int arg1, int int2) {
+ if ((UtilFuncs.GTK_WIDGET_GET_FLAGS(handle) & OS.GTK_HAS_FOCUS) == 0)
+ OS.gtk_widget_grab_focus(handle);
+ GdkEventButton gdkEvent = new GdkEventButton ();
+ OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
+ int eventType = SWT.MouseDown;
+ if (gdkEvent.type == OS.GDK_2BUTTON_PRESS) eventType = SWT.MouseDoubleClick;
+ sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
+ if (gdkEvent.button == 3 && menu != null) {
+ menu.setVisible (true);
+ }
+ return 1;
+}
+
+int processMouseUp (int callData, int arg1, int int2) {
+ GdkEventButton gdkEvent = new GdkEventButton ();
+ OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
+ sendMouseEvent (SWT.MouseUp, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
+ return 1;
+}
+*/
+int processPaint (int callData, int arg1, int int2) {
+ //if (!hooks (SWT.Paint)) return 0;
+
+ GdkEventExpose gdkEvent = new GdkEventExpose ();
+ OS.memmove (gdkEvent, callData, GdkEventExpose.sizeof);
+ Event event = new Event ();
+ event.count = gdkEvent.count;
+ event.x = gdkEvent.x; event.y = gdkEvent.y;
+ event.width = gdkEvent.width; event.height = gdkEvent.height;
+ GC gc = event.gc = new GC (this);
+ sendEvent (SWT.Paint, event);
+ gc.dispose ();
+ event.gc = null;
+ return 0;
+}
+void releaseWidget () {
+ if (caret != null) caret.releaseWidget ();
+ caret = null;
+ super.releaseWidget ();
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Caret.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Caret.java
new file mode 100644
index 0000000..0500c51
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Caret.java
@@ -0,0 +1,498 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class provide an i-beam that is typically used
+ * as the insertion point for text.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+
+public class Caret extends Widget {
+ Canvas parent;
+ int x, y, width, height;
+ boolean moved, resized;
+ boolean isVisible,isShowing;
+ int blinkRate = 500;
+ Image image;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Caret (Canvas parent, int style) {
+ super (parent, style);
+ this.parent = parent;
+ createWidget (0);
+}
+void createWidget (int index) {
+ super.createWidget (index);
+ isVisible = true;
+ if (parent.getCaret () == null) {
+ parent.setCaret (this);
+ }
+}
+
+boolean blinkCaret () {
+ if (!isVisible) return true;
+ if (!isShowing) return showCaret();
+ if (blinkRate==0) return true;
+ return hideCaret();
+}
+
+boolean drawCaret () {
+ if (parent == null) return false;
+ if (parent.isDisposed ()) return false;
+ int handle = parent.handle;
+ GtkWidget widget = new GtkWidget();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ int window = widget.window;
+ if (window == 0) return false;
+ int gc = OS.gdk_gc_new(window);
+ GdkGCValues gcvalues = new GdkGCValues();
+ OS.gdk_gc_get_values(gc, gcvalues);
+ //GdkColor color = new GdkColor();
+ //color.pixel = gcvalues.foreground_pixel ^ gcvalues.background_pixel;
+ //color.red = (short)(gcvalues.foreground_red ^ gcvalues.background_red);
+ //color.green = (short)(gcvalues.foreground_green ^ gcvalues.background_green);
+ //color.blue = (short)(gcvalues.foreground_blue ^ gcvalues.background_blue);
+ Color COLOR_DARK_RED = new Color (Display.getCurrent(), 0x80,0xFF,0xFF);
+ OS.gdk_gc_set_foreground(gc, COLOR_DARK_RED.handle);
+ OS.gdk_gc_set_function(gc, OS.GDK_XOR);
+ int nWidth = width;
+ if (nWidth <= 0) nWidth = 2;
+ OS.gdk_draw_rectangle(window, gc, 1, x, y, nWidth, height);
+ OS.gdk_gc_destroy(gc);
+ return true;
+}
+/**
+ * Returns a rectangle describing the receiver's size and location
+ * relative to its parent (or its display if its parent is null).
+ *
+ * @return the receiver's bounding rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Rectangle getBounds () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return new Rectangle (x, y, width, height);
+}
+public Display getDisplay () {
+ Composite parent = this.parent;
+ if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getDisplay ();
+}
+/**
+ * Returns the font that the receiver will use to paint textual information.
+ *
+ * @return the receiver's font
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Font getFont () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getFont ();
+}
+/**
+ * Returns a point describing the receiver's location relative
+ * to its parent (or its display if its parent is null).
+ *
+ * @return the receiver's location
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getLocation () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return new Point (x, y);
+}
+/**
+ * Returns the receiver's parent, which must be a <code>Canvas</code>.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Canvas getParent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent;
+}
+/**
+ * Returns a point describing the receiver's size.
+ *
+ * @return the receiver's size
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getSize () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return new Point (width, height);
+}
+/**
+ * Returns <code>true</code> if the receiver is visible, and
+ * <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getVisible () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return isVisible;
+}
+boolean hideCaret () {
+// Display display = getDisplay ();
+// if (display.currentCaret != this) return false;
+ if (!isShowing) return true;
+ isShowing = false;
+ return drawCaret ();
+}
+/**
+ * Returns <code>true</code> if the receiver is visible, and
+ * <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isVisible () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return isVisible && parent.isVisible (); // && parent.hasFocus ();
+}
+void killFocus () {
+// OS.DestroyCaret ();
+// self restoreFont.
+}
+void move () {
+ showCaret();
+ moved = false;
+}
+void releaseChild () {
+ super.releaseChild ();
+ if (this == parent.getCaret ()) parent.setCaret (null);
+}
+void releaseWidget () {
+ super.releaseWidget ();
+ parent = null;
+}
+void resize () {
+ int hwnd = parent.handle;
+ if (hwnd == 0) return;
+// OS.DestroyCaret ();
+// OS.CreateCaret (hwnd, 0, width, height);
+// OS.SetCaretPos (x, y);
+// OS.ShowCaret (hwnd);
+// self move.
+// showCaret();
+ resized = false;
+}
+/**
+ * Sets the receiver's size and location to the rectangular
+ * area specified by the arguments. The <code>x</code> and
+ * <code>y</code> arguments are relative to the receiver's
+ * parent (or its display if its parent is null).
+ *
+ * @param x the new x coordinate for the receiver
+ * @param y the new y coordinate for the receiver
+ * @param width the new width for the receiver
+ * @param height the new height for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setBounds (int x, int y, int width, int height) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ boolean samePosition, sameExtent, showing;
+ samePosition = (this.x == x) && (this.y == y);
+ sameExtent = (this.width == width) && (this.height == height);
+ if (samePosition && sameExtent) return;
+ if (isShowing) hideCaret ();
+ this.x = x; this.y = y;
+ this.width = width; this.height = height;
+ if (sameExtent) {
+ moved = true;
+ if (isVisible ()) move ();
+ } else {
+ resized = true;
+ if (isVisible ()) resize ();
+ }
+ if(isVisible())
+ showCaret ();
+}
+/**
+ * Sets the receiver's size and location to the rectangular
+ * area specified by the argument. The <code>x</code> and
+ * <code>y</code> fields of the rectangle are relative to
+ * the receiver's parent (or its display if its parent is null).
+ *
+ * @param rect the new bounds for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setBounds (Rectangle rect) {
+ if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
+ setBounds (rect.x, rect.y, rect.width, rect.height);
+}
+void setFocus () {
+ Display display = getDisplay();
+ if (display.currentCaret==this) return;
+ display.setCurrentCaret(this);
+ if (isVisible) showCaret ();
+}
+
+/**
+ * Sets the font that the receiver will use to paint textual information
+ * to the font specified by the argument, or to the default font for that
+ * kind of control if the argument is null.
+ *
+ * @param font the new font (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the font has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setFont (Font font) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (font != null && font.isDisposed ()) {
+ error (SWT.ERROR_INVALID_ARGUMENT);
+ }
+}
+
+/**
+ * Returns the image that the receiver will use to paint the caret.
+ *
+ * @return the receiver's image
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Image getImage () {
+ checkWidget();
+ return image;
+}
+/**
+ * Sets the image that the receiver will use to paint the caret
+ * to the image specified by the argument, or to the default
+ * which is a filled rectangle if the argument is null
+ *
+ * @param font the new font (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setImage (Image image) {
+ checkWidget();
+ if (image != null && image.isDisposed ()) {
+ error (SWT.ERROR_INVALID_ARGUMENT);
+ }
+ if (isShowing) hideCaret ();
+ this.image = image;
+ if (isShowing) showCaret ();
+}
+/**
+ * Sets the receiver's location to the point specified by
+ * the arguments which are relative to the receiver's
+ * parent (or its display if its parent is null).
+ *
+ * @param x the new x coordinate for the receiver
+ * @param y the new y coordinate for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLocation (int x, int y) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ setBounds (x, y, width, height);
+}
+/**
+ * Sets the receiver's location to the point specified by
+ * the argument which is relative to the receiver's
+ * parent (or its display if its parent is null).
+ *
+ * @param location the new location for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLocation (Point location) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
+ setLocation (location.x, location.y);
+}
+/**
+ * Sets the receiver's size to the point specified by the arguments.
+ *
+ * @param width the new width for the receiver
+ * @param height the new height for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSize (int width, int height) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (this.width == width && this.height == height) return;
+ this.width = width; this.height = height;
+ resized = true;
+ if (isVisible ()) resize ();
+}
+/**
+ * Sets the receiver's size to the point specified by the argument.
+ *
+ * @param size the new extent for the receiver
+ * @param height the new height for the receiver
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSize (Point size) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
+ setSize (size.x, size.y);
+}
+/**
+ * Marks the receiver as visible if the argument is <code>true</code>,
+ * and marks it invisible otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, marking
+ * it visible may not actually cause it to be displayed.
+ * </p>
+ *
+ * @param visible the new visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setVisible (boolean visible) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (visible == isVisible) return;
+ if (isVisible = visible) {
+ showCaret ();
+ } else {
+ hideCaret ();
+ }
+
+}
+boolean showCaret () {
+// if (getDisplay ().currentCaret != this) return false;
+ if (isShowing) return true;
+ isShowing = true;
+ return drawCaret ();
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ColorDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ColorDialog.java
new file mode 100644
index 0000000..33dfd4b
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ColorDialog.java
@@ -0,0 +1,166 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class allow the user to select a color
+ * from a predefined set of available colors.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+public class ColorDialog extends Dialog {
+ RGB rgb;
+/**
+ * Constructs a new instance of this class given only its parent.
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public ColorDialog (Shell parent) {
+ this (parent, SWT.NULL);
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public ColorDialog (Shell parent, int style) {
+ super (parent, style);
+}
+int cancelFunc (int widget, int callData) {
+ OS.gtk_widget_destroy (callData);
+ return 0;
+}
+int destroyFunc (int widget, int colorInfo) {
+ OS.gtk_main_quit ();
+ return 0;
+}
+/**
+ * Returns the currently selected color in the receiver.
+ *
+ * @return the RGB value for the selected color, may be null
+ *
+ * @see PaletteData#getRGBs
+ */
+public RGB getRGB () {
+ return rgb;
+}
+int okFunc (int widget, int callData) {
+ GtkColorSelectionDialog dialog = new GtkColorSelectionDialog ();
+ OS.memmove (dialog, callData, GtkColorSelectionDialog.sizeof);
+ double [] color = new double [4];
+ OS.gtk_color_selection_get_color (dialog.colorsel, color);
+ rgb = new RGB ((int)(color [0] * 256), (int)(color [1] * 256), (int)(color [2] * 256));
+ OS.gtk_widget_destroy (callData);
+ return 0;
+}
+/**
+ * Makes the receiver visible and brings it to the front
+ * of the display.
+ *
+ * @return the selected color, or null if the dialog was
+ * cancelled, no color was selected, or an error
+ * occurred
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public RGB open () {
+ int handle;
+ byte [] titleBytes;
+ titleBytes = Converter.wcsToMbcs (null, title, true);
+ handle = OS.gtk_color_selection_dialog_new (titleBytes);
+ GtkColorSelectionDialog dialog = new GtkColorSelectionDialog ();
+ OS.memmove (dialog, handle, GtkColorSelectionDialog.sizeof);
+ OS.gtk_widget_hide (dialog.help_button);
+ if (rgb != null) {
+ double [] color = new double [4];
+ color [0] = (double)rgb.red / 256;
+ color [1] = (double)rgb.green / 256;
+ color [2] = (double)rgb.blue / 256;
+ OS.gtk_color_selection_set_color (dialog.colorsel, color);
+ }
+ Callback destroyCallback = new Callback (this, "destroyFunc", 2);
+ int destroyFunc = destroyCallback.getAddress ();
+ byte [] destroy = Converter.wcsToMbcs (null, "destroy", true);
+ OS.gtk_signal_connect (handle, destroy, destroyFunc, handle);
+ byte [] clicked = Converter.wcsToMbcs (null, "clicked", true);
+ Callback okCallback = new Callback (this, "okFunc", 2);
+ int okFunc = okCallback.getAddress ();
+ Callback cancelCallback = new Callback (this, "cancelFunc", 2);
+ int cancelFunc = cancelCallback.getAddress ();
+ OS.gtk_signal_connect (dialog.ok_button, clicked, okFunc, handle);
+ OS.gtk_signal_connect (dialog.cancel_button, clicked, cancelFunc, handle);
+ rgb = null;
+ OS.gtk_widget_show_now (handle);
+ OS.gtk_main ();
+ destroyCallback.dispose ();
+ okCallback.dispose ();
+ cancelCallback.dispose ();
+ return rgb;
+}
+/**
+ * Returns the receiver's selected color to be the argument.
+ *
+ * @param rgb the new RGB value for the selected color, may be
+ * null to let the platform to select a default when
+ * open() is called
+ *
+ * @see PaletteData#getRGBs
+ */
+public void setRGB (RGB rgb) {
+ this.rgb = rgb;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Combo.java
new file mode 100644
index 0000000..d2f6fe6
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Combo.java
@@ -0,0 +1,1010 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class are controls that allow the user
+ * to choose an item from a list of items, or optionally
+ * enter a new value by typing it into an editable text
+ * field. Often, <code>Combo</code>s are used in the same place
+ * where a single selection <code>List</code> widget could
+ * be used but space is limited. A <code>Combo</code> takes
+ * less space than a <code>List</code> widget and shows
+ * similar information.
+ * <p>
+ * Note: Since <code>Combo</code>s can contain both a list
+ * and an editable text field, it is possible to confuse methods
+ * which access one versus the other (compare for example,
+ * <code>clearSelection()</code> and <code>deselectAll()</code>).
+ * The API documentation is careful to indicate either "the
+ * receiver's list" or the "the receiver's text field" to
+ * distinguish between the two cases.
+ * </p><p>
+ * Note that although this class is a subclass of <code>Composite</code>,
+ * it does not make sense to add children to it, or set a layout on it.
+ * </p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>DROP_DOWN, READ_ONLY, SIMPLE</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>DefaultSelection, Modify, Selection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ *
+ * @see List
+ */
+
+public class Combo extends Composite {
+ int padHandle, _entryHandle, _listHandle, _arrowHandle;
+ int glist;
+ boolean isSelection;
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Combo (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+/**
+ * Adds the argument to the end of the receiver's list.
+ *
+ * @param string the new item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ *
+ * @see #add(String,int)
+ */
+public void add (String string) {
+ checkWidget();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ String [] items = getItems ();
+ String [] newItems = new String [items.length + 1];
+ System.arraycopy (items, 0, newItems, 0, items.length);
+ newItems [items.length] = string;
+ setItems (newItems);
+}
+/**
+ * Adds the argument to the receiver's list at the given
+ * zero-relative index.
+ * <p>
+ * Note: To add an item at the end of the list, use the
+ * result of calling <code>getItemCount()</code> as the
+ * index or use <code>add(String)</code>.
+ * </p>
+ *
+ * @param string the new item
+ * @param index the index for the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ *
+ * @see #add(String)
+ */
+public void add (String string, int index) {
+ checkWidget();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (!(0 <= index && index <= getItemCount ())) {
+ error (SWT.ERROR_ITEM_NOT_ADDED);
+ }
+ String [] items = getItems ();
+ String [] newItems = new String [items.length + 1];
+ System.arraycopy (items, 0, newItems, 0, items.length);
+ newItems [index] = string;
+ setItems (newItems);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's text is modified, by sending
+ * it one of the messages defined in the <code>ModifyListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ModifyListener
+ * @see #removeModifyListener
+ */
+public void addModifyListener (ModifyListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Modify, typedListener);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's selection changes, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * <code>widgetSelected</code> is called when the combo's list selection changes.
+ * <code>widgetDefaultSelected</code> is typically called when ENTER is pressed the combo's text area.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener(SelectionListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+static int checkStyle (int style) {
+ /*
+ * Feature in Windows. It is not possible to create
+ * a combo box that has a border using Windows style
+ * bits. All combo boxes draw their own border and
+ * do not use the standard Windows border styles.
+ * Therefore, no matter what style bits are specified,
+ * clear the BORDER bits so that the SWT style will
+ * match the Windows widget.
+ *
+ * The Windows behavior is currently implemented on
+ * all platforms.
+ */
+ style &= ~SWT.BORDER;
+
+ /*
+ * Even though it is legal to create this widget
+ * with scroll bars, they serve no useful purpose
+ * because they do not automatically scroll the
+ * widget's client area. The fix is to clear
+ * the SWT style.
+ */
+ style &= ~(SWT.H_SCROLL | SWT.V_SCROLL);
+ style = checkBits (style, SWT.DROP_DOWN, SWT.SIMPLE, 0, 0, 0, 0);
+ if ((style & SWT.SIMPLE) != 0) return style & ~SWT.READ_ONLY;
+ return style;
+}
+/**
+ * Sets the selection in the receiver's text field to an empty
+ * selection starting just before the first character. If the
+ * text field is editable, this has the effect of placing the
+ * i-beam at the start of the text.
+ * <p>
+ * Note: To clear the selected items in the receiver's list,
+ * use <code>deselectAll()</code>.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #deselectAll
+ */
+public void clearSelection () {
+ checkWidget();
+ int position = OS.gtk_editable_get_position (_entryHandle);
+ OS.gtk_editable_set_position (_entryHandle, position);
+}
+
+
+/* === Handle code 1 (creation) ========= */
+
+void createHandle (int index) {
+ state |= HANDLE;
+ eventBoxHandle = OS.gtk_event_box_new ();
+ if (eventBoxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ padHandle = OS.gtk_fixed_new ();
+ if (padHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ handle = OS.gtk_combo_new ();
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+ fixedHandle = OS.gtk_fixed_new();
+ if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ // The GtkCombo internal widgets.
+ // We don't create them, and actually these are not all of them
+ GtkCombo gtkCombo = new GtkCombo();
+ OS.memmove (gtkCombo, handle, GtkCombo.sizeof);
+ _entryHandle = gtkCombo.entry;
+ _listHandle = gtkCombo.list;
+ _arrowHandle = gtkCombo.button;
+}
+
+void setHandleStyle() {
+ boolean isEditable = (style & SWT.READ_ONLY) == 0;
+ OS.gtk_entry_set_editable(_entryHandle, isEditable);
+}
+
+void configure () {
+ _connectParent();
+ OS.gtk_container_add(eventBoxHandle, padHandle);
+ OS.gtk_fixed_put (padHandle, fixedHandle, (short)0, (short)0);
+ OS.gtk_fixed_put (padHandle, handle, (short)0, (short)0);
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ return _computeSize(wHint, hHint, changed);
+}
+
+void showHandle() {
+ OS.gtk_widget_show(eventBoxHandle);
+ OS.gtk_widget_show(padHandle);
+ OS.gtk_widget_show(fixedHandle);
+ OS.gtk_widget_show(handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void register () {
+ super.register ();
+ WidgetTable.put (padHandle, this);
+ WidgetTable.put (_entryHandle, this);
+ WidgetTable.put (_listHandle, this);
+ WidgetTable.put (_arrowHandle, this);
+}
+
+void deregister () {
+ super.deregister ();
+ WidgetTable.remove (padHandle);
+ WidgetTable.remove (_entryHandle);
+ WidgetTable.remove (_listHandle);
+ WidgetTable.remove (_arrowHandle);
+}
+
+void hookEvents () {
+ // TO DO - expose, enter/exit, focus in/out
+ super.hookEvents ();
+ signal_connect(_entryHandle, "changed", SWT.Selection, 2);
+ int mask =
+ OS.GDK_POINTER_MOTION_MASK |
+ OS.GDK_BUTTON_PRESS_MASK | OS.GDK_BUTTON_RELEASE_MASK |
+ OS.GDK_KEY_PRESS_MASK | OS.GDK_KEY_RELEASE_MASK;
+ int [] handles = new int [] {_entryHandle, _listHandle, _arrowHandle};
+ for (int i=0; i<handles.length; i++) {
+ int handle = handles [i];
+ if (!OS.GTK_WIDGET_NO_WINDOW (handle)) {
+ OS.gtk_widget_add_events (handle, mask);
+ }
+ signal_connect_after (handle, "motion_notify_event", SWT.MouseMove, 3);
+ signal_connect_after (handle, "button_press_event", SWT.MouseDown, 3);
+ signal_connect_after (handle, "button_release_event", SWT.MouseUp, 3);
+ signal_connect_after (handle, "key_press_event", SWT.KeyDown, 3);
+ signal_connect_after (handle, "key_release_event", SWT.KeyUp, 3);
+ }
+}
+
+/* === Handle code 2 (identification) === */
+int topHandle() { return eventBoxHandle; }
+int parentingHandle() { return fixedHandle; }
+boolean isMyHandle(int h) {
+ if (h==eventBoxHandle) return true;
+ if (h==padHandle) return true;
+ if (h==fixedHandle) return true;
+ if (h==handle) return true;
+
+ if (h==_arrowHandle) return true;
+ if (h==_entryHandle) return true;
+ if (h==_listHandle) return true;
+
+ return false;
+}
+
+void _connectChild (int h) {
+ OS.gtk_fixed_put (fixedHandle, h, (short)0, (short)0);
+}
+
+/* Geometry */
+
+protected Point _getClientAreaSize () {
+ return UtilFuncs.getSize(fixedHandle);
+}
+
+boolean _setSize(int width, int height) {
+ boolean differentExtent = UtilFuncs.setSize(eventBoxHandle, width,height);
+ UtilFuncs.setSize (fixedHandle, width,height);
+ UtilFuncs.setSize (handle, width,height);
+ return differentExtent;
+}
+
+/**
+ * Deselects the item at the given zero-relative index in the receiver's
+ * list. If the item at the index was already deselected, it remains
+ * deselected. Indices that are out of range are ignored.
+ *
+ * @param index the index of the item to deselect
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselect (int index) {
+ checkWidget();
+ setItems (getItems ());
+}
+/**
+ * Deselects all selected items in the receiver's list.
+ * <p>
+ * Note: To clear the selection in the receiver's text field,
+ * use <code>clearSelection()</code>.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #clearSelection
+ */
+public void deselectAll () {
+ checkWidget();
+ setItems (getItems ());
+}
+/**
+ * Returns the item at the given, zero-relative index in the
+ * receiver's list. Throws an exception if the index is out
+ * of range.
+ *
+ * @param index the index of the item to return
+ * @return the item at the given index
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public String getItem (int index) {
+ checkWidget();
+ if (!(0 <= index && index < getItemCount ())) {
+ error (SWT.ERROR_CANNOT_GET_ITEM);
+ }
+ String [] items = getItems ();
+ return items [index];
+}
+/**
+ * Returns the number of items contained in the receiver's list.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public int getItemCount () {
+ checkWidget();
+ if (glist == 0) return 0;
+ return OS.g_list_length (glist);
+}
+/**
+ * Returns the height of the area which would be used to
+ * display <em>one</em> of the items in the receiver's list.
+ *
+ * @return the height of one item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public int getItemHeight () {
+ checkWidget();
+ /* FIXME */
+ return 0;
+}
+/**
+ * Returns an array of <code>String</code>s which are the items
+ * in the receiver's list.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the items in the receiver's list
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public String [] getItems () {
+ checkWidget();
+ if (glist == 0) return new String [0];
+ int count = OS.g_list_length (glist);
+ String [] items = new String [count];
+ for (int i=0; i<count; i++) {
+ int data = OS.g_list_nth_data (glist, i);
+ int length = OS.strlen (data);
+ byte [] buffer1 = new byte [length];
+ OS.memmove (buffer1, data, length);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ items [i] = new String (buffer2, 0, length);
+ }
+ return items;
+}
+/**
+ * Returns a <code>Point</code> whose x coordinate is the start
+ * of the selection in the receiver's text field, and whose y
+ * coordinate is the end of the selection. The returned values
+ * are zero-relative. An "empty" selection as indicated by
+ * the the x and y coordinates having the same value.
+ *
+ * @return a point representing the selection start and end
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getSelection () {
+ GtkEditable widget = new GtkEditable();
+ OS.memmove (widget, _entryHandle, GtkEditable.sizeof);
+ return new Point (widget.selection_start_pos, widget.selection_end_pos);
+}
+/**
+ * Returns the zero-relative index of the item which is currently
+ * selected in the receiver's list, or -1 if no item is selected.
+ *
+ * @return the index of the selected item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelectionIndex () {
+ checkWidget();
+ return indexOf(getText());
+}
+/**
+ * Returns a string containing a copy of the contents of the
+ * receiver's text field.
+ *
+ * @return the receiver's text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getText () {
+ checkWidget();
+ int address = OS.gtk_entry_get_text(_entryHandle);
+ int length = OS.strlen (address);
+ byte [] buffer1 = new byte [length];
+ OS.memmove (buffer1, address, length);
+ //OS.g_free (address);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ return new String (buffer2, 0, buffer2.length);
+}
+String getText (int start, int stop) {
+ /*
+ * NOTE: The current implementation uses substring ()
+ * which can reference a potentially large character
+ * array.
+ */
+ return getText ().substring (start, stop - 1);
+}
+/**
+ * Returns the height of the receivers's text field.
+ *
+ * @return the text height
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public int getTextHeight () {
+ checkWidget();
+ /* A native approach, just measuring the entry:
+ * return UtilFuncs.getSize(_entryHandle).y;
+ * does not work - the entry is the same size as
+ * the whole combo.
+ */
+ error (SWT.ERROR_CANNOT_GET_ITEM_HEIGHT);
+ return 0;
+}
+/**
+ * Returns the maximum number of characters that the receiver's
+ * text field is capable of holding. If this has not been changed
+ * by <code>setTextLimit()</code>, it will be the constant
+ * <code>Combo.LIMIT</code>.
+ *
+ * @return the text limit
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getTextLimit () {
+ checkWidget();
+ /* Temporary implementation.
+ * Gtk lacks API to get the text limit, and GtkEntry is private.
+ */
+ int limitAddress = _entryHandle + GtkEditable.sizeof + 4*5;
+ int[] bytes = new int[2];
+ OS.memmove(bytes, limitAddress, 4*2);
+
+ return 0xFFFF & bytes[0];
+}
+
+/**
+ * Searches the receiver's list starting at the first item
+ * (index 0) until an item is found that is equal to the
+ * argument, and returns the index of that item. If no item
+ * is found, returns -1.
+ *
+ * @param string the search item
+ * @return the index of the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int indexOf (String string) {
+ checkWidget();
+ return indexOf (string, 0);
+}
+/**
+ * Searches the receiver's list starting at the given,
+ * zero-relative index until an item is found that is equal
+ * to the argument, and returns the index of that item. If
+ * no item is found or the starting index is out of range,
+ * returns -1.
+ *
+ * @param string the search item
+ * @return the index of the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int indexOf (String string, int start) {
+ checkWidget();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ String [] items = getItems ();
+ for (int i=start; i<items.length; i++) {
+ if (string.equals(items [i])) return i;
+ }
+ return -1;
+}
+
+int processSelection (int int0, int int1, int int2) {
+ if (!isSelection){
+ postEvent (SWT.Selection);
+ postEvent (SWT.Modify);
+ }
+ return 0;
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ int padHandle = _entryHandle = _listHandle = _arrowHandle = 0;
+}
+
+void releaseWidget () {
+ if (glist != 0) {
+ int count = OS.g_list_length (glist);
+ for (int i=0; i<count; i++) {
+ int data = OS.g_list_nth_data (glist, i);
+ if (data != 0) OS.g_free (data);
+ }
+ OS.g_list_free (glist);
+ }
+ glist = 0;
+ super.releaseWidget ();
+}
+/**
+ * Removes the item from the receiver's list at the given
+ * zero-relative index.
+ *
+ * @param index the index for the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (int index) {
+ checkWidget();
+ if (!(0 <= index && index < getItemCount ())) {
+ error (SWT.ERROR_ITEM_NOT_REMOVED);
+ }
+ String [] oldItems = getItems ();
+ String [] newItems = new String [oldItems.length - 1];
+ System.arraycopy (oldItems, 0, newItems, 0, index);
+ System.arraycopy (oldItems, index + 1, newItems, index, oldItems.length - index - 1);
+ setItems (newItems);
+}
+/**
+ * Removes the items from the receiver's list which are
+ * between the given zero-relative start and end
+ * indices (inclusive).
+ *
+ * @param start the start of the range
+ * @param end the end of the range
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (int start, int end) {
+ checkWidget();
+ if (!(0 <= start && start <= end && end < getItemCount ())) {
+ error (SWT.ERROR_ITEM_NOT_REMOVED);
+ }
+ String [] oldItems = getItems ();
+ String [] newItems = new String [oldItems.length - (end - start + 1)];
+ System.arraycopy (oldItems, 0, newItems, 0, start);
+ System.arraycopy (oldItems, end + 1, newItems, start, oldItems.length - end - 1);
+ setItems (newItems);
+}
+/**
+ * Searches the receiver's list starting at the first item
+ * until an item is found that is equal to the argument,
+ * and removes that item from the list.
+ *
+ * @param string the item to remove
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (String string) {
+ checkWidget();
+ int index = indexOf (string, 0);
+ if (index != -1) remove (index);
+}
+/**
+ * Removes all of the items from the receiver's list.
+ * <p>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void removeAll () {
+ checkWidget();
+ _removeAll();
+}
+void _removeAll() {
+ clearSelection ();
+ OS.gtk_list_clear_items(_listHandle, 0, -1);
+ glist = 0;
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's text is modified.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ModifyListener
+ * @see #addModifyListener
+ */
+public void removeModifyListener (ModifyListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Modify, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's selection changes.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener (SelectionListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+/**
+ * Selects the item at the given zero-relative index in the receiver's
+ * list. If the item at the index was already selected, it remains
+ * selected. Indices that are out of range are ignored.
+ *
+ * @param index the index of the item to select
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void select (int index) {
+ checkWidget();
+ String selectedText = getItems()[index];
+ GtkCombo gtkCombo = new GtkCombo ();
+ OS.memmove (gtkCombo, handle, GtkCombo.sizeof);
+ int list = gtkCombo.list;
+ int entry = gtkCombo.entry;
+ OS.gtk_list_select_item (list, index);
+ OS.gtk_entry_set_text (entry, Converter.wcsToMbcs (null, selectedText, true));
+}
+/**
+ * Sets the text of the item in the receiver's list at the given
+ * zero-relative index to the string argument. This is equivalent
+ * to <code>remove</code>'ing the old item at the index, and then
+ * <code>add</code>'ing the new item at that index.
+ *
+ * @param index the index for the item
+ * @param string the new text for the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the remove operation fails because of an operating system failure</li>
+ * <li>ERROR_ITEM_NOT_ADDED - if the add operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void setItem (int index, String string) {
+ checkWidget();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (!(0 <= index && index <= getItemCount ())) {
+ error (SWT.ERROR_INVALID_ARGUMENT);
+ }
+ String [] items = getItems ();
+ items [index] = string;
+ setItems (items);
+}
+/**
+ * Sets the receiver's list to be the given array of items.
+ *
+ * @param items the array of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void setItems (String [] items) {
+ checkWidget();
+ if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (items.length==0) {
+ _removeAll();
+ return;
+ }
+ int new_glist = 0;
+ for (int i=0; i<items.length; i++) {
+ String string = items [i];
+ // FIXME leaked strings and glist
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ int data = OS.g_malloc (buffer.length);
+ OS.memmove (data, buffer, buffer.length);
+ new_glist = OS.g_list_append (new_glist, data);
+ }
+ OS.gtk_combo_set_popdown_strings (handle, new_glist);
+ if (glist != 0) {
+ int count = OS.g_list_length (glist);
+ for (int i=0; i<count; i++) {
+ int data = OS.g_list_nth_data (glist, i);
+ if (data != 0) OS.g_free (data);
+ }
+ OS.g_list_free (glist);
+ }
+ glist = new_glist;
+}
+/**
+ * Sets the selection in the receiver's text field to the
+ * range specified by the argument whose x coordinate is the
+ * start of the selection and whose y coordinate is the end
+ * of the selection.
+ *
+ * @param a point representing the new selection start and end
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (Point selection) {
+ checkWidget();
+ if (selection == null) error (SWT.ERROR_NULL_ARGUMENT);
+ GtkCombo gtkCombo = new GtkCombo ();
+ OS.memmove (gtkCombo, handle, GtkCombo.sizeof);
+ int entry = gtkCombo.entry;
+ isSelection = true;
+ OS.gtk_editable_set_position (entry, selection.x);
+ OS.gtk_editable_select_region (entry, selection.x, selection.y);
+ isSelection = false;
+}
+/**
+ * Sets the contents of the receiver's text field to the
+ * given string.
+ * <p>
+ * Note: The text field in a <code>Combo</code> is typically
+ * only capable of displaying a single line of text. Thus,
+ * setting the text to a string containing line breaks or
+ * other special characters will probably cause it to
+ * display incorrectly.
+ * </p>
+ *
+ * @param text the new text
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setText (String string) {
+ checkWidget();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ GtkCombo gtkCombo = new GtkCombo ();
+ OS.memmove (gtkCombo, handle, GtkCombo.sizeof);
+ int entry = gtkCombo.entry;
+ OS.gtk_editable_delete_text (entry, 0, -1);
+ int [] position = new int [1];
+ byte [] buffer = Converter.wcsToMbcs (null, string);
+ OS.gtk_editable_insert_text (entry, buffer, buffer.length, position);
+ OS.gtk_editable_set_position (entry, 0);
+}
+/**
+ * Sets the maximum number of characters that the receiver's
+ * text field is capable of holding to be the argument.
+ *
+ * @param limit new text limit
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_CANNOT_BE_ZERO - if the limit is zero</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setTextLimit (int limit) {
+ checkWidget();
+ if (limit == 0) error (SWT.ERROR_CANNOT_BE_ZERO);
+ OS.gtk_entry_set_max_length(_entryHandle, (short)limit);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Composite.java
new file mode 100644
index 0000000..85b5077
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Composite.java
@@ -0,0 +1,489 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class are controls which are capable
+ * of containing other controls.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>NO_BACKGROUND, NO_FOCUS, NO_MERGE_PAINTS, NO_REDRAW_RESIZE</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * This class may be subclassed by custom control implementors
+ * who are building controls that are constructed from aggregates
+ * of other controls.
+ * </p>
+ *
+ * @see Canvas
+ */
+public class Composite extends Scrollable {
+ int topHandle, eventBoxHandle, fixedHandle, radioHandle;
+ Layout layout;
+
+/*
+ * === CONSTRUCTORS ===
+ */
+
+Composite () {
+ /* Do nothing */
+}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a widget which will be the parent of the new instance (cannot be null)
+ * @param style the style of widget to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Composite (Composite parent, int style) {
+ super (parent, style);
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+
+ topHandle = OS.gtk_event_box_new();
+ if (topHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+
+ scrolledHandle = OS.gtk_scrolled_window_new(0,0);
+ if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ eventBoxHandle = OS.gtk_event_box_new();
+ if (eventBoxHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+
+ fixedHandle = OS.gtk_fixed_new ();
+ if (fixedHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+
+ handle = OS.gtk_drawing_area_new();
+ if (handle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+ OS.GTK_WIDGET_SET_FLAGS(handle, OS.GTK_CAN_FOCUS);
+}
+
+void configure() {
+ _connectParent();
+ OS.gtk_container_add(topHandle, scrolledHandle);
+ _fillBin(scrolledHandle, eventBoxHandle);
+ OS.gtk_container_add(eventBoxHandle, fixedHandle);
+ OS.gtk_fixed_put(fixedHandle, handle, (short)0,(short)0);
+}
+
+void setHandleStyle() {
+ setScrollingPolicy();
+}
+
+void showHandle() {
+ OS.gtk_widget_realize (topHandle);
+ OS.gtk_widget_show_now(topHandle);
+
+ OS.gtk_widget_show (scrolledHandle);
+
+ OS.gtk_widget_realize (eventBoxHandle);
+ OS.gtk_widget_show_now(eventBoxHandle);
+
+ OS.gtk_widget_realize (fixedHandle);
+ OS.gtk_widget_show_now(fixedHandle);
+
+ OS.gtk_widget_realize (handle);
+ OS.gtk_widget_show_now (handle);
+}
+
+void register () {
+ super.register ();
+ if (topHandle != 0) WidgetTable.put (topHandle, this);
+ if (eventBoxHandle != 0) WidgetTable.put (eventBoxHandle, this);
+ if (fixedHandle != 0) WidgetTable.put (fixedHandle, this);
+}
+
+void deregister () {
+ super.deregister ();
+ if (topHandle != 0) WidgetTable.remove (topHandle);
+ if (eventBoxHandle != 0) WidgetTable.remove (eventBoxHandle);
+ if (fixedHandle != 0) WidgetTable.remove (fixedHandle);
+}
+
+int topHandle() {
+ return topHandle;
+}
+
+int parentingHandle() {
+ return fixedHandle;
+}
+
+/**
+ * Answer whether the argument points to an OS widget that is
+ * implementing the receiver, i.e., one of my own handles
+ */
+boolean isMyHandle(int h) {
+ if (h==topHandle) return true;
+ if (h==eventBoxHandle) return true;
+ if (h==scrolledHandle) return true;
+ if (h==fixedHandle) return true;
+ if (h==handle) return true;
+ if (h==radioHandle) return true;
+ return false;
+}
+
+
+
+
+/*
+ * === GEOMETRY - PHYSICAL ===
+ */
+
+
+public void setBounds (int x, int y, int width, int height) {
+ super.setBounds (x, y, width, height);
+ layout();
+}
+
+public void setSize (int width, int height) {
+ super.setSize(width, height);
+ layout();
+}
+
+boolean _setSize(int width, int height) {
+ boolean differentExtent = UtilFuncs.setSize (topHandle(), width,height);
+ Point clientSize = UtilFuncs.getSize(fixedHandle);
+ OS.gtk_drawing_area_size(handle, width, height);
+ UtilFuncs.setSize (handle, clientSize.x, clientSize.y);
+ return differentExtent;
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ Point size;
+ if (layout != null) {
+ if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) {
+ size = layout.computeSize (this, wHint, hHint, changed);
+ } else {
+ size = new Point (wHint, hHint);
+ }
+ } else {
+ size = minimumSize ();
+ }
+ if (size.x == 0) size.x = DEFAULT_WIDTH;
+ if (size.y == 0) size.y = DEFAULT_HEIGHT;
+ if (wHint != SWT.DEFAULT) size.x = wHint;
+ if (hHint != SWT.DEFAULT) size.y = hHint;
+ Rectangle trim = computeTrim (0, 0, size.x, size.y);
+ return new Point (trim.width, trim.height);
+}
+
+void initializeTrim() {
+ /* Temporary implementation - I just measured the scrollbars
+ * with one particular theme. The fair thing to do is get
+ * the real dimensions from gtk.
+ */
+ trim = new Trim();
+ if ((style&SWT.H_SCROLL)!=0) trim.bottom=18;
+ if ((style&SWT.V_SCROLL)!=0) trim.right=18;
+}
+
+
+/*
+ * === GEOMETRY - LAYOUT ===
+ */
+
+/**
+ * Returns layout which is associated with the receiver, or
+ * null if one has not been set.
+ *
+ * @return the receiver's layout or null
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Layout getLayout () {
+ checkWidget();
+ return layout;
+}
+
+/**
+ * Gets the last specified tabbing order for the control.
+ *
+ * @return tabList the ordered list of controls representing the tab order
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setTabList
+ */
+public Control [] getTabList () {
+ return new Control [0];
+}
+
+/**
+ * Sets the layout which is associated with the receiver to be
+ * the argument which may be null.
+ *
+ * @param layout the receiver's new layout or null
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLayout (Layout layout) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ this.layout = layout;
+}
+
+int _gdkWindow() {
+ int windowHandle = _gdkWindow(handle);
+ if (windowHandle==0) error(SWT.ERROR_UNSPECIFIED);
+ return windowHandle;
+}
+
+/**
+ * Returns an array containing the receiver's children.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of children, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return an array of children
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Control [] getChildren () {
+ checkWidget();
+ return _getChildren();
+}
+
+Control [] _getChildren () {
+ return _getChildren(parentingHandle());
+}
+
+/**
+ * Answer the array of the children of the specified handle,
+ * filtering out widgets we don't consider our children.
+ * That is, the OS may return some children that don't qualify
+ * as such under SWT terminology - e.g., Items are not children.
+ */
+Control [] _getChildren (int h) {
+ if (h==0) {
+ error(SWT.ERROR_UNSPECIFIED);
+ }
+ int list = OS.gtk_container_children (h);
+ int count = OS.g_list_length (list);
+ java.util.Vector children = new java.util.Vector();
+ for (int i=0; i<count; i++) {
+ int data = OS.g_list_nth_data (list, i);
+ if (!isMyHandle(data)) {
+ Control child = _childFromHandle(data);
+ if (child != null) children.addElement(child);
+ }
+ }
+ Control[] answer = new Control[children.size()];
+ children.copyInto(answer);
+ return answer;
+}
+/**
+ * Consider the argument a handle of one of the receiver's children.
+ * If the argument is not a handle to a widget, or the widget is
+ * not our child in SWT (not OS) terminology, return null.
+ */
+Control _childFromHandle(int h) {
+ Widget child = WidgetTable.get(h);
+ return (Control)child;
+}
+
+public Rectangle getClientArea () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+
+ return _getClientArea ();
+}
+
+public Rectangle _getClientArea () {
+ Point size = _getClientAreaSize ();
+ return new Rectangle (0, 0, size.x, size.y);
+}
+
+Point _getClientAreaSize () {
+ return UtilFuncs.getSize(handle);
+}
+
+
+/**
+ * If the receiver has a layout, asks the layout to <em>lay out</em>
+ * (that is, set the size and location of) the receiver's children.
+ * If the receiver does not have a layout, do nothing.
+ * <p>
+ * This is equivalent to calling <code>layout(true)</code>.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void layout () {
+ layout (true);
+}
+/**
+ * If the receiver has a layout, asks the layout to <em>lay out</em>
+ * (that is, set the size and location of) the receiver's children.
+ * If the the argument is <code>true</code> the layout must not rely
+ * on any cached information it is keeping about the children. If it
+ * is <code>false</code> the layout may (potentially) simplify the
+ * work it is doing by assuming that the state of the none of the
+ * receiver's children has changed since the last layout.
+ * If the receiver does not have a layout, do nothing.
+ *
+ * @param changed <code>true</code> if the layout must flush its caches, and <code>false</code> otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void layout (boolean changed) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (layout == null) return;
+ layout.layout (this, changed);
+}
+
+Point minimumSize () {
+ Control [] children = _getChildren ();
+ int width = 0, height = 0;
+ for (int i=0; i<children.length; i++) {
+ Rectangle rect = children [i].getBounds ();
+ width = Math.max (width, rect.x + rect.width);
+ height = Math.max (height, rect.y + rect.height);
+ }
+ return new Point (width, height);
+}
+int processResize (int int0, int int1, int int2) {
+ sendEvent (SWT.Resize);
+ layout();
+ return 0;
+}
+int radioGroup() {
+ if (radioHandle==0) _initializeRadioGroup();
+ return OS.gtk_radio_button_group(radioHandle);
+}
+
+public void redraw () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+// Point size = _getSize();
+// GtkWidget widget = new GtkWidget(handle);
+// _redraw(0, 0, size.x, size.y, true);
+OS.gtk_widget_queue_draw(handle);
+}
+
+void _initializeRadioGroup() {
+ radioHandle = OS.gtk_radio_button_new(0);
+}
+
+/**
+ * Adopt the widget h as our child.
+ */
+void _connectChild (int h) {
+ OS.gtk_fixed_put (parentingHandle(), h, (short)0, (short)0);
+}
+
+void releaseChildren () {
+ Control [] children = _getChildren ();
+ for (int i=0; i<children.length; i++) {
+ Control child = children [i];
+ if (child != null && !child.isDisposed ()) {
+ child.releaseWidget ();
+ child.releaseHandle ();
+ }
+ }
+}
+void releaseWidget () {
+ releaseChildren ();
+ super.releaseWidget ();
+ layout = null;
+}
+void releaseHandle () {
+ super.releaseHandle ();
+ topHandle = eventBoxHandle = fixedHandle = radioHandle = 0;
+}
+
+int processFocusIn(int int0, int int1, int int2) {
+ OS.GTK_WIDGET_SET_FLAGS(handle, OS.GTK_HAS_FOCUS);
+ return super.processFocusIn(int0, int1, int2);
+}
+int processFocusOut(int int0, int int1, int int2) {
+ OS.GTK_WIDGET_UNSET_FLAGS(handle, OS.GTK_HAS_FOCUS);
+ return super.processFocusOut(int0, int1, int2);
+}
+
+public boolean setFocus () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ Control [] children = _getChildren ();
+ for (int i=0; i<children.length; i++) {
+ Control child = children [i];
+ if (child.getVisible () && child.setFocus ()) return true;
+ }
+ return super.setFocus ();
+}
+
+/**
+ * Sets the tabbing order for the specified controls to
+ * match the order that they occur in the argument list.
+ *
+ * @param tabList the ordered list of controls representing the tab order; must not be null
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the tabList is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if a widget in the tabList is null or has been disposed</li>
+ * <li>ERROR_INVALID_PARENT - if widget in the tabList is not in the same widget tree</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setTabList (Control [] tabList) {
+}
+
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Control.java
new file mode 100644
index 0000000..470c74e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Control.java
@@ -0,0 +1,2149 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.Converter;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Control is the abstract superclass of all windowed user interface classes.
+ * <p>
+ * <dl>
+ * <dt><b>Styles:</b>
+ * <dd>BORDER</dd>
+ * <dt><b>Events:</b>
+ * <dd>FocusIn, FocusOut, Help, KeyDown, KeyUp, MouseDoubleClick, MouseDown, MouseEnter,
+ * MouseExit, MouseHover, MouseUp, MouseMove, Move, Paint, Resize</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+public abstract class Control extends Widget implements Drawable {
+
+ Composite parent;
+ Menu menu;
+ String toolTipText;
+ Object layoutData;
+
+/*
+ * === CONSTRUCTORS ===
+ */
+
+Control () {
+}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Control (Composite parent, int style) {
+ super (parent, style);
+ this.parent = parent;
+ createWidget (0);
+}
+
+abstract void createHandle(int index);
+
+int eventHandle () {
+ return handle;
+}
+
+/**
+ * Connect the appropriate signal handlers.
+ *
+ * At a minimum, we must connect
+ * <ul>
+ * <li>expose_event
+ * <li>button_press_event / button_release_event
+ * <li>motion_notify_event
+ * <li>enter_notify_event / leave_notify_event
+ * <li>key_press_event / key_release_event
+ * <li>focus_in_event / focus_out_event
+ * </ul>
+ *
+ * The possible mask bits are:
+ * <ul>
+ * GDK_EXPOSURE_MASK |
+ * GDK_POINTER_MOTION_MASK |
+ * GDK_POINTER_MOTION_HINT_MASK |
+ * GDK_ENTER_NOTIFY_MASK |
+ * GDK_LEAVE_NOTIFY_MASK |
+ * GDK_BUTTON_PRESS_MASK
+ * GDK_BUTTON_RELEASE_MASK
+ * GDK_KEY_PRESS_MASK
+ * GDK_KEY_RELEASE_MASK
+ * GDK_FOCUS_CHANGE_MASK
+ * </ul>
+ */
+void hookEvents () {
+ signal_connect (handle, "expose_event", SWT.Paint, 3);
+ int mask =
+ OS.GDK_POINTER_MOTION_MASK |
+ OS.GDK_BUTTON_PRESS_MASK | OS.GDK_BUTTON_RELEASE_MASK |
+ OS.GDK_ENTER_NOTIFY_MASK | OS.GDK_LEAVE_NOTIFY_MASK |
+ OS.GDK_KEY_PRESS_MASK | OS.GDK_KEY_RELEASE_MASK |
+ OS.GDK_FOCUS_CHANGE_MASK;
+ int eventHandle = eventHandle ();
+ if (!OS.GTK_WIDGET_NO_WINDOW (eventHandle)) {
+ OS.gtk_widget_add_events (eventHandle, mask);
+ }
+ signal_connect_after (eventHandle, "motion_notify_event", SWT.MouseMove, 3);
+ signal_connect_after (eventHandle, "button_press_event", SWT.MouseDown, 3);
+ signal_connect_after (eventHandle, "button_release_event", SWT.MouseUp, 3);
+ signal_connect_after (eventHandle, "enter_notify_event", SWT.MouseEnter, 3);
+ signal_connect_after (eventHandle, "leave_notify_event", SWT.MouseExit, 3);
+ signal_connect_after (eventHandle, "key_press_event", SWT.KeyDown, 3);
+ signal_connect_after (eventHandle, "key_release_event", SWT.KeyUp, 3);
+ signal_connect_after (eventHandle, "focus_in_event", SWT.FocusIn, 3);
+ signal_connect_after (eventHandle, "focus_out_event", SWT.FocusOut, 3);
+}
+
+abstract void setHandleStyle ();
+void setInitialSize() { UtilFuncs.setZeroSize(topHandle()); }
+void configure () {
+ // Do NOT directly use gtk_fixed_put in configure(),
+ // because not all composites have GtkFixed as their
+ // parenting (bottom) handle.
+ _connectParent();
+}
+void _connectParent() {
+ parent._connectChild(topHandle());
+}
+/**
+ * Every Control must implement this to map the gtk widgets,
+ * and also realize those that have to be realized - this means
+ * create the actual X window so that there are no surprizes
+ * if the user calls a method expecting the X window to be there.
+ * Widgets normally do it by invoking gtk_widget_show() on all
+ * handles, and then doing gtk_widget_realize() on bottommost
+ * handle, which will realize everything above as well.
+ * An exception to this is the Shell, which we do NOT realize
+ * at this point.
+ */
+abstract void showHandle();
+
+int topHandle() {
+ return handle;
+}
+
+int paintHandle() {
+ return handle;
+}
+
+/*
+ * === GEOMETRY ===
+ */
+
+int computeHandle () {
+ return handle;
+}
+
+Point _computeSize (int wHint, int hHint, boolean changed) {
+ int handle = computeHandle ();
+ byte [] gtk_aux_info = Converter.wcsToMbcs (null, "gtk-aux-info", true);
+ int id = OS.g_quark_from_string (gtk_aux_info);
+ int aux_info = OS.gtk_object_get_data_by_id (handle, id);
+ OS.gtk_object_set_data_by_id (handle, id, 0);
+ GtkRequisition requisition = new GtkRequisition ();
+ OS.gtk_widget_size_request (handle, requisition);
+ OS.gtk_object_set_data_by_id (handle, id, aux_info);
+ int width = wHint == SWT.DEFAULT ? requisition.width : wHint;
+ int height = hHint == SWT.DEFAULT ? requisition.height : hHint;
+ return new Point (width, height);
+}
+
+/**
+ * Returns the preferred size of the receiver.
+ * <p>
+ * The <em>prefered size</em> of a control is the size that it would
+ * best be displayed at. The width hint and height hint arguments
+ * allow the caller to ask a control questions such as "Given a particular
+ * width, how high does the control need to be to show all of the contents?"
+ * To indicate that the caller does not wish to constrain a particular
+ * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
+ * </p>
+ *
+ * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
+ * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
+ * @return the preferred size of the control
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Layout
+ */
+public Point computeSize (int wHint, int hHint) {
+ return computeSize (wHint, hHint, true);
+}
+
+/**
+ * Returns the preferred size of the receiver.
+ * <p>
+ * The <em>prefered size</em> of a control is the size that it would
+ * best be displayed at. The width hint and height hint arguments
+ * allow the caller to ask a control questions such as "Given a particular
+ * width, how high does the control need to be to show all of the contents?"
+ * To indicate that the caller does not wish to constrain a particular
+ * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
+ * </p><p>
+ * If the changed flag is <code>true</code>, it indicates that the receiver's
+ * <em>contents</em> have changed, therefore any caches that a layout manager
+ * containing the control may have been keeping need to be flushed. When the
+ * control is resized, the changed flag will be <code>false</code>, so layout
+ * manager caches can be retained.
+ * </p>
+ *
+ * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
+ * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
+ * @param changed <code>true</code> if the control's contents have changed, and <code>false</code> otherwise
+ * @return the preferred size of the control.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Layout
+ */
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget();
+ return _computeSize (wHint, hHint, changed);
+}
+
+/**
+ * Returns a rectangle describing the receiver's size and location
+ * relative to its parent (or its display if its parent is null).
+ *
+ * @return the receiver's bounding rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Rectangle getBounds () {
+ checkWidget();
+ return _getBounds();
+}
+
+/**
+ * The actual implementation for getBounds().
+ * Concrete controls implement their means to answer the location
+ * and size by overriding _getLocation() and _getSize().
+ */
+final Rectangle _getBounds() {
+ Point location = _getLocation();
+ Point size = _getSize();
+ return new Rectangle(location.x, location.y, size.x, size.y);
+}
+
+/**
+ * Sets the receiver's size and location to the rectangular
+ * area specified by the argument. The <code>x</code> and
+ * <code>y</code> fields of the rectangle are relative to
+ * the receiver's parent (or its display if its parent is null).
+ * <p>
+ * Note: Attempting to set the width or height of the
+ * receiver to a negative number will cause that
+ * value to be set to zero instead.
+ * </p>
+ *
+ * @param rect the new bounds for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setBounds (Rectangle rect) {
+ if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
+ setBounds (rect.x, rect.y, rect.width, rect.height);
+}
+
+/**
+ * Sets the receiver's size and location to the rectangular
+ * area specified by the arguments. The <code>x</code> and
+ * <code>y</code> arguments are relative to the receiver's
+ * parent (or its display if its parent is null).
+ * <p>
+ * Note: Attempting to set the width or height of the
+ * receiver to a negative number will cause that
+ * value to be set to zero instead.
+ * </p>
+ *
+ * @param x the new x coordinate for the receiver
+ * @param y the new y coordinate for the receiver
+ * @param width the new width for the receiver
+ * @param height the new height for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setBounds (int x, int y, int width, int height) {
+ checkWidget();
+ boolean differentOrigin = _setLocation(x,y);
+ boolean differentExtent = _setSize (width,height);
+ if (differentOrigin) sendEvent (SWT.Move);
+ if (differentExtent) sendEvent (SWT.Resize);
+}
+
+/**
+ * Returns a point describing the receiver's location relative
+ * to its parent (or its display if its parent is null).
+ *
+ * @return the receiver's location
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getLocation () {
+ checkWidget();
+ return _getLocation();
+}
+
+Point _getLocation () {
+ return UtilFuncs.getLocation(topHandle());
+}
+
+/**
+ * Sets the receiver's location to the point specified by
+ * the argument which is relative to the receiver's
+ * parent (or its display if its parent is null).
+ *
+ * @param location the new location for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLocation (Point location) {
+ if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
+ setLocation (location.x, location.y);
+}
+
+/**
+ * Sets the receiver's location to the point specified by
+ * the arguments which are relative to the receiver's
+ * parent (or its display if its parent is null).
+ *
+ * @param x the new x coordinate for the receiver
+ * @param y the new y coordinate for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLocation(int x, int y) {
+ checkWidget();
+ if (_setLocation(x,y)) sendEvent(SWT.Move);
+}
+
+boolean _setLocation(int x, int y) {
+ return UtilFuncs.setLocation(parent.parentingHandle(), topHandle(), x,y);
+}
+
+/**
+ * Returns a point describing the receiver's size. The
+ * x coordinate of the result is the width of the receiver.
+ * The y coordinate of the result is the height of the
+ * receiver.
+ *
+ * @return the receiver's size
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getSize () {
+ checkWidget();
+ return _getSize();
+}
+Point _getSize() {
+ return UtilFuncs.getSize(topHandle());
+}
+
+/**
+ * Sets the receiver's size to the point specified by the argument.
+ * <p>
+ * Note: Attempting to set the width or height of the
+ * receiver to a negative number will cause them to be
+ * set to zero instead.
+ * </p>
+ *
+ * @param size the new size for the receiver
+ * @param height the new height for the receiver
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSize (Point size) {
+ if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
+ setSize (size.x, size.y);
+}
+
+/**
+ * Sets the receiver's size to the point specified by the arguments.
+ * <p>
+ * Note: Attempting to set the width or height of the
+ * receiver to a negative number will cause that
+ * value to be set to zero instead.
+ * </p>
+ *
+ * @param width the new width for the receiver
+ * @param height the new height for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSize (int width, int height) {
+ checkWidget();
+ // Even though GTK+ will not let any widget be smaller
+ // than 3@3, we don't care about it here, as this kind
+ // of platform weirdness is handled in UtilFuncs.
+ width = Math.max(width, 0);
+ height = Math.max(height, 0);
+ if (_setSize(width, height)) sendEvent(SWT.Resize);
+}
+boolean _setSize(int width, int height) { return UtilFuncs.setSize(topHandle(), width, height); }
+
+/**
+ * Moves the receiver above the specified control in the
+ * drawing order. If the argument is null, then the receiver
+ * is moved to the top of the drawing order. The control at
+ * the top of the drawing order will not be covered by other
+ * controls even if they occupy intersecting areas.
+ *
+ * @param the sibling control (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void moveAbove (Control control) {
+ checkWidget();
+ GtkWidget widget = new GtkWidget();
+ OS.memmove (widget, topHandle(), GtkWidget.sizeof);
+ int topGdkWindow = widget.window;
+ if (topGdkWindow!=0) OS.gdk_window_raise (topGdkWindow);
+}
+
+/**
+ * Moves the receiver below the specified control in the
+ * drawing order. If the argument is null, then the receiver
+ * is moved to the bottom of the drawing order. The control at
+ * the bottom of the drawing order will be covered by all other
+ * controls which occupy intersecting areas.
+ *
+ * @param the sibling control (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void moveBelow (Control control) {
+ checkWidget();
+ GtkWidget widget = new GtkWidget();
+ OS.memmove (widget, topHandle(), GtkWidget.sizeof);
+ int topGdkWindow = widget.window;
+ if (topGdkWindow!=0) OS.gdk_window_lower (topGdkWindow);
+}
+
+/**
+ * Causes the receiver to be resized to its preferred size.
+ * For a composite, this involves computing the preferred size
+ * from its layout, if there is one.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #computeSize
+ */
+public void pack () {
+ pack (true);
+}
+
+/**
+ * Causes the receiver to be resized to its preferred size.
+ * For a composite, this involves computing the preferred size
+ * from its layout, if there is one.
+ * <p>
+ * If the changed flag is <code>true</code>, it indicates that the receiver's
+ * <em>contents</em> have changed, therefore any caches that a layout manager
+ * containing the control may have been keeping need to be flushed. When the
+ * control is resized, the changed flag will be <code>false</code>, so layout
+ * manager caches can be retained.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #computeSize
+ */
+public void pack (boolean changed) {
+ checkWidget();
+ setSize (computeSize (SWT.DEFAULT, SWT.DEFAULT, changed));
+}
+
+/**
+ * Sets the layout data associated with the receiver to the argument.
+ *
+ * @param layoutData the new layout data for the receiver.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLayoutData (Object layoutData) {
+ checkWidget();
+ this.layoutData = layoutData;
+}
+
+/**
+ * Returns a point which is the result of converting the
+ * argument, which is specified in display relative coordinates,
+ * to coordinates relative to the receiver.
+ * <p>
+ * @param point the point to be translated (must not be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point toControl (Point point) {
+ checkWidget();
+ int[] x = new int[1], y = new int[1];
+ OS.gdk_window_get_origin(_gdkWindow(), x,y);
+ int ctlX = point.x - x[0];
+ int ctlY = point.y - y[0];
+ return new Point (ctlX, ctlY);
+}
+/**
+ * Returns a point which is the result of converting the
+ * argument, which is specified in coordinates relative to
+ * the receiver, to display relative coordinates.
+ * <p>
+ * @param point the point to be translated (must not be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point toDisplay (Point point) {
+ checkWidget();
+ int[] x = new int[1], y = new int[1];
+ OS.gdk_window_get_origin(_gdkWindow(), x,y);
+ return new Point (x[0]+point.x, y[0]+point.y);
+}
+// === End of GEOMETRY Category ===
+
+
+/*
+ * == ADD/REMOVE LISTENERS ==
+ */
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control is moved or resized, by sending
+ * it one of the messages defined in the <code>ControlListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ControlListener
+ * @see #removeControlListener
+ */
+public void addControlListener(ControlListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Resize,typedListener);
+ addListener (SWT.Move,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control gains or loses focus, by sending
+ * it one of the messages defined in the <code>FocusListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see FocusListener
+ * @see #removeFocusListener
+ */
+public void addFocusListener(FocusListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener(SWT.FocusIn,typedListener);
+ addListener(SWT.FocusOut,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the help events are generated for the control, by sending
+ * it one of the messages defined in the <code>HelpListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see HelpListener
+ * @see #removeHelpListener
+ */
+public void addHelpListener (HelpListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Help, typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when keys are pressed and released on the system keyboard, by sending
+ * it one of the messages defined in the <code>KeyListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see KeyListener
+ * @see #removeKeyListener
+ */
+public void addKeyListener(KeyListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener(SWT.KeyUp,typedListener);
+ addListener(SWT.KeyDown,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when mouse buttons are pressed and released, by sending
+ * it one of the messages defined in the <code>MouseListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseListener
+ * @see #removeMouseListener
+ */
+public void addMouseListener(MouseListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener(SWT.MouseDown,typedListener);
+ addListener(SWT.MouseUp,typedListener);
+ addListener(SWT.MouseDoubleClick,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the mouse moves, by sending it one of the
+ * messages defined in the <code>MouseMoveListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseMoveListener
+ * @see #removeMouseMoveListener
+ */
+public void addMouseMoveListener(MouseMoveListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener(SWT.MouseMove,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the mouse passes or hovers over controls, by sending
+ * it one of the messages defined in the <code>MouseTrackListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseTrackListener
+ * @see #removeMouseTrackListener
+ */
+public void addMouseTrackListener (MouseTrackListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.MouseEnter,typedListener);
+ addListener (SWT.MouseExit,typedListener);
+ addListener (SWT.MouseHover,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver needs to be painted, by sending it
+ * one of the messages defined in the <code>PaintListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see PaintListener
+ * @see #removePaintListener
+ */
+public void addPaintListener(PaintListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener(SWT.Paint,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when traversal events occur, by sending it
+ * one of the messages defined in the <code>TraverseListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see TraverseListener
+ * @see #removeTraverseListener
+ */
+public void addTraverseListener (TraverseListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Traverse,typedListener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is moved or resized.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ControlListener
+ * @see #addControlListener
+ */
+public void removeControlListener (ControlListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Move, listener);
+ eventTable.unhook (SWT.Resize, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control gains or loses focus.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see FocusListener
+ * @see #addFocusListener
+ */
+public void removeFocusListener(FocusListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.FocusIn, listener);
+ eventTable.unhook (SWT.FocusOut, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the help events are generated for the control.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see HelpListener
+ * @see #addHelpListener
+ */
+public void removeHelpListener (HelpListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Help, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when keys are pressed and released on the system keyboard.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see KeyListener
+ * @see #addKeyListener
+ */
+public void removeKeyListener(KeyListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.KeyUp, listener);
+ eventTable.unhook (SWT.KeyDown, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when mouse buttons are pressed and released.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseListener
+ * @see #addMouseListener
+ */
+public void removeMouseListener (MouseListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.MouseDown, listener);
+ eventTable.unhook (SWT.MouseUp, listener);
+ eventTable.unhook (SWT.MouseDoubleClick, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the mouse moves.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseMoveListener
+ * @see #addMouseMoveListener
+ */
+public void removeMouseMoveListener(MouseMoveListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.MouseMove, listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the mouse passes or hovers over controls.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MouseTrackListener
+ * @see #addMouseTrackListener
+ */
+public void removeMouseTrackListener(MouseTrackListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.MouseEnter, listener);
+ eventTable.unhook (SWT.MouseExit, listener);
+ eventTable.unhook (SWT.MouseHover, listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver needs to be painted.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see PaintListener
+ * @see #addPaintListener
+ */
+public void removePaintListener(PaintListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook(SWT.Paint, listener);
+}
+
+/*
+ * Return (GTKWIDGET)h->window.
+ */
+final int _gdkWindow(int h) {
+ /* Temporary code.
+ * This check is not necessary as the (internal) callers
+ * always make sure h!=0.
+ */
+ if (h==0) error(SWT.ERROR_CANNOT_BE_ZERO);
+
+ GtkWidget widget = new GtkWidget();
+ OS.memmove (widget, h, GtkWidget.sizeof);
+ return widget.window;
+}
+
+int _gdkWindow() {
+ int windowHandle = _gdkWindow(handle);
+ if (windowHandle==0) error(SWT.ERROR_NO_HANDLES);
+ return windowHandle;
+}
+
+/**
+ * Forces the receiver to have the <em>keyboard focus</em>, causing
+ * all keyboard events to be delivered to it.
+ *
+ * @return <code>true</code> if the control got focus, and <code>false</code> if it was unable to.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setFocus
+ */
+public boolean forceFocus () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_widget_grab_focus (handle);
+ return true;
+}
+
+/**
+ * Returns the receiver's background color.
+ *
+ * @return the background color
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Color getBackground () {
+ checkWidget();
+ return Color.gtk_new (_getBackgroundGdkColor());
+}
+
+/*
+ * Subclasses should override this to pass a meaningful handle
+ */
+GdkColor _getBackgroundGdkColor() {
+ /* Override this */
+ int h = paintHandle();
+
+ int hStyle = OS.gtk_widget_get_style (handle);
+ GtkStyle style = new GtkStyle ();
+ OS.memmove (style, hStyle, GtkStyle.sizeof);
+ GdkColor color = new GdkColor ();
+ color.pixel = style.bg0_pixel;
+ color.red = style.bg0_red;
+ color.green = style.bg0_green;
+ color.blue = style.bg0_blue;
+ return color;
+}
+
+/**
+ * Returns the receiver's border width.
+ *
+ * @return the border width
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getBorderWidth () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return (style & SWT.BORDER) == 0 ? 0 : 1;
+}
+
+/**
+ * Returns the display that the receiver was created on.
+ *
+ * @return the receiver's display
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Display getDisplay () {
+ if (parent == null) {
+ error (SWT.ERROR_WIDGET_DISPOSED);
+ }
+ return parent.getDisplay ();
+}
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getEnabled () {
+ checkWidget ();
+ int topHandle = topHandle ();
+ return OS.GTK_WIDGET_SENSITIVE (topHandle);
+}
+
+/**
+ * Returns the font that the receiver will use to paint textual information.
+ *
+ * @return the receiver's font
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Font getFont () {
+ checkWidget();
+ return Font.gtk_new(_getFontHandle());
+}
+/*
+ * Subclasses should override this, passing a meaningful handle
+ */
+int _getFontHandle () {
+ return UtilFuncs.getFont(handle);
+}
+
+/**
+ * Returns the foreground color that the receiver will use to draw.
+ *
+ * @return the receiver's foreground color
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Color getForeground () {
+ checkWidget();
+ return Color.gtk_new (_getForegroundGdkColor());
+}
+
+/*
+ * Subclasses should override this to pass a meaningful handle
+ */
+GdkColor _getForegroundGdkColor() {
+ /* Override this */
+ int h = paintHandle();
+
+ int hStyle = OS.gtk_widget_get_style (handle);
+ GtkStyle style = new GtkStyle ();
+ OS.memmove (style, hStyle, GtkStyle.sizeof);
+ GdkColor color = new GdkColor ();
+ color.pixel = style.fg0_pixel;
+ color.red = style.fg0_red;
+ color.green = style.fg0_green;
+ color.blue = style.fg0_blue;
+ return color;
+}
+
+/**
+ * Returns layout data which is associated with the receiver.
+ *
+ * @return the receiver's layout data
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Object getLayoutData () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return layoutData;
+}
+
+/**
+ * Returns the receiver's pop up menu if it has one, or null
+ * if it does not. All controls may optionally have a pop up
+ * menu that is displayed when the user requests one for
+ * the control. The sequence of key strokes, button presses
+ * and/or button releases that are used to request a pop up
+ * menu is platform specific.
+ *
+ * @return the receiver's menu
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Menu getMenu () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return menu;
+}
+/**
+ * Returns the receiver's parent, which must be a <code>Composite</code>
+ * or null when the receiver is a shell that was created with null or
+ * a display for a parent.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Composite getParent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent;
+}
+
+/**
+ * Returns the receiver's shell. For all controls other than
+ * shells, this simply returns the control's nearest ancestor
+ * shell. Shells return themselves, even if they are children
+ * of other shells.
+ *
+ * @return the receiver's shell
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #getParent
+ */
+public Shell getShell() {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return _getShell();
+}
+Shell _getShell() {
+ return parent._getShell();
+}
+
+/**
+ * Returns the receiver's tool tip text, or null if it has
+ * not been set.
+ *
+ * @return the receiver's tool tip text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getToolTipText () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return toolTipText;
+}
+/**
+ * Returns <code>true</code> if the receiver is visible, and
+ * <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getVisible () {
+ checkWidget();
+ return _getVisible();
+}
+boolean _getVisible() {
+ return _getVisible(topHandle());
+}
+boolean _getVisible(int h) {
+ return (OS.GTK_WIDGET_FLAGS(h) & OS.GTK_VISIBLE) != 0;
+}
+
+/**
+ * Invokes platform specific functionality to allocate a new GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Control</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param data the platform specific GC data
+ * @return the platform specific GC handle
+ *
+ * @private
+ */
+public int internal_new_GC (GCData data) {
+ if (data == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (paintHandle() == 0) error(SWT.ERROR_UNSPECIFIED);
+
+ // Create the GC with default values for this control
+ GtkWidget w = new GtkWidget();
+ OS.memmove (w, paintHandle(), GtkWidget.sizeof);
+
+ if (w.window == 0) error(SWT.ERROR_UNSPECIFIED);
+ int gc = OS.gdk_gc_new(w.window);
+
+ OS.gdk_gc_set_font(gc, _getFontHandle());
+ OS.gdk_gc_set_background(gc, _getBackgroundGdkColor());
+ OS.gdk_gc_set_foreground(gc, _getForegroundGdkColor());
+
+ data.drawable = w.window;
+ return gc;
+}
+
+/**
+ * Invokes platform specific functionality to dispose a GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Control</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param handle the platform specific GC handle
+ * @param data the platform specific GC data
+ *
+ * @private
+ */
+public void internal_dispose_GC (int xGC, GCData data) {
+ if(xGC == 0) error(SWT.ERROR_NO_HANDLES);
+ OS.gdk_gc_unref(xGC);
+}
+
+/**
+ * Returns <code>true</code> if the underlying operating
+ * system supports this reparenting, otherwise <code>false</code>
+ *
+ * @return <code>true</code> if the widget can be reparented, otherwise <code>false</code>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isReparentable () {
+ checkWidget();
+ return false;
+}
+
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isEnabled () {
+ checkWidget ();
+ int topHandle = topHandle ();
+ return OS.GTK_WIDGET_IS_SENSITIVE (topHandle);
+}
+
+/**
+ * Returns <code>true</code> if the receiver has the user-interface
+ * focus, and <code>false</code> otherwise.
+ *
+ * @return the receiver's focus state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isFocusControl () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return (OS.GTK_WIDGET_FLAGS(handle)&OS.GTK_HAS_FOCUS)!=0;
+}
+/**
+ * Returns <code>true</code> if the receiver is visible, and
+ * <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isVisible () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ boolean result = getVisible ();
+ if (parent != null)
+ result = result && parent.isVisible();
+ return result;
+}
+Decorations menuShell () {
+ return parent.menuShell ();
+}
+
+int processKeyDown (int callData, int arg1, int int2) {
+ GdkEventKey gdkEvent = new GdkEventKey ();
+ OS.memmove (gdkEvent, callData, GdkEventKey.sizeof);
+ sendKeyEvent (SWT.KeyDown, gdkEvent);
+ return 1;
+}
+
+int processKeyUp (int callData, int arg1, int int2) {
+ GdkEventKey gdkEvent = new GdkEventKey ();
+ OS.memmove (gdkEvent, callData, GdkEventKey.sizeof);
+ sendKeyEvent (SWT.KeyUp, gdkEvent);
+ return 1;
+}
+
+int processMouseDown (int callData, int arg1, int int2) {
+ OS.gtk_widget_grab_focus(handle);
+ GdkEventButton gdkEvent = new GdkEventButton ();
+ OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
+ int eventType = SWT.MouseDown;
+ if (gdkEvent.type == OS.GDK_2BUTTON_PRESS) eventType = SWT.MouseDoubleClick;
+ sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
+ if (gdkEvent.button == 3 && menu != null) {
+ menu.setVisible (true);
+ }
+ return 1;
+}
+
+int processMouseEnter (int arg0, int arg1, int int2) {
+ //NOT IMPLEMENTED - event state
+ sendEvent (SWT.MouseEnter);
+ return 1;
+}
+int processMouseExit (int arg0, int arg1, int int2) {
+ //NOT IMPLEMENTED - event state
+ sendEvent (SWT.MouseExit);
+ return 1;
+}
+
+int processMouseUp (int callData, int arg1, int int2) {
+ GdkEventButton gdkEvent = new GdkEventButton ();
+ OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
+ sendMouseEvent (SWT.MouseUp, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
+ return 1;
+}
+
+int processMouseMove (int callData, int arg1, int int2) {
+ GdkEventMotion gdkEvent = new GdkEventMotion ();
+ OS.memmove (gdkEvent, callData, GdkEventMotion.sizeof);
+ Point where = _gdkWindowGetPointer();
+ sendMouseEvent (SWT.MouseMove, 0, gdkEvent.state, gdkEvent.time, where.x, where.y);
+ return 1;
+}
+Point _gdkWindowGetPointer() {
+ int[] px = new int[1], py = new int[1];
+ OS.gdk_window_get_pointer(_gdkWindow(), px, py, 0);
+ return new Point(px[0], py[0]);
+}
+int processFocusIn(int int0, int int1, int int2) {
+ postEvent(SWT.FocusIn);
+ return 0;
+}
+int processFocusOut(int int0, int int1, int int2) {
+ postEvent(SWT.FocusOut);
+ return 0;
+}
+
+int processPaint (int callData, int int2, int int3) {
+ if (!hooks (SWT.Paint)) return 1;
+
+ GdkEventExpose gdkEvent = new GdkEventExpose ();
+ OS.memmove (gdkEvent, callData, GdkEventExpose.sizeof);
+ Event event = new Event ();
+ event.count = gdkEvent.count;
+ event.x = gdkEvent.x; event.y = gdkEvent.y;
+ event.width = gdkEvent.width; event.height = gdkEvent.height;
+ GC gc = event.gc = new GC (this);
+ GdkRectangle rect = new GdkRectangle ();
+ rect.x = gdkEvent.x; rect.y = gdkEvent.y;
+ rect.width = gdkEvent.width; rect.height = gdkEvent.height;
+ OS.gdk_gc_set_clip_rectangle (gc.handle, rect);
+ gc.fillRectangle(rect.x, rect.y, rect.width, rect.height);
+ sendEvent (SWT.Paint, event);
+ gc.dispose ();
+ event.gc = null;
+ return 1;
+}
+
+/**
+ * Causes the entire bounds of the receiver to be marked
+ * as needing to be redrawn. The next time a paint request
+ * is processed, the control will be completely painted.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #update
+ */
+public void redraw () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ Point size = _getSize();
+ _redraw(0, 0, size.x, size.y, true);
+//OS.gtk_widget_queue_draw(handle);
+}
+/**
+ * Causes the rectangular area of the receiver specified by
+ * the arguments to be marked as needing to be redrawn.
+ * The next time a paint request is processed, that area of
+ * the receiver will be painted. If the <code>all</code> flag
+ * is <code>true</code>, any children of the receiver which
+ * intersect with the specified area will also paint their
+ * intersecting areas. If the <code>all</code> flag is
+ * <code>false</code>, the children will not be painted.
+ *
+ * @param x the x coordinate of the area to draw
+ * @param y the y coordinate of the area to draw
+ * @param width the width of the area to draw
+ * @param height the height of the area to draw
+ * @param all <code>true</code> if children should redraw, and <code>false</code> otherwise
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #update
+ */
+public void redraw (int x, int y, int width, int height, boolean all) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ _redraw(x, y, width, height, all);
+}
+protected void _redraw(int x, int y, int width, int height, boolean all) {
+ OS.gdk_window_clear_area_e (_gdkWindow(), x, y, width, height);
+
+GdkRectangle rect = new GdkRectangle();
+rect.x = (short)x;
+rect.y = (short)y;
+rect.width = (short)width;
+rect.height =(short) height;
+//OS.gtk_widget_draw(handle, rect);
+OS.gtk_widget_queue_draw(handle);
+
+// OS.gtk_widget_queue_draw_area (handle, x, y, width, height);
+}
+
+void releaseWidget () {
+ super.releaseWidget ();
+ toolTipText = null;
+ parent = null;
+ menu = null;
+ layoutData = null;
+}
+void sendKeyEvent (int type, GdkEventKey gdkEvent) {
+ /* Look up the keysym and character(s) */
+ int size = gdkEvent.length;
+ if (gdkEvent.keyval == 0 && size == 0) return;
+
+ /* If there is no composed string input by keypress, only send the keyvalue */
+ if (size == 0 ) {
+ Event event = new Event ();
+ event.time = gdkEvent.time;
+// event.character = (char) 0; //no character sent
+ event.keyCode = Display.translateKey (gdkEvent.keyval);
+ event.character = (char) event.keyCode; //no character sent
+ if ((gdkEvent.state & OS.GDK_MOD1_MASK) != 0) event.stateMask |= SWT.ALT;
+ if ((gdkEvent.state & OS.GDK_SHIFT_MASK) != 0) event.stateMask |= SWT.SHIFT;
+ if ((gdkEvent.state & OS.GDK_CONTROL_MASK) != 0) event.stateMask |= SWT.CONTROL;
+ if ((gdkEvent.state & OS.GDK_BUTTON1_MASK) != 0) event.stateMask |= SWT.BUTTON1;
+ if ((gdkEvent.state & OS.GDK_BUTTON2_MASK) != 0) event.stateMask |= SWT.BUTTON2;
+ if ((gdkEvent.state & OS.GDK_BUTTON3_MASK) != 0) event.stateMask |= SWT.BUTTON3;
+ postEvent (type, event);
+ }
+ else {
+ byte [] buffer = new byte [size];
+ OS.memmove (buffer, gdkEvent.string, size);
+ /* Convert from MBCS to UNICODE and send the event */
+ char [] result = Converter.mbcsToWcs (null, buffer);
+ for (int i=0; i<result.length; i++) {
+ Event event = new Event ();
+ event.time = gdkEvent.time;
+ event.character = result [i];
+ event.keyCode = result [i]; //0; //no keyCode sent
+ if ((gdkEvent.state & OS.GDK_MOD1_MASK) != 0) event.stateMask |= SWT.ALT;
+ if ((gdkEvent.state & OS.GDK_SHIFT_MASK) != 0) event.stateMask |= SWT.SHIFT;
+ if ((gdkEvent.state & OS.GDK_CONTROL_MASK) != 0) event.stateMask |= SWT.CONTROL;
+ if ((gdkEvent.state & OS.GDK_BUTTON1_MASK) != 0) event.stateMask |= SWT.BUTTON1;
+ if ((gdkEvent.state & OS.GDK_BUTTON2_MASK) != 0) event.stateMask |= SWT.BUTTON2;
+ if ((gdkEvent.state & OS.GDK_BUTTON3_MASK) != 0) event.stateMask |= SWT.BUTTON3;
+ postEvent (type, event);
+ }
+ }
+}
+void sendMouseEvent (int type, int button, int mask, int time, int x, int y) {
+ Event event = new Event ();
+ event.time = time;
+ event.button = button;
+ event.x = x; event.y = y;
+ if ((mask & OS.GDK_MOD1_MASK) != 0) event.stateMask |= SWT.ALT;
+ if ((mask & OS.GDK_SHIFT_MASK) != 0) event.stateMask |= SWT.SHIFT;
+ if ((mask & OS.GDK_CONTROL_MASK) != 0) event.stateMask |= SWT.CONTROL;
+ if ((mask & OS.GDK_BUTTON1_MASK) != 0) event.stateMask |= SWT.BUTTON1;
+ if ((mask & OS.GDK_BUTTON2_MASK) != 0) event.stateMask |= SWT.BUTTON2;
+ if ((mask & OS.GDK_BUTTON3_MASK) != 0) event.stateMask |= SWT.BUTTON3;
+ postEvent (type, event);
+}
+
+/**
+ * Sets the receiver's background color to the color specified
+ * by the argument, or to the default system color for the control
+ * if the argument is null.
+ *
+ * @param color the new color (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setBackground (Color color) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int hDefaultStyle = OS.gtk_widget_get_default_style ();
+ int hStyle = OS.gtk_widget_get_style (handle);
+ boolean makeCopy = hStyle == hDefaultStyle;
+ hStyle = OS.gtk_style_copy (makeCopy ? hDefaultStyle : hStyle);
+ GtkStyle style = new GtkStyle ();
+ OS.memmove (style, hStyle, GtkStyle.sizeof);
+ if (color == null) {
+ GtkStyle defaultStyle = new GtkStyle ();
+ OS.memmove (defaultStyle, hDefaultStyle, GtkStyle.sizeof);
+ style.bg0_pixel = defaultStyle.bg0_pixel;
+ style.bg0_red = defaultStyle.bg0_red;
+ style.bg0_green = defaultStyle.bg0_green;
+ style.bg0_blue = defaultStyle.bg0_blue;
+ style.bg1_pixel = defaultStyle.bg1_pixel;
+ style.bg1_red = defaultStyle.bg1_red;
+ style.bg1_green = defaultStyle.bg1_green;
+ style.bg1_blue = defaultStyle.bg1_blue;
+ style.bg2_pixel = defaultStyle.bg2_pixel;
+ style.bg2_red = defaultStyle.bg2_red;
+ style.bg2_green = defaultStyle.bg2_green;
+ style.bg2_blue = defaultStyle.bg2_blue;
+ style.bg3_pixel = defaultStyle.bg3_pixel;
+ style.bg3_red = defaultStyle.bg3_red;
+ style.bg3_green = defaultStyle.bg3_green;
+ style.bg3_blue = defaultStyle.bg3_blue;
+ style.bg4_pixel = defaultStyle.bg4_pixel;
+ style.bg4_red = defaultStyle.bg4_red;
+ style.bg4_green = defaultStyle.bg4_green;
+ style.bg4_blue = defaultStyle.bg4_blue;
+ } else {
+ style.bg0_pixel = color.handle.pixel;
+ style.bg0_red = color.handle.red;
+ style.bg0_green = color.handle.green;
+ style.bg0_blue = color.handle.blue;
+ style.bg1_pixel = color.handle.pixel;
+ style.bg1_red = color.handle.red;
+ style.bg1_green = color.handle.green;
+ style.bg1_blue = color.handle.blue;
+ style.bg2_pixel = color.handle.pixel;
+ style.bg2_red = color.handle.red;
+ style.bg2_green = color.handle.green;
+ style.bg2_blue = color.handle.blue;
+ style.bg3_pixel = color.handle.pixel;
+ style.bg3_red = color.handle.red;
+ style.bg3_green = color.handle.green;
+ style.bg3_blue = color.handle.blue;
+ style.bg4_pixel = color.handle.pixel;
+ style.bg4_red = color.handle.red;
+ style.bg4_green = color.handle.green;
+ style.bg4_blue = color.handle.blue;
+ }
+ OS.memmove (hStyle, style, GtkStyle.sizeof);
+ OS.gtk_widget_set_style (handle, hStyle);
+ if (makeCopy) {
+ OS.gtk_style_unref (hStyle);
+ }
+}
+
+/**
+ * If the argument is <code>true</code>, causes the receiver to have
+ * all mouse events delivered to it until the method is called with
+ * <code>false</code> as the argument.
+ *
+ * @param capture <code>true</code> to capture the mouse, and <code>false</code> to release it
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setCapture (boolean capture) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ /*
+ if (capture) {
+ OS.gtk_widget_grab_focus (handle);
+ } else {
+ OS.gtk_widget_grab_default (handle);
+ }
+ */
+}
+/**
+ * Sets the receiver's cursor to the cursor specified by the
+ * argument, or to the default cursor for that kind of control
+ * if the argument is null.
+ * <p>
+ * When the mouse pointer passes over a control its appearance
+ * is changed to match the control's cursor.
+ * </p>
+ *
+ * @param cursor the new cursor (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setCursor (Cursor cursor) {
+ checkWidget();
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, paintHandle(), GtkWidget.sizeof);
+ int window = widget.window;
+ if (window == 0) return;
+ int hCursor = 0;
+ if (cursor != null) hCursor = cursor.handle;
+ OS.gdk_window_set_cursor (window, hCursor);
+}
+/**
+ * Enables the receiver if the argument is <code>true</code>,
+ * and disables it otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @param enabled the new enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setEnabled (boolean enabled) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int topHandle = topHandle ();
+ OS.gtk_widget_set_sensitive (topHandle, enabled);
+ /*
+ * This code is intentionally commented
+ */
+// OS.gtk_widget_set_state (topHandle, enabled ? OS.GTK_STATE_NORMAL : OS.GTK_STATE_INSENSITIVE);
+// if (enabled) {
+// OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_SENSITIVE);
+// } else {
+// OS.GTK_WIDGET_UNSET_FLAGS (handle, OS.GTK_SENSITIVE);
+// }
+}
+/**
+ * Causes the receiver to have the <em>keyboard focus</em>,
+ * such that all keyboard events will be delivered to it.
+ *
+ * @return <code>true</code> if the control got focus, and <code>false</code> if it was unable to.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #forceFocus
+ */
+public boolean setFocus () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return forceFocus ();
+}
+
+/**
+ * Sets the font that the receiver will use to paint textual information
+ * to the font specified by the argument, or to the default font for that
+ * kind of control if the argument is null.
+ *
+ * @param font the new font (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setFont (Font font) {
+ checkWidget();
+
+ /* The non-null font case */
+ if (font != null) {
+ if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ int fontHandle = OS.gdk_font_ref(font.handle);
+ _setFontHandle(fontHandle);
+ return;
+ }
+
+ /* The font argument is null, revert to default font */
+ GtkStyle style = new GtkStyle();
+ OS.memmove (style, OS.gtk_widget_get_default_style(), GtkStyle.sizeof);
+ int fontHandle = OS.gdk_font_ref(style.font);
+ if (fontHandle==0) error(SWT.ERROR_NO_HANDLES);
+ _setFontHandle(fontHandle);
+}
+
+/**
+ * Actually set the receiver's font in the OS.
+ * Concrete subclasses may override this method to operate
+ * on a different handle.
+ */
+void _setFontHandle (int f) {
+ UtilFuncs.setFont(handle, f);
+}
+
+/**
+ * Sets the receiver's foreground color to the color specified
+ * by the argument, or to the default system color for the control
+ * if the argument is null.
+ *
+ * @param color the new color (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setForeground (Color color) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int hStyle = OS.gtk_widget_get_style (handle);
+ hStyle = OS.gtk_style_copy (hStyle);
+ GtkStyle style = new GtkStyle ();
+ OS.memmove (style, hStyle, GtkStyle.sizeof);
+ if (color == null) {
+ int hDefaultStyle = OS.gtk_widget_get_default_style ();
+ GtkStyle defaultStyle = new GtkStyle ();
+ OS.memmove (defaultStyle, hDefaultStyle, GtkStyle.sizeof);
+ style.fg0_pixel = defaultStyle.fg0_pixel;
+ style.fg0_red = defaultStyle.fg0_red;
+ style.fg0_green = defaultStyle.fg0_green;
+ style.fg0_blue = defaultStyle.fg0_blue;
+ style.fg1_pixel = defaultStyle.fg1_pixel;
+ style.fg1_red = defaultStyle.fg1_red;
+ style.fg1_green = defaultStyle.fg1_green;
+ style.fg1_blue = defaultStyle.fg1_blue;
+ style.fg2_pixel = defaultStyle.fg2_pixel;
+ style.fg2_red = defaultStyle.fg2_red;
+ style.fg2_green = defaultStyle.fg2_green;
+ style.fg2_blue = defaultStyle.fg2_blue;
+ style.fg3_pixel = defaultStyle.fg3_pixel;
+ style.fg3_red = defaultStyle.fg3_red;
+ style.fg3_green = defaultStyle.fg3_green;
+ style.fg3_blue = defaultStyle.fg3_blue;
+ style.fg4_pixel = defaultStyle.fg4_pixel;
+ style.fg4_red = defaultStyle.fg4_red;
+ style.fg4_green = defaultStyle.fg4_green;
+ style.fg4_blue = defaultStyle.fg4_blue;
+ } else {
+ style.fg0_pixel = color.handle.pixel;
+ style.fg0_red = color.handle.red;
+ style.fg0_green = color.handle.green;
+ style.fg0_blue = color.handle.blue;
+ style.fg1_pixel = color.handle.pixel;
+ style.fg1_red = color.handle.red;
+ style.fg1_green = color.handle.green;
+ style.fg1_blue = color.handle.blue;
+ style.fg2_pixel = color.handle.pixel;
+ style.fg2_red = color.handle.red;
+ style.fg2_green = color.handle.green;
+ style.fg2_blue = color.handle.blue;
+ style.fg3_pixel = color.handle.pixel;
+ style.fg3_red = color.handle.red;
+ style.fg3_green = color.handle.green;
+ style.fg3_blue = color.handle.blue;
+ style.fg4_pixel = color.handle.pixel;
+ style.fg4_red = color.handle.red;
+ style.fg4_green = color.handle.green;
+ style.fg4_blue = color.handle.blue;
+ }
+ OS.memmove (hStyle, style, GtkStyle.sizeof);
+ OS.gtk_widget_set_style (handle, hStyle);
+}
+
+/**
+ * Sets the receiver's pop up menu to the argument.
+ * All controls may optionally have a pop up
+ * menu that is displayed when the user requests one for
+ * the control. The sequence of key strokes, button presses
+ * and/or button releases that are used to request a pop up
+ * menu is platform specific.
+ *
+ * @param menu the new pop up menu
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_MENU_NOT_POP_UP - the menu is not a pop up menu</li>
+ * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMenu (Menu menu) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (menu != null) {
+ if ((menu.style & SWT.POP_UP) == 0) {
+ error (SWT.ERROR_MENU_NOT_POP_UP);
+ }
+ if (menu.parent != menuShell ()) {
+ error (SWT.ERROR_INVALID_PARENT);
+ }
+ }
+ this.menu = menu;
+}
+
+/**
+ * Changes the parent of the widget to be the one provided if
+ * the underlying operating system supports this feature.
+ * Answers <code>true</code> if the parent is successfully changed.
+ *
+ * @param parent the new parent for the control.
+ * @return <code>true</code> if the parent is changed and <code>false</code> otherwise.
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
+ * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
+ * </ul>
+ */
+public boolean setParent (Composite parent) {
+ checkWidget();
+ if (parent.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ return false;
+}
+
+/**
+ * If the argument is <code>false</code>, causes subsequent drawing
+ * operations in the receiver to be ignored. No drawing of any kind
+ * can occur in the receiver until the flag is set to true.
+ * Graphics operations that occurred while the flag was
+ * <code>false</code> are lost. When the flag is set to <code>true</code>,
+ * the entire widget is marked as needing to be redrawn.
+ * <p>
+ * Note: This operation is a hint and may not be supported on some
+ * platforms or for some widgets.
+ * </p>
+ *
+ * @param redraw the new redraw state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #redraw
+ * @see #update
+ */
+public void setRedraw (boolean redraw) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+/**
+ * Sets the receiver's tool tip text to the argument, which
+ * may be null indicating that no tool tip text should be shown.
+ *
+ * @param string the new tool tip text (or null)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setToolTipText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ toolTipText = string;
+}
+/**
+ * Marks the receiver as visible if the argument is <code>true</code>,
+ * and marks it invisible otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, marking
+ * it visible may not actually cause it to be displayed.
+ * </p>
+ *
+ * @param visible the new visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setVisible (boolean visible) {
+ checkWidget();
+ int topHandle = topHandle();
+ if (visible) {
+ sendEvent (SWT.Show);
+ OS.gtk_widget_show (topHandle);
+ } else {
+ OS.gtk_widget_hide (topHandle);
+ sendEvent (SWT.Hide);
+ }
+}
+void sort (int [] items) {
+ /* Shell Sort from K&R, pg 108 */
+ int length = items.length;
+ for (int gap=length/2; gap>0; gap/=2) {
+ for (int i=gap; i<length; i++) {
+ for (int j=i-gap; j>=0; j-=gap) {
+ if (items [j] <= items [j + gap]) {
+ int swap = items [j];
+ items [j] = items [j + gap];
+ items [j + gap] = swap;
+ }
+ }
+ }
+ }
+}
+/**
+ * Forces all outstanding paint requests for the widget tree
+ * to be processed before this method returns.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #redraw
+ */
+public void update () {
+ checkWidget ();
+ //NOT DONE - should only dispatch paint events
+ OS.gdk_flush ();
+ while ((OS.gtk_events_pending()) != 0) {
+ OS.gtk_main_iteration ();
+ }
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Decorations.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Decorations.java
new file mode 100644
index 0000000..9ee0f06
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Decorations.java
@@ -0,0 +1,459 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class provide the appearance and
+ * behavior of <code>Shells</code>, but are not top
+ * level shells or dialogs. Class <code>Shell</code>
+ * shares a significant amount of code with this class,
+ * and is a subclass.
+ * <p>
+ * Instances are always displayed in one of the maximized,
+ * minimized or normal states:
+ * <ul>
+ * <li>
+ * When an instance is marked as <em>maximized</em>, the
+ * window manager will typically resize it to fill the
+ * entire visible area of the display, and the instance
+ * is usually put in a state where it can not be resized
+ * (even if it has style <code>RESIZE</code>) until it is
+ * no longer maximized.
+ * </li><li>
+ * When an instance is in the <em>normal</em> state (neither
+ * maximized or minimized), its appearance is controlled by
+ * the style constants which were specified when it was created
+ * and the restrictions of the window manager (see below).
+ * </li><li>
+ * When an instance has been marked as <em>minimized</em>,
+ * its contents (client area) will usually not be visible,
+ * and depending on the window manager, it may be
+ * "iconified" (that is, replaced on the desktop by a small
+ * simplified representation of itself), relocated to a
+ * distinguished area of the screen, or hidden. Combinations
+ * of these changes are also possible.
+ * </li>
+ * </ul>
+ * </p>
+ * Note: The styles supported by this class must be treated
+ * as <em>HINT</em>s, since the window manager for the
+ * desktop on which the instance is visible has ultimate
+ * control over the appearance and behavior of decorations.
+ * For example, some window managers only support resizable
+ * windows and will always assume the RESIZE style, even if
+ * it is not set.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * Class <code>SWT</code> provides two "convenience constants"
+ * for the most commonly required style combinations:
+ * <dl>
+ * <dt><code>SHELL_TRIM</code></dt>
+ * <dd>
+ * the result of combining the constants which are required
+ * to produce a typical application top level shell: (that
+ * is, <code>CLOSE | TITLE | MIN | MAX | RESIZE</code>)
+ * </dd>
+ * <dt><code>DIALOG_TRIM</code></dt>
+ * <dd>
+ * the result of combining the constants which are required
+ * to produce a typical application dialog shell: (that
+ * is, <code>TITLE | CLOSE | BORDER</code>)
+ * </dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ *
+ * @see #getMinimized
+ * @see #getMaximized
+ * @see Shell
+ * @see SWT
+ */
+
+public class Decorations extends Canvas {
+ String text;
+ Image image;
+ Menu menuBar;
+ Menu [] menus;
+ Button defaultButton, saveDefault;
+Decorations () {
+ /* Do nothing */
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Decorations (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+static int checkStyle (int style) {
+ if ((style & (SWT.MENU | SWT.MIN | SWT.MAX | SWT.CLOSE)) != 0) {
+ style |= SWT.TITLE;
+ }
+ return style;
+}
+
+void add (Menu menu) {
+ if (menus == null) menus = new Menu [4];
+ for (int i=0; i<menus.length; i++) {
+ if (menus [i] == null) {
+ menus [i] = menu;
+ return;
+ }
+ }
+ Menu [] newMenus = new Menu [menus.length + 4];
+ newMenus [menus.length] = menu;
+ System.arraycopy (menus, 0, newMenus, 0, menus.length);
+ menus = newMenus;
+}
+
+void createWidget (int index) {
+ super.createWidget (index);
+ text = "";
+}
+
+/**
+ * Returns the receiver's default button if one had
+ * previously been set, otherwise returns null.
+ *
+ * @return the default button or null
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setDefaultButton
+ */
+public Button getDefaultButton () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return defaultButton;
+}
+/**
+ * Returns the receiver's image if it had previously been
+ * set using <code>setImage()</code>. The image is typically
+ * displayed by the window manager when the instance is
+ * marked as iconified, and may also be displayed somewhere
+ * in the trim when the instance is in normal or maximized
+ * states.
+ * <p>
+ * Note: This method will return null if called before
+ * <code>setImage()</code> is called. It does not provide
+ * access to a window manager provided, "default" image
+ * even if one exists.
+ * </p>
+ *
+ * @return the image
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Image getImage () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return image;
+}
+/**
+ * Returns <code>true</code> if the receiver is currently
+ * maximized, and false otherwise.
+ * <p>
+ *
+ * @return the maximized state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setMaximized
+ */
+public boolean getMaximized () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return false;
+}
+/**
+ * Returns the receiver's menu bar if one had previously
+ * been set, otherwise returns null.
+ *
+ * @return the menu bar or null
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Menu getMenuBar () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return menuBar;
+}
+/**
+ * Returns <code>true</code> if the receiver is currently
+ * minimized, and false otherwise.
+ * <p>
+ *
+ * @return the minimized state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setMinimized
+ */
+public boolean getMinimized () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return false;
+}
+String getNameText () {
+ return getText ();
+}
+/**
+ * Returns the receiver's text, which is the string that the
+ * window manager will typically display as the receiver's
+ * <em>title</em>. If the text has not previously been set,
+ * returns an empty string.
+ *
+ * @return the text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getText () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return text;
+}
+Decorations menuShell () {
+ return this;
+}
+
+void remove (Menu menu) {
+ if (menus == null) return;
+ for (int i=0; i<menus.length; i++) {
+ if (menus [i] == menu) {
+ menus [i] = null;
+ return;
+ }
+ }
+}
+
+void releaseWidget () {
+ if (menuBar != null) {
+ menuBar.releaseWidget ();
+ menuBar.releaseHandle ();
+ }
+ menuBar = null;
+ if (menus != null) {
+ for (int i=0; i<menus.length; i++) {
+ Menu menu = menus [i];
+ if (menu != null && !menu.isDisposed ()) {
+ menu.dispose ();
+ }
+ }
+ }
+ menus = null;
+ super.releaseWidget ();
+ image = null;
+ defaultButton = saveDefault = null;
+}
+/**
+ * If the argument is not null, sets the receiver's default
+ * button to the argument, and if the argument is null, sets
+ * the receiver's default button to the first button which
+ * was set as the receiver's default button (called the
+ * <em>saved default button</em>). If no default button had
+ * previously been set, or the saved default button was
+ * disposed, the receiver's default button will be set to
+ * null.
+ *
+ * @param the new default button
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the button has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setDefaultButton (Button button) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+/**
+ * Sets the receiver's image to the argument, which may
+ * be null. The image is typically displayed by the window
+ * manager when the instance is marked as iconified, and
+ * may also be displayed somewhere in the trim when the
+ * instance is in normal or maximized states.
+ *
+ * @param image the new image (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setImage (Image image) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ this.image = image;
+ int pixmap = 0, mask = 0;
+ if (image != null) {
+ pixmap = image.pixmap;
+ mask = image.mask;
+ }
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove(widget, topHandle(), GtkWidget.sizeof);
+ OS.gdk_window_set_icon (widget.window, 0, pixmap, mask);
+}
+/**
+ * Sets the maximized state of the receiver.
+ * If the argument is <code>true</code> causes the receiver
+ * to switch to the maximized state, and if the argument is
+ * <code>false</code> and the receiver was previously maximized,
+ * causes the receiver to switch back to either the minimized
+ * or normal states.
+ * <p>
+ * Note: The result of intermixing calls to<code>setMaximized(true)</code>
+ * and <code>setMinimized(true)</code> will vary by platform. Typically,
+ * the behavior will match the platform user's expectations, but not
+ * always. This should be avoided if possible.
+ * </p>
+ *
+ * @param the new maximized state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setMinimized
+ */
+public void setMaximized (boolean maximized) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+/**
+ * Sets the receiver's menu bar to the argument, which
+ * may be null.
+ *
+ * @param menu the new menu bar
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
+ * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMenuBar (Menu menu) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (menuBar == menu) return;
+ if (menu != null) {
+ if ((menu.style & SWT.BAR) == 0) error (SWT.ERROR_MENU_NOT_BAR);
+ if (menu.parent != this) error (SWT.ERROR_INVALID_PARENT);
+ }
+ menuBar = menu;
+}
+/**
+ * Sets the minimized stated of the receiver.
+ * If the argument is <code>true</code> causes the receiver
+ * to switch to the minimized state, and if the argument is
+ * <code>false</code> and the receiver was previously minimized,
+ * causes the receiver to switch back to either the maximized
+ * or normal states.
+ * <p>
+ * Note: The result of intermixing calls to<code>setMaximized(true)</code>
+ * and <code>setMinimized(true)</code> will vary by platform. Typically,
+ * the behavior will match the platform user's expectations, but not
+ * always. This should be avoided if possible.
+ * </p>
+ *
+ * @param the new maximized state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setMaximized
+ */
+public void setMinimized (boolean minimized) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+/**
+ * Sets the receiver's text, which is the string that the
+ * window manager will typically display as the receiver's
+ * <em>title</em>, to the argument, which may not be null.
+ *
+ * @param text the new text
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ text = string;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/DirectoryDialog.java
new file mode 100644
index 0000000..d1c762e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/DirectoryDialog.java
@@ -0,0 +1,137 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Instances of this class allow the user to navigate
+ * the file system and select a directory.
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+
+public class DirectoryDialog extends Dialog {
+ String message = "", filterPath = "";
+ String directoryPath;
+/**
+ * Constructs a new instance of this class given only its
+ * parent.
+ * <p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the dialog on the currently active
+ * display if there is one. If there is no current display, the
+ * dialog is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public DirectoryDialog (Shell parent) {
+ this (parent, SWT.PRIMARY_MODAL);
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT dialog classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the dialog on the currently active
+ * display if there is one. If there is no current display, the
+ * dialog is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public DirectoryDialog (Shell parent, int style) {
+ super (parent, style);
+}
+/**
+ * Returns the path which the dialog will use to filter
+ * the directories it shows.
+ *
+ * @return the filter path
+ */
+public String getFilterPath () {
+ return filterPath;
+}
+/**
+ * Returns the dialog's message, which is a description of
+ * the purpose for which it was opened. This message will be
+ * visible on the dialog while it is open.
+ *
+ * @return the message
+ */
+public String getMessage () {
+ return message;
+}
+/**
+ * Makes the dialog visible and brings it to the front
+ * of the display.
+ *
+ * @return a string describing the absolute path of the selected directory,
+ * or null if the dialog was cancelled or an error occurred
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
+ * </ul>
+ */
+public String open () {
+ return null;
+}
+/**
+ * Sets the path which the dialog will use to filter
+ * the directories it shows to the argument, which may be
+ * null.
+ *
+ * @param string the filter path
+ */
+public void setFilterPath (String string) {
+ filterPath = string;
+}
+/**
+ * Sets the dialog's message, which is a description of
+ * the purpose for which it was opened. This message will be
+ * visible on the dialog while it is open.
+ *
+ * @param string the message
+ */
+public void setMessage (String string) {
+ message = string;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Display.java
new file mode 100644
index 0000000..6f77884
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Display.java
@@ -0,0 +1,1513 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class are responsible for managing the
+ * connection between SWT and the underlying operating
+ * system. Their most important function is to implement
+ * the SWT event loop in terms of the platform event model.
+ * They also provide various methods for accessing information
+ * about the operating system, and have overall control over
+ * the operating system resources which SWT allocates.
+ * <p>
+ * Applications which are built with SWT will <em>almost always</em>
+ * require only a single display. In particular, some platforms
+ * which SWT supports will not allow more than one <em>active</em>
+ * display. In other words, some platforms do not support
+ * creating a new display if one already exists that has not been
+ * sent the <code>dispose()</code> message.
+ * <p>
+ * In SWT, the thread which creates a <code>Display</code>
+ * instance is distinguished as the <em>user-interface thread</em>
+ * for that display.
+ * </p>
+ * The user-interface thread for a particular display has the
+ * following special attributes:
+ * <ul>
+ * <li>
+ * The event loop for that display must be run from the thread.
+ * </li>
+ * <li>
+ * Some SWT API methods (notably, most of the public methods in
+ * <code>Widget</code> and its subclasses), may only be called
+ * from the thread. (To support multi-threaded user-interface
+ * applications, class <code>Display</code> provides inter-thread
+ * communication methods which allow threads other than the
+ * user-interface thread to request that it perform operations
+ * on their behalf.)
+ * </li>
+ * <li>
+ * The thread is not allowed to construct other
+ * <code>Display</code>s until that display has been disposed.
+ * (Note that, this is in addition to the restriction mentioned
+ * above concerning platform support for multiple displays. Thus,
+ * the only way to have multiple simultaneously active displays,
+ * even on platforms which support it, is to have multiple threads.)
+ * </li>
+ * </ul>
+ * Enforcing these attributes allows SWT to be implemented directly
+ * on the underlying operating system's event model. This has
+ * numerous benefits including smaller footprint, better use of
+ * resources, safer memory management, clearer program logic,
+ * better performance, and fewer overall operating system threads
+ * required. The down side however, is that care must be taken
+ * (only) when constructing multi-threaded applications to use the
+ * inter-thread communication mechanisms which this class provides
+ * when required.
+ * </p><p>
+ * All SWT API methods which may only be called from the user-interface
+ * thread are distinguished in their documentation by indicating that
+ * they throw the "<code>ERROR_THREAD_INVALID_ACCESS</code>"
+ * SWT exception.
+ * </p><p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ *
+ * @see #syncExec
+ * @see #asyncExec
+ * @see #wake
+ * @see #readAndDispatch
+ * @see #sleep
+ * @see #dispose
+ */
+
+public class Display extends Device {
+
+ /* Events Dispatching and Callback */
+ Event [] eventQueue;
+ int windowProc2, windowProc3, windowProc4, windowProc5;
+ Callback windowCallback2, windowCallback3, windowCallback4, windowCallback5;
+
+ /* Sync/Async Widget Communication */
+ Synchronizer synchronizer = new Synchronizer (this);
+ int messagesSize;
+ RunnableLock [] messages;
+ Object messageLock = new Object ();
+ Thread thread = Thread.currentThread ();
+
+ /* Display Shutdown */
+ Runnable [] disposeList;
+
+ /* Timers */
+ int [] timerIDs;
+ Runnable [] timerList;
+ Callback timerCallback;
+ int timerProc;
+
+ /* Caret */
+ Caret currentCaret;
+ Callback caretCallback;
+ int caretID, caretProc;
+
+ Color NORMAL_fg, NORMAL_bg, NORMAL_dark, NORMAL_mid, NORMAL_light, NORMAL_text, NORMAL_base;
+ Color ACTIVE_fg, ACTIVE_bg, ACTIVE_dark, ACTIVE_mid, ACTIVE_light, ACTIVE_text, ACTIVE_base;
+ Color PRELIGHT_fg, PRELIGHT_bg, PRELIGHT_dark, PRELIGHT_mid, PRELIGHT_light, PRELIGHT_text, PRELIGHT_base;
+ Color SELECTED_fg, SELECTED_bg, SELECTED_dark, SELECTED_mid, SELECTED_light, SELECTED_text, SELECTED_base;
+ Color INSENSITIVE_fg, INSENSITIVE_bg, INSENSITIVE_dark, INSENSITIVE_mid, INSENSITIVE_light, INSENSITIVE_text, INSENSITIVE_base;
+
+ /* Key Mappings */
+ static final int [] [] KeyTable = {
+
+ /* Keyboard and Mouse Masks */
+ {OS.GDK_Alt_L, SWT.ALT},
+ {OS.GDK_Alt_R, SWT.ALT},
+ {OS.GDK_Shift_L, SWT.SHIFT},
+ {OS.GDK_Shift_R, SWT.SHIFT},
+ {OS.GDK_Control_L, SWT.CONTROL},
+ {OS.GDK_Control_R, SWT.CONTROL},
+
+ /* Non-Numeric Keypad Constants */
+ {OS.GDK_Up, SWT.ARROW_UP},
+ {OS.GDK_Down, SWT.ARROW_DOWN},
+ {OS.GDK_Left, SWT.ARROW_LEFT},
+ {OS.GDK_Right, SWT.ARROW_RIGHT},
+ {OS.GDK_Page_Up, SWT.PAGE_UP},
+ {OS.GDK_Page_Down, SWT.PAGE_DOWN},
+ {OS.GDK_Home, SWT.HOME},
+ {OS.GDK_End, SWT.END},
+ {OS.GDK_Insert, SWT.INSERT},
+
+ /* NOT CURRENTLY USED */
+// {OS.GDK_Delete, SWT.DELETE},
+ {OS.GDK_Return, SWT.CR},
+
+ /* Functions Keys */
+ {OS.GDK_F1, SWT.F1},
+ {OS.GDK_F2, SWT.F2},
+ {OS.GDK_F3, SWT.F3},
+ {OS.GDK_F4, SWT.F4},
+ {OS.GDK_F5, SWT.F5},
+ {OS.GDK_F6, SWT.F6},
+ {OS.GDK_F7, SWT.F7},
+ {OS.GDK_F8, SWT.F8},
+ {OS.GDK_F9, SWT.F9},
+ {OS.GDK_F10, SWT.F10},
+ {OS.GDK_F11, SWT.F11},
+ {OS.GDK_F12, SWT.F12},
+
+ /* Numeric Keypad Constants */
+ /* NOT CURRENTLY USED */
+// {OS.GDK_KP_Add, SWT.KP_PLUS},
+// {OS.GDK_KP_Subtract, SWT.KP_MINUS},
+// {OS.GDK_KP_Multiply, SWT.KP_TIMES},
+// {OS.GDK_KP_Divide, SWT.KP_DIVIDE},
+// {OS.GDK_KP_Decimal, SWT.KP_PERIOD},
+// {OS.GDK_KP_Enter, SWT.CR},
+// {OS.GDK_KP_0, SWT.KP_0},
+// {OS.GDK_KP_1, SWT.KP_1},
+// {OS.GDK_KP_2, SWT.KP_2},
+// {OS.GDK_KP_3, SWT.KP_3},
+// {OS.GDK_KP_4, SWT.KP_4},
+// {OS.GDK_KP_5, SWT.KP_5},
+// {OS.GDK_KP_6, SWT.KP_6},
+// {OS.GDK_KP_7, SWT.KP_7},
+// {OS.GDK_KP_8, SWT.KP_8},
+// {OS.GDK_KP_9, SWT.KP_9},
+
+ };
+
+ /* Multiple Displays. */
+ static Display Default;
+ static Display [] Displays = new Display [4];
+
+ /* Package name */
+ static final String PACKAGE_NAME;
+ static {
+ String name = Display.class.getName ();
+ int index = name.lastIndexOf ('.');
+ PACKAGE_NAME = name.substring (0, index + 1);
+ }
+
+ /* #define in gdkevents.h */
+ static final int DOUBLE_CLICK_TIME = 250;
+
+ /* Display Data */
+ Object data;
+ String [] keys;
+ Object [] values;
+
+ /*
+ * TEMPORARY CODE. Install the runnable that
+ * gets the current display. This code will
+ * be removed in the future.
+ */
+ static {
+ DeviceFinder = new Runnable () {
+ public void run () {
+ Device device = getCurrent ();
+ if (device == null) {
+ device = getDefault ();
+ }
+ setDevice (device);
+ }
+ };
+ }
+
+/*
+* TEMPORARY CODE.
+*/
+static void setDevice (Device device) {
+ CurrentDevice = device;
+}
+
+/**
+ * Constructs a new instance of this class.
+ * <p>
+ * Note: The resulting display is marked as the <em>current</em>
+ * display. If this is the first display which has been
+ * constructed since the application started, it is also
+ * marked as the <em>default</em> display.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see #getCurrent
+ * @see #getDefault
+ * @see Widget#checkSubclass
+ * @see Shell
+ */
+public Display () {
+ this (null);
+}
+
+public Display (DeviceData data) {
+ super (data);
+}
+
+void addLast (RunnableLock entry) {
+ synchronized (messageLock) {
+ if (messages == null) messages = new RunnableLock [4];
+ if (messagesSize == messages.length) {
+ RunnableLock[] newMessages = new RunnableLock [messagesSize + 4];
+ System.arraycopy (messages, 0, newMessages, 0, messagesSize);
+ messages = newMessages;
+ }
+ messages [messagesSize++] = entry;
+ }
+}
+
+/**
+ * Causes the <code>run()</code> method of the runnable to
+ * be invoked by the user-interface thread at the next
+ * reasonable opportunity. The caller of this method continues
+ * to run in parallel, and is not notified when the
+ * runnable has completed.
+ *
+ * @param runnable code to run on the user-interface thread.
+ *
+ * @see #syncExec
+ */
+public void asyncExec (Runnable runnable) {
+ if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
+ synchronizer.asyncExec (runnable);
+}
+
+/**
+ * Causes the system hardware to emit a short sound
+ * (if it supports this capability).
+ */
+public void beep () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ OS.gdk_beep();
+ OS.gdk_flush();
+}
+
+protected void checkDevice () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
+}
+
+synchronized void checkDisplay () {
+ for (int i=0; i<Displays.length; i++) {
+ if (Displays [i] != null && Displays [i].thread == thread) {
+ error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ }
+ }
+}
+
+protected void checkSubclass () {
+ if (!isValidClass (getClass ())) error (SWT.ERROR_INVALID_SUBCLASS);
+}
+
+protected void create (DeviceData data) {
+ checkDisplay ();
+ checkSubclass ();
+ thread = Thread.currentThread ();
+ createDisplay (data);
+ register ();
+ if (Default == null) Default = this;
+}
+
+synchronized void createDisplay (DeviceData data) {
+ if (!OS.gtk_init_check (new int [] {0}, null)) {
+ /*
+ * This code is intentionally commented.
+ */
+// disposed = true;
+// SWT.error (SWT.ERROR_DEVICE_DISPOSED);
+ return;
+ }
+ OS.gdk_rgb_init ();
+ int ptr = OS.gtk_check_version (1, 2, 8);
+ if (ptr != 0) {
+ System.out.println ("***WARNING: SWT requires GTK version 1.2.8 or greater");
+ int length = OS.strlen (ptr);
+ byte [] buffer = new byte [length];
+ OS.memmove (buffer, ptr, length);
+ System.out.println ("***WARNING: " + new String (Converter.mbcsToWcs (null, buffer)));
+ }
+}
+
+synchronized void deregister () {
+ for (int i=0; i<Displays.length; i++) {
+ if (this == Displays [i]) Displays [i] = null;
+ }
+}
+
+protected void destroy () {
+ if (this == Default) Default = null;
+ deregister ();
+ destroyDisplay ();
+}
+
+void destroyDisplay () {
+}
+
+/**
+ * Returns the display which the given thread is the
+ * user-interface thread for, or null if the given thread
+ * is not a user-interface thread for any display.
+ *
+ * @param thread the user-interface thread
+ * @return the display for the given thread
+ */
+public static synchronized Display findDisplay (Thread thread) {
+ for (int i=0; i<Displays.length; i++) {
+ Display display = Displays [i];
+ if (display != null && display.thread == thread) {
+ return display;
+ }
+ }
+ return null;
+}
+
+/**
+ * Causes the <code>run()</code> method of the runnable to
+ * be invoked by the user-interface thread just before the
+ * receiver is disposed.
+ *
+ * @param runnable code to run at dispose time.
+ */
+public void disposeExec (Runnable runnable) {
+ checkDevice ();
+ if (disposeList == null) disposeList = new Runnable [4];
+ for (int i=0; i<disposeList.length; i++) {
+ if (disposeList [i] == null) {
+ disposeList [i] = runnable;
+ return;
+ }
+ }
+ Runnable [] newDisposeList = new Runnable [disposeList.length + 4];
+ System.arraycopy (disposeList, 0, newDisposeList, 0, disposeList.length);
+ newDisposeList [disposeList.length] = runnable;
+ disposeList = newDisposeList;
+}
+
+/**
+ * Does whatever display specific cleanup is required, and then
+ * uses the code in <code>SWTError.error</code> to handle the error.
+ *
+ * @param code the descriptive error code
+ *
+ * @see SWTError#error
+ */
+void error (int code) {
+ throw new SWTError (code);
+}
+
+/**
+ * Given the operating system handle for a widget, returns
+ * the instance of the <code>Widget</code> subclass which
+ * represents it in the currently running application, if
+ * such exists, or null if no matching widget can be found.
+ *
+ * @param handle the handle for the widget
+ * @return the SWT widget that the handle represents
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Widget findWidget (int handle) {
+ checkDevice ();
+ // In 0.058 and before, this used to go up the parent
+ // chain if the handle was not found in the widget
+ // table, up to the root. Now, we require that all
+ // widgets register ALL their handles.
+ // If somebody creates their own handles outside
+ // SWT, it's their problem.
+ return WidgetTable.get (handle);
+}
+
+/*
+ * In SWT, we force all widgets to have real Gdk windows,
+ * thus getting rid of the concept of "lightweight" widgets.
+ * Given a GdkWindow, answer a handle to the GtkWidget realized
+ * through that window.
+ * If the argument is not the pointe rto a GdkWindow, the
+ * universe will be left in an inconsistent state.
+ */
+int findGtkWidgetByGdkWindow (int gdkWindow) {
+ int[] pwidget = new int[1];
+ OS.gdk_window_get_user_data(gdkWindow, pwidget);
+ return pwidget[0];
+}
+
+/**
+ * Returns the currently active <code>Shell</code>, or null
+ * if no shell belonging to the currently running application
+ * is active.
+ *
+ * @return the active shell or null
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Shell getActiveShell () {
+ checkDevice ();
+ Shell [] shells = getShells();
+ for (int i=0; i<shells.length; i++) {
+ if (shells [i].hasFocus) return shells [i];
+ }
+ return null;
+}
+
+/**
+ * Returns a rectangle describing the receiver's size and location.
+ *
+ * @return the bounding rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Rectangle getBounds () {
+ checkDevice ();
+ return new Rectangle(0, 0, OS.gdk_screen_width (), OS.gdk_screen_height ());
+}
+
+/**
+ * Returns the display which the currently running thread is
+ * the user-interface thread for, or null if the currently
+ * running thread is not a user-interface thread for any display.
+ *
+ * @return the current display
+ */
+public static synchronized Display getCurrent () {
+ Thread current = Thread.currentThread ();
+ for (int i=0; i<Displays.length; i++) {
+ Display display = Displays [i];
+ if (display != null && display.thread == current) return display;
+ }
+ return null;
+}
+
+/**
+ * Returns the control which the on-screen pointer is currently
+ * over top of, or null if it is not currently over one of the
+ * controls built by the currently running application.
+ *
+ * @return the control under the cursor
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Control getCursorControl () {
+ checkDevice();
+ int[] x = new int[1], y = new int[1];
+ int cursorWindowHandle = OS.gdk_window_at_pointer(x,y);
+ if (cursorWindowHandle==0) return null;
+ int handle = findGtkWidgetByGdkWindow(cursorWindowHandle);
+ if (handle==0) return null;
+ return findControl(handle);
+}
+
+Control findControl(int h) {
+ Widget w = findWidget(h);
+ if (w==null) return null;
+ if (w instanceof Control) return (Control)w;
+ // w is something like an Item. Go for the parent
+
+ GtkWidget widget = new GtkWidget();
+ OS.memmove(widget, h, GtkWidget.sizeof);
+ return findControl(widget.parent);
+}
+
+/**
+ * Returns the location of the on-screen pointer relative
+ * to the top left corner of the screen.
+ *
+ * @return the cursor location
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getCursorLocation () {
+ checkDevice ();
+ int [] x = new int [1], y = new int [1];
+ OS.gdk_window_get_pointer (0, x, y, 0);
+ return new Point (x [0], y [0]);
+}
+
+/**
+ * Returns the application defined property of the receiver
+ * with the specified name, or null if it has not been set.
+ * <p>
+ * Applications may have associated arbitrary objects with the
+ * receiver in this fashion. If the objects stored in the
+ * properties need to be notified when the display is disposed
+ * of, it is the application's responsibility provide a
+ * <code>disposeExec()</code> handler which does so.
+ * </p>
+ *
+ * @param key the name of the property
+ * @return the value of the property or null if it has not been set
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setData
+ * @see #disposeExec
+ */
+public Object getData (String key) {
+ checkDevice ();
+ if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (keys == null) return null;
+ for (int i=0; i<keys.length; i++) {
+ if (keys [i].equals (key)) return values [i];
+ }
+ return null;
+}
+
+/**
+ * Returns the application defined, display specific data
+ * associated with the receiver, or null if it has not been
+ * set. The <em>display specific data</em> is a single,
+ * unnamed field that is stored with every display.
+ * <p>
+ * Applications may put arbitrary objects in this field. If
+ * the object stored in the display specific data needs to
+ * be notified when the display is disposed of, it is the
+ * application's responsibility provide a
+ * <code>disposeExec()</code> handler which does so.
+ * </p>
+ *
+ * @return the display specific data
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
+ * </ul>
+ *
+ * @see #setData
+ * @see #disposeExec
+ */
+public Object getData () {
+ checkDevice ();
+ return data;
+}
+/**
+ * Returns a point whose x coordinate is the horizontal
+ * dots per inch of the display, and whose y coordinate
+ * is the vertical dots per inch of the display.
+ *
+ * @return the horizontal and vertical DPI
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getDPI () {
+ checkDevice ();
+ int widthMM = OS.gdk_screen_width_mm ();
+ int width = OS.gdk_screen_width ();
+ // compute round(25.4 * width / widthMM)
+ int dpi = Compatibility.round(254 * width, widthMM * 10);
+ return new Point (dpi, dpi);
+}
+
+/**
+ * Returns the default display. One is created (making the
+ * thread that invokes this method its user-interface thread)
+ * if it did not already exist.
+ *
+ * @return the default display
+ */
+public static synchronized Display getDefault () {
+ if (Default == null) Default = new Display ();
+ return Default;
+}
+
+static boolean isValidClass (Class clazz) {
+ String name = clazz.getName ();
+ int index = name.lastIndexOf ('.');
+ return name.substring (0, index + 1).equals (PACKAGE_NAME);
+}
+
+/**
+ * Returns the longest duration, in milliseconds, between
+ * two mouse button clicks that will be considered a
+ * <em>double click</em> by the underlying operating system.
+ *
+ * @return the double click time
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getDoubleClickTime () {
+ checkDevice ();
+ return DOUBLE_CLICK_TIME;
+}
+
+/**
+ * Returns the control which currently has keyboard focus,
+ * or null if keyboard events are not currently going to
+ * any of the controls built by the currently running
+ * application.
+ *
+ * @return the control under the cursor
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Control getFocusControl () {
+ checkDevice ();
+ Shell active = getActiveShell();
+ if (active==null) return null;
+ return active.getFocusControl();
+}
+
+public int getDepth () {
+ checkDevice ();
+ GdkVisual visual = new GdkVisual ();
+ OS.memmove(visual, OS.gdk_visual_get_system(), GdkVisual.sizeof);
+ return visual.depth;
+}
+
+/**
+ * Returns the maximum allowed depth of icons on this display.
+ * On some platforms, this may be different than the actual
+ * depth of the display.
+ *
+ * @return the maximum icon depth
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getIconDepth () {
+ checkDevice ();
+ return getDepth ();
+}
+
+/**
+ * Returns an array containing all shells which have not been
+ * disposed and have the receiver as their display.
+ *
+ * @return the receiver's shells
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Shell [] getShells () {
+ checkDevice ();
+ int count = 0;
+ Shell [] shells = WidgetTable.shells ();
+ for (int i=0; i<shells.length; i++) {
+ Shell shell = shells [i];
+ if (!shell.isDisposed () && (this == shell.getDisplay ())) {
+ count++;
+ }
+ }
+ int index = 0;
+ Shell [] result = new Shell [count];
+ for (int i=0; i<shells.length; i++) {
+ Shell shell = shells [i];
+ if (!shell.isDisposed () && (this == shell.getDisplay ())) {
+ result [index++] = shell;
+ }
+ }
+ return result;
+}
+
+/**
+ * Returns the thread that has invoked <code>syncExec</code>
+ * or null if no such runnable is currently being invoked by
+ * the user-interface thread.
+ * <p>
+ * Note: If a runnable invoked by asyncExec is currently
+ * running, this method will return null.
+ * </p>
+ *
+ * @return the receiver's sync-interface thread
+ */
+public Thread getSyncThread () {
+ if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
+ return synchronizer.syncThread;
+}
+
+/**
+ * Returns the matching standard color for the given
+ * constant, which should be one of the color constants
+ * specified in class <code>SWT</code>. Any value other
+ * than one of the SWT color constants which is passed
+ * in will result in the color black. This color should
+ * not be free'd because it was allocated by the system,
+ * not the application.
+ *
+ * @param id the color constant
+ * @return the matching color
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SWT
+ */
+public Color getSystemColor (int id) {
+ checkDevice ();
+ switch (id) {
+ case SWT.COLOR_INFO_FOREGROUND: return NORMAL_fg;
+ case SWT.COLOR_INFO_BACKGROUND: return NORMAL_bg;
+
+ case SWT.COLOR_TITLE_FOREGROUND: return SELECTED_text;
+ case SWT.COLOR_TITLE_BACKGROUND: return SELECTED_bg;
+ case SWT.COLOR_TITLE_BACKGROUND_GRADIENT: return SELECTED_light;
+ case SWT.COLOR_TITLE_INACTIVE_FOREGROUND: return INSENSITIVE_fg;
+ case SWT.COLOR_TITLE_INACTIVE_BACKGROUND: return INSENSITIVE_bg;
+ case SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT: return INSENSITIVE_light;
+
+ case SWT.COLOR_WIDGET_DARK_SHADOW: return NORMAL_dark;
+ case SWT.COLOR_WIDGET_NORMAL_SHADOW: return NORMAL_mid;
+ case SWT.COLOR_WIDGET_LIGHT_SHADOW: return NORMAL_light;
+ case SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW: return NORMAL_light;
+ case SWT.COLOR_WIDGET_BACKGROUND: return NORMAL_bg;
+ case SWT.COLOR_WIDGET_FOREGROUND: return NORMAL_fg;
+ case SWT.COLOR_WIDGET_BORDER: return super.getSystemColor (SWT.COLOR_BLACK);
+
+ case SWT.COLOR_LIST_FOREGROUND: return super.getSystemColor (SWT.COLOR_BLACK);
+ case SWT.COLOR_LIST_BACKGROUND: return super.getSystemColor (SWT.COLOR_WHITE);
+ case SWT.COLOR_LIST_SELECTION: return SELECTED_bg;
+ case SWT.COLOR_LIST_SELECTION_TEXT: return SELECTED_text;
+ }
+ return super.getSystemColor (id);
+}
+
+void initializeSystemColors() {
+
+ /* Get the theme colors */
+ GtkStyle defaultStyle = new GtkStyle();
+ OS.memmove (defaultStyle, OS.gtk_widget_get_default_style(), GtkStyle.sizeof);
+
+ GdkColor gdk_NORMAL_dark = new GdkColor();
+ gdk_NORMAL_dark.pixel = defaultStyle.dark0_pixel;
+ gdk_NORMAL_dark.red = defaultStyle.dark0_red;
+ gdk_NORMAL_dark.green = defaultStyle.dark0_green;
+ gdk_NORMAL_dark.blue = defaultStyle.dark0_blue;
+ NORMAL_dark = Color.gtk_new(gdk_NORMAL_dark);
+
+ GdkColor gdk_NORMAL_mid = new GdkColor();
+ gdk_NORMAL_mid.pixel = defaultStyle.mid0_pixel;
+ gdk_NORMAL_mid.red = defaultStyle.mid0_red;
+ gdk_NORMAL_mid.green = defaultStyle.mid0_green;
+ gdk_NORMAL_mid.blue = defaultStyle.mid0_blue;
+ NORMAL_mid = Color.gtk_new(gdk_NORMAL_mid);
+
+ GdkColor gdk_NORMAL_light = new GdkColor();
+ gdk_NORMAL_light.pixel = defaultStyle.light0_pixel;
+ gdk_NORMAL_light.red = defaultStyle.light0_red;
+ gdk_NORMAL_light.green = defaultStyle.light0_green;
+ gdk_NORMAL_light.blue = defaultStyle.light0_blue;
+ NORMAL_light = Color.gtk_new(gdk_NORMAL_light);
+
+ GdkColor gdk_NORMAL_fg = new GdkColor();
+ gdk_NORMAL_fg.pixel = defaultStyle.fg0_pixel;
+ gdk_NORMAL_fg.red = defaultStyle.fg0_red;
+ gdk_NORMAL_fg.green = defaultStyle.fg0_green;
+ gdk_NORMAL_fg.blue = defaultStyle.fg0_blue;
+ NORMAL_fg = Color.gtk_new(gdk_NORMAL_fg);
+
+ GdkColor gdk_NORMAL_bg = new GdkColor();
+ gdk_NORMAL_bg.pixel = defaultStyle.bg0_pixel;
+ gdk_NORMAL_bg.red = defaultStyle.bg0_red;
+ gdk_NORMAL_bg.green = defaultStyle.bg0_green;
+ gdk_NORMAL_bg.blue = defaultStyle.bg0_blue;
+ NORMAL_bg = Color.gtk_new(gdk_NORMAL_bg);
+
+ GdkColor gdk_NORMAL_text = new GdkColor();
+ gdk_NORMAL_text.pixel = defaultStyle.text0_pixel;
+ gdk_NORMAL_text.red = defaultStyle.text0_red;
+ gdk_NORMAL_text.green = defaultStyle.text0_green;
+ gdk_NORMAL_text.blue = defaultStyle.text0_blue;
+ NORMAL_text = Color.gtk_new(gdk_NORMAL_text);
+
+ GdkColor gdk_NORMAL_base = new GdkColor();
+ gdk_NORMAL_base.pixel = defaultStyle.base0_pixel;
+ gdk_NORMAL_base.red = defaultStyle.base0_red;
+ gdk_NORMAL_base.green = defaultStyle.base0_green;
+ gdk_NORMAL_base.blue = defaultStyle.base0_blue;
+ NORMAL_base = Color.gtk_new(gdk_NORMAL_base);
+
+ GdkColor gdk_SELECTED_text = new GdkColor();
+ gdk_SELECTED_text.pixel = defaultStyle.text3_pixel;
+ gdk_SELECTED_text.red = defaultStyle.text3_red;
+ gdk_SELECTED_text.green = defaultStyle.text3_green;
+ gdk_SELECTED_text.blue = defaultStyle.text3_blue;
+ SELECTED_text = Color.gtk_new(gdk_SELECTED_text);
+
+ GdkColor gdk_SELECTED_bg = new GdkColor();
+ gdk_SELECTED_bg.pixel = defaultStyle.bg3_pixel;
+ gdk_SELECTED_bg.red = defaultStyle.bg3_red;
+ gdk_SELECTED_bg.green = defaultStyle.bg3_green;
+ gdk_SELECTED_bg.blue = defaultStyle.bg3_blue;
+ SELECTED_bg = Color.gtk_new(gdk_SELECTED_bg);
+
+ GdkColor gdk_SELECTED_base = new GdkColor();
+ gdk_SELECTED_base.pixel = defaultStyle.base3_pixel;
+ gdk_SELECTED_base.red = defaultStyle.base3_red;
+ gdk_SELECTED_base.green = defaultStyle.base3_green;
+ gdk_SELECTED_base.blue = defaultStyle.base3_blue;
+ SELECTED_base = Color.gtk_new(gdk_SELECTED_base);
+
+ GdkColor gdk_SELECTED_light = new GdkColor();
+ gdk_SELECTED_light.pixel = defaultStyle.light3_pixel;
+ gdk_SELECTED_light.red = defaultStyle.light3_red;
+ gdk_SELECTED_light.green = defaultStyle.light3_green;
+ gdk_SELECTED_light.blue = defaultStyle.light3_blue;
+ SELECTED_light = Color.gtk_new(gdk_SELECTED_light);
+
+
+ GdkColor gdk_PRELIGHT_light = new GdkColor();
+ gdk_PRELIGHT_light.pixel = defaultStyle.light2_pixel;
+ gdk_PRELIGHT_light.red = defaultStyle.light2_red;
+ gdk_PRELIGHT_light.green = defaultStyle.light2_green;
+ gdk_PRELIGHT_light.blue = defaultStyle.light2_blue;
+ PRELIGHT_light = Color.gtk_new(gdk_PRELIGHT_light);
+
+ GdkColor gdk_INSENSITIVE_light = new GdkColor();
+ gdk_INSENSITIVE_light.pixel = defaultStyle.light4_pixel;
+ gdk_INSENSITIVE_light.red = defaultStyle.light4_red;
+ gdk_INSENSITIVE_light.green = defaultStyle.light4_green;
+ gdk_INSENSITIVE_light.blue = defaultStyle.light4_blue;
+ INSENSITIVE_light = Color.gtk_new(gdk_INSENSITIVE_light);
+
+ GdkColor gdk_INSENSITIVE_fg = new GdkColor();
+ gdk_INSENSITIVE_fg.pixel = defaultStyle.fg4_pixel;
+ gdk_INSENSITIVE_fg.red = defaultStyle.fg4_red;
+ gdk_INSENSITIVE_fg.green = defaultStyle.fg4_green;
+ gdk_INSENSITIVE_fg.blue = defaultStyle.fg4_blue;
+ INSENSITIVE_fg = Color.gtk_new(gdk_INSENSITIVE_fg);
+
+ GdkColor gdk_INSENSITIVE_bg = new GdkColor();
+ gdk_INSENSITIVE_bg.pixel = defaultStyle.bg4_pixel;
+ gdk_INSENSITIVE_bg.red = defaultStyle.bg4_red;
+ gdk_INSENSITIVE_bg.green = defaultStyle.bg4_green;
+ gdk_INSENSITIVE_bg.blue = defaultStyle.bg4_blue;
+ INSENSITIVE_bg = Color.gtk_new(gdk_INSENSITIVE_bg);
+
+
+}
+
+/**
+ * Returns a reasonable font for applications to use.
+ * On some platforms, this will match the "default font"
+ * or "system font" if such can be found. This font
+ * should not be free'd because it was allocated by the
+ * system, not the application.
+ * <p>
+ * Typically, applications which want the default look
+ * should simply not set the font on the widgets they
+ * create. Widgets are always created with the correct
+ * default font for the class of user-interface component
+ * they represent.
+ * </p>
+ *
+ * @return a font
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Font getSystemFont () {
+ checkDevice ();
+ GtkStyle style = new GtkStyle();
+ OS.memmove (style, OS.gtk_widget_get_default_style(), GtkStyle.sizeof);
+ int gdkFont = style.font; // gives a GdkFont*
+ return Font.gtk_new (gdkFont);
+}
+
+/**
+ * Returns the user-interface thread for the receiver.
+ *
+ * @return the receiver's user-interface thread
+ */
+public Thread getThread () {
+ if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
+ return thread;
+}
+
+protected void init () {
+ super.init ();
+ initializeCallbacks ();
+ initializeSystemColors ();
+}
+
+void initializeCallbacks () {
+ windowCallback2 = new Callback (this, "windowProc", 2);
+ windowProc2 = windowCallback2.getAddress ();
+ if (windowProc2 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+ windowCallback3 = new Callback (this, "windowProc", 3);
+ windowProc3 = windowCallback3.getAddress ();
+ if (windowProc3 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+ windowCallback4 = new Callback (this, "windowProc", 4);
+ windowProc4 = windowCallback4.getAddress ();
+ if (windowProc4 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+ windowCallback5 = new Callback (this, "windowProc", 5);
+ windowProc5 = windowCallback5.getAddress ();
+ if (windowProc5 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+ timerCallback = new Callback (this, "timerProc", 2);
+ timerProc = timerCallback.getAddress ();
+ if (timerProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
+
+ caretCallback = new Callback(this, "caretProc", 2);
+ caretProc = caretCallback.getAddress();
+ if (caretProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
+}
+
+/**
+ * Invokes platform specific functionality to dispose a GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Display</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param handle the platform specific GC handle
+ * @param data the platform specific GC data
+ *
+ * @private
+ */
+public void internal_dispose_GC (int handle, GCData data) {
+ OS.gdk_gc_destroy(handle);
+}
+
+/**
+ * Invokes platform specific functionality to allocate a new GC handle.
+ * <p>
+ * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+ * API for <code>Display</code>. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is not
+ * available on all platforms, and should never be called from
+ * application code.
+ * </p>
+ *
+ * @param data the platform specific GC data
+ * @return the platform specific GC handle
+ *
+ * @private
+ */
+public int internal_new_GC (GCData data) {
+ if (isDisposed()) SWT.error(SWT.ERROR_DEVICE_DISPOSED);
+ int root = OS.GDK_ROOT_PARENT();
+ int gc = OS.gdk_gc_new(root);
+ data.drawable = root;
+ return gc;
+}
+
+boolean isValidThread () {
+ return thread == Thread.currentThread ();
+}
+
+void postEvent (Event event) {
+ /*
+ * Place the event at the end of the event queue.
+ * This code is always called in the Display's
+ * thread so it must be re-enterant but does not
+ * need to be synchronized.
+ */
+ if (eventQueue == null) eventQueue = new Event [4];
+ int index = 0;
+ int length = eventQueue.length;
+ while (index < length) {
+ if (eventQueue [index] == null) break;
+ index++;
+ }
+ if (index == length) {
+ Event [] newQueue = new Event [length + 4];
+ System.arraycopy (eventQueue, 0, newQueue, 0, length);
+ eventQueue = newQueue;
+ }
+ eventQueue [index] = event;
+}
+
+/**
+ * Reads an event from the operating system's event queue,
+ * dispatches it appropriately, and returns <code>true</code>
+ * if there is potentially more work to do, or <code>false</code>
+ * if the caller can sleep until another event is placed on
+ * the event queue.
+ * <p>
+ * In addition to checking the system event queue, this method also
+ * checks if any inter-thread messages (created by <code>syncExec()</code>
+ * or <code>asyncExec()</code>) are waiting to be processed, and if
+ * so handles them before returning.
+ * </p>
+ *
+ * @return <code>false</code> if the caller can sleep upon return from this method
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #sleep
+ * @see #wake
+ */
+public boolean readAndDispatch () {
+ checkDevice ();
+ int status = OS.gtk_events_pending ();
+ if (status != 0) {
+// if ((status & OS.XtIMTimer) != 0) OS.XtAppProcessEvent (context, OS.XtIMTimer);
+// if ((status & OS.XtIMAlternateInput) != 0) OS.XtAppProcessEvent (context, OS.XtIMAlternateInput);
+// if ((status & OS.XtIMXEvent) != 0) {
+// OS.XtAppNextEvent (context, event);
+// OS.XtDispatchEvent (event);
+// }
+/* int eventPtr = OS.gdk_event_get();
+ if (eventPtr != 0) {
+ OS.gtk_main_do_event(eventPtr);
+ }*/
+ OS.gtk_main_iteration ();
+ runDeferredEvents ();
+ return true;
+ }
+ return runAsyncMessages ();
+}
+
+synchronized void register () {
+ for (int i=0; i<Displays.length; i++) {
+ if (Displays [i] == null) {
+ Displays [i] = this;
+ return;
+ }
+ }
+ Display [] newDisplays = new Display [Displays.length + 4];
+ System.arraycopy (Displays, 0, newDisplays, 0, Displays.length);
+ newDisplays [Displays.length] = this;
+ Displays = newDisplays;
+}
+
+protected void release () {
+
+ /* Release shells */
+ Shell [] shells = WidgetTable.shells ();
+ for (int i=0; i<shells.length; i++) {
+ Shell shell = shells [i];
+ if (!shell.isDisposed ()) {
+ if (this == shell.getDisplay ()) shell.dispose ();
+ }
+ }
+ while (readAndDispatch ()) {};
+
+ /* Run dispose list */
+ if (disposeList != null) {
+ for (int i=0; i<disposeList.length; i++) {
+ if (disposeList [i] != null) disposeList [i].run ();
+ }
+ }
+ disposeList = null;
+
+ /* Release synchronizer */
+ synchronizer.releaseSynchronizer ();
+ synchronizer = null;
+ releaseDisplay ();
+
+ super.release ();
+}
+
+void releaseDisplay () {
+ windowCallback2.dispose (); windowCallback2 = null;
+ windowCallback3.dispose (); windowCallback3 = null;
+ windowCallback4.dispose (); windowCallback4 = null;
+ windowCallback5.dispose (); windowCallback5 = null;
+
+ /* Dispose the caret callback */
+ if (caretID != 0) OS.gtk_timeout_remove (caretID);
+ caretID = caretProc = 0;
+ caretCallback.dispose ();
+ caretCallback = null;
+
+ /* Dispose the timer callback */
+ if (timerIDs != null) {
+ for (int i=0; i<timerIDs.length; i++) {
+ if (timerIDs [i] != 0) OS.gtk_timeout_remove (timerIDs [i]);
+ }
+ }
+ timerIDs = null;
+ timerList = null;
+ timerProc = 0;
+ timerCallback.dispose ();
+ timerCallback = null;
+
+ messages = null; messageLock = null; thread = null;
+ messagesSize = windowProc2 = windowProc3 = windowProc4 = windowProc5 = 0;
+
+ NORMAL_fg = NORMAL_bg = NORMAL_dark = NORMAL_mid = NORMAL_light = NORMAL_text = NORMAL_base =
+ ACTIVE_fg = ACTIVE_bg = ACTIVE_dark = ACTIVE_mid = ACTIVE_light = ACTIVE_text = ACTIVE_base =
+ PRELIGHT_fg = PRELIGHT_bg = PRELIGHT_dark = PRELIGHT_mid = PRELIGHT_light = PRELIGHT_text = PRELIGHT_base =
+ SELECTED_fg = SELECTED_bg = SELECTED_dark = SELECTED_mid = SELECTED_light = SELECTED_text = SELECTED_base =
+ INSENSITIVE_fg = INSENSITIVE_bg = INSENSITIVE_dark = INSENSITIVE_mid = INSENSITIVE_light = INSENSITIVE_text =
+ INSENSITIVE_base = null;
+}
+
+RunnableLock removeFirst () {
+ synchronized (messageLock) {
+ if (messagesSize == 0) return null;
+ RunnableLock lock = messages [0];
+ System.arraycopy (messages, 1, messages, 0, --messagesSize);
+ messages [messagesSize] = null;
+ if (messagesSize == 0) messages = null;
+ return lock;
+ }
+}
+
+boolean runAsyncMessages () {
+ return synchronizer.runAsyncMessages ();
+}
+
+boolean runDeferredEvents () {
+ /*
+ * Run deferred events. This code is always
+ * called in the Display's thread so it must
+ * be re-enterant need not be synchronized.
+ */
+ while (eventQueue != null) {
+
+ /* Take an event off the queue */
+ Event event = eventQueue [0];
+ if (event == null) break;
+ int length = eventQueue.length;
+ System.arraycopy (eventQueue, 1, eventQueue, 0, --length);
+ eventQueue [length] = null;
+
+ /* Run the event */
+ Widget widget = event.widget;
+ if (widget != null && !widget.isDisposed ()) {
+ Widget item = event.item;
+ if (item == null || !item.isDisposed ()) {
+ widget.notifyListeners (event.type, event);
+ }
+ }
+
+ /*
+ * At this point, the event queue could
+ * be null due to a recursive invokation
+ * when running the event.
+ */
+ }
+
+ /* Clear the queue */
+ eventQueue = null;
+ return true;
+}
+
+/**
+ * On platforms which support it, sets the application name
+ * to be the argument. On Motif, for example, this can be used
+ * to set the name used for resource lookup.
+ *
+ * @param name the new app name
+ */
+public static void setAppName (String name) {
+ /* Do nothing - Gtk doesn't have the concept of application name. */
+}
+
+/**
+ * Sets the application defined property of the receiver
+ * with the specified name to the given argument.
+ * <p>
+ * Applications may have associated arbitrary objects with the
+ * receiver in this fashion. If the objects stored in the
+ * properties need to be notified when the display is disposed
+ * of, it is the application's responsibility provide a
+ * <code>disposeExec()</code> handler which does so.
+ * </p>
+ *
+ * @param key the name of the property
+ * @param value the new value for the property
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setData
+ * @see #disposeExec
+ */
+public void setData (String key, Object value) {
+ checkDevice ();
+ if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
+
+ /* Remove the key/value pair */
+ if (value == null) {
+ if (keys == null) return;
+ int index = 0;
+ while (index < keys.length && !keys [index].equals (key)) index++;
+ if (index == keys.length) return;
+ if (keys.length == 1) {
+ keys = null;
+ values = null;
+ } else {
+ String [] newKeys = new String [keys.length - 1];
+ Object [] newValues = new Object [values.length - 1];
+ System.arraycopy (keys, 0, newKeys, 0, index);
+ System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index);
+ System.arraycopy (values, 0, newValues, 0, index);
+ System.arraycopy (values, index + 1, newValues, index, newValues.length - index);
+ keys = newKeys;
+ values = newValues;
+ }
+ return;
+ }
+
+ /* Add the key/value pair */
+ if (keys == null) {
+ keys = new String [] {key};
+ values = new Object [] {value};
+ return;
+ }
+ for (int i=0; i<keys.length; i++) {
+ if (keys [i].equals (key)) {
+ values [i] = value;
+ return;
+ }
+ }
+ String [] newKeys = new String [keys.length + 1];
+ Object [] newValues = new Object [values.length + 1];
+ System.arraycopy (keys, 0, newKeys, 0, keys.length);
+ System.arraycopy (values, 0, newValues, 0, values.length);
+ newKeys [keys.length] = key;
+ newValues [values.length] = value;
+ keys = newKeys;
+ values = newValues;
+}
+
+/**
+ * Sets the application defined, display specific data
+ * associated with the receiver, to the argument.
+ * The <em>display specific data</em> is a single,
+ * unnamed field that is stored with every display.
+ * <p>
+ * Applications may put arbitrary objects in this field. If
+ * the object stored in the display specific data needs to
+ * be notified when the display is disposed of, it is the
+ * application's responsibility provide a
+ * <code>disposeExec()</code> handler which does so.
+ * </p>
+ *
+ * @param data the new display specific data
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
+ * </ul>
+ *
+ * @see #getData
+ * @see #disposeExec
+ */
+public void setData (Object data) {
+ checkDevice ();
+ this.data = data;
+}
+
+/**
+ * Sets the synchronizer used by the display to be
+ * the argument, which can not be null.
+ *
+ * @param synchronizer the new synchronizer for the display (must not be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the synchronizer is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSynchronizer (Synchronizer synchronizer) {
+ checkDevice ();
+ if (synchronizer == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (this.synchronizer != null) {
+ this.synchronizer.runAsyncMessages();
+ }
+ this.synchronizer = synchronizer;
+}
+
+/**
+ * Causes the user-interface thread to <em>sleep</em> (that is,
+ * to be put in a state where it does not consume CPU cycles)
+ * until an event is received or it is otherwise awakened.
+ *
+ * @return <code>true</code> if an event requiring dispatching was placed on the queue.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #wake
+ */
+
+public boolean sleep () {
+ checkDevice ();
+ /* Temporary code - need to sleep waiting for the next message */
+ try { Thread.sleep(50); } catch (Exception e) {};
+ return true;
+}
+
+/**
+ * Causes the <code>run()</code> method of the runnable to
+ * be invoked by the user-interface thread after the specified
+ * number of milliseconds have elapsed.
+ *
+ * @param milliseconds the delay before running the runnable
+ * @param runnable code to run on the user-interface thread
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #asyncExec
+ */
+public void timerExec (int milliseconds, Runnable runnable) {
+ checkDevice ();
+ if (timerList == null) timerList = new Runnable [4];
+ if (timerIDs == null) timerIDs = new int [4];
+ int index = 0;
+ while (index < timerList.length) {
+ if (timerList [index] == null) break;
+ index++;
+ }
+ if (index == timerList.length) {
+ Runnable [] newTimerList = new Runnable [timerList.length + 4];
+ System.arraycopy (timerList, 0, newTimerList, 0, timerList.length);
+ timerList = newTimerList;
+ int [] newTimerIDs = new int [timerIDs.length + 4];
+ System.arraycopy (timerIDs, 0, newTimerIDs, 0, timerIDs.length);
+ timerIDs = newTimerIDs;
+ }
+ int timerID = OS.gtk_timeout_add (milliseconds, timerProc, index);
+ if (timerID != 0) {
+ timerIDs [index] = timerID;
+ timerList [index] = runnable;
+ }
+}
+
+int timerProc (int index, int id) {
+ if (timerList == null) return 0;
+ if (0 <= index && index < timerList.length) {
+ Runnable runnable = timerList [index];
+ timerList [index] = null;
+ timerIDs [index] = 0;
+ if (runnable != null) runnable.run ();
+ }
+ return 0;
+}
+
+int caretProc (int clientData, int id) {
+ caretID = 0;
+ if (currentCaret == null) {
+ return 0;
+ }
+ if (currentCaret.blinkCaret()) {
+ int blinkRate = currentCaret.blinkRate;
+ caretID = OS.gtk_timeout_add (blinkRate, caretProc, 0);
+ } else {
+ currentCaret = null;
+ }
+ return 0;
+}
+
+void setCurrentCaret (Caret caret) {
+ if (caretID != 0) OS.gtk_timeout_remove(caretID);
+ caretID = 0;
+ currentCaret = caret;
+ if (caret == null) return;
+ int blinkRate = currentCaret.blinkRate;
+ caretID = OS.gtk_timeout_add (blinkRate, caretProc, 0);
+}
+
+/**
+ * Causes the <code>run()</code> method of the runnable to
+ * be invoked by the user-interface thread at the next
+ * reasonable opportunity. The thread which calls this method
+ * is suspended until the runnable completes.
+ *
+ * @param runnable code to run on the user-interface thread.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_FAILED_EXEC - if an exception occured when executing the runnable</li>
+ * </ul>
+ *
+ * @see #asyncExec
+ */
+public void syncExec (Runnable runnable) {
+ if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
+ synchronizer.syncExec (runnable);
+}
+
+static int translateKey (int key) {
+ for (int i=0; i<KeyTable.length; i++) {
+ if (KeyTable [i] [0] == key) return KeyTable [i] [1];
+ }
+ return 0;
+}
+
+static int untranslateKey (int key) {
+ for (int i=0; i<KeyTable.length; i++) {
+ if (KeyTable [i] [1] == key) return KeyTable [i] [0];
+ }
+ return 0;
+}
+
+public void update () {
+ checkDevice ();
+ /* NOT IMPLEMENTED - Need to flush only pending draws */
+ OS.gdk_flush ();
+ while ((OS.gtk_events_pending ()) != 0) {
+ OS.gtk_main_iteration ();
+ }
+}
+
+/**
+ * If the receiver's user-interface thread was <code>sleep</code>'ing,
+ * causes it to be awakened and start running again. Note that this
+ * method may be called from any thread.
+ *
+ * @see #sleep
+ */
+public void wake () {
+ /* NOT IMPLEMENTED - Need to wake up the event loop */
+ if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
+}
+
+int windowProc (int handle, int user_data) {
+ Widget widget = WidgetTable.get (handle);
+ if (widget == null) return 0;
+ return widget.processEvent (user_data, 0, 0, 0);
+}
+
+int windowProc (int handle, int int0, int user_data) {
+ Widget widget = WidgetTable.get (handle);
+ if (widget == null) return 0;
+ return widget.processEvent (user_data, int0, 0, 0);
+}
+
+int windowProc (int handle, int int0, int int1, int user_data) {
+ Widget widget = WidgetTable.get (handle);
+ if (widget == null) return 0;
+ return widget.processEvent (user_data, int0, int1, 0);
+}
+
+int windowProc (int handle, int int0, int int1, int int2, int user_data) {
+ Widget widget = WidgetTable.get (handle);
+ if (widget == null) return 0;
+ return widget.processEvent (user_data, int0, int1, int2);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/FileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/FileDialog.java
new file mode 100644
index 0000000..8192904
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/FileDialog.java
@@ -0,0 +1,288 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ * Instances of this class allow the user to navigate
+ * the file system and select or enter a file name.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>SAVE, OPEN, MULTI</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+public class FileDialog extends Dialog {
+ String [] filterNames = new String [0];
+ String [] filterExtensions = new String [0];
+ String filterPath = "", fileName = "";
+ String fullPath = "";
+ boolean cancel = true;
+
+/**
+ * Constructs a new instance of this class given only its
+ * parent.
+ * <p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the dialog on the currently active
+ * display if there is one. If there is no current display, the
+ * dialog is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public FileDialog (Shell parent) {
+ this (parent, SWT.PRIMARY_MODAL);
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT dialog classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the dialog on the currently active
+ * display if there is one. If there is no current display, the
+ * dialog is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public FileDialog (Shell parent, int style) {
+ super (parent, style);
+}
+int cancelFunc (int widget, int callData) {
+ cancel = true;
+ OS.gtk_widget_destroy (callData);
+ return 0;
+}
+int destroyFunc (int widget, int callData) {
+ OS.gtk_main_quit ();
+ return 0;
+}
+/**
+ * Returns the path of the first file that was
+ * selected in the dialog relative to the filter path,
+ * or null if none is available.
+ *
+ * @return the relative path of the file
+ */
+public String getFileName () {
+ return fileName;
+}
+/**
+ * Returns the paths of all files that were selected
+ * in the dialog relative to the filter path, or null
+ * if none are available.
+ *
+ * @return the relative paths of the files
+ */
+public String [] getFileNames () {
+ return new String[] {fileName};
+}
+/**
+ * Returns the file extensions which the dialog will
+ * use to filter the files it shows.
+ *
+ * @return the file extensions filter
+ */
+public String [] getFilterExtensions () {
+ return filterExtensions;
+}
+/**
+ * Returns the file names which the dialog will
+ * use to filter the files it shows.
+ *
+ * @return the file name filter
+ */
+public String [] getFilterNames () {
+ return filterNames;
+}
+/**
+ * Returns the path which the dialog will use to filter
+ * the files it shows.
+ *
+ * @return the filter path
+ */
+public String getFilterPath () {
+ return filterPath;
+}
+int okFunc (int widget, int callData) {
+ cancel = false;
+ char separator = System.getProperty ("file.separator").charAt (0);
+ int lpFilename = OS.gtk_file_selection_get_filename (callData);
+ int filenameLength = OS.strlen (lpFilename);
+ byte [] filenameBytes = new byte [filenameLength];
+ OS.memmove (filenameBytes, lpFilename, filenameLength);
+ fullPath = new String (Converter.mbcsToWcs (null, filenameBytes));
+
+ /* Calculate fileName and filterPath */
+ int separatorIndex = fullPath.indexOf (separator);
+ int index = separatorIndex;
+ while (index != -1) {
+ separatorIndex = index;
+ index = fullPath.indexOf (separator, index + 1);
+ }
+ fileName = fullPath.substring (separatorIndex + 1, fullPath.length ());
+ filterPath = fullPath.substring (0, separatorIndex);
+ OS.gtk_widget_destroy (callData);
+ return 0;
+}
+/**
+ * Makes the dialog visible and brings it to the front
+ * of the display.
+ *
+ * @return a string describing the absolute path of the first selected file,
+ * or null if the dialog was cancelled or an error occurred
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
+ * </ul>
+ */
+public String open () {
+ byte [] titleBytes = Converter.wcsToMbcs (null, title, true);
+ int handle = OS.gtk_file_selection_new (titleBytes);
+ GtkFileSelection dialog = new GtkFileSelection ();
+ OS.memmove (dialog, handle, GtkFileSelection.sizeof);
+
+ /* Calculate the fully-specified file name and convert to bytes */
+ StringBuffer stringBuffer = new StringBuffer ();
+ char separator = System.getProperty ("file.separator").charAt (0);
+ if (filterPath == null) {
+ filterPath = "";
+ } else {
+ if (filterPath.length () > 0) {
+ stringBuffer.append (filterPath);
+ if (filterPath.charAt (filterPath.length () - 1) != separator) {
+ stringBuffer.append (separator);
+ }
+ }
+ }
+ if (fileName == null) {
+ fileName = "";
+ } else {
+ stringBuffer.append (fileName);
+ }
+ fullPath = stringBuffer.toString ();
+ byte [] fullPathBytes = Converter.wcsToMbcs (null, fullPath, true);
+ OS.gtk_file_selection_set_filename (handle, fullPathBytes);
+
+ /* Set the extension */
+ if (filterNames == null) filterNames = new String [0];
+ if (filterExtensions == null) filterExtensions = new String [0];
+ if (filterExtensions.length == 1) {
+ String ext = filterExtensions [0];
+ byte [] extBytes = Converter.wcsToMbcs (null, ext, true);
+ OS.gtk_file_selection_complete (handle, extBytes);
+ }
+
+ /* Hook callbacks */
+ Callback destroyCallback = new Callback (this, "destroyFunc", 2);
+ int destroyFunc = destroyCallback.getAddress ();
+ byte [] destroy = Converter.wcsToMbcs (null, "destroy", true);
+ OS.gtk_signal_connect (handle, destroy, destroyFunc, handle);
+ byte [] clicked = Converter.wcsToMbcs (null, "clicked", true);
+ Callback okCallback = new Callback (this, "okFunc", 2);
+ int okFunc = okCallback.getAddress ();
+ Callback cancelCallback = new Callback (this, "cancelFunc", 2);
+ int cancelFunc = cancelCallback.getAddress ();
+ OS.gtk_signal_connect (dialog.ok_button, clicked, okFunc, handle);
+ OS.gtk_signal_connect (dialog.cancel_button, clicked, cancelFunc, handle);
+
+ fileName = null;
+ fullPath = null;
+ filterPath = null;
+
+ /* Show the dialog */
+ cancel = true;
+ OS.gtk_widget_show_now (handle);
+ OS.gtk_main ();
+
+ destroyCallback.dispose ();
+ okCallback.dispose ();
+ cancelCallback.dispose ();
+
+ /* Return the full path or null */
+ if (cancel) return null;
+ return fullPath;
+}
+/**
+ * Set the initial filename which the dialog will
+ * select by default when opened to the argument,
+ * which may be null. The name will be prefixed with
+ * the filter path when one is supplied.
+ *
+ * @param string the file name
+ */
+public void setFileName (String string) {
+ fileName = string;
+}
+/**
+ * Set the file extensions which the dialog will
+ * use to filter the files it shows to the argument,
+ * which may be null.
+ *
+ * @param extensions the file extension filter
+ */
+public void setFilterExtensions (String [] extensions) {
+ filterExtensions = extensions;
+}
+/**
+ * Sets the file names which the dialog will
+ * use to filter the files it shows to the argument,
+ * which may be null.
+ *
+ * @param names the file name filter
+ */
+public void setFilterNames (String [] names) {
+ filterNames = names;
+}
+/**
+ * Sets the path which the dialog will use to filter
+ * the files it shows to the argument, which may be
+ * null.
+ *
+ * @param string the filter path
+ */
+public void setFilterPath (String string) {
+ filterPath = string;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/FontDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/FontDialog.java
new file mode 100644
index 0000000..bf6b90c
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/FontDialog.java
@@ -0,0 +1,161 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class allow the user to select a font
+ * from all available fonts in the system.
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+
+public class FontDialog extends Dialog {
+ FontData fontData;
+/**
+ * Constructs a new instance of this class given only its
+ * parent.
+ * <p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the dialog on the currently active
+ * display if there is one. If there is no current display, the
+ * dialog is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public FontDialog (Shell parent) {
+ this (parent, SWT.PRIMARY_MODAL);
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT dialog classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the dialog on the currently active
+ * display if there is one. If there is no current display, the
+ * dialog is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public FontDialog (Shell parent, int style) {
+ super (parent, style);
+}
+int cancelFunc (int widget, int callData) {
+ OS.gtk_widget_destroy (callData);
+ return 0;
+}
+int destroyFunc (int widget, int colorInfo) {
+ OS.gtk_main_quit ();
+ return 0;
+}
+/**
+ * Returns a FontData object describing the font that was
+ * selected in the dialog, or null if none is available.
+ *
+ * @return the FontData for the selected font, or null
+ */
+public FontData getFontData() {
+ return fontData;
+}
+int okFunc (int widget, int callData) {
+ int hFontName = OS.gtk_font_selection_dialog_get_font_name (callData);
+ int fontSize = OS.strlen (hFontName);
+ byte [] buffer = new byte [fontSize];
+ OS.memmove (buffer, hFontName, fontSize);
+ char [] fontName = Converter.mbcsToWcs (null, buffer);
+ fontData = FontData.gtk_new(new String (fontName));
+ OS.gtk_widget_destroy (callData);
+ return 0;
+}
+/**
+ * Makes the dialog visible and brings it to the front
+ * of the display.
+ *
+ * @return a FontData object describing the font that was selected,
+ * or null if the dialog was cancelled or an error occurred
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
+ * </ul>
+ */
+public FontData open () {
+ int handle;
+ byte [] titleBytes;
+ titleBytes = Converter.wcsToMbcs (null, title, true);
+ handle = OS.gtk_font_selection_dialog_new (titleBytes);
+ GtkFontSelectionDialog dialog = new GtkFontSelectionDialog ();
+ OS.memmove (dialog, handle, GtkFontSelectionDialog.sizeof);
+ if (fontData != null) {
+ byte[] buffer = Converter.wcsToMbcs(null, fontData.getXlfd(), true);
+ OS.gtk_font_selection_set_font_name(dialog.fontsel, buffer);
+ }
+ Callback destroyCallback = new Callback (this, "destroyFunc", 2);
+ int destroyFunc = destroyCallback.getAddress ();
+ byte [] destroy = Converter.wcsToMbcs (null, "destroy", true);
+ OS.gtk_signal_connect (handle, destroy, destroyFunc, handle);
+ byte [] clicked = Converter.wcsToMbcs (null, "clicked", true);
+ Callback okCallback = new Callback (this, "okFunc", 2);
+ int okFunc = okCallback.getAddress ();
+ Callback cancelCallback = new Callback (this, "cancelFunc", 2);
+ int cancelFunc = cancelCallback.getAddress ();
+ OS.gtk_signal_connect (dialog.ok_button, clicked, okFunc, handle);
+ OS.gtk_signal_connect (dialog.cancel_button, clicked, cancelFunc, handle);
+ fontData = null;
+ OS.gtk_widget_show_now (handle);
+ OS.gtk_main ();
+ destroyCallback.dispose ();
+ okCallback.dispose ();
+ cancelCallback.dispose ();
+ return fontData;
+}
+/**
+ * Sets a FontData object describing the font to be
+ * selected by default in the dialog, or null to let
+ * the platform choose one.
+ *
+ * @param fontData the FontData to use initially, or null
+ */
+public void setFontData (FontData fontData) {
+ this.fontData = fontData;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Group.java
new file mode 100644
index 0000000..b0d72d4
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Group.java
@@ -0,0 +1,253 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class provide an etched border
+ * with an optional title.
+ * <p>
+ * Shadow styles are hints and may not be honoured
+ * by the platform. To create a group with the
+ * default shadow style for the platform, do not
+ * specify a shadow style.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>SHADOW_ETCHED_IN, SHADOW_ETCHED_OUT, SHADOW_IN, SHADOW_OUT, SHADOW_NONE</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+public class Group extends Composite {
+ int frameHandle;
+ String text="";
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Group (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+static int checkStyle (int style) {
+ /*
+ * Even though it is legal to create this widget
+ * with scroll bars, they serve no useful purpose
+ * because they do not automatically scroll the
+ * widget's client area. The fix is to clear
+ * the SWT style.
+ */
+ return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
+}
+
+void createHandle(int index) {
+ state |= HANDLE;
+
+ eventBoxHandle = OS.gtk_event_box_new ();
+ if (eventBoxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ frameHandle = OS.gtk_frame_new(null);
+ if (frameHandle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ handle = OS.gtk_fixed_new();
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void _setHandleStyle() {
+ int shadow = OS.GTK_SHADOW_IN;
+ if ((style & SWT.SHADOW_IN) != 0) shadow = OS.GTK_SHADOW_IN;
+ if ((style & SWT.SHADOW_OUT) != 0) shadow = OS.GTK_SHADOW_OUT;
+ if ((style & SWT.SHADOW_ETCHED_IN) != 0) shadow = OS.GTK_SHADOW_ETCHED_IN;
+ if ((style & SWT.SHADOW_ETCHED_OUT) != 0) shadow = OS.GTK_SHADOW_ETCHED_OUT;
+ OS.gtk_frame_set_shadow_type(frameHandle, shadow);
+}
+
+void configure() {
+ _connectParent();
+ OS.gtk_container_add(eventBoxHandle, frameHandle);
+ OS.gtk_container_add(frameHandle, handle);
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ int width = _computeSize(wHint, hHint, changed).x;
+ int height = 0;
+ Point size;
+ if (layout != null) {
+ size = layout.computeSize (this, wHint, hHint, changed);
+ } else {
+ size = minimumSize ();
+ }
+ if (size.x == 0) size.x = DEFAULT_WIDTH;
+ if (size.y == 0) size.y = DEFAULT_HEIGHT;
+ if (wHint != SWT.DEFAULT) size.x = wHint;
+ if (hHint != SWT.DEFAULT) size.y = hHint;
+ width = Math.max (width, size.x);
+ height = Math.max (height, size.y);
+ Rectangle trim = computeTrim (0, 0, width, height);
+ width = trim.width; height = trim.height;
+ return new Point (width, height);
+}
+
+void showHandle() {
+ OS.gtk_widget_show (eventBoxHandle);
+ OS.gtk_widget_show (frameHandle);
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void register () {
+ super.register ();
+ WidgetTable.put (frameHandle, this);
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ frameHandle = 0;
+}
+
+void releaseWidget () {
+ super.releaseWidget ();
+ text = null;
+}
+
+void deregister () {
+ super.deregister ();
+ WidgetTable.remove (frameHandle);
+}
+
+int topHandle () { return eventBoxHandle; }
+int parentingHandle() { return handle; }
+
+/*
+ * === GEOMETRY ===
+ */
+
+public Rectangle _getClientArea () {
+ /*
+ * The Group coordinates originate at the client area
+ */
+ int width, height;
+ Point size = _getSize();
+ width = size.x - _getTrim().left - _getTrim().right;
+ height = size.y - _getTrim().top - _getTrim().bottom;
+ return new Rectangle(0,0, width, height);
+}
+
+Trim _getTrim() {
+ trim = new Trim();
+
+ // set up the test widgets
+ int testWindowHandle = OS.gtk_window_new(0);
+ int testHandle = OS.gtk_frame_new(string2bytesConvertMnemonic("Test String"));
+ OS.gtk_container_add(testWindowHandle, testHandle);
+ OS.gtk_widget_realize(testHandle);
+
+ // get info
+ GtkFrame frame = new GtkFrame();
+ OS.memmove (frame, testHandle, GtkFrame.sizeof);
+ GtkStyle groupStyle = new GtkStyle();
+ OS.memmove (groupStyle, frame.style, GtkStyle.sizeof);
+ GtkStyleClass styleClass = new GtkStyleClass();
+ OS.memmove (styleClass, groupStyle.klass, GtkStyleClass.sizeof);
+
+ // see gtk_frame_size_allocate()
+ trim.left = trim.right = frame.border_width + styleClass.xthickness;
+ trim.top = frame.border_width + Math.max(frame.label_height, styleClass.ythickness);
+ trim.bottom = frame.border_width + styleClass.ythickness;
+
+ // clean up
+ OS.gtk_widget_destroy(testHandle);
+ OS.gtk_widget_destroy(testWindowHandle);
+ return trim;
+}
+
+boolean _setSize(int width, int height) {
+ boolean differentExtent = UtilFuncs.setSize (topHandle(), width,height);
+ Point clientSize = UtilFuncs.getSize(frameHandle);
+ // WRONG but it's quite safe - the frame clips it
+ UtilFuncs.setSize (handle, clientSize.x, clientSize.y);
+ return differentExtent;
+}
+/* ========= Model Logic ========= */
+
+String getNameText () {
+ return getText ();
+}
+/**
+ * Returns the receiver's text, which is the string that the
+ * is used as the <em>title</em>. If the text has not previously
+ * been set, returns an empty string.
+ *
+ * @return the text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getText () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return text;
+}
+
+
+/**
+ * Sets the receiver's text, which is the string that will
+ * be displayed as the receiver's <em>title</em>, to the argument,
+ * which may not be null.
+ *
+ * @param text the new text
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ OS.gtk_frame_set_label (frameHandle, string2bytesConvertMnemonic(string));
+ text=string;
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Label.java
new file mode 100644
index 0000000..84f872b
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Label.java
@@ -0,0 +1,365 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class represent a non-selectable
+ * user interface object that displays a string or image.
+ * When SEPARATOR is specified, displays a single
+ * vertical or horizontal line.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>SEPARATOR, HORIZONTAL, SHADOW_IN, SHADOW_OUT, VERTICAL</dd>
+ * <dd>CENTER, LEFT, RIGHT, WRAP</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+
+public class Label extends Control {
+ int boxHandle, frameHandle;
+ Image image;
+ String text;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Label (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+static int checkStyle (int style) {
+ if ((style & SWT.SEPARATOR) != 0) return style;
+ return checkBits (style, SWT.LEFT, SWT.CENTER, SWT.RIGHT, 0, 0, 0);
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+
+ boxHandle = OS.gtk_event_box_new ();
+ if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ frameHandle = OS.gtk_frame_new(null);
+ if (frameHandle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ handle = ((style&SWT.SEPARATOR) != 0)? (((style&SWT.HORIZONTAL)!= 0)?
+ OS.gtk_hseparator_new() : OS.gtk_vseparator_new()):
+ OS.gtk_label_new (new byte [1]);
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void createWidget (int index) {
+ super.createWidget (index);
+ text = "";
+}
+
+void setHandleStyle () {
+ int type = (style & SWT.BORDER) != 0 ? OS.GTK_SHADOW_ETCHED_IN : OS.GTK_SHADOW_NONE;
+ OS.gtk_frame_set_shadow_type (frameHandle, type);
+ if ((style & SWT.SEPARATOR) != 0) return;
+ if ((style & SWT.WRAP) != 0) OS.gtk_label_set_line_wrap (handle, true);
+ if ((style & SWT.LEFT) != 0) {
+ OS.gtk_misc_set_alignment (handle, 0.0f, 0.0f);
+ OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_LEFT);
+ return;
+ }
+ if ((style & SWT.CENTER) != 0) {
+ OS.gtk_misc_set_alignment (handle, 0.5f, 0.0f);
+ OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_CENTER);
+ return;
+ }
+ if ((style & SWT.RIGHT) != 0) {
+ OS.gtk_misc_set_alignment (handle, 1.0f, 0.0f);
+ OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_RIGHT);
+ return;
+ }
+}
+
+void configure() {
+ _connectParent();
+ OS.gtk_container_add(boxHandle, frameHandle);
+ OS.gtk_container_add(frameHandle, handle);
+}
+
+void showHandle() {
+ OS.gtk_widget_show (boxHandle);
+ OS.gtk_widget_show (frameHandle);
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void register () {
+ super.register ();
+ WidgetTable.put (boxHandle, this);
+ WidgetTable.put (frameHandle, this);
+}
+
+void deregister () {
+ super.deregister ();
+ WidgetTable.remove (boxHandle);
+ WidgetTable.remove (frameHandle);
+}
+
+int eventHandle () {
+ return boxHandle;
+}
+
+void releaseWidget () {
+ super.releaseWidget ();
+ image = null;
+ text = null;
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ boxHandle = frameHandle = 0;
+}
+
+int topHandle () {
+ return boxHandle;
+}
+
+int computeHandle () {
+ return frameHandle;
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ if ((style&SWT.SEPARATOR) != 0) {
+ int w, h;
+ if ((style&SWT.HORIZONTAL)!= 0) {
+ w = 45;
+ h = 6;
+ } else { // vertical
+ w = 6;
+ h = 45;
+ }
+ if (wHint != SWT.DEFAULT) w = wHint;
+ if (hHint != SWT.DEFAULT) h = hHint;
+ return new Point(w,h);
+ }
+ return super.computeSize(wHint, hHint, changed);
+}
+
+/**
+ * Returns a value which describes the position of the
+ * text or image in the receiver. The value will be one of
+ * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>
+ * unless the receiver is a <code>SEPARATOR</code> label, in
+ * which case, <code>NONE</code> is returned.
+ *
+ * @return the alignment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getAlignment () {
+ checkWidget ();
+ if ((style & SWT.SEPARATOR) != 0) return 0;
+ if ((style & SWT.LEFT) != 0) return SWT.LEFT;
+ if ((style & SWT.CENTER) != 0) return SWT.CENTER;
+ if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
+ return SWT.LEFT;
+}
+
+/**
+ * Returns the receiver's image if it has one, or null
+ * if it does not.
+ *
+ * @return the receiver's image
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Image getImage () {
+ checkWidget ();
+ return image;
+}
+
+String getNameText () {
+ return getText ();
+}
+
+/**
+ * Returns the receiver's text, which will be an empty
+ * string if it has never been set or if the receiver is
+ * a <code>SEPARATOR</code> label.
+ *
+ * @return the receiver's text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getText () {
+ checkWidget ();
+ if ((style & SWT.SEPARATOR) != 0) return "";
+ return text;
+}
+
+/**
+ * Controls how text and images will be displayed in the receiver.
+ * The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
+ * or <code>CENTER</code>. If the receiver is a <code>SEPARATOR</code>
+ * label, the argument is ignored and the alignment is not changed.
+ *
+ * @param alignment the new alignment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setAlignment (int alignment) {
+ checkWidget ();
+ if ((style & SWT.SEPARATOR) != 0) return;
+ if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
+ style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
+ style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
+ boolean isText = OS.GTK_WIDGET_TYPE (handle) == OS.gtk_label_get_type ();
+ if ((style & SWT.LEFT) != 0) {
+ OS.gtk_misc_set_alignment (handle, 0.0f, 0.0f);
+ if (isText) OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_LEFT);
+ return;
+ }
+ if ((style & SWT.CENTER) != 0) {
+ OS.gtk_misc_set_alignment (handle, 0.5f, 0.0f);
+ if (isText) OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_CENTER);
+ return;
+ }
+ if ((style & SWT.RIGHT) != 0) {
+ OS.gtk_misc_set_alignment (handle, 1.0f, 0.0f);
+ if (isText) OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_RIGHT);
+ return;
+ }
+}
+
+/**
+ * Sets the receiver's image to the argument, which may be
+ * null indicating that no image should be displayed.
+ *
+ * @param image the image to display on the receiver (may be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setImage (Image image) {
+ checkWidget ();
+ this.image = image;
+ if ((style & SWT.SEPARATOR) != 0) return;
+ //NOT IMPLEMENTED - events and state of handle lost
+ WidgetTable.remove (handle);
+ OS.gtk_widget_destroy (handle);
+ if (image == null) {
+ handle = OS.gtk_label_new (new byte [1]);
+ } else {
+ handle = OS.gtk_pixmap_new (image.pixmap, image.mask);
+ }
+ OS.gtk_container_add (frameHandle, handle);
+ WidgetTable.put (handle, this);
+ int alignment = style & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
+ switch (alignment) {
+ case SWT.LEFT: OS.gtk_misc_set_alignment (handle, 0.0f, 0.0f); break;
+ case SWT.CENTER: OS.gtk_misc_set_alignment (handle, 0.5f, 0.0f); break;
+ case SWT.RIGHT: OS.gtk_misc_set_alignment (handle, 1.0f, 0.0f); break;
+ }
+ OS.gtk_widget_show (handle);
+}
+
+/**
+ * Sets the receiver's text.
+ * <p>
+ * This method sets the widget label. The label may include
+ * the mnemonic characters and line delimiters.
+ * </p>
+ *
+ * @param string the new text
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setText (String string) {
+ checkWidget();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if ((style & SWT.SEPARATOR) != 0) return;
+ text = string;
+ boolean isText = OS.GTK_WIDGET_TYPE (handle) == OS.gtk_label_get_type ();
+ if (!isText) {
+ //NOT IMPLEMENTED - events and state of handle lost
+ WidgetTable.remove (handle);
+ OS.gtk_widget_destroy (handle);
+ handle = OS.gtk_label_new (new byte [1]);
+ OS.gtk_container_add (frameHandle, handle);
+ WidgetTable.put (handle, this);
+ int alignment = style & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
+ switch (alignment) {
+ case SWT.LEFT:
+ OS.gtk_misc_set_alignment (handle, 0.0f, 0.0f);
+ OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_LEFT);
+ break;
+ case SWT.CENTER:
+ OS.gtk_misc_set_alignment (handle, 0.5f, 0.0f);
+ OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_CENTER);
+ break;
+ case SWT.RIGHT:
+ OS.gtk_misc_set_alignment (handle, 1.0f, 0.0f);
+ OS.gtk_label_set_justify (handle, OS.GTK_JUSTIFY_RIGHT);
+ break;
+ }
+ }
+ OS.gtk_label_parse_uline (handle, string2bytesConvertMnemonic(string));
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/List.java
new file mode 100644
index 0000000..3965964
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/List.java
@@ -0,0 +1,1089 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+
+/**
+ * Instances of this class represent a selectable user interface
+ * object that displays a list of strings and issues notificiation
+ * when a string selected. A list may be single or multi select.
+ * <p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>SINGLE, MULTI</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection, DefaultSelection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+
+public class List extends Scrollable {
+ int boxHandle;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public List (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+/**
+ * Adds the argument to the end of the receiver's list.
+ *
+ * @param string the new item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ *
+ * @see #add(String,int)
+ */
+public void add (String string) {
+ checkWidget();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ int ptr = OS.g_malloc (buffer.length);
+ OS.memmove (ptr, buffer, buffer.length);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ int result = OS.gtk_clist_append (handle, new int [] {ptr});
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ OS.g_free (ptr);
+}
+/**
+ * Adds the argument to the receiver's list at the given
+ * zero-relative index.
+ * <p>
+ * Note: To add an item at the end of the list, use the
+ * result of calling <code>getItemCount()</code> as the
+ * index or use <code>add(String)</code>.
+ * </p>
+ *
+ * @param string the new item
+ * @param index the index for the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ *
+ * @see #add(String)
+ */
+public void add (String string, int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (index == -1) error (SWT.ERROR_ITEM_NOT_ADDED);
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ int ptr = OS.g_malloc (buffer.length);
+ OS.memmove (ptr, buffer, buffer.length);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ int result = OS.gtk_clist_insert (handle, index, new int [] {ptr});
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ OS.g_free (ptr);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's selection changes, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * <code>widgetSelected</code> is called when the selection changes.
+ * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener(SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+static int checkStyle (int style) {
+ return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+ boxHandle = OS.gtk_hbox_new(true,0); // false for homogeneous; doesn't really matter
+ if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ handle = OS.gtk_clist_new (1);
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+ scrolledHandle = OS.gtk_scrolled_window_new (0, 0);
+ if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void setHandleStyle() {
+ int selectionMode = ((style & SWT.MULTI) != 0)?
+ OS.GTK_SELECTION_EXTENDED :
+ OS.GTK_SELECTION_BROWSE;
+ OS.gtk_clist_set_selection_mode (handle, selectionMode);
+
+ int border = OS.GTK_SHADOW_NONE;
+ if ((style&SWT.BORDER)!=0) {
+ border = OS.GTK_SHADOW_ETCHED_IN;
+ if ((style&SWT.SHADOW_IN)!=0) border = OS.GTK_SHADOW_IN;
+ if ((style&SWT.SHADOW_OUT)!=0) border = OS.GTK_SHADOW_OUT;
+ if ((style&SWT.SHADOW_ETCHED_IN)!=0) border = OS.GTK_SHADOW_ETCHED_IN;
+ if ((style&SWT.SHADOW_ETCHED_OUT)!=0) border = OS.GTK_SHADOW_ETCHED_OUT;
+ }
+ OS.gtk_clist_set_shadow_type(handle, border);
+ setScrollingPolicy();
+}
+
+void configure() {
+ _connectParent();
+ OS.gtk_box_pack_start(boxHandle, scrolledHandle, true,true,0);
+ OS.gtk_container_add (scrolledHandle, handle);
+}
+
+void hookEvents () {
+ //TO DO - get rid of enter/exit for mouse crossing border
+ super.hookEvents();
+ signal_connect(handle, "select_row", SWT.Selection, 5);
+ signal_connect(handle, "unselect_row", SWT.Selection, 5);
+ signal_connect(handle, "extend_selection", SWT.Selection, 5);
+}
+
+void showHandle() {
+ OS.gtk_widget_show (boxHandle);
+ OS.gtk_widget_show (scrolledHandle);
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void register () {
+ super.register ();
+ WidgetTable.put (boxHandle, this);
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ boxHandle = 0;
+}
+
+void deregister () {
+ super.deregister ();
+ WidgetTable.remove (boxHandle);
+}
+
+int topHandle() {
+ return boxHandle;
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ if (wHint == SWT.DEFAULT) wHint = 200;
+ return super.computeSize (wHint, hHint, changed);
+}
+
+
+/**
+ * Deselects the item at the given zero-relative index in the receiver.
+ * If the item at the index was already deselected, it remains
+ * deselected. Indices that are out of range are ignored.
+ *
+ * @param index the index of the item to deselect
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselect (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_unselect_row (handle, index, 0);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Deselects the items at the given zero-relative indices in the receiver.
+ * If the item at the given zero-relative index in the receiver
+ * is selected, it is deselected. If the item at the index
+ * was not selected, it remains deselected. The range of the
+ * indices is inclusive. Indices that are out of range are ignored.
+ *
+ * @param start the start index of the items to deselect
+ * @param end the end index of the items to deselect
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselect (int start, int end) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ for (int i=start; i<=end; i++) {
+ OS.gtk_clist_unselect_row (handle, i, 0);
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Deselects the items at the given zero-relative indices in the receiver.
+ * If the item at the given zero-relative index in the receiver
+ * is selected, it is deselected. If the item at the index
+ * was not selected, it remains deselected. Indices that are out
+ * of range and duplicate indices are ignored.
+ *
+ * @param indices the array of indices for the items to deselect
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselect (int [] indices) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ for (int i=0; i<indices.length; i++) {
+ OS.gtk_clist_unselect_row (handle, indices [i], 0);
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Deselects all selected items in the receiver.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselectAll () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_unselect_all (handle);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Returns the item at the given, zero-relative index in the
+ * receiver. Throws an exception if the index is out of range.
+ *
+ * @param index the index of the item to return
+ * @return the item at the given index
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public String getItem (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int [] buffer = new int [1];
+ int result = OS.gtk_clist_get_text (handle, index, 0, buffer);
+ int length = OS.strlen (buffer [0]);
+ byte [] buffer1 = new byte [length];
+ OS.memmove (buffer1, buffer [0], length);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ return new String (buffer2, 0, buffer2.length);
+}
+/**
+ * Returns the number of items contained in the receiver.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public int getItemCount () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkCList widget = new GtkCList ();
+ OS.memmove (widget, handle, GtkCList.sizeof);
+ return widget.rows;
+}
+/**
+ * Returns the height of the area which would be used to
+ * display <em>one</em> of the items in the tree.
+ *
+ * @return the height of one item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_ITEM_HEIGHT - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public int getItemHeight () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkCList clist = new GtkCList ();
+ OS.memmove (clist, handle, GtkCList.sizeof);
+ return clist.row_height;
+}
+/**
+ * Returns an array of <code>String</code>s which are the items
+ * in the receiver.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the items in the receiver's list
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
+ * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure while getting the item count</li>
+ * </ul>
+ */
+public String [] getItems () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int count = getItemCount ();
+ String [] result = new String [count];
+ for (int i=0; i<count; i++) result [i] = getItem (i);
+ return result;
+}
+/**
+ * Returns an array of <code>String</code>s that are currently
+ * selected in the receiver. An empty array indicates that no
+ * items are selected.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its selection, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ * @return an array representing the selection
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure while getting the selection</li>
+ * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
+ * </ul>
+ */
+public String [] getSelection () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkCList widget = new GtkCList ();
+ OS.memmove (widget, handle, GtkCList.sizeof);
+ int list = widget.selection;
+ if (list==0) return new String[0];
+ int length = OS.g_list_length (list);
+ String [] items = new String [length];
+ int [] buffer = new int [1];
+ for (int i=0; i<length; i++) {
+ int index = OS.g_list_nth_data (list, i);
+ int result = OS.gtk_clist_get_text (handle, index, 0, buffer);
+ int strlen = OS.strlen (buffer [0]);
+ byte [] buffer1 = new byte [strlen];
+ OS.memmove (buffer1, buffer [0], strlen);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ items [i] = new String (buffer2, 0, buffer2.length);
+ }
+ return items;
+}
+/**
+ * Returns the number of selected items contained in the receiver.
+ *
+ * @return the number of selected items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public int getSelectionCount () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkCList widget = new GtkCList ();
+ OS.memmove (widget, handle, GtkCList.sizeof);
+ return OS.g_list_length (widget.selection);
+}
+/**
+ * Returns the zero-relative index of the item which is currently
+ * selected in the receiver, or -1 if no item is selected.
+ *
+ * @return the index of the selected item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public int getSelectionIndex () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+
+ if ((style&SWT.SINGLE)!=0) {
+ GtkCList clist = new GtkCList();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ int pselection = clist.selection;
+ if (OS.g_list_length (pselection) == 0) return -1;
+ return OS.g_list_nth_data (pselection, 0);
+ }
+
+ error(SWT.ERROR_NOT_IMPLEMENTED);
+ return 0;
+}
+/**
+ * Returns the zero-relative indices of the items which are currently
+ * selected in the receiver. The array is empty if no items are selected.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its selection, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ * @return the array of indices of the selected items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_SELECTION - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public int [] getSelectionIndices () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkCList widget = new GtkCList ();
+ OS.memmove (widget, handle, GtkCList.sizeof);
+ int list = widget.selection;
+ int length = OS.g_list_length (list);
+ int [] indices = new int [length];
+ for (int i=0; i<length; i++) {
+ indices [i] = OS.g_list_nth_data (list, i);
+ }
+ return indices;
+}
+/**
+ * Returns the zero-relative index of the item which is currently
+ * at the top of the receiver. This index can change when items are
+ * scrolled or new items are added or removed.
+ *
+ * @return the index of the top item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getTopIndex () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkCList clist = new GtkCList ();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ return -clist.voffset / (clist.row_height + 1);
+}
+
+/**
+ * Gets the index of an item.
+ * <p>
+ * The list is searched starting at 0 until an
+ * item is found that is equal to the search item.
+ * If no item is found, -1 is returned. Indexing
+ * is zero based.
+ *
+ * @param string the search item
+ * @return the index of the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int indexOf (String string) {
+ if (!isValidThread ()) error(SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error(SWT.ERROR_WIDGET_DISPOSED);
+ return indexOf (string, 0);
+}
+/**
+ * Searches the receiver's list starting at the given,
+ * zero-relative index until an item is found that is equal
+ * to the argument, and returns the index of that item. If
+ * no item is found or the starting index is out of range,
+ * returns -1.
+ *
+ * @param string the search item
+ * @return the index of the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure while getting the item count</li>
+ * <li>ERROR_CANNOT_GET_ITEM - if the operation fails because of an operating system failure while getting an item</li>
+ * </ul>
+ */
+public int indexOf (String string, int start) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ String [] items = getItems ();
+ for (int i=start; i<items.length; i++) {
+ if (items [i].equals (string)) return i;
+ }
+ return -1;
+}
+/**
+ * Returns <code>true</code> if the item is selected,
+ * and <code>false</code> otherwise. Indices out of
+ * range are ignored.
+ *
+ * @param index the index of the item
+ * @return the visibility state of the item at the index
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isSelected (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkCList widget = new GtkCList ();
+ OS.memmove (widget, handle, GtkCList.sizeof);
+ int list = widget.selection;
+ int length = OS.g_list_length (list);
+ for (int i=0; i<length; i++) {
+ if (index == OS.g_list_nth_data (list, i)) return true;
+ }
+ return false;
+}
+/**
+ * Removes the item from the receiver at the given
+ * zero-relative index.
+ *
+ * @param index the index for the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_remove (handle, index);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Removes the items from the receiver which are
+ * between the given zero-relative start and end
+ * indices (inclusive).
+ *
+ * @param start the start of the range
+ * @param end the end of the range
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (int start, int end) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ int index = start;
+ while (index <= end) {
+ OS.gtk_clist_remove (handle, start);
+ index++;
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Searches the receiver's list starting at the first item
+ * until an item is found that is equal to the argument,
+ * and removes that item from the list.
+ *
+ * @param string the item to remove
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int index = indexOf (string, 0);
+ if (index == -1) error (SWT.ERROR_ITEM_NOT_REMOVED);
+ remove (index);
+}
+/**
+ * Removes the items from the receiver at the given
+ * zero-relative indices.
+ *
+ * @param indices the array of indices of the items
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (int [] indices) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
+ int [] newIndices = new int [indices.length];
+ System.arraycopy (indices, 0, newIndices, 0, indices.length);
+ sort (newIndices);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ int last = -1;
+ for (int i=0; i<newIndices.length; i++) {
+ int index = newIndices [i];
+ if (index != last || i == 0) {
+ OS.gtk_clist_remove (handle, index);
+ last = index;
+ }
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Removes all of the items from the receiver.
+ * <p>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void removeAll () {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_clear (handle);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's selection changes.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener(SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+/**
+ * Selects the item at the given zero-relative index in the receiver's
+ * list. If the item at the index was already selected, it remains
+ * selected. Indices that are out of range are ignored.
+ *
+ * @param index the index of the item to select
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void select (int index) {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_select_row (handle, index, 0);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Selects the items at the given zero-relative indices in the receiver.
+ * If the item at the index was already selected, it remains
+ * selected. The range of the indices is inclusive. Indices that are
+ * out of range are ignored.
+ *
+ * @param start the start of the range
+ * @param end the end of the range
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void select (int start, int end) {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ for (int i=start; i<=end; i++) {
+ OS.gtk_clist_select_row (handle, i, 0);
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Selects the items at the given zero-relative indices in the receiver.
+ * If the item at the given zero-relative index in the receiver
+ * is not selected, it is selected. If the item at the index
+ * was selected, it remains selected. Indices that are out
+ * of range and duplicate indices are ignored.
+ *
+ * @param indices the array of indices for the items to select
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void select (int [] indices) {
+ checkWidget();
+ if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ for (int i=0; i<indices.length; i++) {
+ OS.gtk_clist_select_row (handle, indices [i], 0);
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Selects all the items in the receiver.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void selectAll () {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_select_all (handle);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Sets the text of the item in the receiver's list at the given
+ * zero-relative index to the string argument. This is equivalent
+ * to <code>remove</code>'ing the old item at the index, and then
+ * <code>add</code>'ing the new item at that index.
+ *
+ * @param index the index for the item
+ * @param string the new text for the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the remove operation fails because of an operating system failure</li>
+ * <li>ERROR_ITEM_NOT_ADDED - if the add operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void setItem (int index, String string) {
+ checkWidget();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_set_text (handle, index, 0, buffer);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Sets the receiver's items to be the given array of items.
+ *
+ * @param items the array of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_ADDED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void setItems (String [] items) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
+ removeAll ();
+ for (int i=0; i<items.length; i++) {
+ add (items [i]);
+ }
+}
+/**
+ * Selects the item at the given zero-relative index in the receiver.
+ * If the item at the index was already selected, it remains selected.
+ * The current selected is first cleared, then the new items are selected.
+ * Indices that are out of range are ignored.
+ *
+ * @param index the index of the item to select
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @see List#deselectAll()
+ * @see List#select(int)
+ */
+public void setSelection (int index) {
+ if ((style & SWT.MULTI) != 0) deselectAll ();
+ select (index);
+}
+/**
+ * Selects the items at the given zero-relative indices in the receiver.
+ * The current selected if first cleared, then the new items are selected.
+ *
+ * @param start the start index of the items to select
+ * @param end the end index of the items to select
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Table#deselectAll()
+ * @see Table#select(int,int)
+ */
+public void setSelection (int start, int end) {
+ if ((style & SWT.MULTI) != 0) deselectAll ();
+ select (start, end);
+}
+/**
+ * Selects the items at the given zero-relative indices in the receiver.
+ * The current selection is first cleared, then the new items are selected.
+ *
+ * @param indices the indices of the items to select
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see List#deselectAll()
+ * @see List#select(int[])
+ */
+public void setSelection(int[] indices) {
+ if ((style & SWT.MULTI) != 0) deselectAll ();
+ select (indices);
+}
+/**
+ * Sets the receiver's selection to be the given array of items.
+ * The current selected is first cleared, then the new items are
+ * selected.
+ *
+ * @param items the array of items
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see List#deselectAll()
+ * @see List#select(int)
+ */
+public void setSelection (String [] items) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if ((style & SWT.MULTI) != 0) deselectAll ();
+ for (int i=items.length-1; i>=0; --i) {
+ int index = 0;
+ String string = items [i];
+ if (string != null) {
+ while ((index = indexOf (string, index)) != -1) {
+ select (index);
+ if (((style & SWT.SINGLE) != 0) && isSelected (index)) return;
+ index++;
+ }
+ }
+ }
+ if ((style & SWT.SINGLE) != 0) deselectAll ();
+}
+/**
+ * Sets the zero-relative index of the item which is currently
+ * at the top of the receiver. This index can change when items
+ * are scrolled or new items are added and removed.
+ *
+ * @param index the index of the top item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setTopIndex (int index) {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_moveto (handle, index, 0, 0.0f, 0.0f);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Shows the selection. If the selection is already showing in the receiver,
+ * this method simply returns. Otherwise, the items are scrolled until
+ * the selection is visible.
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void showSelection () {
+ checkWidget();
+ /* FIXME */
+}
+
+int processSelection (int int0, int int1, int int2) {
+ Event event = new Event();
+ event.widget=this;
+ sendEvent (SWT.Selection,event);
+ return 0;
+}
+int processMouseDown (int callData, int arg1, int int2) {
+ OS.gtk_widget_grab_focus(handle);
+ GdkEventButton gdkEvent = new GdkEventButton ();
+ OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
+ int eventType = SWT.MouseDown;
+ if (gdkEvent.type == OS.GDK_2BUTTON_PRESS) {
+ eventType = SWT.MouseDoubleClick;
+ Event event = new Event ();
+ event.widget=this;
+ sendEvent (SWT.DefaultSelection, event);
+ }else
+ sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
+ if (gdkEvent.button == 3 && menu != null) {
+ menu.setVisible (true);
+ }
+ return 1;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Menu.java
new file mode 100644
index 0000000..7a77f50
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Menu.java
@@ -0,0 +1,563 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class are user interface objects that contain
+ * menu items.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>BAR, DROP_DOWN, POP_UP</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Help, Hide, Show </dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+
+public class Menu extends Widget {
+ MenuItem cascade;
+ Decorations parent;
+/**
+* Creates a new instance of the widget.
+*/
+public Menu (Control parent) {
+ this (parent.getShell (), SWT.POP_UP);
+}
+/**
+* Creates a new instance of the widget.
+*/
+public Menu (Decorations parent, int style) {
+ super (parent, checkStyle (style));
+ this.parent = parent;
+ createWidget (0);
+}
+/**
+* Creates a new instance of the widget.
+*/
+public Menu (Menu parentMenu) {
+ this (parentMenu.parent, SWT.DROP_DOWN);
+}
+/**
+* Creates a new instance of the widget.
+*/
+public Menu (MenuItem parentItem) {
+ this (parentItem.parent);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the help events are generated for the control, by sending
+ * it one of the messages defined in the <code>MenuListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MenuListener
+ * @see #removeMenuListener
+ */
+public void addMenuListener (MenuListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Hide,typedListener);
+ addListener (SWT.Show,typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the help events are generated for the control, by sending
+ * it one of the messages defined in the <code>HelpListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see HelpListener
+ * @see #removeHelpListener
+ */
+public void addHelpListener (HelpListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Help, typedListener);
+}
+
+static int checkStyle (int style) {
+ return checkBits (style, SWT.POP_UP, SWT.BAR, SWT.DROP_DOWN, 0, 0, 0);
+}
+void createHandle (int index) {
+ state |= HANDLE;
+ if ((style & SWT.BAR) != 0) {
+ handle = OS.gtk_menu_bar_new ();
+ OS.gtk_widget_show (handle);
+ } else {
+ handle = OS.gtk_menu_new ();
+ }
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void createWidget (int index) {
+ super.createWidget (index);
+ parent.add (this);
+}
+
+/**
+ * Returns the default menu item or null if none has
+ * been previously set.
+ *
+ * @return the default menu item.
+ *
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public MenuItem getDefaultItem () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return null;
+}
+public Display getDisplay () {
+ Decorations parent = this.parent;
+ if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getDisplay ();
+}
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getEnabled () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return (widget.flags & OS.GTK_SENSITIVE) != 0;
+}
+/**
+ * Returns the item at the given, zero-relative index in the
+ * receiver. Throws an exception if the index is out of range.
+ *
+ * @param index the index of the item to return
+ * @return the item at the given index
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public MenuItem getItem (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int list = OS.gtk_container_children (handle);
+ int data = OS.g_list_nth_data (list, index);
+ if (data == 0) error (SWT.ERROR_CANNOT_GET_ITEM);
+ return (MenuItem) WidgetTable.get (data);
+}
+/**
+ * Returns the number of items contained in the receiver.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getItemCount () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int list = OS.gtk_container_children (handle);
+ return OS.g_list_length (list);
+}
+/**
+ * Returns an array of <code>MenuItem</code>s which are the items
+ * in the receiver.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the items in the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public MenuItem [] getItems () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int list = OS.gtk_container_children (handle);
+ int count = OS.g_list_length (list);
+ MenuItem [] items = new MenuItem [count];
+ for (int i=0; i<count; i++) {
+ int data = OS.g_list_nth_data (list, i);
+ items [i] = (MenuItem) WidgetTable.get (data);
+ }
+ return items;
+}
+/**
+ * Returns the receiver's parent, which must be a <code>Decorations</code>.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Decorations getParent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent;
+}
+/**
+ * Returns the receiver's parent item, which must be a
+ * <code>MenuItem</code> or null when the receiver is a
+ * root.
+ *
+ * @return the receiver's parent item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public MenuItem getParentItem () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return cascade;
+}
+/**
+ * Returns the receiver's parent item, which must be a
+ * <code>Menu</code> or null when the receiver is a
+ * root.
+ *
+ * @return the receiver's parent item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Menu getParentMenu () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (cascade == null) return null;
+ return cascade.getParent ();
+}
+/**
+ * Returns the receiver's shell. For all controls other than
+ * shells, this simply returns the control's nearest ancestor
+ * shell. Shells return themselves, even if they are children
+ * of other shells.
+ *
+ * @return the receiver's shell
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #getParent
+ */
+public Shell getShell () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getShell ();
+}
+/**
+ * Returns <code>true</code> if the receiver is visible, and
+ * <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getVisible () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return (widget.flags & OS.GTK_MAPPED) != 0;
+}
+/**
+ * Searches the receiver's list starting at the first item
+ * (index 0) until an item is found that is equal to the
+ * argument, and returns the index of that item. If no item
+ * is found, returns -1.
+ *
+ * @param item the search item
+ * @return the index of the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int indexOf (MenuItem item) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
+ MenuItem [] items = getItems ();
+ for (int i=0; i<items.length; i++) {
+ if (items [i] == item) return i;
+ }
+ return -1;
+}
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isEnabled () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return getEnabled () && getParent ().getEnabled ();
+}
+/**
+ * Returns <code>true</code> if the receiver is visible, and
+ * <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isVisible () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return getVisible ();
+}
+void releaseChild () {
+ super.releaseChild ();
+ if (cascade != null) cascade.setMenu (null);
+ if ((style & SWT.BAR) != 0 && this == parent.menuBar) {
+ parent.setMenuBar (null);
+ }
+}
+void releaseWidget () {
+ MenuItem [] items = getItems ();
+ for (int i=0; i<items.length; i++) {
+ MenuItem item = items [i];
+ if (!item.isDisposed ()) {
+ item.releaseWidget ();
+ item.releaseHandle ();
+ }
+ }
+ if (parent != null) parent.remove (this);
+ super.releaseWidget ();
+ parent = null;
+ cascade = null;
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the menu events are generated for the control.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see MenuListener
+ * @see #addMenuListener
+ */
+public void removeMenuListener (MenuListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Hide, listener);
+ eventTable.unhook (SWT.Show, listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the help events are generated for the control.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see HelpListener
+ * @see #addHelpListener
+ */
+public void removeHelpListener (HelpListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Help, listener);
+}
+
+/**
+ * Sets the default menu item to the argument or removes
+ * the default emphasis when the argument is <code>null</code>.
+ *
+ * @param item the default menu item or null
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the menu item has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setDefaultItem (MenuItem item) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+/**
+ * Enables the receiver if the argument is <code>true</code>,
+ * and disables it otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @param enabled the new enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setEnabled (boolean enabled) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_widget_set_sensitive (handle, enabled);
+}
+
+/**
+ * Sets the receiver's location to the point specified by
+ * the arguments which are relative to the display.
+ * <p>
+ * Note: This is different from most widgets where the
+ * location of the widget is relative to the parent.
+ * </p>
+ *
+ * @param x the new x coordinate for the receiver
+ * @param y the new y coordinate for the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLocation (int x, int y) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & (SWT.BAR | SWT.DROP_DOWN)) != 0) return;
+// OS.gtk_widget_set_uposition(handle, x, y);
+// OS.gtk_widget_set_uposition(handle, 0, 0);
+ sendEvent(SWT.Move);
+}
+
+/**
+ * Marks the receiver as visible if the argument is <code>true</code>,
+ * and marks it invisible otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, marking
+ * it visible may not actually cause it to be displayed.
+ * </p>
+ *
+ * @param visible the new visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setVisible (boolean visible) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & SWT.BAR) != 0) return;
+ if (visible) {
+ sendEvent(SWT.Show);
+ OS.gtk_menu_popup (handle, 0, 0, 0, 0, 3, 0);
+ } else {
+ OS.gtk_menu_popdown (handle);
+ sendEvent(SWT.Hide);
+ }
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/MenuItem.java
new file mode 100644
index 0000000..bfe074e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/MenuItem.java
@@ -0,0 +1,627 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class represent a selectable user interface object
+ * that issues notification when pressed and released.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>CHECK, CASCADE, PUSH, RADIO, SEPARATOR</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Arm, Help, Selection</dd>
+ * </dl>
+ *<p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+
+public class MenuItem extends Item {
+ Menu parent, menu;
+ int accelerator;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Menu</code>) and a style value
+ * describing its behavior and appearance. The item is added
+ * to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public MenuItem (Menu parent, int style) {
+ super (parent, checkStyle (style));
+ this.parent = parent;
+ createWidget (parent.getItemCount ());
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Menu</code>), a style value
+ * describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public MenuItem (Menu parent, int style, int index) {
+ super (parent, checkStyle (style));
+ this.parent = parent;
+ int count = parent.getItemCount ();
+ if (!(0 <= index && index <= count)) {
+ error (SWT.ERROR_ITEM_NOT_ADDED);
+ }
+ createWidget (index);
+}
+void addAccelerator (int accel_group) {
+ if (accel_group == 0) return;
+ if (accelerator == 0) return;
+ byte [] activate = Converter.wcsToMbcs (null, "activate", true);
+ int mask = 0;
+ if ((accelerator & SWT.CONTROL) != 0) mask |= OS.GDK_CONTROL_MASK;
+ if ((accelerator & SWT.ALT) != 0) mask |= OS.GDK_MOD1_MASK;
+ if ((accelerator & SWT.SHIFT) != 0) mask |= OS.GDK_SHIFT_MASK;
+ int keysym = accelerator & ~(SWT.ALT | SWT.SHIFT | SWT.CTRL);
+ int newKey = Display.untranslateKey (keysym);
+ if (newKey != 0) {
+ keysym = newKey;
+ } else {
+ keysym = wcsToMbcs ((char) keysym);
+ }
+ OS.gtk_widget_add_accelerator (handle, activate, accel_group, keysym, mask, OS.GTK_ACCEL_VISIBLE);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the arm events are generated for the control, by sending
+ * it one of the messages defined in the <code>ArmListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ArmListener
+ * @see #removeArmListener
+ */
+public void addArmListener (ArmListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Arm, typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the help events are generated for the control, by sending
+ * it one of the messages defined in the <code>HelpListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see HelpListener
+ * @see #removeHelpListener
+ */
+public void addHelpListener (HelpListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Help, typedListener);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control is selected, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * When <code>widgetSelected</code> is called, the stateMask field of the event object is valid.
+ * <code>widgetDefaultSelected</code> is not called.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener (SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener(listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+static int checkStyle (int style) {
+ return checkBits (style, SWT.PUSH, SWT.CHECK, SWT.RADIO, SWT.SEPARATOR, SWT.CASCADE, 0);
+}
+void createHandle (int index) {
+ state |= HANDLE;
+ byte [] buffer = new byte [1];
+ int bits = SWT.CHECK | SWT.RADIO | SWT.PUSH | SWT.SEPARATOR;
+ switch (style & bits) {
+ case SWT.SEPARATOR:
+ handle = OS.gtk_menu_item_new ();
+ break;
+ case SWT.RADIO:
+// handle = OS.gtk_radio_menu_item_new_with_label (0, buffer);
+// break;
+ case SWT.CHECK:
+ handle = OS.gtk_check_menu_item_new_with_label (buffer);
+ break;
+ case SWT.PUSH:
+ default:
+ handle = OS.gtk_menu_item_new_with_label (buffer);
+ break;
+ }
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+ if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
+ OS.gtk_check_menu_item_set_show_toggle (handle, true);
+ }
+ if ((parent.style & SWT.BAR) != 0) {
+ OS.gtk_menu_bar_insert (parent.handle, handle, index);
+ } else {
+ OS.gtk_menu_insert (parent.handle, handle, index);
+ }
+ OS.gtk_widget_show (handle);
+}
+/**
+ * Return the widget accelerator. An accelerator is the bit-wise
+ * OR of zero or more modifier masks and a key. Examples:
+ * <code>SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2</code>.
+ *
+ * @return the accelerator
+ *
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getAccelerator () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return accelerator;
+}
+public Display getDisplay () {
+ Menu parent = this.parent;
+ if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getDisplay ();
+}
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getEnabled () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return (widget.flags & OS.GTK_SENSITIVE) != 0;
+}
+/**
+ * Returns the receiver's cascade menu if it has one or null
+ * if it does not. Only <code>CASCADE</code> menu items can have
+ * a pull down menu. The sequence of key strokes, button presses
+ * and/or button releases that are used to request a pull down
+ * menu is platform specific.
+ *
+ * @return the receiver's menu
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Menu getMenu () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return menu;
+}
+/**
+ * Returns the receiver's parent, which must be a <code>Menu</code>.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Menu getParent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent;
+}
+/**
+ * Returns <code>true</code> if the receiver is selected,
+ * and false otherwise.
+ * <p>
+ * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
+ * it is selected when it is checked.
+ *
+ * @return the selection state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getSelection () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return false;
+ GtkCheckMenuItem menuItem = new GtkCheckMenuItem ();
+ OS.memmove (menuItem, handle, GtkCheckMenuItem.sizeof);
+ return menuItem.active != 0;
+}
+void hookEvents () {
+ super.hookEvents ();
+ Display display = getDisplay ();
+ int windowProc2 = display.windowProc2;
+ byte [] activate_event = Converter.wcsToMbcs (null, "activate", true);
+ OS.gtk_signal_connect (handle, activate_event, windowProc2, SWT.Selection);
+}
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isEnabled () {
+ return getEnabled ();
+}
+int processSelection (int int0, int int1, int int2) {
+ postEvent (SWT.Selection);
+ return 0;
+}
+void releaseChild () {
+ super.releaseChild ();
+ if (menu != null) menu.dispose ();
+ menu = null;
+}
+void releaseWidget () {
+ if (menu != null) {
+ menu.releaseWidget ();
+ menu.releaseHandle ();
+ }
+ menu = null;
+ super.releaseWidget ();
+ int accel_group = parent.getShell ().accelGroup;
+ removeAccelerator (accel_group);
+ accelerator = 0;
+ parent = null;
+}
+void removeAccelerator (int accel_group) {
+ if (accel_group == 0) return;
+ if (accelerator == 0) return;
+ int mask = 0;
+ if ((accelerator & SWT.CONTROL) != 0) mask |= OS.GDK_CONTROL_MASK;
+ if ((accelerator & SWT.ALT) != 0) mask |= OS.GDK_MOD1_MASK;
+ if ((accelerator & SWT.SHIFT) != 0) mask |= OS.GDK_SHIFT_MASK;
+ int keysym = accelerator & ~(SWT.ALT | SWT.SHIFT | SWT.CTRL);
+ int newKey = Display.untranslateKey (keysym);
+ if (newKey != 0) {
+ keysym = newKey;
+ } else {
+ keysym = wcsToMbcs ((char) keysym);
+ }
+ OS.gtk_widget_remove_accelerator (handle, accel_group, keysym, mask);
+ accelerator = 0;
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the arm events are generated for the control.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ArmListener
+ * @see #addArmListener
+ */
+public void removeArmListener (ArmListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Arm, listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the help events are generated for the control.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see HelpListener
+ * @see #addHelpListener
+ */
+public void removeHelpListener (HelpListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Help, listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is selected.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener (SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+/**
+ * Sets the widget accelerator. An accelerator is the bit-wise
+ * OR of zero or more modifier masks and a key. Examples:
+ * <code>SWT.CONTROL | SWT.SHIFT | 'T', SWT.ALT | SWT.F2</code>.
+ *
+ * @param accelerator an integer that is the bit-wise OR of masks and a key
+ *
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setAccelerator (int accelerator) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int accel_group = parent.getShell ().accelGroup;
+ if (accelerator != 0) removeAccelerator (accel_group);
+ this.accelerator = accelerator;
+ if (accelerator != 0) addAccelerator (accel_group);
+}
+/**
+ * Enables the receiver if the argument is <code>true</code>,
+ * and disables it otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @param enabled the new enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setEnabled (boolean enabled) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_widget_set_sensitive (handle, enabled);
+}
+
+
+
+/**
+ * Sets the receiver's pull down menu to the argument.
+ * Only <code>CASCADE</code> menu items can have a
+ * pull down menu. The sequence of key strokes, button presses
+ * and/or button releases that are used to request a pull down
+ * menu is platform specific.
+ *
+ * @param menu the new pull down menu
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_MENU_NOT_DROP_DOWN - if the menu is not a drop down menu</li>
+ * <li>ERROR_MENUITEM_NOT_CASCADE - if the menu item is not a <code>CASCADE</code></li>
+ * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
+ * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMenu (Menu menu) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+
+ /* Check to make sure the new menu is valid */
+ if ((style & SWT.CASCADE) == 0) {
+ error (SWT.ERROR_MENUITEM_NOT_CASCADE);
+ }
+ if (menu != null) {
+ if ((menu.style & SWT.DROP_DOWN) == 0) {
+ error (SWT.ERROR_MENU_NOT_DROP_DOWN);
+ }
+ if (menu.parent != parent.parent) {
+ error (SWT.ERROR_INVALID_PARENT);
+ }
+ }
+
+ /* Assign the new menu */
+ Menu oldMenu = this.menu;
+ if (oldMenu == menu) return;
+ if (oldMenu != null) oldMenu.cascade = null;
+ if ((this.menu = menu) != null) {
+ menu.cascade = this;
+ int menuHandle = menu.handle;
+ OS.gtk_menu_item_set_submenu (handle, menuHandle);
+ } else {
+ OS.gtk_menu_item_remove_submenu (handle);
+ }
+
+
+}
+/**
+ * Sets the selection state of the receiver.
+ * <p>
+ * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
+ * it is selected when it is checked.
+ *
+ * @param selected the new selection state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (boolean selected) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return;
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_check_menu_item_set_active (handle, selected);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+public void setText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if ((style & SWT.SEPARATOR) != 0) return;
+ text = string;
+ if ((style & SWT.ARROW) != 0) return;
+ int length = string.length ();
+ int index = string.indexOf('\t');
+ if (index != -1) length = index;
+ char [] text = new char [length + 1];
+ char [] pattern = new char [length + 1];
+ string.getChars (0, length, text, 0);
+ int i = 0, j = 0;
+ while (i < length) {
+ pattern [j] = ' ';
+ if (text [i] == '&') {
+ i++;
+ if (i < length && text [i] != '&') {
+ pattern [j] = '_';
+ }
+ }
+ text [j++] = text [i++];
+ }
+ while (j < i) {
+ text [j] = pattern [j] = '\0';
+ j++;
+ }
+ int list = OS.gtk_container_children (handle);
+ int label = OS.g_list_nth_data (list, 0);
+ byte [] buffer1 = Converter.wcsToMbcs (null, text);
+ OS.gtk_label_set_text (label, buffer1);
+ byte [] buffer2 = Converter.wcsToMbcs (null, pattern);
+ OS.gtk_label_set_pattern (label, buffer2);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/MessageBox.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/MessageBox.java
new file mode 100644
index 0000000..d6542d4
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/MessageBox.java
@@ -0,0 +1,232 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Instances of this class are used used to inform or warn the user.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>ICON_ERROR, ICON_INFORMATION, ICON_QUESTION, ICON_WARNING, ICON_WORKING</dd>
+ * <dd>OK, OK | CANCEL</dd>
+ * <dd>YES | NO, YES | NO | CANCEL</dd>
+ * <dd>RETRY | CANCEL</dd>
+ * <dd>ABORT | RETRY | IGNORE</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+public class MessageBox extends Dialog {
+
+ String message;
+
+ // Handles
+ int handle;
+ int label;
+ int buttonOK, buttonCANCEL, buttonYES, buttonNO, buttonABORT, buttonRETRY, buttonIGNORE;
+
+ // While open...
+ boolean isWaiting = false;
+ int result;
+
+/*
+ * === CONSTRUCTORS ===
+ */
+
+
+/**
+ * Constructs a new instance of this class given only its
+ * parent.
+ * <p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the dialog on the currently active
+ * display if there is one. If there is no current display, the
+ * dialog is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public MessageBox (Shell parent) {
+ this (parent, SWT.OK | SWT.ICON_INFORMATION | SWT.APPLICATION_MODAL);
+}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT dialog classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the dialog on the currently active
+ * display if there is one. If there is no current display, the
+ * dialog is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public MessageBox (Shell parent, int style) {
+ super(parent, checkStyle(style));
+ createHandle();
+}
+
+
+
+/*
+ * === GET/SET MESSAGE; OPEN ===
+ */
+
+/**
+ * Returns the dialog's message, which is a description of
+ * the purpose for which it was opened. This message will be
+ * visible on the dialog while it is open.
+ *
+ * @return the message
+ */
+public String getMessage () {
+ return message;
+}
+
+/**
+ * Sets the dialog's message, which is a description of
+ * the purpose for which it was opened. This message will be
+ * visible on the dialog while it is open.
+ *
+ * @param string the message
+ */
+public void setMessage (String string) {
+ message = string;
+}
+
+/**
+ * Makes the dialog visible and brings it to the front
+ * of the display.
+ *
+ * @return the ID of the button that was selected to dismiss the
+ * message box (e.g. SWT.OK, SWT.CANCEL, etc...)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the dialog has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the dialog</li>
+ * </ul>
+ */
+public int open () {
+ OS.gtk_widget_show (handle);
+
+// FIXME - WAIT FOR CLICK
+// There is a fundamental problem here.
+// We can't receive the clicked signal from the buttons, because by the API shape,
+// we are not a widget.
+
+ OS.gtk_widget_hide(handle);
+ return SWT.OK;
+}
+
+/*
+ * === HANDLE DANCES ===
+ */
+
+private void createHandle() {
+ handle = OS.gtk_dialog_new();
+ byte[] bytes = Converter.wcsToMbcs (null, getText(), true);
+
+ label = OS.gtk_label_new (bytes);
+ GtkDialog dialog = new GtkDialog();
+ OS.memmove (dialog, handle, GtkDialog.sizeof);
+ OS.gtk_box_pack_start (dialog.vbox, label, true, true, 5);
+ OS.gtk_widget_show (label);
+
+ if ((style & SWT.OK) != 0) buttonOK = createButton("OK");
+ if ((style & SWT.CANCEL) != 0) buttonCANCEL = createButton("CANCEL");
+
+ if ((style & SWT.YES) != 0) buttonYES = createButton("YES");
+ if ((style & SWT.NO) != 0) buttonNO = createButton("NO");
+
+ if ((style & SWT.ABORT) != 0) buttonABORT = createButton("ABORT");
+ if ((style & SWT.RETRY) != 0) buttonRETRY = createButton("RETRY");
+ if ((style & SWT.IGNORE) != 0) buttonIGNORE = createButton("IGNORE");
+}
+
+int createButton(String buttonName) {
+ byte[] bytes = Converter.wcsToMbcs (null, buttonName, true);
+ int h = OS.gtk_button_new_with_label(bytes);
+ GtkDialog dialog = new GtkDialog();
+ OS.memmove (dialog, handle, GtkDialog.sizeof);
+ OS.gtk_box_pack_start (dialog.action_area, h, true, true, 0);
+ signal_connect(h, "clicked", SWT.Selection, 2);
+// WidgetTable.put (h, this);
+ OS.gtk_widget_show (h);
+ return h;
+}
+
+int processEvent (int eventNumber, int int0, int int1, int int2) {
+ if (eventNumber == SWT.Selection) processSelection (int0, int1, int2);
+ return 0;
+}
+
+void processSelection (int int0, int int1, int int2) {
+}
+
+/*
+ * === AS YET UNCLASSIFIED ==
+ */
+
+private static int checkStyle (int style) {
+ int mask = (SWT.YES | SWT.NO | SWT.OK | SWT.CANCEL | SWT.ABORT | SWT.RETRY | SWT.IGNORE);
+ int bits = style & mask;
+ if (bits == SWT.OK || bits == SWT.CANCEL || bits == (SWT.OK | SWT.CANCEL)) return style;
+ if (bits == SWT.YES || bits == SWT.NO || bits == (SWT.YES | SWT.NO) || bits == (SWT.YES | SWT.NO | SWT.CANCEL)) return style;
+ if (bits == (SWT.RETRY | SWT.CANCEL) || bits == (SWT.ABORT | SWT.RETRY | SWT.IGNORE)) return style;
+ style = (style & ~mask) | SWT.OK;
+ return style;
+}
+private void signal_connect (int handle, String eventName, int swtEvent, int numArgs) {
+ byte [] buffer = Converter.wcsToMbcs (null, eventName, true);
+ int proc=0;
+ switch (numArgs) {
+ case 2: proc=Display.getDefault().windowProc2; break;
+ case 3: proc=Display.getDefault().windowProc3; break;
+ case 4: proc=Display.getDefault().windowProc4; break;
+ case 5: proc=Display.getDefault().windowProc5; break;
+ default: error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ OS.gtk_signal_connect (handle, buffer, proc, swtEvent);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ProgressBar.java
new file mode 100644
index 0000000..b5b36ce
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ProgressBar.java
@@ -0,0 +1,215 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of the receiver represent is an unselectable
+ * user interface object that is used to display progress,
+ * typically in the form of a bar.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>SMOOTH, HORIZONTAL, VERTICAL</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+
+public class ProgressBar extends Control {
+ int min = 0, max = 100, value = 0;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public ProgressBar (Composite parent, int style) {
+ super (parent, checkStyle(style));
+}
+
+static int checkStyle (int style) {
+ return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+ handle = OS.gtk_progress_bar_new ();
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+ OS.gtk_progress_configure (handle, value, min, max);
+}
+
+void setHandleStyle() {
+ int orientation = (style & SWT.VERTICAL) != 0 ? OS.GTK_PROGRESS_TOP_TO_BOTTOM : OS.GTK_PROGRESS_LEFT_TO_RIGHT;
+ OS.gtk_progress_bar_set_orientation (handle, orientation);
+ int style = (this.style & SWT.SMOOTH) == 0 ? OS.GTK_PROGRESS_DISCRETE : OS.GTK_PROGRESS_CONTINUOUS;
+ OS.gtk_progress_bar_set_bar_style (handle, style);
+}
+
+void showHandle() {
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+/**
+ * Returns the maximum value which the receiver will allow.
+ *
+ * @return the maximum
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getMaximum () {
+ checkWidget ();
+ return max;
+}
+
+/**
+ * Returns the minimum value which the receiver will allow.
+ *
+ * @return the minimum
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getMinimum () {
+ checkWidget ();
+ return min;
+}
+
+/**
+ * Returns the single <em>selection</em> that is the receiver's position.
+ *
+ * @return the selection
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelection () {
+ checkWidget ();
+ return value;
+}
+
+/**
+ * Sets the maximum value which the receiver will allow
+ * to be the argument which must be greater than or
+ * equal to zero.
+ *
+ * @param value the new maximum (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMaximum (int maximum) {
+ checkWidget ();
+ if (maximum < 0) return;
+ max = maximum;
+ if (value > maximum) value = maximum;
+ OS.gtk_progress_configure (handle, value, min, max);
+ /*
+ * Feature in GTK. The progress bar does
+ * not redraw right away when a value is
+ * changed. This is not strictly incorrect
+ * but unexpected. The fix is to force all
+ * outstanding redraws to be delivered.
+ */
+ update ();
+}
+
+/**
+ * Sets the minimum value which the receiver will allow
+ * to be the argument which must be greater than or
+ * equal to zero.
+ *
+ * @param value the new minimum (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMinimum (int minimum) {
+ checkWidget ();
+ if (minimum < 0) return;
+ if (value < minimum) value = minimum;
+ min = minimum;
+ OS.gtk_progress_configure (handle, value, min, max);
+ /*
+ * Feature in GTK. The progress bar does
+ * not redraw right away when a value is
+ * changed. This is not strictly incorrect
+ * but unexpected. The fix is to force all
+ * outstanding redraws to be delivered.
+ */
+ update ();
+}
+
+/**
+ * Sets the single <em>selection</em> that is the receiver's
+ * position to the argument which must be greater than or equal
+ * to zero.
+ *
+ * @param value the new selection (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (int x) {
+ checkWidget ();
+ if (x < 0) return;
+ value = x;
+ OS.gtk_progress_configure (handle, value, min, max);
+ /*
+ * Feature in GTK. The progress bar does
+ * not redraw right away when a value is
+ * changed. This is not strictly incorrect
+ * but unexpected. The fix is to force all
+ * outstanding redraws to be delivered.
+ */
+ update ();
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Sash.java
new file mode 100644
index 0000000..cad77f4
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Sash.java
@@ -0,0 +1,333 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of the receiver represent a selectable user interface object
+ * that allows the user to drag a rubber banded outline of the sash within
+ * the parent control.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd> HORIZONTAL, VERTICAL</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+public class Sash extends Control {
+ boolean dragging, drawing;
+ int startX, startY, lastX, lastY, drawX, drawY;
+ int start_root_x, start_root_y;
+ int last_root_x, last_root_y;
+ int cursor;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Sash (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+ handle=OS.gtk_drawing_area_new();
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void setHandleStyle() {}
+
+void showHandle() {
+ createCursor();
+ OS.gtk_widget_show(handle);
+ OS.gtk_widget_realize(handle);
+}
+
+private void createCursor() {
+ int cursorType = ((style&SWT.VERTICAL)!=0)?
+ OS.GDK_SB_H_DOUBLE_ARROW:OS.GDK_SB_V_DOUBLE_ARROW;
+ cursor = OS.gdk_cursor_new(cursorType);
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove(widget, handle, GtkWidget.sizeof);
+ OS.gdk_window_set_cursor(widget.window, cursor);
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ int border = getBorderWidth ();
+ int width = border * 2, height = border * 2;
+ if ((style & SWT.HORIZONTAL) != 0) {
+ width += DEFAULT_WIDTH; height += 3;
+ } else {
+ width += 3; height += DEFAULT_HEIGHT;
+ }
+ if (wHint != SWT.DEFAULT) width = wHint + (border * 2);
+ if (hHint != SWT.DEFAULT) height = hHint + (border * 2);
+ return new Point (width, height);
+}
+
+
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control is selected, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * When <code>widgetSelected</code> is called, the x, y, width, and height fields of the event object are valid.
+ * If the reciever is being dragged, the event object detail field contains the value <code>SWT.DRAG</code>.
+ * <code>widgetDefaultSelected</code> is not called.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener (SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.MouseDoubleClick,typedListener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is selected.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener(SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.MouseDoubleClick,listener);
+}
+
+int processMouseDown (int callData, int arg1, int int2) {
+ OS.gtk_grab_add(handle);
+ dragging = true;
+ GdkEventButton gdkEvent = new GdkEventButton ();
+ OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
+ if (gdkEvent.button != 1) return 0;
+ startX = (int)gdkEvent.x; startY = (int)gdkEvent.y;
+ start_root_x=(int)gdkEvent.x_root; start_root_y=(int)gdkEvent.y_root;
+ drawX=startX; drawY=startY;
+ GtkWidget gtkwidget = new GtkWidget();
+ OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
+ int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
+ lastX = gtkwidget.alloc_x - border; lastY = gtkwidget.alloc_y - border;
+ Event event = new Event ();
+ event.detail = SWT.DRAG;
+ event.time = gdkEvent.time;
+ event.x = lastX; event.y = lastY;
+ event.width = width; event.height = height;
+ sendEvent (SWT.MouseDown, event);
+ return 0;
+}
+
+int processMouseMove (int callData, int arg1, int int2) {
+ GdkEventMotion gdkEvent = new GdkEventMotion ();
+ OS.memmove (gdkEvent, callData, GdkEventMotion.sizeof);
+ if (!dragging) return 0;
+ GtkWidget gtkwidget = new GtkWidget();
+ OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
+ int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
+ int x = gtkwidget.alloc_x - border, y = gtkwidget.alloc_y - border;
+ Rectangle rect = parent.getClientArea();
+ int parentWidth = rect.width - 2;
+ int parentHeight = rect.height - 2;
+ last_root_x=(int)gdkEvent.x_root; last_root_y=(int)gdkEvent.y_root;
+ int newX = lastX, newY = lastY;
+ if ((style & SWT.VERTICAL) != 0) {
+ if (last_root_x<=start_root_x)
+ newX = Math.min (Math.max (0, x - (start_root_x-last_root_x) - startX ), parentWidth - width);
+ else
+ newX = Math.min (Math.max (0, x + (last_root_x-start_root_x) - startX ), parentWidth - width);
+ } else {
+ if (last_root_y<=start_root_y)
+ newY = Math.min (Math.max (0, y - (start_root_y-last_root_y) - startY ), parentHeight - height);
+ else
+ newY = Math.min (Math.max (0, y + (last_root_y-start_root_y) - startY ), parentHeight - height);
+ }
+ if ((newX == lastX) && (newY == lastY)) return 0;
+ drawBand(newX, newY, width, height);
+ return 0;
+}
+int processMouseUp (int callData, int arg1, int int2) {
+ GdkEventButton gdkEvent = new GdkEventButton ();
+ OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
+ if (gdkEvent.button != 1) return 0;
+ if (!dragging) return 0;
+ GtkWidget gtkwidget = new GtkWidget();
+ OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
+ int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
+ int x = gtkwidget.alloc_x - border, y = gtkwidget.alloc_y - border;
+ Rectangle rect = parent.getClientArea();
+ int parentWidth = rect.width - 2;
+ int parentHeight = rect.height - 2;
+ last_root_x=(int)gdkEvent.x_root; last_root_y=(int)gdkEvent.y_root;
+ int newX = lastX, newY = lastY;
+ if ((style & SWT.VERTICAL) != 0) {
+ if (last_root_x<=start_root_x)
+ newX = Math.min (Math.max (0, x - (start_root_x-last_root_x) - startX ), parentWidth - width);
+ else
+ newX = Math.min (Math.max (0, x + (last_root_x-start_root_x) - startX ), parentWidth - width);
+ } else {
+ if (last_root_y<=start_root_y)
+ newY = Math.min (Math.max (0, y - (start_root_y-last_root_y) - startY ), parentHeight - height);
+ else
+ newY = Math.min (Math.max (0, y + (last_root_y-start_root_y) - startY ), parentHeight - height);
+ }
+ if ((newX == lastX) && (newY == lastY)) return 0;
+
+ Event event = new Event ();
+ event.time = gdkEvent.time;
+ event.x = newX; event.y = newY;
+ event.width = width; event.height = height;
+ dragging = false;
+ drawBand(newX, newY, width, height);
+ drawing = false;
+ OS.gtk_grab_remove(handle);
+ sendEvent (SWT.Selection, event);
+ return 0;
+}
+/*
+int processMouseEnter (int callData, int arg1, int int2) {
+ GdkEventMotion gdkEvent = new GdkEventMotion ();
+ OS.memmove (gdkEvent, callData, GdkEventMotion.sizeof);
+ GtkWidget gtkwidget = new GtkWidget();
+ OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
+ int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
+ lastX = gtkwidget.alloc_x - border; lastY = gtkwidget.alloc_y - border;
+ Event event = new Event ();
+ event.time = gdkEvent.time;
+ event.detail = SWT.DRAG;
+ event.x = lastX; event.y = lastY;
+ event.width = width; event.height = height;
+ Cursor arrowCursor;
+ if ((style & SWT.HORIZONTAL) != 0) {
+ arrowCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_SIZENS);
+ } else {
+ arrowCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_SIZEWE);
+ }
+ setCursor(arrowCursor);
+ sendEvent (SWT.Selection, event);
+ return 0;
+}
+*/
+int processMouseExit (int callData, int arg1, int int2) {
+ GdkEventMotion gdkEvent = new GdkEventMotion ();
+ OS.memmove (gdkEvent, callData, GdkEventMotion.sizeof);
+ GtkWidget gtkwidget = new GtkWidget();
+ OS.memmove(gtkwidget, handle, GtkWidget.sizeof);
+ int border = 0, width = gtkwidget.alloc_width+border*2, height = gtkwidget.alloc_height+border*2;
+ Event event = new Event ();
+ event.time = gdkEvent.time;
+ event.x = lastX; event.y = lastY;
+ event.width = width; event.height = height;
+ sendEvent (SWT.MouseExit, event);
+ return 0;
+
+}
+
+void drawBand (int x, int y, int width, int height) {
+ if (x == drawX && y == drawY) return;
+ Display display= parent.getDisplay ();
+ if (display == null) return;
+ GtkWidget gtkwidget = new GtkWidget();
+ OS.memmove(gtkwidget, parent.topHandle(), GtkWidget.sizeof);
+ int window = gtkwidget.window;
+ if (window == 0) return;
+ byte [] bits = {-86, 0, 85, 0, -86, 0, 85, 0, -86, 0, 85, 0, -86, 0, 85, 0};
+ int stipplePixmap = OS.gdk_bitmap_create_from_data (window, bits, 8, 8);
+ int gc = OS.gdk_gc_new(window);
+ Color color = new Color(display, 0xFF, 0, 0);
+ OS.gdk_gc_set_background(gc, color.handle);
+ Color color1 = new Color(display, 0, 0xFF, 0);
+ OS.gdk_gc_set_foreground(gc, color1.handle);
+ OS.gdk_gc_set_stipple(gc, stipplePixmap);
+ OS.gdk_gc_set_subwindow(gc, OS.GDK_INCLUDE_INFERIORS);
+ OS.gdk_gc_set_fill(gc, OS.GDK_STIPPLED);
+ OS.gdk_gc_set_function(gc, OS.GDK_XOR);
+
+ if (drawing)
+ OS.gdk_draw_rectangle(window, gc, 1, drawX, drawY, width, height);
+ else
+ drawing = true;
+ drawX=x;drawY=y;
+ OS.gdk_draw_rectangle(window, gc, 1, x, y, width, height);
+ OS.gdk_bitmap_unref(stipplePixmap);
+ OS.gdk_gc_destroy(gc);
+}
+static int checkStyle (int style) {
+ return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
+}
+
+void releaseWidget () {
+ super.releaseWidget ();
+ OS.gdk_cursor_destroy (cursor);
+ cursor = 0;
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Scale.java
new file mode 100644
index 0000000..0f56d44
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Scale.java
@@ -0,0 +1,380 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of the receiver represent a selectable user
+ * interface object that present a range of continuous
+ * numeric values.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd> HORIZONTAL, VERTICAL</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+
+public class Scale extends Control {
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Scale (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's value changes, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ */
+public void addSelectionListener (SelectionListener listener) {
+ checkWidget ();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+
+static int checkStyle (int style) {
+ return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+ int hAdjustment = OS.gtk_adjustment_new (0, 0, 100, 1, 10, 0);
+ if (hAdjustment == 0) error (SWT.ERROR_NO_HANDLES);
+ if ((style & SWT.HORIZONTAL) != 0) {
+ handle = OS.gtk_hscale_new (hAdjustment);
+ } else {
+ handle = OS.gtk_vscale_new (hAdjustment);
+ }
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void setHandleStyle() {
+ OS.gtk_scale_set_digits (handle, 0);
+ OS.gtk_scale_set_draw_value (handle, false);
+}
+
+void showHandle() {
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void hookEvents () {
+ super.hookEvents ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ signal_connect (hAdjustment, "value_changed", SWT.Selection, 2);
+}
+
+void register () {
+ super.register ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ WidgetTable.put (hAdjustment, this);
+}
+
+void deregister () {
+ super.deregister ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ WidgetTable.remove (hAdjustment);
+ /*
+ * This code is intentionally commented.
+ */
+// OS.gtk_object_unref (hAdjustment);
+// OS.gtk_object_destroy (hAdjustment);
+}
+
+/**
+ * Returns the amount that the receiver's value will be
+ * modified by when the up/down (or right/left) arrows
+ * are pressed.
+ *
+ * @return the increment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getIncrement () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.step_increment;
+}
+
+/**
+ * Returns the maximum value which the receiver will allow.
+ *
+ * @return the maximum
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getMaximum () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.upper;
+}
+
+/**
+ * Returns the minimum value which the receiver will allow.
+ *
+ * @return the minimum
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getMinimum () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.lower;
+}
+
+/**
+ * Returns the amount that the receiver's value will be
+ * modified by when the page increment/decrement areas
+ * are selected.
+ *
+ * @return the page increment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getPageIncrement () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.page_increment;
+}
+
+/**
+ * Returns the single <em>selection</em> that is the receiver's position.
+ *
+ * @return the selection
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelection () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.value;
+}
+
+int processSelection (int int0, int int1, int int2) {
+ postEvent (SWT.Selection);
+ return 0;
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's value changes.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener (SelectionListener listener) {
+ checkWidget ();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+
+/**
+ * Sets the amount that the receiver's value will be
+ * modified by when the up/down (or right/left) arrows
+ * are pressed to the argument, which must be at least
+ * one.
+ *
+ * @param value the new increment (must be greater than zero)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setIncrement (int value) {
+ checkWidget ();
+ if (value < 1) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.step_increment = (float) value;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+}
+
+/**
+ * Sets the maximum value which the receiver will allow
+ * to be the argument which must be greater than or
+ * equal to zero.
+ *
+ * @param value the new maximum (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMaximum (int value) {
+ checkWidget ();
+ if (value < 0) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.upper = (float) value;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+}
+
+/**
+ * Sets the minimum value which the receiver will allow
+ * to be the argument which must be greater than or
+ * equal to zero.
+ *
+ * @param value the new minimum (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMinimum (int value) {
+ checkWidget ();
+ if (value < 0) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.lower = (float) value;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+}
+/**
+ * Sets the amount that the receiver's value will be
+ * modified by when the page increment/decrement areas
+ * are selected to the argument, which must be at least
+ * one.
+ *
+ * @return the page increment (must be greater than zero)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setPageIncrement (int value) {
+ checkWidget ();
+ if (value < 1) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.page_increment = (float) value;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+}
+
+/**
+ * Sets the single <em>selection</em> that is the receiver's
+ * value to the argument which must be greater than or equal
+ * to zero.
+ *
+ * @param value the new selection (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (int value) {
+ checkWidget();
+ if (value < 0) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
+ OS.gtk_adjustment_set_value (hAdjustment, value);
+ OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ScrollBar.java
new file mode 100644
index 0000000..14d7ba3
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ScrollBar.java
@@ -0,0 +1,621 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class are selectable user interface
+ * objects that represent a range of positive, numeric values.
+ * <p>
+ * At any given moment, a given scroll bar will have a
+ * single <em>selection</em> that is considered to be its
+ * value, which is constrained to be within the range of
+ * values the scroll bar represents (that is, between its
+ * <em>minimum</em> and <em>maximum</em> values).
+ * </p><p>
+ * Typically, scroll bars will be made up of five areas:
+ * <ol>
+ * <li>an arrow button for decrementing the value</li>
+ * <li>a page decrement area for decrementing the value by a larger amount</li>
+ * <li>a <em>thumb</em> for modifying the value by mouse dragging</li>
+ * <li>a page increment area for incrementing the value by a larger amount</li>
+ * <li>an arrow button for incrementing the value</li>
+ * </ol>
+ * Based on their style, scroll bars are either <code>HORIZONTAL</code>
+ * (which have left and right facing buttons for incrementing and
+ * decrementing the value) or <code>VERTICAL</code> (which have
+ * up and down facing buttons for incrementing and decrementing
+ * the value).
+ * </p><p>
+ * On some platforms, the size of the scroll bar's thumb can be
+ * varied relative to the magnitude of the range of values it
+ * represents (that is, relative to the difference between its
+ * maximum and minimum values). Typically, this is used to
+ * indicate some proportional value such as the ratio of the
+ * visible area of a document to the total amount of space that
+ * it would take to display it. SWT supports setting the thumb
+ * size even if the underlying platform does not, but in this
+ * case the appearance of the scroll bar will not change.
+ * </p><p>
+ * Scroll bars are created by specifying either <code>H_SCROLL</code>,
+ * <code>V_SCROLL</code> or both when creating a <code>Scrollable</code>.
+ * They are accessed from the <code>Scrollable</code> using
+ * <code>getHorizontalBar</code> and <code>getVerticalBar</code>.
+ * </p><p>
+ * Note: Scroll bars are not Controls. On some platforms, scroll bars
+ * that appear as part of some standard controls such as a text or list
+ * have no operating system resources and are not children of the control.
+ * For this reason, scroll bars are treated specially. To create a control
+ * that looks like a scroll bar but has operating system resources, use
+ * <code>Slider</code>.
+ * </p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>HORIZONTAL, VERTICAL</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ *
+ * @see Slider
+ * @see Scrollable
+ * @see Scrollable#getHorizontalBar
+ * @see Scrollable#getVerticalBar
+ */
+
+public class ScrollBar extends Widget {
+ Scrollable parent;
+ScrollBar () {
+}
+/**
+* Creates a new instance of the widget.
+*/
+ScrollBar (Scrollable parent, int style) {
+ super (parent, checkStyle (style));
+ this.parent = parent;
+ createWidget (0);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's value changes, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * When <code>widgetSelected</code> is called, the event object detail field contains one of the following values:
+ * <code>0</code> - for the end of a drag.
+ * <code>SWT.DRAG</code>.
+ * <code>SWT.HOME</code>.
+ * <code>SWT.END</code>.
+ * <code>SWT.ARROW_DOWN</code>.
+ * <code>SWT.ARROW_UP</code>.
+ * <code>SWT.PAGE_DOWN</code>.
+ * <code>SWT.PAGE_UP</code>.
+ * <code>widgetDefaultSelected</code> is not called.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener (SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener(listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+static int checkStyle (int style) {
+ return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
+}
+public Display getDisplay () {
+ Scrollable parent = this.parent;
+ if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getDisplay ();
+}
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @return the enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getEnabled () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return true;
+}
+/**
+ * Returns the amount that the receiver's value will be
+ * modified by when the up/down (or right/left) arrows
+ * are pressed.
+ *
+ * @return the increment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getIncrement () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ return (int) adjustment.step_increment;
+}
+/**
+ * Returns the maximum value which the receiver will allow.
+ *
+ * @return the maximum
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getMaximum () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ return (int) adjustment.upper;
+}
+/**
+ * Returns the minimum value which the receiver will allow.
+ *
+ * @return the minimum
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getMinimum () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ return (int) adjustment.lower;
+}
+/**
+ * Returns the amount that the receiver's value will be
+ * modified by when the page increment/decrement areas
+ * are selected.
+ *
+ * @return the page increment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getPageIncrement () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ return (int) adjustment.page_increment;
+}
+/**
+ * Returns the receiver's parent, which must be scrollable.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Scrollable getParent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent;
+}
+/**
+ * Returns the single <em>selection</em> that is the receiver's value.
+ *
+ * @return the selection
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelection () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ return (int) adjustment.value;
+}
+/**
+ * For horizontal scroll bars, returns the height of the
+ * instance, and for vertical scroll bars, returns the width
+ * of the instance.
+ *
+ * @return the scroll bar size
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getSize () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return new Point (widget.alloc_width, widget.alloc_height);
+}
+/**
+ * Answers the size of the receiver's thumb relative to the
+ * difference between its maximum and minimum values.
+ *
+ * @return the thumb value
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ScrollBar
+ */
+public int getThumb () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ return (int) adjustment.page_size;
+}
+/**
+ * Returns <code>true</code> if the receiver is visible, and
+ * <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getVisible () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return true;
+}
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ * <p>
+ * Note: Because of the strong connection between a scroll bar
+ * and the widget which contains it (its parent), a scroll bar
+ * will not indicate that it is enabled if its parent is not.
+ * </p>
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isEnabled () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return getEnabled () && getParent ().getEnabled ();
+}
+/**
+ * Returns <code>true</code> if the receiver is visible, and
+ * <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isVisible () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return getVisible () && getParent ().isVisible ();
+}
+int processSelection (int int0, int int1, int int2) {
+ postEvent (SWT.Selection);
+ return 0;
+}
+void releaseChild () {
+ super.releaseChild ();
+ if (parent.horizontalBar == this) parent.horizontalBar = null;
+ if (parent.verticalBar == this) parent.verticalBar = null;
+}
+void releaseWidget () {
+ super.releaseWidget ();
+ parent = null;
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's value changes.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener (SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+/**
+ * Enables the receiver if the argument is <code>true</code>,
+ * and disables it otherwise. A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ *
+ * @param enabled the new enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setEnabled (boolean enabled) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+/**
+ * Sets the amount that the receiver's value will be
+ * modified by when the up/down (or right/left) arrows
+ * are pressed to the argument, which must be at least
+ * one.
+ *
+ * @param value the new increment (must be greater than zero)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setIncrement (int value) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (value < 1) return;
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ adjustment.step_increment = (float) value;
+ OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (handle);
+}
+/**
+ * Sets the maximum value which the receiver will allow
+ * to be the argument which must be greater than or
+ * equal to zero.
+ *
+ * @param value the new maximum (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMaximum (int value) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (value < 0) return;
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ adjustment.upper = (float) value;
+ OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (handle);
+}
+/**
+ * Sets the minimum value which the receiver will allow
+ * to be the argument which must be greater than or
+ * equal to zero.
+ *
+ * @param value the new minimum (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMinimum (int value) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (value < 0) return;
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ adjustment.lower = (float) value;
+ OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (handle);
+}
+/**
+ * Sets the amount that the receiver's value will be
+ * modified by when the page increment/decrement areas
+ * are selected to the argument, which must be at least
+ * one.
+ *
+ * @return the page increment (must be greater than zero)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setPageIncrement (int value) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (value < 1) return;
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ adjustment.page_increment = (float) value;
+ OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (handle);
+}
+/**
+ * Sets the single <em>selection</em> that is the receiver's
+ * value to the argument which must be greater than or equal
+ * to zero.
+ *
+ * @param value the new selection (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (int value) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (value < 0) return;
+ OS.gtk_adjustment_set_value (handle, value);
+}
+/**
+ * Sets the size of the receiver's thumb relative to the
+ * difference between its maximum and minimum values to the
+ * argument which must be at least one.
+ *
+ * @param value the new thumb value (must be at least one)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ScrollBar
+ */
+public void setThumb (int value) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (value < 1) return;
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ adjustment.page_size = (float) value;
+ OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (handle);
+}
+
+/**
+ * Sets the receiver's selection, minimum value, maximum
+ * value, thumb, increment and page increment all at once.
+ * <p>
+ * Note: This is equivalent to setting the values individually
+ * using the appropriate methods, but may be implemented in a
+ * more efficient fashion on some platforms.
+ * </p>
+ *
+ * @param selection the new selection value
+ * @param minimum the new minimum value
+ * @param maximum the new maximum value
+ * @param thumb the new thumb value
+ * @param increment the new increment value
+ * @param pageIncrement the new pageIncrement value
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setValues (int selection, int minimum, int maximum, int thumb, int increment, int pageIncrement) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (selection < 0) return;
+ if (minimum < 0) return;
+ if (maximum < 0) return;
+ if (thumb < 1) return;
+ if (maximum - minimum - thumb < 0) return;
+ if (increment < 1) return;
+ if (pageIncrement < 1) return;
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, handle, GtkAdjustment.sizeof);
+ adjustment.lower = minimum;
+ adjustment.upper = maximum;
+ adjustment.step_increment = increment;
+ adjustment.page_increment = pageIncrement;
+ adjustment.page_size = thumb;
+ adjustment.value = selection;
+ OS.memmove (handle, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (handle);
+ OS.gtk_adjustment_value_changed (handle);
+// error(SWT.ERROR_NOT_IMPLEMENTED);
+}
+
+/**
+ * Marks the receiver as visible if the argument is <code>true</code>,
+ * and marks it invisible otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, marking
+ * it visible may not actually cause it to be displayed.
+ * </p>
+ *
+ * @param visible the new visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setVisible (boolean visible) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+
+void hookEvents () {
+ signal_connect(handle, "value_changed", SWT.Selection, 2);
+// signal_connect(handle, "changed", SWT.Selection, 2);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Scrollable.java
new file mode 100644
index 0000000..a2405fc
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Scrollable.java
@@ -0,0 +1,239 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * This class is the abstract superclass of all classes which
+ * represent controls that have standard scroll bars.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>H_SCROLL, V_SCROLL</dd>
+ * <dt><b>Events:</b>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation.
+ * </p>
+ */
+
+public abstract class Scrollable extends Control {
+
+ int scrolledHandle;
+ ScrollBar horizontalBar, verticalBar;
+ static Trim trim;
+
+/**
+ * Prevents uninitialized instances from being created outside the package.
+ */
+Scrollable () {}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Scrollable (Composite parent, int style) {
+ super (parent, style);
+}
+
+/**
+ * Given a desired <em>client area</em> for the receiver
+ * (as described by the arguments), returns the bounding
+ * rectangle which would be required to produce that client
+ * area.
+ * <p>
+ * In other words, it returns a rectangle such that, if the
+ * receiver's bounds were set to that rectangle, the area
+ * of the receiver which is capable of displaying data
+ * (that is, not covered by the "trimmings") would be the
+ * rectangle described by the arguments (relative to the
+ * receiver's parent).
+ * </p>
+ *
+ * @return the required bounds to produce the given client area
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #getClientArea
+ */
+public Rectangle computeTrim (int x, int y, int width, int height) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+
+ Trim t = _getTrim();
+ return new Rectangle (x-t.left, y-t.top, width+t.left+t.right, height+t.top+t.bottom);
+}
+
+Trim _getTrim() {
+ if (trim==null) initializeTrim();
+ return trim;
+}
+
+void initializeTrim() { trim = new Trim(); }
+
+void _fillBin(int binHandle, int childHandle) {
+ GtkBin bin = new GtkBin();
+ OS.memmove(bin, binHandle, GtkBin.sizeof);
+ bin.child = childHandle;
+ OS.memmove(binHandle, bin, GtkBin.sizeof);
+ OS.gtk_widget_set_parent(childHandle, binHandle);
+}
+
+/*
+ * Subclasses must only use super.configure()
+ * to connect their topHandle to the parent.
+ * It is the responsibility of the conrete subclass
+ * to configure the scrolled handles.
+ */
+abstract void configure ();
+
+ScrollBar createScrollBar (int style) {
+ if (scrolledHandle == 0) return null;
+ ScrollBar bar = new ScrollBar ();
+ bar.parent = this;
+ bar.style = style;
+ bar.state |= HANDLE;
+ if ((style & SWT.H_SCROLL) != 0) {
+ bar.handle = OS.gtk_scrolled_window_get_hadjustment (scrolledHandle);
+ } else {
+ bar.handle = OS.gtk_scrolled_window_get_vadjustment (scrolledHandle);
+ }
+ bar.hookEvents ();
+ bar.register ();
+ return bar;
+}
+void createWidget (int index) {
+ super.createWidget (index);
+ if ((style & SWT.H_SCROLL) != 0) horizontalBar = createScrollBar (SWT.H_SCROLL);
+ if ((style & SWT.V_SCROLL) != 0) verticalBar = createScrollBar (SWT.V_SCROLL);
+}
+void deregister () {
+ super.deregister ();
+ if (scrolledHandle != 0) {
+ WidgetTable.remove (scrolledHandle);
+ }
+}
+/**
+ * Returns a rectangle which describes the area of the
+ * receiver which is capable of displaying data (that is,
+ * not covered by the "trimmings").
+ *
+ * @return the client area
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #computeTrim
+ */
+public Rectangle getClientArea () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return new Rectangle (0, 0, widget.alloc_width, widget.alloc_height);
+}
+/**
+ * Returns the receiver's horizontal scroll bar if it has
+ * one, and null if it does not.
+ *
+ * @return the horizontal scroll bar (or null)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public ScrollBar getHorizontalBar () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return horizontalBar;
+}
+/**
+ * Returns the receiver's vertical scroll bar if it has
+ * one, and null if it does not.
+ *
+ * @return the vertical scroll bar (or null)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public ScrollBar getVerticalBar () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return verticalBar;
+}
+
+void setScrollingPolicy() {
+ if (scrolledHandle==0) return;
+ int hsp = ((style&SWT.H_SCROLL)==0)? OS.GTK_POLICY_NEVER : OS.GTK_POLICY_ALWAYS;
+ int vsp = ((style&SWT.V_SCROLL)==0)? OS.GTK_POLICY_NEVER : OS.GTK_POLICY_ALWAYS;
+ OS.gtk_scrolled_window_set_policy(scrolledHandle, hsp,vsp);
+}
+
+void register () {
+ super.register ();
+ if (scrolledHandle != 0) {
+ WidgetTable.put (scrolledHandle, this);
+ }
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ scrolledHandle = 0;
+}
+
+void releaseWidget () {
+ if (horizontalBar != null) {
+ horizontalBar.releaseWidget ();
+ horizontalBar.releaseHandle ();
+ }
+ if (verticalBar != null) {
+ verticalBar.releaseWidget ();
+ verticalBar.releaseHandle ();
+ }
+ horizontalBar = verticalBar = null;
+ super.releaseWidget ();
+}
+int topHandle () {
+ if (scrolledHandle != 0) return scrolledHandle;
+ return handle;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Shell.java
new file mode 100644
index 0000000..3d1b310
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Shell.java
@@ -0,0 +1,818 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class represent the "windows"
+ * which the desktop or "window manager" is managing.
+ * Instances which do not have a parent (that is, they
+ * are built using the constructor which takes a
+ * <code>Display</code> as the argument) are described
+ * as <em>top level</em> shells. Instances which do have
+ * a parent, are described as <em>secondary</em> or
+ * <em>dialog</em> shells.
+ * <p>
+ * Instances are always displayed in one of the maximized,
+ * minimized or normal states:
+ * <ul>
+ * <li>
+ * When an instance is marked as <em>maximized</em>, the
+ * window manager will typically resize it to fill the
+ * entire visible area of the display, and the instance
+ * is usually put in a state where it can not be resized
+ * (even if it has style <code>RESIZE</code>) until it is
+ * no longer maximized.
+ * </li><li>
+ * When an instance is in the <em>normal</em> state (neither
+ * maximized or minimized), its appearance is controlled by
+ * the style constants which were specified when it was created
+ * and the restrictions of the window manager (see below).
+ * </li><li>
+ * When an instance has been marked as <em>minimized</em>,
+ * its contents (client area) will usually not be visible,
+ * and depending on the window manager, it may be
+ * "iconified" (that is, replaced on the desktop by a small
+ * simplified representation of itself), relocated to a
+ * distinguished area of the screen, or hidden. Combinations
+ * of these changes are also possible.
+ * </li>
+ * </ul>
+ * </p>
+ * Note: The styles supported by this class must be treated
+ * as <em>HINT</em>s, since the window manager for the
+ * desktop on which the instance is visible has ultimate
+ * control over the appearance and behavior of decorations.
+ * For example, some window managers only support resizable
+ * windows and will always assume the RESIZE style, even if
+ * it is not set.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Activate, Close, Deactivate, Deiconify, Iconify</dd>
+ * </dl>
+ * Class <code>SWT</code> provides two "convenience constants"
+ * for the most commonly required style combinations:
+ * <dl>
+ * <dt><code>SHELL_TRIM</code></dt>
+ * <dd>
+ * the result of combining the constants which are required
+ * to produce a typical application top level shell: (that
+ * is, <code>CLOSE | TITLE | MIN | MAX | RESIZE</code>)
+ * </dd>
+ * <dt><code>DIALOG_TRIM</code></dt>
+ * <dd>
+ * the result of combining the constants which are required
+ * to produce a typical application dialog shell: (that
+ * is, <code>TITLE | CLOSE | BORDER</code>)
+ * </dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is not intended to be subclassed.
+ * </p>
+ *
+ * @see Decorations
+ * @see SWT
+ */
+
+public class Shell extends Decorations {
+ Display display;
+ int shellHandle, vboxHandle, eventBoxHandle;
+ int modal;
+ int accelGroup;
+ Rectangle lastClientArea;
+ boolean hasFocus=false;
+/**
+ * Constructs a new instance of this class. This is equivalent
+ * to calling <code>Shell((Display) null)</code>.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public Shell () {
+ this ((Display) null);
+}
+/**
+ * Constructs a new instance of this class given only the style
+ * value describing its behavior and appearance. This is equivalent
+ * to calling <code>Shell((Display) null, style)</code>.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param style the style of control to construct
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public Shell (int style) {
+ this ((Display) null, style);
+}
+
+/**
+ * Constructs a new instance of this class given only the display
+ * to create it on. It is created with style <code>SWT.SHELL_TRIM</code>.
+ * <p>
+ * Note: Currently, null can be passed in for the display argument.
+ * This has the effect of creating the shell on the currently active
+ * display if there is one. If there is no current display, the
+ * shell is created on a "default" display. <b>Passing in null as
+ * the display argument is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param display the display to create the shell on
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public Shell (Display display) {
+ this (display, SWT.SHELL_TRIM);
+}
+/**
+ * Constructs a new instance of this class given the display
+ * to create it on and a style value describing its behavior
+ * and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p><p>
+ * Note: Currently, null can be passed in for the display argument.
+ * This has the effect of creating the shell on the currently active
+ * display if there is one. If there is no current display, the
+ * shell is created on a "default" display. <b>Passing in null as
+ * the display argument is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param display the display to create the shell on
+ * @param style the style of control to construct
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public Shell (Display display, int style) {
+ this (display, null, style);
+}
+Shell (Display display, Shell parent, int style) {
+ super ();
+ if (display == null) display = Display.getCurrent ();
+ if (display == null) display = Display.getDefault ();
+ if (!display.isValidThread ()) {
+ error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ }
+ this.display = display;
+ this.style = checkStyle (style);
+ createWidget (0);
+}
+/**
+ * Constructs a new instance of this class given only its
+ * parent. It is created with style <code>SWT.DIALOG_TRIM</code>.
+ * <p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the shell on the currently active
+ * display if there is one. If there is no current display, the
+ * shell is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public Shell (Shell parent) {
+ this (parent, SWT.TITLE | SWT.CLOSE | SWT.BORDER);
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p><p>
+ * Note: Currently, null can be passed in for the parent.
+ * This has the effect of creating the shell on the currently active
+ * display if there is one. If there is no current display, the
+ * shell is created on a "default" display. <b>Passing in null as
+ * the parent is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param parent a shell which will be the parent of the new instance
+ * @param style the style of control to construct
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public Shell (Shell parent, int style) {
+ this (null, parent, style);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when operations are performed on the receiver,
+ * by sending the listener one of the messages defined in the
+ * <code>ShellListener</code> interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ShellListener
+ * @see #removeShellListener
+ */
+public void addShellListener (ShellListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Close,typedListener);
+ addListener (SWT.Iconify,typedListener);
+ addListener (SWT.Deiconify,typedListener);
+ addListener (SWT.Activate, typedListener);
+ addListener (SWT.Deactivate, typedListener);
+}
+void bringToTop () {
+// OS.gtk_window_activate_focus (shellHandle);
+}
+/**
+ * Requests that the window manager close the receiver in
+ * the same way it would be closed when the user clicks on
+ * the "close box" or performs some other platform specific
+ * key or mouse combination that indicates the window
+ * should be removed.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void close () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ closeWidget ();
+}
+void closeWidget () {
+ Event event = new Event ();
+ event.time = OS.gdk_time_get ();
+ sendEvent (SWT.Close, event);
+ if (event.doit && !isDisposed ()) dispose ();
+}
+
+
+/*
+ * HANDLE DANCES
+ *
+ * FIRST SPECIES: HANDLE CREATION CODE - The createWidget() cycle.
+ */
+
+void createHandle (int index) {
+ state |= HANDLE;
+ shellHandle = OS.gtk_window_new((parent==null)? OS.GTK_WINDOW_TOPLEVEL:OS.GTK_WINDOW_DIALOG);
+ if (shellHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+ vboxHandle = OS.gtk_vbox_new(false,0);
+ if (vboxHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+ eventBoxHandle = OS.gtk_event_box_new ();
+ if (eventBoxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ fixedHandle = OS.gtk_fixed_new ();
+ if (fixedHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+ handle = OS.gtk_drawing_area_new();
+ if (handle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+ accelGroup = OS.gtk_accel_group_new ();
+ OS.gtk_window_add_accel_group (shellHandle, accelGroup);
+ OS.gtk_window_set_title (shellHandle, new byte [1]);
+}
+
+void configure () {
+ OS.gtk_container_add (shellHandle, vboxHandle);
+ OS.gtk_box_pack_end(vboxHandle, eventBoxHandle, true,true,0);
+ OS.gtk_container_add (eventBoxHandle, fixedHandle);
+ OS.gtk_fixed_put(fixedHandle, handle, (short)0,(short)0);
+}
+
+void showHandle() {
+ OS.gtk_widget_realize (shellHandle); // careful: NOT show
+ _setStyle();
+
+ OS.gtk_widget_realize (vboxHandle);
+ OS.gtk_widget_show_now (vboxHandle);
+
+ OS.gtk_widget_realize (eventBoxHandle);
+ OS.gtk_widget_show_now (eventBoxHandle);
+
+ OS.gtk_widget_realize (fixedHandle);
+ OS.gtk_widget_show_now (fixedHandle);
+
+ OS.gtk_widget_realize (handle);
+ OS.gtk_widget_show_now (handle);
+}
+
+void hookEvents () {
+ super.hookEvents ();
+ signal_connect(shellHandle, "map_event", SWT.Deiconify, 3);
+ signal_connect(shellHandle, "unmap_event", SWT.Iconify, 3);
+ signal_connect(shellHandle, "size_allocate", SWT.Resize, 3);
+ signal_connect(shellHandle, "delete_event", SWT.Dispose, 3);
+}
+
+void register () {
+ super.register ();
+ WidgetTable.put (shellHandle, this);
+ WidgetTable.put (vboxHandle, this);
+ WidgetTable.put (eventBoxHandle, this);
+}
+
+private void _setStyle() {
+ int decorations = 0;
+ if ((style & SWT.NO_TRIM) == 0) {
+ if ((style & SWT.MIN) != 0) decorations |= OS.GDK_DECOR_MINIMIZE;
+ if ((style & SWT.MAX) != 0) decorations |= OS.GDK_DECOR_MAXIMIZE;
+ if ((style & SWT.RESIZE) != 0) decorations |= OS.GDK_DECOR_RESIZEH;
+ if ((style & SWT.BORDER) != 0) decorations |= OS.GDK_DECOR_BORDER;
+ if ((style & SWT.MENU) != 0) decorations |= OS.GDK_DECOR_MENU;
+ if ((style & SWT.TITLE) != 0) decorations |= OS.GDK_DECOR_TITLE;
+ /*
+ * Under some Window Managers (Sawmill), in order
+ * to get any border at all from the window manager it is necessary
+ * to set GDK_DECOR_BORDER. The fix is to force these bits when any
+ * kind of border is requested.
+ */
+ if ((style & SWT.RESIZE) != 0) decorations |= OS.GDK_DECOR_BORDER;
+ }
+ GtkWidget widget = new GtkWidget();
+ OS.memmove(widget, shellHandle, GtkWidget.sizeof);
+ int w = widget.window;
+ // PANIC - this must absolutely never happen, so it's not NO_HANDLES actually
+ if (w == 0) error(SWT.ERROR_NO_HANDLES);
+ OS.gdk_window_set_decorations(w, decorations);
+}
+
+void _connectChild (int h) {
+ OS.gtk_fixed_put (fixedHandle, h, (short)0, (short)0);
+}
+
+int topHandle () {
+ return shellHandle;
+}
+
+int parentingHandle() {
+ return fixedHandle;
+}
+
+boolean isMyHandle(int h) {
+ if (h == shellHandle) return true;
+ if (h == vboxHandle) return true;
+ if (h == eventBoxHandle) return true;
+ if (h == fixedHandle) return true;
+ if (h == handle) return true;
+ return false;
+}
+
+
+/*
+ * === GEOMETRY ===
+ */
+
+public Point _getLocation() {
+ GtkWidget widget = new GtkWidget();
+ OS.memmove (widget, shellHandle, GtkWidget.sizeof);
+ int [] x = new int [1], y = new int [1];
+ OS.gdk_window_get_origin(widget.window, x,y);
+ return new Point(x[0], y[0]);
+}
+
+public Rectangle _getClientArea () {
+ Point clientSize = UtilFuncs.getSize(eventBoxHandle);
+ return new Rectangle (0, 0, clientSize.x, clientSize.y);
+}
+
+boolean _setSize(int width, int height) {
+ boolean differentExtent = UtilFuncs.setSize(shellHandle, width,height);
+ Point clientSize = UtilFuncs.getSize(eventBoxHandle);
+ UtilFuncs.setSize(fixedHandle, clientSize.x, clientSize.y);
+ UtilFuncs.setSize(handle, clientSize.x, clientSize.y);
+ return differentExtent;
+}
+
+// Unreliable
+boolean _setLocation (int x, int y) {
+ OS.gtk_widget_set_uposition (shellHandle, x, y);
+ return true;
+}
+
+void setInitialSize() {
+ int width = OS.gdk_screen_width () * 5 / 8;
+ int height = OS.gdk_screen_height () * 5 / 8;
+ _setSize(width, height);
+ OS.gtk_window_set_policy (shellHandle, 1,1,0);
+}
+
+public Display getDisplay () {
+ if (display == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return display;
+}
+
+/*
+ * Return the control inside this shell that has the focus,
+ * if there is one. Return <code>null</code> if there is no
+ * such control - e.g., this shell is not active, or it is active
+ * but the user clicked in a no-entry widget (like Label).
+ */
+Control getFocusControl() {
+ GtkWindow shell = new GtkWindow();
+ OS.memmove(shell, shellHandle, GtkWindow.sizeof);
+ int focusHandle = shell.focus_widget;
+ if (focusHandle==0) return null;
+ return (Control)this.getDisplay().findWidget(focusHandle);
+}
+
+/**
+ * Returns the receiver's input method editor mode. This
+ * will be the result of bitwise OR'ing together one or
+ * more of the following constants defined in class
+ * <code>SWT</code>:
+ * <code>NONE</code>, <code>ROMAN</code>, <code>DBCS</code>,
+ * <code>PHONETIC</code>, <code>NATIVE</code>, <code>ALPHA</code>.
+ *
+ * @return the IME mode
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SWT
+ */
+public int getImeInputMode () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return SWT.NONE;
+}
+
+/**
+* Get the modal state.
+* <p>
+* @return the modal state
+*
+* @exception SWTError(ERROR_ERROR_INVALID_PARENT)
+* when the parent is invalid
+* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
+*/
+public int getModal () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return modal;
+}
+
+Shell _getShell () {
+ return this;
+}
+/**
+ * Returns an array containing all shells which are
+ * descendents of the receiver.
+ * <p>
+ * @return the dialog shells
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Shell [] getShells () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int count = 0;
+ Shell [] shells = display.getShells ();
+ for (int i=0; i<shells.length; i++) {
+ Control shell = shells [i];
+ do {
+ shell = shell.getParent ();
+ } while (shell != null && shell != this);
+ if (shell == this) count++;
+ }
+ int index = 0;
+ Shell [] result = new Shell [count];
+ for (int i=0; i<shells.length; i++) {
+ Control shell = shells [i];
+ do {
+ shell = shell.getParent ();
+ } while (shell != null && shell != this);
+ if (shell == this) {
+ result [index++] = shells [i];
+ }
+ }
+ return result;
+}
+
+boolean isModal () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+// GtkWindow window = new GtkWindow ();
+// OS.memmove (window, handle, GtkWindow.sizeof);
+// return window.modal != 0;
+ return false;
+}
+
+public void layout (boolean changed) {
+ checkWidget();
+// if (!resizedSinceLastLayout()) return;
+ lastClientArea=getClientArea();
+ if (layout == null) return;
+ layout.layout (this, changed);
+}
+
+/*
+ * Returns whether the shell has been resized since the last layout()
+ */
+boolean resizedSinceLastLayout() {
+ return !getClientArea().equals(lastClientArea);
+}
+
+/**
+ * Moves the receiver to the top of the drawing order for
+ * the display on which it was created (so that all other
+ * shells on that display, which are not the receiver's
+ * children will be drawn behind it), marks it visible,
+ * and sets focus to its default button (if it has one).
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Control#setVisible
+ * @see Decorations#setDefaultButton
+*/
+public void open () {
+ checkWidget();
+ bringToTop ();
+ setVisible (true);
+}
+
+int processDispose (int int0, int int1, int int2) {
+ closeWidget ();
+ return 1;
+}
+
+int processFocusIn(int int0, int int1, int int2) {
+ hasFocus=true;
+ postEvent(SWT.Activate);
+ return 0;
+}
+
+int processFocusOut(int int0, int int1, int int2) {
+ hasFocus=false;
+ postEvent(SWT.Deactivate);
+ return 0;
+}
+
+int processPaint (int callData, int int2, int int3) {
+ //if (!hooks (SWT.Paint)) return 1;
+
+ GdkEventExpose gdkEvent = new GdkEventExpose ();
+ OS.memmove (gdkEvent, callData, GdkEventExpose.sizeof);
+ Event event = new Event ();
+ event.count = gdkEvent.count;
+ event.x = gdkEvent.x; event.y = gdkEvent.y;
+ event.width = gdkEvent.width; event.height = gdkEvent.height;
+ GC gc = event.gc = new GC (this);
+ GdkRectangle rect = new GdkRectangle ();
+ rect.x = gdkEvent.x; rect.y = gdkEvent.y;
+ rect.width = gdkEvent.width; rect.height = gdkEvent.height;
+ OS.gdk_gc_set_clip_rectangle (gc.handle, rect);
+ gc.fillRectangle(rect.x, rect.y, rect.width, rect.height);
+ sendEvent (SWT.Paint, event);
+ gc.dispose ();
+ event.gc = null;
+ return 1;
+/*}else{
+ GdkRectangle gdkEvent = new GdkRectangle ();
+ OS.memmove (gdkEvent, callData, GdkRectangle.sizeof);
+ Event event = new Event ();
+// event.count = gdkEvent.count;
+ event.x = gdkEvent.x; event.y = gdkEvent.y;
+ event.width = gdkEvent.width; event.height = gdkEvent.height;
+ GC gc = event.gc = new GC (this);
+ OS.gdk_gc_set_clip_rectangle (gc.handle, gdkEvent);
+ sendEvent (SWT.Paint, event);
+ gc.dispose ();
+ event.gc = null;
+ return 1;
+} */
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when operations are performed on the receiver.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ShellListener
+ * @see #addShellListener
+ */
+public void removeShellListener (ShellListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Close, listener);
+ eventTable.unhook (SWT.Iconify,listener);
+ eventTable.unhook (SWT.Deiconify,listener);
+ eventTable.unhook (SWT.Activate, listener);
+ eventTable.unhook (SWT.Deactivate, listener);
+}
+
+/**
+ * Sets the input method editor mode to the argument which
+ * should be the result of bitwise OR'ing together one or more
+ * of the following constants defined in class <code>SWT</code>:
+ * <code>NONE</code>, <code>ROMAN</code>, <code>DBCS</code>,
+ * <code>PHONETIC</code>, <code>NATIVE</code>, <code>ALPHA</code>.
+ *
+ * @param mode the new IME mode
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SWT
+ */
+public void setImeInputMode (int mode) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+
+public void setMaximized (boolean maximized) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+// GtkWidget widget = new GtkWidget ();
+// OS.memmove (widget, shellHandle, GtkWidget.sizeof);
+// OS.gdk_window_set_functions (window, OS.GDK_FUNC_MAXIMIZE);
+}
+public void setMenuBar (Menu menu) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+
+ if (menuBar == menu) return;
+ if (menu != null) {
+ if ((menu.style & SWT.BAR) == 0) error (SWT.ERROR_MENU_NOT_BAR);
+ if (menu.parent != this) error (SWT.ERROR_INVALID_PARENT);
+ }
+ if (menu == null) {
+ if (menuBar != null) {
+ OS.gtk_object_ref (menuBar.handle);
+ OS.gtk_container_remove (vboxHandle, menuBar.handle);
+ }
+ }
+ menuBar = menu;
+ if (menuBar != null) {
+ int menuHandle = menu.handle;
+ OS.gtk_box_pack_start (vboxHandle, menuHandle, false, false, 0);
+ }
+}
+public void setMinimized (boolean minimized) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+// GtkWidget widget = new GtkWidget ();
+// OS.memmove (widget, shellHandle, GtkWidget.sizeof);
+// OS.gdk_window_set_functions (widget.window, OS.GDK_FUNC_MINIMIZE);
+}
+/**
+* Set the modal state.
+* <p>
+* @param modal the new modal state
+*
+* @exception SWTError(ERROR_ERROR_INVALID_PARENT)
+* when the parent is invalid
+* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
+*/
+public void setModal (int modal) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ this.modal = modal;
+}
+
+public void setText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ super.setText (string);
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ OS.gtk_window_set_title (shellHandle, buffer);
+}
+public void setVisible (boolean visible) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (visible) {
+ OS.gtk_widget_show_now (shellHandle);
+ display.update();
+ sendEvent (SWT.Show);
+ } else {
+ OS.gtk_widget_hide (shellHandle);
+ sendEvent (SWT.Hide);
+ }
+}
+
+
+/*
+ * === DESTRUCTION ===
+ */
+
+public void dispose () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+// Display display = this.display;
+ Composite parent = this.parent;
+ super.dispose ();
+// if (display != null) display.update ();
+ if (parent != null) {
+ Shell shell = parent.getShell ();
+ shell.bringToTop ();
+ }
+}
+
+void deregister () {
+ super.deregister ();
+ WidgetTable.remove (shellHandle);
+ WidgetTable.remove (vboxHandle);
+ WidgetTable.remove (eventBoxHandle);
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ shellHandle = vboxHandle = eventBoxHandle = 0;
+}
+
+void releaseShells () {
+ Shell [] shells = getShells ();
+ for (int i=0; i<shells.length; i++) {
+ Shell shell = shells [i];
+ if (!shell.isDisposed ()) {
+ shell.releaseWidget ();
+ shell.releaseHandle ();
+ }
+ }
+}
+void releaseWidget () {
+ releaseShells ();
+ super.releaseWidget ();
+ if (accelGroup != 0) OS.gtk_accel_group_unref (accelGroup);
+ accelGroup = 0;
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Slider.java
new file mode 100644
index 0000000..167d3c6
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Slider.java
@@ -0,0 +1,527 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class are selectable user interface
+ * objects that represent a range of positive, numeric values.
+ * <p>
+ * At any given moment, a given slider will have a
+ * single <em>selection</em> that is considered to be its
+ * value, which is constrained to be within the range of
+ * values the slider represents (that is, between its
+ * <em>minimum</em> and <em>maximum</em> values).
+ * </p><p>
+ * Typically, sliders will be made up of five areas:
+ * <ol>
+ * <li>an arrow button for decrementing the value</li>
+ * <li>a page decrement area for decrementing the value by a larger amount</li>
+ * <li>a <em>thumb</em> for modifying the value by mouse dragging</li>
+ * <li>a page increment area for incrementing the value by a larger amount</li>
+ * <li>an arrow button for incrementing the value</li>
+ * </ol>
+ * Based on their style, sliders are either <code>HORIZONTAL</code>
+ * (which have left and right facing buttons for incrementing and
+ * decrementing the value) or <code>VERTICAL</code> (which have
+ * up and down facing buttons for incrementing and decrementing
+ * the value).
+ * </p><p>
+ * On some platforms, the size of the slider's thumb can be
+ * varied relative to the magnitude of the range of values it
+ * represents (that is, relative to the difference between its
+ * maximum and minimum values). Typically, this is used to
+ * indicate some proportional value such as the ratio of the
+ * visible area of a document to the total amount of space that
+ * it would take to display it. SWT supports setting the thumb
+ * size even if the underlying platform does not, but in this
+ * case the appearance of the slider will not change.
+ * </p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>HORIZONTAL, VERTICAL</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ *
+ * @see ScrollBar
+ */
+
+public class Slider extends Control {
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Slider (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's value changes, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * When <code>widgetSelected</code> is called, the event object detail field contains one of the following values:
+ * <code>0</code> - for the end of a drag.
+ * <code>SWT.DRAG</code>.
+ * <code>SWT.HOME</code>.
+ * <code>SWT.END</code>.
+ * <code>SWT.ARROW_DOWN</code>.
+ * <code>SWT.ARROW_UP</code>.
+ * <code>SWT.PAGE_DOWN</code>.
+ * <code>SWT.PAGE_UP</code>.
+ * <code>widgetDefaultSelected</code> is not called.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener (SelectionListener listener) {
+ checkWidget ();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+
+static int checkStyle (int style) {
+ return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0);
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+ int hAdjustment = OS.gtk_adjustment_new (0, 0, 100, 1, 10, 10);
+ if (hAdjustment == 0) error (SWT.ERROR_NO_HANDLES);
+ if ((style & SWT.HORIZONTAL) != 0) {
+ handle = OS.gtk_hscrollbar_new (hAdjustment);
+ } else {
+ handle = OS.gtk_vscrollbar_new (hAdjustment);
+ }
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void setHandleStyle() {}
+
+void showHandle() {
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void hookEvents () {
+ super.hookEvents ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ signal_connect (hAdjustment, "value_changed", SWT.Selection, 2);
+}
+
+void register () {
+ super.register ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ WidgetTable.put (hAdjustment, this);
+}
+
+void deregister () {
+ super.deregister ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ WidgetTable.remove (hAdjustment);
+ /*
+ * This code is intentionally commented.
+ */
+// OS.gtk_object_unref (hAdjustment);
+// OS.gtk_object_destroy (hAdjustment);
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ // We are interested in the preferred size.
+ // The native widget gives us what it thinks the minimum reasonable
+ // size; we'll say we prefer to be twice that long, and exactly
+ // that wide.
+ int x,y;
+ Point size = super.computeSize (wHint, hHint, changed);
+ if (hHint==SWT.DEFAULT) {
+ x = size.x;
+ if ((style & SWT.HORIZONTAL) != 0) x = 2*x;
+ } else x = hHint;
+ if (wHint==SWT.DEFAULT) {
+ y = size.y;
+ if ((style & SWT.VERTICAL) != 0) y = 2*y;
+ } else y = wHint;
+
+ return new Point(x,y);
+}
+
+/**
+ * Returns the amount that the receiver's value will be
+ * modified by when the up/down (or right/left) arrows
+ * are pressed.
+ *
+ * @return the increment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getIncrement () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.step_increment;
+}
+
+/**
+ * Returns the maximum value which the receiver will allow.
+ *
+ * @return the maximum
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getMaximum () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.upper;
+}
+
+/**
+ * Returns the minimum value which the receiver will allow.
+ *
+ * @return the minimum
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getMinimum () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.lower;
+}
+
+/**
+ * Returns the amount that the receiver's value will be
+ * modified by when the page increment/decrement areas
+ * are selected.
+ *
+ * @return the page increment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getPageIncrement () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.page_increment;
+}
+
+/**
+ * Returns the single <em>selection</em> that is the receiver's value.
+ *
+ * @return the selection
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelection () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.value;
+}
+
+/**
+ * Returns the size of the receiver's thumb relative to the
+ * difference between its maximum and minimum values.
+ *
+ * @return the thumb value
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getThumb () {
+ checkWidget ();
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ return (int) adjustment.page_size;
+}
+
+int processSelection (int int0, int int1, int int2) {
+ postEvent (SWT.Selection);
+ return 0;
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's value changes.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener (SelectionListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+
+/**
+ * Sets the amount that the receiver's value will be
+ * modified by when the up/down (or right/left) arrows
+ * are pressed to the argument, which must be at least
+ * one.
+ *
+ * @param value the new increment (must be greater than zero)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setIncrement (int value) {
+ checkWidget();
+ if (value < 1) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.step_increment = (float) value;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+}
+
+/**
+ * Sets the maximum value which the receiver will allow
+ * to be the argument which must be greater than or
+ * equal to zero.
+ *
+ * @param value the new maximum (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMaximum (int value) {
+ checkWidget ();
+ if (value < 0) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.upper = (float) value;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+}
+
+/**
+ * Sets the minimum value which the receiver will allow
+ * to be the argument which must be greater than or
+ * equal to zero.
+ *
+ * @param value the new minimum (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setMinimum (int value) {
+ checkWidget ();
+ if (value < 0) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.lower = (float) value;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+}
+
+/**
+ * Sets the amount that the receiver's value will be
+ * modified by when the page increment/decrement areas
+ * are selected to the argument, which must be at least
+ * one.
+ *
+ * @return the page increment (must be greater than zero)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setPageIncrement (int value) {
+ checkWidget ();
+ if (value < 1) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.page_increment = (float) value;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+}
+
+/**
+ * Sets the single <em>selection</em> that is the receiver's
+ * value to the argument which must be greater than or equal
+ * to zero.
+ *
+ * @param value the new selection (must be zero or greater)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (int value) {
+ checkWidget ();
+ if (value < 0) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ OS.gtk_signal_handler_block_by_data (hAdjustment, SWT.Selection);
+ OS.gtk_adjustment_set_value (hAdjustment, value);
+ OS.gtk_signal_handler_unblock_by_data (hAdjustment, SWT.Selection);
+}
+
+/**
+ * Sets the size of the receiver's thumb relative to the
+ * difference between its maximum and minimum values to the
+ * argument which must be at least one.
+ *
+ * @param value the new thumb value (must be at least one)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ScrollBar
+ */
+public void setThumb (int value) {
+ checkWidget ();
+ if (value < 1) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.page_size = (float) value;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+}
+
+/**
+ * Sets the receiver's selection, minimum value, maximum
+ * value, thumb, increment and page increment all at once.
+ * <p>
+ * Note: This is equivalent to setting the values individually
+ * using the appropriate methods, but may be implemented in a
+ * more efficient fashion on some platforms.
+ * </p>
+ *
+ * @param selection the new selection value
+ * @param minimum the new minimum value
+ * @param maximum the new maximum value
+ * @param thumb the new thumb value
+ * @param increment the new increment value
+ * @param pageIncrement the new pageIncrement value
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setValues (int selection, int minimum, int maximum, int thumb, int increment, int pageIncrement) {
+ checkWidget ();
+ if (selection < 0) return;
+ if (minimum < 0) return;
+ if (maximum < 0) return;
+ if (thumb < 1) return;
+ if (maximum - minimum - thumb < 0) return;
+ if (increment < 1) return;
+ if (pageIncrement < 1) return;
+ int hAdjustment = OS.gtk_range_get_adjustment (handle);
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, hAdjustment, GtkAdjustment.sizeof);
+ adjustment.value = (float) selection;
+ adjustment.lower = (float) minimum;
+ adjustment.upper = (float) maximum;
+ adjustment.page_size = (float) thumb;
+ adjustment.step_increment = (float) increment;
+ adjustment.page_increment = (float) pageIncrement;
+ OS.memmove (hAdjustment, adjustment, GtkAdjustment.sizeof);
+ OS.gtk_adjustment_changed (hAdjustment);
+ OS.gtk_adjustment_value_changed (hAdjustment);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TabFolder.java
new file mode 100644
index 0000000..4338e7e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TabFolder.java
@@ -0,0 +1,554 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class implement the notebook user interface
+ * metaphor. It allows the user to select a notebook page from
+ * set of pages.
+ * <p>
+ * The item children that may be added to instances of this class
+ * must be of type <code>TabItem</code>.
+ * <code>Control</code> children are created and then set into a
+ * tab item using <code>TabItem#setControl</code>.
+ * </p><p>
+ * Note that although this class is a subclass of <code>Composite</code>,
+ * it does not make sense to set a layout on it.
+ * </p><p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+public class TabFolder extends Composite {
+ int notebookHandle;
+ TabItem [] items;
+
+
+/*
+ * == CONSTRUCTORS ==
+ */
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TabFolder (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+/*
+ * == HANDLE DANCES, FIRST SPECIES ==
+ */
+
+void createHandle (int index) {
+ state |= HANDLE;
+ eventBoxHandle = OS.gtk_event_box_new();
+ fixedHandle = OS.gtk_fixed_new ();
+ notebookHandle = OS.gtk_notebook_new ();
+ handle = OS.gtk_fixed_new();
+}
+
+void configure () {
+ _connectParent();
+ OS.gtk_container_add(eventBoxHandle, fixedHandle);
+ OS.gtk_fixed_put (fixedHandle, notebookHandle, (short)0, (short)0);
+ OS.gtk_fixed_put (fixedHandle, handle, (short)2, (short)33);
+}
+
+void showHandle() {
+ OS.gtk_widget_show(eventBoxHandle);
+ OS.gtk_widget_show(fixedHandle);
+ OS.gtk_widget_show(notebookHandle);
+ OS.gtk_widget_show(handle);
+ OS.gtk_widget_realize (notebookHandle);
+ OS.gtk_widget_realize (handle);
+}
+
+void register () {
+ super.register ();
+ WidgetTable.put (notebookHandle, this);
+}
+
+void hookEvents () {
+ super.hookEvents ();
+ signal_connect (notebookHandle, "size_allocate", SWT.Resize, 3);
+ signal_connect (notebookHandle, "switch_page", SWT.Selection, 4);
+}
+
+void createWidget (int index) {
+ super.createWidget(index);
+ items = new TabItem [4];
+}
+
+int topHandle () { return eventBoxHandle; }
+int paintHandle () { return notebookHandle; }
+int parentingHandle () { return handle; }
+boolean isMyHandle(int h) {
+ if (h==eventBoxHandle) return true;
+ if (h==notebookHandle) return true;
+ if (h==fixedHandle) return true;
+ if (h==handle) return true;
+ return false;
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ //notebookHandle
+ int width = _computeSize(wHint, hHint, changed).x;
+ int height = 0;
+ Point size;
+ if (layout != null) {
+ size = layout.computeSize (this, wHint, hHint, changed);
+ } else {
+ size = minimumSize ();
+ }
+ if (size.x == 0) size.x = DEFAULT_WIDTH;
+ if (size.y == 0) size.y = DEFAULT_HEIGHT;
+ if (wHint != SWT.DEFAULT) size.x = wHint;
+ if (hHint != SWT.DEFAULT) size.y = hHint;
+ width = Math.max (width, size.x);
+ height = Math.max (height, size.y);
+ Rectangle trim = computeTrim (0, 0, width, height);
+ width = trim.width; height = trim.height;
+ return new Point (width, height);
+}
+
+/**
+* Computes the widget trim.
+*/
+public Rectangle computeTrim (int x, int y, int width, int height) {
+ checkWidget();
+ return new Rectangle(x-2, y-33, width+4, height+35);
+}
+
+/*
+ **** Layout code ****
+ */
+
+boolean _setSize(int width, int height) {
+ boolean differentExtent = UtilFuncs.setSize(eventBoxHandle, width,height);
+ UtilFuncs.setSize (fixedHandle, width,height);
+ UtilFuncs.setSize (notebookHandle, width,height);
+ UtilFuncs.setSize (handle, width-4, height-35);
+ layoutCurrent();
+ return differentExtent;
+}
+
+public Rectangle _getClientArea () {
+ org.eclipse.swt.graphics.Point size = _getSize();
+ int x = Math.max(size.x-4, 3);
+ int y = Math.max(size.y-35, 3);
+ return new Rectangle(0,0, x, y);
+}
+
+void layoutCurrent() {
+ int index=getSelectionIndex();
+ if (index==-1) return;
+ Control control = items[index].control;
+ if (control==null) return;
+ if (control.isDisposed()) return;
+ control.setBounds(getClientArea());
+}
+
+void createItem (TabItem item, int index) {
+ int list = OS.gtk_container_children (notebookHandle);
+ int itemCount = OS.g_list_length (list);
+ if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_ITEM_NOT_ADDED);
+ if (itemCount == items.length) {
+ TabItem [] newItems = new TabItem [items.length + 4];
+ System.arraycopy (items, 0, newItems, 0, items.length);
+ items = newItems;
+ }
+
+ // create a new label
+ byte [] buffer = new byte [] {0};
+ int labelHandle = OS.gtk_label_new (buffer);
+
+ // create a new fake page
+ int stubPage = OS.gtk_fixed_new();
+
+ // put the label and the fake page inside the notebook
+ OS.gtk_signal_handler_block_by_data (notebookHandle, SWT.Selection);
+ OS.gtk_notebook_append_page(notebookHandle, stubPage, labelHandle);
+ OS.gtk_signal_handler_unblock_by_data (notebookHandle, SWT.Selection);
+
+ OS.gtk_widget_show(labelHandle);
+ OS.gtk_widget_show(stubPage);
+
+ item.state |= HANDLE;
+ item.handle = labelHandle;
+ System.arraycopy (items, index, items, index + 1, itemCount++ - index);
+ items [index] = item;
+ OS.gtk_notebook_set_show_tabs (notebookHandle, true);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's selection changes, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * When <code>widgetSelected</code> is called, the item field of the event object is valid.
+ * <code>widgetDefaultSelected</code> is not called.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener(SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener(listener);
+ addListener(SWT.Selection,typedListener);
+ addListener(SWT.DefaultSelection,typedListener);
+}
+
+void destroyItem (TabItem item) {
+ int index = 0;
+ int itemCount = getItemCount();
+ while (index < itemCount) {
+ if (items [index] == item) break;
+ index++;
+ }
+ if (index == itemCount) error (SWT.ERROR_ITEM_NOT_REMOVED);
+ OS.gtk_notebook_remove_page (notebookHandle, index);
+ System.arraycopy (items, index + 1, items, index, --itemCount - index);
+ items [itemCount] = null;
+ item.handle = 0;
+}
+/**
+ * Returns the item at the given, zero-relative index in the
+ * receiver. Throws an exception if the index is out of range.
+ *
+ * @param index the index of the item to return
+ * @return the item at the given index
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+
+public TabItem getItem (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int list = OS.gtk_container_children (notebookHandle);
+ int itemCount = OS.g_list_length (list);
+ if (!(0 <= index && index < itemCount)) error (SWT.ERROR_CANNOT_GET_ITEM);
+ return items [index];
+}
+/**
+ * Returns the number of items contained in the receiver.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getItemCount () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ //return itemCount;
+ int list = OS.gtk_container_children (notebookHandle);
+ return OS.g_list_length (list);
+}
+/**
+ * Returns an array of <code>TabItem</code>s which are the items
+ * in the receiver.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the items in the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TabItem [] getItems () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int list = OS.gtk_container_children (notebookHandle);
+ int itemCount = OS.g_list_length (list);
+ TabItem [] result = new TabItem [itemCount];
+ System.arraycopy (items, 0, result, 0, itemCount);
+ return result;
+}
+/**
+ * Returns an array of <code>TabItem</code>s that are currently
+ * selected in the receiver. An empty array indicates that no
+ * items are selected.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its selection, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ * @return an array representing the selection
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TabItem [] getSelection () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int index = OS.gtk_notebook_get_current_page (notebookHandle);
+ if (index == -1) return new TabItem [0];
+ return new TabItem [] {items [index]};
+}
+/**
+ * Returns the zero-relative index of the item which is currently
+ * selected in the receiver, or -1 if no item is selected.
+ *
+ * @return the index of the selected item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelectionIndex () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return OS.gtk_notebook_get_current_page (notebookHandle);
+}
+
+/**
+ * Searches the receiver's list starting at the first item
+ * (index 0) until an item is found that is equal to the
+ * argument, and returns the index of that item. If no item
+ * is found, returns -1.
+ *
+ * @param item the search item
+ * @return the index of the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int indexOf (TabItem item) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
+ int list = OS.gtk_container_children (notebookHandle);
+ int itemCount = OS.g_list_length (list);
+ for (int i=0; i<itemCount; i++) {
+ if (items [i] == item) return i;
+ }
+ return -1;
+}
+
+int processSelection (int int0, int int1, int int2) {
+ int index = OS.gtk_notebook_get_current_page (notebookHandle);
+ if (index != -1) {
+ Control control = items [index].getControl ();
+ if (control != null && !control.isDisposed ()) {
+ control.setVisible (false);
+ }
+ }
+ Control control = items [int1].getControl ();
+ if (control != null && !control.isDisposed ()) {
+ control.setBounds(getClientArea());
+ control.setVisible (true);
+ }
+ Event event = new Event();
+ event.item = items[int1];
+ postEvent(SWT.Selection, event);
+ return 0;
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's selection changes.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener (SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+/**
+ * Selects the item at the given zero-relative index in the receiver.
+ * If the item at the index was already selected, it remains selected.
+ * The current selected is first cleared, then the new items are
+ * selected. Indices that are out of range are ignored.
+ *
+ * @param index the index of the item to select
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (int index) {
+ checkWidget();
+ if (index == -1) return;
+ OS.gtk_signal_handler_block_by_data (notebookHandle, SWT.Selection);
+ OS.gtk_notebook_set_page (notebookHandle, index);
+ OS.gtk_signal_handler_unblock_by_data (notebookHandle, SWT.Selection);
+}
+
+/**
+ * Sets the receiver's selection to be the given array of items.
+ * The current selected is first cleared, then the new items are
+ * selected.
+ *
+ * @param items the array of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (TabItem [] items) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (items.length == 0) {
+ setSelection (-1);
+ return;
+ }
+ for (int i=items.length-1; i>=0; --i) {
+ int index = indexOf (items [i]);
+ if (index != -1) setSelection (index);
+ }
+}
+
+/*
+ * == DESTRUCTION ===
+ */
+
+void deregister () {
+ super.deregister ();
+ WidgetTable.remove (notebookHandle);
+}
+
+void releaseChildren() {
+ int list = OS.gtk_container_children (notebookHandle);
+ int itemCount = OS.g_list_length (list);
+ for (int i=0; i<itemCount; i++) {
+ TabItem item = items [i];
+ if (!item.isDisposed ()) {
+ item.releaseWidget ();
+ item.releaseHandle ();
+ }
+ }
+
+ // Now, the non-item children
+ list = OS.gtk_container_children(parentingHandle());
+ int childCount = OS.g_list_length (list);
+ for (int i=0; i<childCount; i++) {
+ int childHandle = OS.g_list_nth_data(list, i);
+ if (!isMyHandle(childHandle)) {
+ Widget w = WidgetTable.get(childHandle);
+ if (!(w==null) && !(w.isDisposed())) {
+ w.releaseWidget();
+ w.releaseHandle();
+ }
+ }
+ }
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ notebookHandle = 0;
+}
+
+void releaseWidget () {
+ super.releaseWidget();
+ items = null;
+}
+
+/*
+ * == AS YET UNCLASSIFIED ===
+ */
+
+static int checkStyle (int style) {
+ /*
+ * Even though it is legal to create this widget
+ * with scroll bars, they serve no useful purpose
+ * because they do not automatically scroll the
+ * widget's client area. The fix is to clear
+ * the SWT style.
+ */
+ return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TabItem.java
new file mode 100644
index 0000000..8454cc3
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TabItem.java
@@ -0,0 +1,218 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class represent a selectable user interface object
+ * corresponding to a tab for a page in a tab folder.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+
+public class TabItem extends Item {
+ Control control;
+ TabFolder parent;
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>TabFolder</code>) and a style value
+ * describing its behavior and appearance. The item is added
+ * to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TabItem (TabFolder parent, int style) {
+ super (parent, style);
+ this.parent = parent;
+ parent.createItem (this, parent.getItemCount ());
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>TabFolder</code>), a style value
+ * describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TabItem (TabFolder parent, int style, int index) {
+ super (parent, style);
+ this.parent = parent;
+ parent.createItem (this, index);
+}
+/**
+ * Returns the control that is used to fill the client area of
+ * the tab folder when the user selects the tab item. If no
+ * control has been set, return <code>null</code>.
+ * <p>
+ * @return the control
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Control getControl () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return control;
+}
+public Display getDisplay () {
+ TabFolder parent = this.parent;
+ if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getDisplay ();
+}
+/**
+ * Returns the receiver's parent, which must be a <code>TabFolder</code>.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TabFolder getParent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent;
+}
+/**
+ * Returns the receiver's tool tip text, or null if it has
+ * not been set.
+ *
+ * @return the receiver's tool tip text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getToolTipText () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return "";
+}
+void releaseChild () {
+ super.releaseChild ();
+ parent.destroyItem (this);
+}
+void releaseWidget () {
+ super.releaseWidget ();
+ parent = null;
+}
+/**
+ * Sets the control that is used to fill the client area of
+ * the tab folder when the user selects the tab item.
+ * <p>
+ * @param control the new control (or null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
+ * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setControl (Control control) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ Control oldControl = this.control, newControl = control;
+ this.control = control;
+ int index = parent.indexOf (this);
+ if (index != parent.getSelectionIndex ()) return;
+ if (newControl != null) {
+ newControl.setBounds (parent.getClientArea ());
+ newControl.setVisible (true);
+ }
+ if (oldControl != null) oldControl.setVisible (false);
+}
+public void setImage (Image image) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ super.setImage (image);
+}
+public void setText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ super.setText (string);
+ byte [] buffer = string2bytesConvertMnemonic(string);
+ OS.gtk_label_parse_uline(handle, buffer);
+}
+/**
+ * Sets the receiver's tool tip text to the argument, which
+ * may be null indicating that no tool tip text should be shown.
+ *
+ * @param string the new tool tip text (or null)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setToolTipText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Table.java
new file mode 100644
index 0000000..e6a4d87
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Table.java
@@ -0,0 +1,1333 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class implement a selectable user interface
+ * object that displays a list of images and strings and issue
+ * notificiation when selected.
+ * <p>
+ * The item children that may be added to instances of this class
+ * must be of type <code>TableItem</code>.
+ * </p><p>
+ * Note that although this class is a subclass of <code>Composite</code>,
+ * it does not make sense to add <code>Control</code> children to it,
+ * or set a layout on it.
+ * </p><p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>SINGLE, MULTI, CHECK, FULL_SELECTION, HIDE_SELECTION</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection, DefaultSelection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+public class Table extends Composite {
+ int itemCount, columnCount;
+ TableItem [] items;
+ TableColumn [] columns;
+ TableItem itemBeingSelected;
+ TableItem[] selection = new TableItem[0];
+ public static int MAX_COLUMNS = 32;
+
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Table (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+
+
+
+/*
+ * === HANDLE CODE 1 ===
+ */
+
+void createHandle (int index) {
+ state |= HANDLE;
+
+ eventBoxHandle = OS.gtk_event_box_new();
+ if (eventBoxHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+
+ fixedHandle = OS.gtk_fixed_new();
+ if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ handle = OS.gtk_clist_new (MAX_COLUMNS);
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ scrolledHandle = OS.gtk_scrolled_window_new (0, 0);
+ if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+void setHandleStyle () {
+ /* Single or Multiple Selection */
+ int selectionMode;
+ if ((style & SWT.MULTI) != 0) selectionMode = OS.GTK_SELECTION_EXTENDED;
+ else selectionMode = OS.GTK_SELECTION_BROWSE;
+ OS.gtk_clist_set_selection_mode (handle, selectionMode);
+
+ /* We fake the number of columns, because we have to know beforehand.
+ * Initially all those fake columns are invisible
+ */
+ byte [] buffer = new byte [1];
+ OS.gtk_clist_set_column_title (handle, 0, buffer);
+ for (int i=1; i<MAX_COLUMNS; i++) {
+ OS.gtk_clist_set_column_visibility (handle, i, false);
+ }
+
+ /* Scrolling policy */
+ int hscrollbar_policy = (style & SWT.H_SCROLL) != 0 ? OS.GTK_POLICY_ALWAYS : OS.GTK_POLICY_AUTOMATIC;
+ int vscrollbar_policy = (style & SWT.V_SCROLL) != 0 ? OS.GTK_POLICY_ALWAYS : OS.GTK_POLICY_AUTOMATIC;
+ OS.gtk_scrolled_window_set_policy (scrolledHandle, hscrollbar_policy, vscrollbar_policy);
+}
+void configure() {
+ _connectParent();
+ OS.gtk_container_add(eventBoxHandle, fixedHandle);
+ OS.gtk_fixed_put (fixedHandle, scrolledHandle, (short)0, (short)0);
+ OS.gtk_container_add (scrolledHandle, handle);
+}
+
+static int checkStyle (int style) {
+ /*
+ * To be compatible with Windows, force the H_SCROLL
+ * and V_SCROLL style bits. On Windows, it is not
+ * possible to create a table without scroll bars.
+ */
+ style |= SWT.H_SCROLL | SWT.V_SCROLL;
+ return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ if (wHint == SWT.DEFAULT) wHint = 200;
+ return _computeSize (wHint, hHint, changed);
+}
+
+void showHandle() {
+ OS.gtk_widget_show (eventBoxHandle);
+ OS.gtk_widget_show (fixedHandle);
+ OS.gtk_widget_show (scrolledHandle);
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void hookEvents () {
+ //TO DO - get rid of enter/exit for mouse crossing border
+ super.hookEvents ();
+ signal_connect (handle, "select_row", SWT.Selection, 5);
+}
+
+void createWidget (int index) {
+ super.createWidget (index);
+ items = new TableItem [4];
+ columns = new TableColumn [4];
+ itemCount = columnCount = 0;
+}
+
+/*
+ * HANDLE CODE 2
+ */
+int topHandle() { return eventBoxHandle; }
+int parentingHandle() { return fixedHandle; }
+boolean isMyHandle(int h) {
+ if (h==eventBoxHandle) return true;
+ if (h==scrolledHandle) return true;
+ if (h==fixedHandle) return true;
+ if (h==handle) return true;
+ return false;
+
+}
+
+
+
+/*
+ * === GEOMETRY ===
+ */
+
+boolean _setSize(int width, int height) {
+ boolean different = UtilFuncs.setSize(eventBoxHandle, width, height);
+ if (different) UtilFuncs.setSize(fixedHandle, width, height);
+ if (different) UtilFuncs.setSize(scrolledHandle, width, height);
+ return different;
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's selection changes, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * When <code>widgetSelected</code> is called, the item field of the event object is valid.
+ * If the reciever has <code>SWT.CHECK</code> style set and the check selection changes,
+ * the event object detail field contains the value <code>SWT.CHECK</code>.
+ * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
+ * The item field of the event object is valid for default selection, but the detail field is not used.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener (SelectionListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+
+
+/* The real work to create a new column */
+void createItem (TableColumn column, int index) {
+ if (!(0 <= index && index <= columnCount)) error (SWT.ERROR_ITEM_NOT_ADDED);
+ if (columnCount == columns.length) {
+ TableColumn [] newColumns = new TableColumn [columns.length + 4];
+ System.arraycopy (columns, 0, newColumns, 0, columns.length);
+ columns = newColumns;
+ }
+ OS.gtk_clist_set_column_visibility (handle, index, true);
+ OS.gtk_clist_column_titles_passive(handle); // paranoia
+ System.arraycopy (columns, index, columns, index + 1, columnCount++ - index);
+ columns [index] = column;
+}
+void createItem (TableItem item, int index) {
+ if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_ITEM_NOT_ADDED);
+ if (itemCount == items.length) {
+ TableItem [] newItems = new TableItem [items.length + 4];
+ System.arraycopy (items, 0, newItems, 0, items.length);
+ items = newItems;
+ }
+// int ptr = OS.g_malloc (1);
+ int [] strings = new int [MAX_COLUMNS];
+// for (int i=0; i<strings.length; i++) strings [i] = ptr;
+ for (int i=0; i<strings.length; i++) strings [i] = 0;
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ int result = OS.gtk_clist_insert (handle, index, strings);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+// OS.g_free (ptr);
+ System.arraycopy (items, index, items, index + 1, itemCount++ - index);
+ items [index] = item;
+}
+
+/**
+ * Deselects the item at the given zero-relative index in the receiver.
+ * If the item at the index was already deselected, it remains
+ * deselected. Indices that are out of range are ignored.
+ *
+ * @param index the index of the item to deselect
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselect (int index) {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_unselect_row (handle, index, 0);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ selection = _getNativeSelection();
+}
+/**
+ * Deselects the items at the given zero-relative indices in the receiver.
+ * If the item at the given zero-relative index in the receiver
+ * is selected, it is deselected. If the item at the index
+ * was not selected, it remains deselected. The range of the
+ * indices is inclusive. Indices that are out of range are ignored.
+ *
+ * @param start the start index of the items to deselect
+ * @param end the end index of the items to deselect
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselect (int start, int end) {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ for (int i=start; i<=end; i++) {
+ OS.gtk_clist_unselect_row (handle, i, 0);
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ selection = _getNativeSelection();
+}
+/**
+ * Deselects the items at the given zero-relative indices in the receiver.
+ * If the item at the given zero-relative index in the receiver
+ * is selected, it is deselected. If the item at the index
+ * was not selected, it remains deselected. Indices that are out
+ * of range and duplicate indices are ignored.
+ *
+ * @param indices the array of indices for the items to deselect
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselect (int [] indices) {
+ checkWidget();
+ if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ for (int i=0; i<indices.length; i++) {
+ OS.gtk_clist_unselect_row (handle, indices [i], 0);
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+/**
+ * Deselects all selected items in the receiver.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselectAll () {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_unselect_all (handle);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ selection = new TableItem[0];
+}
+
+void destroyItem (TableColumn column) {
+ int index = 0;
+ while (index < columnCount) {
+ if (columns [index] == column) break;
+ index++;
+ }
+ if (index == columnCount) return;
+ OS.gtk_clist_set_column_visibility (handle, index, false);
+ OS.gtk_clist_set_column_title (handle, index, new byte [1]);
+ System.arraycopy (columns, index + 1, columns, index, --columnCount - index);
+ columns [columnCount] = null;
+}
+void destroyItem (TableItem item) {
+ int index = 0;
+ while (index < itemCount) {
+ if (items [index] == item) break;
+ index++;
+ }
+ if (index == itemCount) return;
+ OS.gtk_clist_remove (handle, index);
+ System.arraycopy (items, index + 1, items, index, --itemCount - index);
+ items [itemCount] = null;
+}
+/**
+ * Returns the column at the given, zero-relative index in the
+ * receiver. Throws an exception if the index is out of range.
+ * If no <code>TableColumn</code>s were created by the programmer,
+ * this method will throw <code>ERROR_INVALID_RANGE</code> despite
+ * the fact that a single column of data may be visible in the table.
+ * This occurs when the programmer uses the table like a list, adding
+ * items but never creating a column.
+ *
+ * @param index the index of the column to return
+ * @return the column at the given index
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TableColumn getColumn (int index) {
+ checkWidget();
+ if (!(0 <= index && index < columnCount)) error (SWT.ERROR_CANNOT_GET_ITEM);
+ return columns [index];
+}
+/**
+ * Returns the number of columns contained in the receiver.
+ * If no <code>TableColumn</code>s were created by the programmer,
+ * this value is zero, despite the fact that visually, one column
+ * of items is may be visible. This occurs when the programmer uses
+ * the table like a list, adding items but never creating a column.
+ *
+ * @return the number of columns
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public int getColumnCount () {
+ checkWidget();
+ return columnCount;
+}
+/**
+ * Returns an array of <code>TableColumn</code>s which are the
+ * columns in the receiver. If no <code>TableColumn</code>s were
+ * created by the programmer, the array is empty, despite the fact
+ * that visually, one column of items may be visible. This occurs
+ * when the programmer uses the table like a list, adding items but
+ * never creating a column.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the items in the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TableColumn [] getColumns () {
+ checkWidget();
+ TableColumn [] result = new TableColumn [columnCount];
+ System.arraycopy (columns, 0, result, 0, columnCount);
+ return result;
+}
+/**
+ * Returns the width in pixels of a grid line.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getGridLineWidth () {
+ checkWidget();
+ /* FIXME */
+ return 0;
+}
+
+
+
+/**
+ * Returns the item at the given, zero-relative index in the
+ * receiver. Throws an exception if the index is out of range.
+ *
+ * @param index the index of the item to return
+ * @return the item at the given index
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TableItem getItem (int index) {
+ checkWidget();
+ if (!(0 <= index && index < itemCount)) error (SWT.ERROR_CANNOT_GET_ITEM);
+ return items [index];
+}
+
+/**
+ * Returns the item at the given point in the receiver
+ * or null if no such item exists. The point is in the
+ * coordinate system of the receiver.
+ *
+ * @param point the point used to locate the item
+ * @return the item at the given point
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TableItem getItem (Point pt) {
+ checkWidget();
+
+ GtkCList clist = new GtkCList ();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ int clientX = pt.x;
+ int clientY = pt.y - clist.column_title_area_height;
+ if (clientY <= 0) return null;
+
+ int[] row = new int[1], column = new int[1];
+ row[0] = -1;
+ OS.gtk_clist_get_selection_info(handle, clientX, clientY, row, column);
+ if (row[0] == -1) return null;
+ return items[row[0]];
+}
+
+/**
+ * Returns the number of items contained in the receiver.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getItemCount () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return itemCount;
+}
+/**
+ * Returns the height of the area which would be used to
+ * display <em>one</em> of the items in the receiver's.
+ *
+ * @return the height of one item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getItemHeight () {
+ checkWidget();
+ GtkCList clist = new GtkCList ();
+ OS.memmove (clist, handle, GtkCList.sizeof);
+ return clist.row_height;
+}
+/**
+ * Returns an array of <code>TableItem</code>s which are the items
+ * in the receiver.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the items in the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TableItem [] getItems () {
+ checkWidget();
+ TableItem [] result = new TableItem [itemCount];
+ System.arraycopy (items, 0, result, 0, itemCount);
+ return result;
+}
+
+
+
+/*
+ * === SELECTION STORY ===
+ */
+
+/**
+ * Returns an array of <code>TableItem</code>s that are currently
+ * selected in the receiver. An empty array indicates that no
+ * items are selected.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its selection, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ * @return an array representing the selection
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TableItem[] getSelection () {
+ checkWidget();
+ return selection;
+}
+
+/**
+ * Get the selection from the OS.
+ */
+private TableItem[] _getNativeSelection () {
+ GtkCList clist = new GtkCList ();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ switch (clist.selection_mode) {
+ case OS.GTK_SELECTION_SINGLE: return getSelection_single();
+ case OS.GTK_SELECTION_BROWSE: return getSelection_browse();
+ case OS.GTK_SELECTION_MULTIPLE: return getSelection_multiple();
+ case OS.GTK_SELECTION_EXTENDED: return getSelection_extended();
+ default: error(SWT.ERROR_UNSPECIFIED);
+ }
+ /* can never get here */
+ return null;
+}
+private TableItem[] getSelection_single () {
+ GtkCList clist = new GtkCList();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ if (clist.selection==0) return new TableItem[0];
+ int length = OS.g_list_length (clist.selection);
+ if (length == 0) return new TableItem[0];
+ int index = OS.g_list_nth_data (clist.selection, 0);
+ return new TableItem [] {items[index]};
+}
+private TableItem[] getSelection_browse () {
+ /* same as single */
+ GtkCList clist = new GtkCList();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ if (clist.selection==0) return new TableItem[0];
+ int length = OS.g_list_length (clist.selection);
+ if (length == 0) return new TableItem[0];
+ int index = OS.g_list_nth_data (clist.selection, 0);
+ return new TableItem [] {items[index]};
+}
+private TableItem[] getSelection_multiple () {
+ GtkCList clist = new GtkCList();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ if (clist.selection==0) return new TableItem[0];
+ int length = OS.g_list_length (clist.selection);
+ TableItem [] result = new TableItem [length];
+ for (int i=0; i<length; i++) {
+ int index = OS.g_list_nth_data (clist.selection, i);
+ result [i] = items [index];
+ }
+ return result;
+}
+private TableItem[] getSelection_extended () {
+ GtkCList clist = new GtkCList();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ if (clist.selection==0) return new TableItem[0];
+ int length = OS.g_list_length (clist.selection);
+ TableItem [] result = new TableItem [length];
+ for (int i=0; i<length; i++) {
+ int index = OS.g_list_nth_data (clist.selection, i);
+ result [i] = items [index];
+ }
+ return result;
+}
+
+/**
+ * Returns the number of selected items contained in the receiver.
+ *
+ * @return the number of selected items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelectionCount () {
+ checkWidget();
+ return selection.length;
+}
+private int _getNativeSelectionCount () {
+ GtkCList clist = new GtkCList ();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ int selectionList = clist.selection;
+ if (selectionList==0) return 0;
+ return OS.g_list_length (clist.selection);
+}
+/**
+ * Returns the zero-relative index of the item which is currently
+ * selected in the receiver, or -1 if no item is selected.
+ *
+ * @return the index of the selected item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelectionIndex () {
+ checkWidget();
+ GtkCList clist = new GtkCList ();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ int list = clist.selection;
+ if (OS.g_list_length (list) == 0) return -1;
+ return OS.g_list_nth_data (list, 0);
+}
+/**
+ * Returns the zero-relative indices of the items which are currently
+ * selected in the receiver. The array is empty if no items are selected.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its selection, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ * @return the array of indices of the selected items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int [] getSelectionIndices () {
+ checkWidget();
+ GtkCList widget = new GtkCList ();
+ OS.memmove (widget, handle, GtkCList.sizeof);
+ int list = widget.selection;
+ int length = OS.g_list_length (list);
+ int [] indices = new int [length];
+ for (int i=0; i<length; i++) {
+ indices [i] = OS.g_list_nth_data (list, i);
+ }
+ return indices;
+}
+
+/**
+ * Returns <code>true</code> if the item is selected,
+ * and <code>false</code> otherwise. Indices out of
+ * range are ignored.
+ *
+ * @param index the index of the item
+ * @return the visibility state of the item at the index
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isSelected (int index) {
+ checkWidget();
+ GtkCList widget = new GtkCList ();
+ OS.memmove (widget, handle, GtkCList.sizeof);
+ int list = widget.selection;
+ int length = OS.g_list_length (list);
+ for (int i=0; i<length; i++) {
+ if (index == OS.g_list_nth_data (list, i)) return true;
+ }
+ return false;
+}
+
+
+
+
+
+/**
+ * Returns the zero-relative index of the item which is currently
+ * at the top of the receiver. This index can change when items are
+ * scrolled or new items are added or removed.
+ *
+ * @return the index of the top item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getTopIndex () {
+ checkWidget();
+ GtkCList clist = new GtkCList ();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ return -clist.voffset / (clist.row_height + 1);
+}
+
+/**
+ * Searches the receiver's list starting at the first column
+ * (index 0) until a column is found that is equal to the
+ * argument, and returns the index of that column. If no column
+ * is found, returns -1.
+ *
+ * @param column the search column
+ * @return the index of the column
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int indexOf (TableColumn column) {
+ checkWidget();
+ if (column == null) error (SWT.ERROR_NULL_ARGUMENT);
+ for (int i=0; i<columnCount; i++) {
+ if (columns [i] == column) return i;
+ }
+ return -1;
+}
+/**
+ * Searches the receiver's list starting at the first item
+ * (index 0) until an item is found that is equal to the
+ * argument, and returns the index of that item. If no item
+ * is found, returns -1.
+ *
+ * @param item the search item
+ * @return the index of the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int indexOf (TableItem item) {
+ checkWidget();
+ if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
+ for (int i=0; i<itemCount; i++) {
+ if (items [i] == item) return i;
+ }
+ return -1;
+}
+
+void releaseWidget () {
+ int columnCount = 0;
+ for (int i=0; i<columnCount; i++) {
+ TableColumn column = columns [i];
+// if (!column.isDisposed ()) column.releaseWidget ();
+ if (column != null && !column.isDisposed ()) column.releaseWidget ();
+ }
+ columns = null;
+ int itemCount = 0;
+ for (int i=0; i<itemCount; i++) {
+ TableItem item = items [i];
+ if (!item.isDisposed ()) item.releaseWidget ();
+ }
+ items = null;
+ itemBeingSelected = null;
+ super.releaseWidget ();
+}
+/**
+ * Removes the item from the receiver at the given
+ * zero-relative index.
+ *
+ * @param index the index for the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (int index) {
+ checkWidget();
+ if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_ITEM_NOT_REMOVED);
+ OS.gtk_clist_remove (handle, index);
+ TableItem item = items [index];
+ System.arraycopy (items, index + 1, items, index, --itemCount - index);
+ items [itemCount] = null;
+ item.releaseWidget ();
+}
+/**
+ * Removes the items from the receiver which are
+ * between the given zero-relative start and end
+ * indices (inclusive).
+ *
+ * @param start the start of the range
+ * @param end the end of the range
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (int start, int end) {
+ checkWidget();
+ int index = end;
+ while (index >= start) {
+ OS.gtk_clist_remove (handle, index);
+ items [index].releaseWidget ();
+ --index;
+ }
+ int first = index + 1, last = end + 1;
+ System.arraycopy (items, last, items, first, itemCount - last);
+ for (int i=itemCount-(last-first); i<itemCount; i++) items [i] = null;
+ itemCount = itemCount - (last - first);
+ if (first > start) error (SWT.ERROR_ITEM_NOT_REMOVED);
+}
+/**
+ * Removes the items from the receiver's list at the given
+ * zero-relative indices.
+ *
+ * @param indices the array of indices of the items
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ * @exception SWTError <ul>
+ * <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
+ * </ul>
+ */
+public void remove (int [] indices) {
+ checkWidget();
+ if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
+ int [] newIndices = new int [indices.length];
+ System.arraycopy (indices, 0, newIndices, 0, indices.length);
+ sort (newIndices);
+ int last = -1;
+ for (int i=0; i<newIndices.length; i++) {
+ int index = newIndices [i];
+ if (index != last || i == 0) {
+ OS.gtk_clist_remove (handle, index);
+ // BUG - disposed callback could remove an item
+ items [index].releaseWidget ();
+ System.arraycopy (items, index + 1, items, index, --itemCount - index);
+ items [itemCount] = null;
+ last = index;
+ }
+ }
+}
+/**
+ * Removes all of the items from the receiver.
+ * <p>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void removeAll () {
+ checkWidget();
+ OS.gtk_clist_clear (handle);
+ items = new TableItem [4];
+ itemCount = 0;
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's selection changes.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener(SelectionListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+/**
+ * Selects the item at the given zero-relative index in the receiver.
+ * If the item at the index was already selected, it remains
+ * selected. Indices that are out of range are ignored.
+ *
+ * @param index the index of the item to select
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void select (int index) {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_select_row (handle, index, 0);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ selection = _getNativeSelection();
+}
+
+/**
+ * Selects the items at the given zero-relative indices in the receiver.
+ * If the item at the index was already selected, it remains
+ * selected. The range of the indices is inclusive. Indices that are
+ * out of range are ignored.
+ *
+ * @param start the start of the range
+ * @param end the end of the range
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void select (int start, int end) {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ for (int i=start; i<=end; i++) {
+ OS.gtk_clist_select_row (handle, i, 0);
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ selection = _getNativeSelection();
+}
+/**
+ * Selects the items at the given zero-relative indices in the receiver.
+ * If the item at the given zero-relative index in the receiver
+ * is not selected, it is selected. If the item at the index
+ * was selected, it remains selected. Indices that are out
+ * of range and duplicate indices are ignored.
+ *
+ * @param indices the array of indices for the items to select
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void select (int [] indices) {
+ checkWidget();
+ if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ for (int i=0; i<indices.length; i++) {
+ OS.gtk_clist_select_row (handle, indices [i], 0);
+ }
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ selection = _getNativeSelection();
+}
+/**
+ * Selects all the items in the receiver.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void selectAll () {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_select_all (handle);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ selection = _getNativeSelection();
+}
+
+/**
+ * Returns <code>true</code> if the receiver's header is visible,
+ * and <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the receiver's header's visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getHeaderVisible () {
+ checkWidget();
+ return (OS.GTK_WIDGET_FLAGS(handle)&OS.GTK_CLIST_SHOW_TITLES) != 0;
+}
+
+/**
+ * Marks the receiver's header as visible if the argument is <code>true</code>,
+ * and marks it invisible otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, marking
+ * it visible may not actually cause it to be displayed.
+ * </p>
+ *
+ * @param visible the new visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setHeaderVisible (boolean show) {
+ /* FIXME
+ * We should investigate why this optimization is not working.
+ */
+// boolean isVisibleNow = getHeaderVisible();
+// if (show==isVisibleNow) return;
+ if (show) {
+ OS.gtk_clist_column_titles_show (handle);
+ OS.gtk_clist_column_titles_passive(handle);
+ } else {
+ OS.gtk_clist_column_titles_hide (handle);
+ }
+}
+/**
+ * Returns <code>true</code> if the receiver's lines are visible,
+ * and <code>false</code> otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, this method
+ * may still indicate that it is considered visible even though
+ * it may not actually be showing.
+ * </p>
+ *
+ * @return the visibility state of the lines
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getLinesVisible() {
+ checkWidget();
+ return false;
+}
+/**
+ * Marks the receiver's lines as visible if the argument is <code>true</code>,
+ * and marks it invisible otherwise.
+ * <p>
+ * If one of the receiver's ancestors is not visible or some
+ * other condition makes the receiver not visible, marking
+ * it visible may not actually cause it to be displayed.
+ * </p>
+ *
+ * @param visible the new visibility state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setLinesVisible (boolean show) {
+ checkWidget();
+}
+/**
+ * Selects the item at the given zero-relative index in the receiver.
+ * The current selected is first cleared, then the new item is selected.
+ *
+ * @param index the index of the item to select
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Table#deselectAll()
+ * @see Table#select(int)
+ */
+public void setSelection (int index) {
+ deselectAll ();
+ select (index);
+ selection = _getNativeSelection();
+}
+/**
+ * Selects the items at the given zero-relative indices in the receiver.
+ * The current selected if first cleared, then the new items are selected.
+ *
+ * @param start the start index of the items to select
+ * @param end the end index of the items to select
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Table#deselectAll()
+ * @see Table#select(int,int)
+ */
+public void setSelection (int start, int end) {
+ deselectAll ();
+ select (start, end);
+ selection = _getNativeSelection();
+}
+/**
+ * Selects the items at the given zero-relative indices in the receiver.
+ * The current selected is first cleared, then the new items are selected.
+ *
+ * @param indices the indices of the items to select
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Table#deselectAll()
+ * @see Table#select(int[])
+ */
+public void setSelection (int [] indices) {
+ deselectAll ();
+ select (indices);
+ selection = _getNativeSelection();
+}
+/**
+ * Sets the receiver's selection to be the given array of items.
+ * The current selected is first cleared, then the new items are
+ * selected.
+ *
+ * @param items the array of items
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if one of the item has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Table#deselectAll()
+ * @see Table#select(int)
+ */
+public void setSelection (TableItem [] items) {
+ checkWidget();
+ if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
+ deselectAll ();
+ int length = items.length;
+ if (length == 0) return;
+ if ((style & SWT.SINGLE) != 0) length = 1;
+ for (int i=length-1; i>=0; --i) {
+ int index = indexOf (items [i]);
+ if (index != -1) select (index);
+ }
+ selection = items; /* FIXME */
+}
+/**
+ * Sets the zero-relative index of the item which is currently
+ * at the top of the receiver. This index can change when items
+ * are scrolled or new items are added and removed.
+ *
+ * @param index the index of the top item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setTopIndex (int index) {
+ checkWidget();
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_clist_moveto (handle, index, 0, 0.0f, 0.0f);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+
+/**
+ * Shows the item. If the item is already showing in the receiver,
+ * this method simply returns. Otherwise, the items are scrolled until
+ * the item is visible.
+ *
+ * @param item the item to be shown
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the item is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Table#showSelection()
+ */
+public void showItem (TableItem item) {
+// error(SWT.ERROR_NOT_IMPLEMENTED);
+}
+
+/**
+ * Shows the selection. If the selection is already showing in the receiver,
+ * this method simply returns. Otherwise, the items are scrolled until
+ * the selection is visible.
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Table#showItem(TableItem)
+ */
+public void showSelection () {
+ checkWidget();
+ setTopIndex (getSelectionIndex ());
+}
+
+int processSelection (int int0, int int1, int int2) {
+ selection = _getNativeSelection();
+ itemBeingSelected = items [int0];
+ Event event = new Event ();
+ event.item = itemBeingSelected;
+ sendEvent (SWT.Selection, event);
+ return 0;
+}
+
+int processMouseDown (int callData, int arg1, int int2) {
+ OS.gtk_widget_grab_focus(handle);
+
+ // First, see if we have a single or double click
+ GdkEventButton gdkEvent = new GdkEventButton ();
+ OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
+ boolean isDoubleClick = (gdkEvent.type == OS.GDK_2BUTTON_PRESS);
+
+ // We can't just use the x and y coordinates from the Gdk event,
+ // because the actual items are drawn on a special X window
+ Point where = _gdkWindowGetPointer();
+ int eventType;
+ if (isDoubleClick) {
+ eventType = SWT.MouseDoubleClick;
+ Event event = new Event ();
+ event.item=itemBeingSelected;
+ event.x = where.x; event.y = where.y;
+ sendEvent (SWT.DefaultSelection, event);
+ return 1;
+ }
+
+ eventType = SWT.MouseDown;
+ sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, where.x, where.y);
+ if (gdkEvent.button == 3 && menu != null) menu.setVisible (true);
+ return 1;
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TableColumn.java
new file mode 100644
index 0000000..eab13db
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TableColumn.java
@@ -0,0 +1,403 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class represent a column in a table widget.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>LEFT, RIGHT, CENTER</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd> Move, Resize, Selection</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+
+public class TableColumn extends Item {
+ Table parent;
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Table</code>) and a style value
+ * describing its behavior and appearance. The item is added
+ * to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TableColumn (Table parent, int style) {
+ super (parent, checkStyle (style));
+ this.parent = parent;
+ createWidget (parent.getColumnCount ());
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Table</code>), a style value
+ * describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TableColumn (Table parent, int style, int index) {
+ super (parent, checkStyle (style));
+ this.parent = parent;
+ createWidget (index);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control is moved or resized, by sending
+ * it one of the messages defined in the <code>ControlListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ControlListener
+ * @see #removeControlListener
+ */
+public void addControlListener(ControlListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Resize,typedListener);
+ addListener (SWT.Move,typedListener);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control is selected, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * <code>widgetSelected</code> is called when the column header is selected.
+ * <code>widgetDefaultSelected</code> is not called.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener (SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+static int checkStyle (int style) {
+ return checkBits (style, SWT.LEFT, SWT.CENTER, SWT.RIGHT, 0, 0, 0);
+}
+void createWidget (int index) {
+ parent.createItem (this, index);
+ text = "";
+}
+/**
+ * Returns a value which describes the position of the
+ * text or image in the receiver. The value will be one of
+ * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>.
+ *
+ * @return the alignment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getAlignment () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & SWT.LEFT) != 0) return SWT.LEFT;
+ if ((style & SWT.CENTER) != 0) return SWT.CENTER;
+ if ((style & SWT.RIGHT) != 0) return SWT.RIGHT;
+ return SWT.LEFT;
+}
+public Display getDisplay () {
+ Table parent = this.parent;
+ if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getDisplay ();
+}
+/**
+ * Returns the receiver's parent, which must be a <code>Table</code>.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Table getParent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent;
+}
+/**
+ * Gets the resizable attribute. A column that is
+ * not resizable cannot be dragged by the user but
+ * may be resized by the programmer.
+ *
+ * @return the resizable attribute
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getResizable () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int index = parent.indexOf (this);
+ if (index == -1) return false;
+ GtkCList gtkclist = new GtkCList();
+ OS.memmove(gtkclist, parent.handle, GtkCList.sizeof);
+ int chandle=gtkclist.column;
+ GtkCListColumn gtkcolumn = new GtkCListColumn();
+ OS.memmove(gtkcolumn, chandle+index*GtkCListColumn.sizeof, GtkCListColumn.sizeof);
+ return (gtkcolumn.resizeable == 1) ? true : false;
+}
+/**
+ * Gets the width of the receiver.
+ *
+ * @return the width
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getWidth () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int index = parent.indexOf (this);
+ if (index == -1) return 0;
+ GtkCList gtkclist = new GtkCList();
+ OS.memmove(gtkclist, parent.handle, GtkCList.sizeof);
+ int chandle=gtkclist.column;
+ GtkCListColumn gtkcolumn = new GtkCListColumn();
+ OS.memmove(gtkcolumn, chandle+index*GtkCListColumn.sizeof, GtkCListColumn.sizeof);
+ return gtkcolumn.width;
+}
+/**
+ * Causes the receiver to be resized to its preferred size.
+ * For a composite, this involves computing the preferred size
+ * from its layout, if there is one.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ */
+public void pack () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+void releaseChild () {
+ super.releaseChild ();
+ parent.destroyItem (this);
+}
+void releaseWidget () {
+ super.releaseWidget ();
+ text = null;
+ parent = null;
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is moved or resized.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ControlListener
+ * @see #addControlListener
+ */
+public void removeControlListener (ControlListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Move, listener);
+ eventTable.unhook (SWT.Resize, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is selected.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener(SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+/**
+ * Controls how text and images will be displayed in the receiver.
+ * The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
+ * or <code>CENTER</code>.
+ *
+ * @param alignment the new alignment
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setAlignment (int alignment) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return;
+ int index = parent.indexOf (this);
+ if (index == -1 || index == 0) return;
+ int table = parent.handle;
+ style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER);
+ style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER);
+ int justification = 0;
+ if ((style & SWT.LEFT) == SWT.LEFT) justification |= OS.GTK_JUSTIFY_LEFT;
+ if ((style & SWT.CENTER) == SWT.CENTER) justification |= OS.GTK_JUSTIFY_CENTER;
+ if ((style & SWT.RIGHT) == SWT.RIGHT) justification |= OS.GTK_JUSTIFY_RIGHT;
+ OS.gtk_clist_set_column_justification (table, index, justification);
+}
+/**
+ * Sets the resizable attribute. A column that is
+ * not resizable cannot be dragged by the user but
+ * may be resized by the programmer.
+ *
+ * @param resizable the resize attribute
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setResizable (boolean resizable) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int index = parent.indexOf (this);
+ if (index == -1) return;
+ int table = parent.handle;
+ OS.gtk_clist_set_column_resizeable (table, index, resizable);
+}
+public void setText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ super.setText (string);
+ int index = parent.indexOf (this);
+ if (index == -1) return;
+ int table = parent.handle;
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ OS.gtk_clist_set_column_title (table, index, buffer);
+}
+/**
+ * Sets the width of the receiver.
+ *
+ * @param width the new width
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setWidth (int width) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int index = parent.indexOf (this);
+ if (index == -1) return;
+ int table = parent.handle;
+ OS.gtk_clist_set_column_width (table, index, width);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TableItem.java
new file mode 100644
index 0000000..2750823
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TableItem.java
@@ -0,0 +1,483 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class represent a selectable user interface object
+ * that represents an item in a table.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+
+public class TableItem extends Item {
+ Table parent;
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Table</code>) and a style value
+ * describing its behavior and appearance. The item is added
+ * to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TableItem (Table parent, int style) {
+ super (parent, style);
+ this.parent = parent;
+ parent.createItem (this, parent.getItemCount ());
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Table</code>), a style value
+ * describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TableItem (Table parent, int style, int index) {
+ super (parent, style);
+ this.parent = parent;
+ parent.createItem (this, index);
+}
+/**
+ * Returns a rectangle describing the receiver's size and location
+ * relative to its parent at a column in the table.
+ *
+ * @param index the index that specifies the column
+ * @return the receiver's bounding column rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Rectangle getBounds (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int CELL_SPACING=1;
+ GtkCList table = new GtkCList();
+ OS.memmove(table, parent.handle, GtkCList.sizeof);
+ int columnHandle = table.column;
+ columnHandle= columnHandle+index*GtkCListColumn.sizeof;
+ GtkCListColumn column=new GtkCListColumn();
+ OS.memmove(column, columnHandle, GtkCListColumn.sizeof);
+ GtkAdjustment adjustment=new GtkAdjustment();
+ OS.memmove(adjustment, table.vadjustment, GtkAdjustment.sizeof);
+ float vaj = adjustment.value;
+ OS.memmove(adjustment, table.hadjustment, GtkAdjustment.sizeof);
+ float haj = adjustment.value;
+ int x=(short)column.area_x+table.hoffset;
+ int width=(short)column.area_width;
+ int height=parent.getItemHeight();
+ int row=parent.indexOf(this);
+ int y=table.column_title_area_height+height*row+(row+2)*CELL_SPACING-(int)vaj;
+ return new Rectangle (x, y, width, height);
+}
+/**
+ * Returns <code>true</code> if the receiver is checked,
+ * and false otherwise. When the parent does not have
+ * the <code>CHECK style, return false.
+ *
+ * @return the checked state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getChecked () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((parent.style & SWT.CHECK) == 0) return false;
+ int index = parent.indexOf (this);
+ if (index == -1) return false;
+ GtkCList gtkclist = new GtkCList();
+ OS.memmove(gtkclist, parent.handle, GtkCList.sizeof);
+ int chandle=gtkclist.row_list;
+ int data = OS.g_list_nth_data(chandle, index);
+ GtkCListRow gtkrow = new GtkCListRow();
+ OS.memmove(gtkrow, data, GtkCListRow.sizeof);
+ return (gtkrow.state == OS.GTK_STATE_SELECTED) ? true : false;
+}
+public Display getDisplay () {
+ Table parent = this.parent;
+ if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getDisplay ();
+}
+/**
+ * Returns <code>true</code> if the receiver is grayed,
+ * and false otherwise. When the parent does not have
+ * the <code>CHECK style, return false.
+ *
+ * @return the grayed state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getGrayed () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((parent.style & SWT.CHECK) == 0) return false;
+ return false;
+}
+
+/**
+* Gets the image at an index.
+* <p>
+* Indexing is zero based.
+*
+* This operation will fail when the index is out
+* of range or an item could not be queried from
+* the OS.
+*
+* @param index the index of the image
+* @return the image
+*
+* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
+* when called from the wrong thread
+* @exception SWTError(ERROR_WIDGET_DISPOSED)
+* when the widget has been disposed
+*/
+public Image getImage (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return null;
+}
+/**
+ * Returns a rectangle describing the size and location
+ * relative to its parent of an image at a column in the
+ * table.
+ *
+ * @param index the index that specifies the column
+ * @return the receiver's bounding image rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Rectangle getImageBounds (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return new Rectangle (0, 0, 0, 0);
+}
+/**
+ * Gets the image indent.
+ *
+ * @return the indent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getImageIndent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return 0;
+}
+/**
+ * Returns the receiver's parent, which must be a <code>Table</code>.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Table getParent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent;
+}
+/**
+* Gets the item text at an index.
+* <p>
+* Indexing is zero based.
+*
+* This operation will fail when the index is out
+* of range or an item could not be queried from
+* the OS.
+*
+* @param index the index of the item
+* @return the item
+*
+* @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
+* when called from the wrong thread
+* @exception SWTError(ERROR_WIDGET_DISPOSED)
+* when the widget has been disposed
+* @exception SWTError(ERROR_CANNOT_GET_TEXT)
+* when the operation fails
+*/
+public String getText (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return "";
+}
+void releaseChild () {
+ super.releaseChild ();
+ parent.destroyItem (this);
+}
+void releaseWidget () {
+ super.releaseWidget ();
+ parent = null;
+}
+/**
+ * Sets the checked state of the receiver.
+ *
+ * @param checked the new checked state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setChecked (boolean checked) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((parent.style & SWT.CHECK) == 0) return;
+ int index = parent.indexOf (this);
+ if (index == -1) return;
+ if (checked)
+ OS.gtk_clist_select_row(parent.handle, index, 0);
+ else
+ OS.gtk_clist_unselect_row(parent.handle, index, 0);
+}
+/**
+ * Sets the grayed state of the receiver.
+ *
+ * @param checked the new grayed state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setGrayed (boolean grayed) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+/**
+ * Sets the receiver's image at a column.
+ *
+ * @param index the column index
+ * @param image the new image
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setImage (int index, Image image) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+// if (index == 0) {
+// setImage (image);
+// return;
+// }
+ int row = parent.indexOf (this);
+ if (row == -1) return;
+ int pixmap = 0, mask = 0;
+ if (image != null) {
+ pixmap = image.pixmap;
+ mask = image.mask;
+ }
+ int ctable = parent.handle;
+ if (text != null) {
+ byte [] buffer = Converter.wcsToMbcs (null, text, true);
+ OS.gtk_clist_set_pixtext (ctable, row, index, buffer, (byte) 2, pixmap, mask);
+ } else {
+ OS.gtk_clist_set_pixmap (ctable, row, index, pixmap, mask);
+ }
+}
+public void setImage (Image image) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int row = parent.indexOf (this);
+ if (row == -1) return;
+ super.setImage (image);
+ int ctable = parent.handle;
+ int pixmap = 0, mask = 0;
+ if (image != null) {
+ pixmap = image.pixmap;
+ mask = image.mask;
+ }
+ if (text != null) {
+ byte [] buffer = Converter.wcsToMbcs (null, text, true);
+ OS.gtk_clist_set_pixtext (ctable, row, 0, buffer, (byte) 2, pixmap, mask);
+ } else {
+ OS.gtk_clist_set_pixmap (ctable, row, 0, pixmap, mask);
+ }
+}
+/**
+ * Sets the image for multiple columns in the Table.
+ *
+ * @param images the array of new images
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the array of images is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if one of the images has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setImage (Image [] images) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (images == null) error (SWT.ERROR_NULL_ARGUMENT);
+ for (int i=0; i<images.length; i++) {
+ setImage (i, images [i]);
+ }
+}
+/**
+ * Sets the image indent.
+ *
+ * @param indent the new indent
+ *
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setImageIndent (int indent) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+/**
+ * Sets the receiver's text at a column
+ *
+ * @param index the column index
+ * @param string the new text
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setText (int index, String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (index == 0) {
+ setText (string);
+ return;
+ }
+ int row = parent.indexOf (this);
+ if (row == -1) return;
+ int ctree = parent.handle;
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ if (image != null) {
+ OS.gtk_clist_set_pixtext(ctree, row, index, buffer, (byte) 2, image.pixmap, image.mask);
+ } else {
+ OS.gtk_clist_set_text (ctree, row, index, buffer);
+ }
+}
+public void setText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ int row = parent.indexOf (this);
+ if (row == -1) return;
+ super.setText (string);
+ int ctree = parent.handle;
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ if (image != null) {
+ OS.gtk_clist_set_pixtext(ctree, row, 0, buffer, (byte) 2, image.pixmap, image.mask);
+ } else {
+ OS.gtk_clist_set_text (ctree, row, 0, buffer);
+ }
+}
+/**
+ * Sets the text for multiple columns in the table.
+ *
+ * @param strings the array of new strings
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setText (String [] strings) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (strings == null) error (SWT.ERROR_NULL_ARGUMENT);
+ for (int i=0; i<strings.length; i++) {
+ String string = strings [i];
+ if (string != null) setText (i, string);
+ }
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Text.java
new file mode 100644
index 0000000..05e502f
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Text.java
@@ -0,0 +1,1230 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class are selectable user interface
+ * objects that allow the user to enter and modify text.
+ * <p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>MULTI, SINGLE, READ_ONLY, WRAP</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>DefaultSelection, Modify, Verify</dd>
+ * </dl>
+ * </p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ */
+
+public class Text extends Scrollable {
+ int textLimit = LIMIT;
+ boolean visibility = true;
+ public final static int LIMIT;
+ public final static String DELIMITER;
+ /*
+ * These values can be different on different platforms.
+ * Therefore they are not initialized in the declaration
+ * to stop the compiler from inlining.
+ */
+ static {
+ LIMIT = 0x7FFFFFFF;
+ DELIMITER = "\n";
+ }
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Text (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+ if ((style & SWT.SINGLE) != 0) {
+ handle = OS.gtk_entry_new ();
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+ } else {
+ scrolledHandle = OS.gtk_scrolled_window_new (0, 0);
+ if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ handle = OS.gtk_text_new (0, 0);
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+ }
+}
+
+Point _computeSize (int a, int b, boolean c) {
+ return super._computeSize (a, b, c);
+}
+
+void setHandleStyle() {
+ OS.gtk_editable_set_editable (handle, (style & SWT.READ_ONLY) == 0);
+ if ((style & SWT.SINGLE) == 0)
+ OS.gtk_text_set_word_wrap (handle, (style & SWT.WRAP) != 0 ? 1 : 0);
+ if (scrolledHandle!=0) setScrollingPolicy();
+ // When 2.0 arrives, we'll be able to set the flat appearance
+
+}
+
+void configure() {
+ _connectParent();
+ if (scrolledHandle != 0) {
+ OS.gtk_container_add (scrolledHandle, handle);
+ }
+}
+
+void showHandle() {
+ if (scrolledHandle != 0) OS.gtk_widget_show (scrolledHandle);
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void hookEvents () {
+ //TO DO - get rid of enter/exit for mouse crossing border
+ super.hookEvents();
+ signal_connect_after(handle, "changed", SWT.Modify, 2);
+ signal_connect (handle, "insert_text", SWT.Verify, 5);
+ signal_connect (handle, "delete_text", SWT.Verify, 4);
+ signal_connect (handle, "activate", SWT.Selection, 2);
+}
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's text is modified, by sending
+ * it one of the messages defined in the <code>ModifyListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ModifyListener
+ * @see #removeModifyListener
+ */
+public void addModifyListener (ModifyListener listener) {
+ checkWidget ();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Modify, typedListener);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control is selected, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * <code>widgetSelected</code> is not called for texts.
+ * <code>widgetDefaultSelected</code> is typically called when ENTER is pressed in a single-line text.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener(SelectionListener listener) {
+ checkWidget ();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener(listener);
+ addListener(SWT.Selection,typedListener);
+ addListener(SWT.DefaultSelection,typedListener);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's text is verified, by sending
+ * it one of the messages defined in the <code>VerifyListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see VerifyListener
+ * @see #removeVerifyListener
+ */
+public void addVerifyListener (VerifyListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Verify, typedListener);
+}
+
+/**
+ * Appends a string.
+ * <p>
+ * The new text is appended to the text at
+ * the end of the widget.
+ * </p>
+ *
+ * @param string the string to be appended
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void append (String string) {
+ checkWidget ();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ byte [] buffer = Converter.wcsToMbcs (null, string);
+ if ((style & SWT.SINGLE) != 0) {
+ OS.gtk_entry_append_text(handle, buffer);
+ } else {
+ int length = getCharCount();
+ int [] position = new int [] {length};
+ OS.gtk_editable_insert_text (handle, buffer, buffer.length, position);
+ OS.gtk_editable_set_position (handle, position [0]);
+ }
+}
+
+static int checkStyle (int style) {
+ if ((style & SWT.SINGLE) != 0) style &= ~(SWT.H_SCROLL | SWT.V_SCROLL);
+ if ((style & (SWT.SINGLE | SWT.MULTI)) != 0) return style;
+ if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) != 0) {
+ return style | SWT.MULTI;
+ }
+ return style | SWT.SINGLE;
+}
+/**
+ * Clears the selection.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void clearSelection () {
+ checkWidget ();
+ int position = OS.gtk_editable_get_position (handle);
+ OS.gtk_editable_delete_selection(handle);
+ OS.gtk_editable_set_position (handle, position);
+}
+
+/**
+ * Copies the selected text.
+ * <p>
+ * The current selection is copied to the clipboard.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void copy () {
+ checkWidget ();
+ byte [] clipboard = Converter.wcsToMbcs (null, "CLIPBOARD", true);
+ OS.gtk_selection_owner_set(handle, OS.gdk_atom_intern(clipboard, 0), 0);
+ GtkEditable widget = new GtkEditable ();
+ OS.memmove(widget, handle, GtkEditable.sizeof);
+ int start = Math.min(widget.selection_start_pos, widget.selection_end_pos);
+ int end = Math.max(widget.selection_start_pos, widget.selection_end_pos);
+ widget.clipboard_text = OS.gtk_editable_get_chars(handle, start, end);
+ OS.memmove (handle, widget, GtkEditable.sizeof);
+}
+/**
+ * Cuts the selected text.
+ * <p>
+ * The current selection is first copied to the
+ * clipboard and then deleted from the widget.
+ * </p>
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void cut () {
+ checkWidget ();
+ byte [] clipboard = Converter.wcsToMbcs (null, "CLIPBOARD", true);
+ OS.gtk_selection_owner_set(handle, OS.gdk_atom_intern(clipboard, 0), 0);
+ GtkEditable widget = new GtkEditable ();
+ OS.memmove (widget, handle, GtkEditable.sizeof);
+ int start = Math.min(widget.selection_start_pos, widget.selection_end_pos);
+ int end = Math.max(widget.selection_start_pos, widget.selection_end_pos);
+ widget.clipboard_text = OS.gtk_editable_get_chars(handle, start, end);
+ OS.memmove (handle, widget, GtkEditable.sizeof);
+ OS.gtk_editable_delete_text(handle, start, end);
+}
+
+/**
+ * Gets the line number of the caret.
+ * <p>
+ * The line number of the caret is returned.
+ * </p>
+ *
+ * @return the line number
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getCaretLineNumber () {
+ checkWidget ();
+ int addr_index=getCaretPosition();
+ String tmpString= new String(getText(0,addr_index));
+ return getLineNumberInString(tmpString,'\n');
+}
+
+/**
+ * Gets the location the caret.
+ * <p>
+ * The location of the caret is returned.
+ * </p>
+ *
+ * @return a point, the location of the caret
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getCaretLocation () {
+ checkWidget ();
+ GtkText gtktext = new GtkText ();
+ OS.memmove (gtktext, handle, GtkText.sizeof);
+ return new Point (gtktext.cursor_pos_x, gtktext.cursor_pos_y);
+}
+
+/**
+ * Gets the position of the caret.
+ * <p>
+ * The character position of the caret is returned.
+ * </p>
+ *
+ * @return the position of the caret
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getCaretPosition () {
+ checkWidget ();
+ //return OS.gtk_text_get_point (handle);
+ return OS.gtk_editable_get_position (handle);
+}
+
+
+/**
+ * Gets the number of characters.
+ *
+ * @return number of characters in the widget
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getCharCount () {
+ checkWidget ();
+ if ((style & SWT.SINGLE) != 0) {
+ int address = OS.gtk_editable_get_chars (handle, 0, -1);
+ int length = OS.strlen (address);
+ OS.g_free (address);
+ return length;
+ }
+ return OS.gtk_text_get_length (handle);
+}
+
+/**
+ * Gets the line delimiter.
+ *
+ * @return a string that is the line delimiter
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getLineDelimiter () {
+ checkWidget ();
+ return "\n";
+}
+/**
+ * Gets the double click enabled flag.
+ * <p>
+ * The double click flag enables or disables the
+ * default action of the text widget when the user
+ * double clicks.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getDoubleClickEnabled () {
+ checkWidget ();
+ return true;
+}
+/**
+ * Gets the echo character.
+ * <p>
+ * The echo character is the character that is
+ * displayed when the user enters text or the
+ * text is changed by the programmer.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public char getEchoChar () {
+ checkWidget ();
+ return visibility ? '\0' : '*';
+}
+
+/**
+ * Gets the editable state.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getEditable () {
+ checkWidget ();
+ GtkEditable widget = new GtkEditable ();
+ OS.memmove (widget, handle, GtkEditable.sizeof);
+ return widget.editable!=0;
+}
+
+/**
+ * Gets the number of lines.
+ *
+ * @return the number of lines in the widget
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getLineCount () {
+ checkWidget ();
+ return getLineNumberInString(new String(getText()),'\n') + 1;
+}
+/**
+ * Gets the height of a line.
+ *
+ * @return the height of a row of text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getLineHeight () {
+ checkWidget ();
+ Font font = getFont();
+ GdkFont gdkfont = new GdkFont();
+ int fontHandle = font.handle;
+ OS.memmove(gdkfont, fontHandle, GdkFont.sizeof);
+ return gdkfont.ascent + gdkfont.descent;
+
+}
+/**
+ * Gets the position of the selected text.
+ * <p>
+ * Indexing is zero based. The range of
+ * a selection is from 0..N where N is
+ * the number of characters in the widget.
+ * </p>
+ *
+ * @return the start and end of the selection
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Point getSelection () {
+ checkWidget ();
+ GtkEditable widget = new GtkEditable ();
+ OS.memmove (widget, handle, GtkEditable.sizeof);
+ return new Point (widget.selection_start_pos, widget.selection_end_pos);
+}
+/**
+ * Gets the number of selected characters.
+ *
+ * @return the number of selected characters.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelectionCount () {
+ checkWidget ();
+ GtkEditable widget = new GtkEditable ();
+ OS.memmove (widget, handle, GtkEditable.sizeof);
+ int start = Math.min(widget.selection_start_pos, widget.selection_end_pos);
+ int end = Math.max(widget.selection_start_pos, widget.selection_end_pos);
+ return end - start;
+}
+/**
+ * Gets the selected text.
+ *
+ * @return the selected text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getSelectionText () {
+ checkWidget ();
+ GtkEditable widget = new GtkEditable ();
+ OS.memmove (widget, handle, GtkEditable.sizeof);
+ int start = Math.min(widget.selection_start_pos,widget.selection_end_pos);
+ int end = Math.max(widget.selection_start_pos,widget.selection_end_pos);
+ int address = OS.gtk_editable_get_chars (handle, start, end);
+ int length = OS.strlen (address);
+ byte [] buffer1 = new byte [length];
+ OS.memmove (buffer1, address, length);
+ OS.g_free (address);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ return new String (buffer2, 0, buffer2.length);
+}
+
+/**
+ * Gets the number of tabs.
+ * <p>
+ * Tab stop spacing is specified in terms of the
+ * space (' ') character. The width of a single
+ * tab stop is the pixel width of the spaces.
+ * </p>
+ *
+ * @return the number of tab characters
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getTabs () {
+ checkWidget ();
+ GtkText widget= new GtkText();
+ OS.memmove(widget, handle, GtkText.sizeof);
+ return widget.default_tab_width;
+}
+
+/**
+ * Gets the widget text.
+ * <p>
+ * The text for a text widget is the characters in the widget.
+ * </p>
+ *
+ * @return the widget text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getText () {
+ checkWidget ();
+ int address = OS.gtk_editable_get_chars (handle, 0, -1);
+ int length = OS.strlen (address);
+ byte [] buffer1 = new byte [length];
+ OS.memmove (buffer1, address, length);
+ OS.g_free (address);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ return new String (buffer2, 0, buffer2.length);
+}
+
+/**
+ * Gets a range of text.
+ * <p>
+ * Indexing is zero based. The range of
+ * a selection is from 0..N-1 where N is
+ * the number of characters in the widget.
+ * </p>
+ *
+ * @param start the start of the range
+ * @param end the end of the range
+ * @return the range of text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getText (int start, int end) {
+ checkWidget ();
+ int address = OS.gtk_editable_get_chars (handle, start, end);
+ if (address == 0) return null;
+ int length = OS.strlen (address);
+ byte [] buffer1 = new byte [length];
+ OS.memmove (buffer1, address, length);
+ OS.g_free (address);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ return new String (buffer2, 0, buffer2.length);
+}
+
+/**
+ * Returns the maximum number of characters that the receiver is capable of holding.
+ * <p>
+ * If this has not been changed by <code>setTextLimit()</code>,
+ * it will be the constant <code>Text.LIMIT</code>.
+ * </p>
+ *
+ * @return the text limit
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getTextLimit () {
+ checkWidget ();
+ if ((style & SWT.SINGLE) != 0) return textLimit;
+ return LIMIT;
+}
+
+/**
+ * Returns the zero-relative index of the line which is currently
+ * at the top of the receiver.
+ * <p>
+ * This index can change when lines are scrolled or new lines are added or removed.
+ * </p>
+ *
+ * @return the index of the top line
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getTopIndex () {
+ checkWidget ();
+ if ((style & SWT.SINGLE) != 0) return 0;
+ GtkText widget = new GtkText ();
+ OS.memmove (widget, handle, GtkText.sizeof);
+ int topCharIndex=widget.first_line_start_index;
+ return (getLineNumberInString(getText(0,topCharIndex), '\n'));
+ //Since getText uses substring (start, end + 1),so topCharIndex-1
+}
+
+/**
+ * Gets the top pixel.
+ * <p>
+ * The top pixel is the pixel position of the line
+ * that is currently at the top of the widget. On
+ * some platforms, a text widget can be scrolled by
+ * pixels instead of lines so that a partial line
+ * is displayed at the top of the widget.
+ * </p><p>
+ * The top pixel changes when the widget is scrolled.
+ * The top pixel does not include the widget trimming.
+ * </p>
+ *
+ * @return the pixel position of the top line
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getTopPixel () {
+ checkWidget ();
+ if ((style & SWT.SINGLE) != 0) return 0;
+ GtkText widget= new GtkText();
+ OS.memmove(widget, handle, GtkText.sizeof);
+ return widget.first_onscreen_ver_pixel;
+}
+
+boolean getWrap () {
+ checkWidget ();
+ return false;
+}
+
+/**
+ * Inserts a string.
+ * <p>
+ * The old selection is replaced with the new text.
+ * </p>
+ *
+ * @param string the string
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void insert (String string) {
+ checkWidget ();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ byte [] buffer = Converter.wcsToMbcs (null, string);
+ GtkEditable widget = new GtkEditable ();
+ OS.memmove (widget, handle, GtkEditable.sizeof);
+ int start = Math.min(widget.selection_start_pos, widget.selection_end_pos);
+ int end = Math.max(widget.selection_start_pos, widget.selection_end_pos);
+ OS.gtk_editable_delete_text (handle, start, end);
+ int [] position = new int [] {start};
+ OS.gtk_editable_insert_text (handle, buffer, buffer.length, position);
+}
+
+/**
+ * Pastes text from clipboard.
+ * <p>
+ * The selected text is deleted from the widget
+ * and new text inserted from the clipboard.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void paste () {
+ checkWidget ();
+ byte [] clipboard = Converter.wcsToMbcs (null, "CLIPBOARD", true);
+ byte [] compound = Converter.wcsToMbcs (null, "COMPOUND_TEXT", true);
+ int clipboard_atom = OS.gdk_atom_intern (clipboard, 0);
+ int compound_atom = OS.gdk_atom_intern (compound, 0);
+ OS.gtk_selection_convert(handle, clipboard_atom, compound_atom, 0);
+}
+
+int processModify (int arg0, int arg1, int int2) {
+ sendEvent (SWT.Modify);
+ return 0;
+}
+
+int processVerify (int int0, int int1, int int2) {
+ if (!hooks (SWT.Verify)) return 0;
+ if (int2 != 0) {
+ // Insert
+ if (int0 == 0 || int1==0){
+ return 0;
+ }
+// int length = OS.strlen (int0);
+ byte [] buffer1 = new byte [int1];
+ OS.memmove (buffer1, int0, buffer1.length);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ String oldText = new String (buffer2, 0, buffer2.length);
+ int [] position = new int [1];
+ OS.memmove (position, int2, 4);
+ if (position [0] == -1) position [0] = OS.gtk_text_get_length (handle);
+ String newText = verifyText (oldText, position [0], position [0]); //WRONG POSITION
+ if (newText == null) {
+ byte [] insert_text = Converter.wcsToMbcs (null, "insert-text", true);
+ OS.gtk_signal_emit_stop_by_name (handle, insert_text);
+ return 0;
+ }
+ if (newText != oldText) {
+ int windowProc5 = getDisplay ().windowProc5;
+ byte [] buffer3 = Converter.wcsToMbcs (null, newText);
+ OS.gtk_signal_handler_block_by_func (handle, windowProc5, SWT.Verify);
+ OS.gtk_editable_insert_text (handle, buffer3, buffer3.length, position);
+ OS.gtk_signal_handler_unblock_by_func (handle, windowProc5, SWT.Verify);
+ byte [] insert_text = Converter.wcsToMbcs (null, "insert-text", true);
+ OS.gtk_signal_emit_stop_by_name (handle, insert_text);
+ return 0;
+ }
+ } else {
+ // Delete
+ int address = OS.gtk_editable_get_chars (handle, int0, int1);
+ int length = OS.strlen (address);
+ byte [] buffer1 = new byte [length];
+ OS.memmove (buffer1, address, length);
+ OS.g_free (address);
+ char [] buffer2 = Converter.mbcsToWcs (null, buffer1);
+ String oldText = new String (buffer2, 0, buffer2.length);
+ String newText = verifyText (oldText, int0, int1);
+ if (newText == null) {
+ byte [] delete_text = Converter.wcsToMbcs (null, "delete-text", true);
+ OS.gtk_signal_emit_stop_by_name (handle, delete_text);
+ return 0;
+ }
+ }
+ return 0;
+}
+
+int processSelection (int int0, int int1, int int2) {
+ postEvent (SWT.DefaultSelection);
+ return 0;
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's text is modified.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ModifyListener
+ * @see #addModifyListener
+ */
+public void removeModifyListener (ModifyListener listener) {
+ checkWidget ();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Modify, listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is selected.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener(SelectionListener listener) {
+ checkWidget ();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook(SWT.Selection, listener);
+ eventTable.unhook(SWT.DefaultSelection,listener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is verified.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see VerifyListener
+ * @see #addVerifyListener
+ */
+public void removeVerifyListener (VerifyListener listener) {
+ checkWidget ();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Verify, listener);
+}
+
+/**
+ * Selects all the text in the receiver.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void selectAll () {
+ checkWidget ();
+ OS.gtk_editable_select_region (handle, 0, -1);
+}
+
+/**
+ * Sets the double click enabled flag.
+ * <p>
+ * The double click flag enables or disables the
+ * default action of the text widget when the user
+ * double clicks.
+ * </p>
+ *
+ * @param doubleClick the new double click flag
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setDoubleClickEnabled (boolean doubleClick) {
+ checkWidget ();
+}
+
+/**
+ * Sets the echo character.
+ * <p>
+ * The echo character is the character that is
+ * displayed when the user enters text or the
+ * text is changed by the programmer.
+ * </p>
+ *
+ * @param echo the new echo character
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setEchoChar (char echo) {
+ checkWidget ();
+ if ((style & SWT.SINGLE) != 0) {
+ OS.gtk_entry_set_visibility (handle, visibility = echo == '\0');
+ }
+}
+
+/**
+ * Sets the editable state.
+ *
+ * @param editable the new editable state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setEditable (boolean editable) {
+ checkWidget ();
+ OS.gtk_editable_set_editable (handle, editable);
+}
+
+/**
+ * Sets the selection.
+ * <p>
+ * Indexing is zero based. The range of
+ * a selection is from 0..N where N is
+ * the number of characters in the widget.
+ * </p><p>
+ * Text selections are specified in terms of
+ * caret positions. In a text widget that
+ * contains N characters, there are N+1 caret
+ * positions, ranging from 0..N. This differs
+ * from other functions that address character
+ * position such as getText () that use the
+ * regular array indexing rules.
+ * </p>
+ *
+ * @param start new caret position
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (int start) {
+ checkWidget ();
+ OS.gtk_editable_set_position (handle, start);
+}
+
+/**
+ * Sets the selection.
+ * <p>
+ * Indexing is zero based. The range of
+ * a selection is from 0..N where N is
+ * the number of characters in the widget.
+ * </p><p>
+ * Text selections are specified in terms of
+ * caret positions. In a text widget that
+ * contains N characters, there are N+1 caret
+ * positions, ranging from 0..N. This differs
+ * from other functions that address character
+ * position such as getText () that use the
+ * usual array indexing rules.
+ * </p>
+ *
+ * @param start the start of the range
+ * @param end the end of the range
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (int start, int end) {
+ checkWidget ();
+ OS.gtk_editable_set_position (handle, start);
+ OS.gtk_editable_select_region (handle, start, end);
+}
+
+/**
+ * Sets the selection.
+ * <p>
+ * Indexing is zero based. The range of
+ * a selection is from 0..N where N is
+ * the number of characters in the widget.
+ * </p><p>
+ * Text selections are specified in terms of
+ * caret positions. In a text widget that
+ * contains N characters, there are N+1 caret
+ * positions, ranging from 0..N. This differs
+ * from other functions that address character
+ * position such as getText () that use the
+ * usual array indexing rules.
+ * </p>
+ *
+ * @param selection the point
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (Point selection) {
+ checkWidget ();
+ if (selection == null) error (SWT.ERROR_NULL_ARGUMENT);
+ OS.gtk_editable_set_position (handle, selection.x);
+ OS.gtk_editable_select_region (handle, selection.x, selection.y);
+}
+
+ /**
+ * Sets the number of tabs.
+ * <p>
+ * Tab stop spacing is specified in terms of the
+ * space (' ') character. The width of a single
+ * tab stop is the pixel width of the spaces.
+ * </p>
+ *
+ * @param tabs the number of tabs
+ *
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+*/
+public void setTabs (int tabs) {
+ checkWidget ();
+ GtkText widget= new GtkText();
+ widget.default_tab_width=tabs;
+ OS.memmove(handle, widget, GtkText.sizeof);
+}
+
+/**
+ * Sets the contents of the receiver to the given string.
+ *
+ * @param text the new text
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setText (String string) {
+ checkWidget ();
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ OS.gtk_editable_delete_text (handle, 0, -1);
+ int [] position = new int [1];
+ byte [] buffer = Converter.wcsToMbcs (null, string);
+ OS.gtk_editable_insert_text (handle, buffer, buffer.length, position);
+ OS.gtk_editable_set_position (handle, 0);
+}
+
+/**
+ * Sets the maximum number of characters that the receiver
+ * is capable of holding to be the argument.
+ *
+ * @param limit new text limit
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_CANNOT_BE_ZERO - if the limit is zero</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setTextLimit (int limit) {
+ checkWidget ();
+ if (limit == 0) error (SWT.ERROR_CANNOT_BE_ZERO);
+ if ((style & SWT.SINGLE) != 0) {
+ textLimit = (short) limit;
+ OS.gtk_entry_set_max_length (handle, (short) limit);
+ }
+}
+
+/**
+ * Sets the zero-relative index of the line which is currently
+ * at the top of the receiver. This index can change when lines
+ * are scrolled or new lines are added and removed.
+ *
+ * @param index the index of the top item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setTopIndex (int index) {
+ checkWidget ();
+ if ((style & SWT.SINGLE) != 0) return;
+ if (index > getLineCount()) return;
+ GtkAdjustment adjustment = new GtkAdjustment();
+ int adjustmentHandle = OS.gtk_scrolled_window_get_vadjustment(scrolledHandle);
+ OS.memmove(adjustment, adjustmentHandle, GtkAdjustment.sizeof);
+ int adjust = (int)(index*adjustment.upper/getLineCount());
+ if (adjust <= 0) {
+ adjust = 0;
+ verticalBar.setSelection(0);
+ } else {
+ verticalBar.setSelection(adjust);
+ }
+ OS.gtk_adjustment_value_changed(verticalBar.handle);
+ int topindex=getTopIndex();
+ int lineheight = getLineHeight();
+ while( topindex != index) {
+ adjust=adjust+lineheight;
+ verticalBar.setSelection(adjust+lineheight);
+ OS.gtk_adjustment_value_changed(verticalBar.handle);
+ topindex=getTopIndex();
+ }
+}
+
+void setWrap (boolean wrap) {
+ checkWidget ();
+ OS.gtk_text_set_word_wrap(handle, wrap ? 1 : 0);
+}
+
+/**
+ * Shows the selection.
+ * <p>
+ * If the selection is already showing
+ * in the receiver, this method simply returns. Otherwise,
+ * lines are scrolled until the selection is visible.
+ * </p>
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void showSelection () {
+ checkWidget ();
+ if ((style & SWT.SINGLE) != 0) return;
+ int start_pos, end_pos, pos;
+ pos = OS.gtk_editable_get_position (handle);
+ GtkEditable widget = new GtkEditable ();
+ OS.memmove (widget, handle, GtkEditable.sizeof);
+ start_pos = Math.min(widget.selection_start_pos, widget.selection_end_pos) ;
+ end_pos = Math.max(widget.selection_start_pos, widget.selection_end_pos) ;
+ GtkText gtktext = new GtkText ();
+ OS.memmove (gtktext, handle, GtkText.sizeof);
+ int topCharIndex=gtktext.first_line_start_index;
+ if ( (topCharIndex > start_pos && topCharIndex < end_pos) || topCharIndex==start_pos ||
+ topCharIndex == end_pos) return;
+ if (pos < start_pos || pos > end_pos) {
+ GtkAdjustment adjustment = new GtkAdjustment();
+ int adjustmentHandle = OS.gtk_scrolled_window_get_vadjustment(scrolledHandle);
+ OS.memmove(adjustment, adjustmentHandle, GtkAdjustment.sizeof);
+ String tmpString= new String(getText(0,start_pos));
+ int currentln=getLineNumberInString(tmpString, '\n');
+ int adjust = (int)(currentln*adjustment.upper/getLineCount()-adjustment.page_increment);
+ if (adjust <= 0)
+ OS.gtk_adjustment_set_value (verticalBar.handle, 0);
+ else
+ OS.gtk_adjustment_set_value (verticalBar.handle, adjust);
+ OS.gtk_adjustment_value_changed(verticalBar.handle);
+ OS.gtk_editable_set_position (handle, widget.selection_end_pos);
+ OS.gtk_editable_select_region (handle, widget.selection_start_pos, widget.selection_end_pos);
+ }
+
+}
+
+String verifyText (String string, int start, int end) {
+ Event event = new Event ();
+ event.text = string;
+ event.start = start;
+ event.end = end;
+ sendEvent (SWT.Verify, event);
+ if (!event.doit) return null;
+ return event.text;
+}
+
+int getLineNumberInString( String string,char delimiter) {
+ int count=0;
+ for (int i=0; i<string.length (); i++) {
+ if (string.charAt (i) == delimiter) count++;
+ }
+ return count;
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ToolBar.java
new file mode 100644
index 0000000..b06c11a
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ToolBar.java
@@ -0,0 +1,361 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+
+/**
+ * Instances of this class support the layout of selectable
+ * tool bar items.
+ * <p>
+ * The item children that may be added to instances of this class
+ * must be of type <code>ToolItem</code>.
+ * </p><p>
+ * Note that although this class is a subclass of <code>Composite</code>,
+ * it does not make sense to add <code>Control</code> children to it,
+ * or set a layout on it.
+ * </p><p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>FLAT, WRAP, RIGHT, HORIZONTAL, VERTICAL</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+
+public class ToolBar extends Composite {
+ int boxHandle, tempHandle;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public ToolBar (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+
+ /* FIXME
+ * We do not need an event box here, as event boxes
+ * have real X windows.
+ */
+ boxHandle = OS.gtk_event_box_new ();
+ if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ int orientation = ((style&SWT.VERTICAL)!=0)?
+ OS.GTK_ORIENTATION_VERTICAL : OS.GTK_ORIENTATION_HORIZONTAL;
+ handle = OS.gtk_toolbar_new (orientation, OS.GTK_TOOLBAR_BOTH);
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+
+ tempHandle = OS.gtk_fixed_new();
+ if (tempHandle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void setHandleStyle() {
+ int relief = ((style&SWT.FLAT)!=0)? OS.GTK_RELIEF_NONE : OS.GTK_RELIEF_NORMAL;
+ OS.gtk_toolbar_set_button_relief(handle, relief);
+}
+
+void configure() {
+ _connectParent();
+ OS.gtk_container_add (boxHandle, handle);
+ // invisible handle to temporarily hold control (non-item) items
+ OS.gtk_toolbar_insert_widget (handle,tempHandle,new byte[1], new byte[1],0);
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ if (layout != null) super.computeSize(wHint, hHint, changed);
+ return _computeSize (wHint, hHint, changed);
+}
+
+int eventHandle () {
+ return boxHandle;
+}
+
+void showHandle() {
+ OS.gtk_widget_show (boxHandle);
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+ // don't show the temp fixed
+}
+
+void register() {
+ super.register ();
+ WidgetTable.put (boxHandle, this);
+}
+
+void deregister() {
+ super.deregister ();
+ WidgetTable.remove (boxHandle);
+}
+
+int topHandle() { return boxHandle; }
+int parentingHandle() { return handle; } // event though we override connectChild, we still need this for getChildren
+
+/**
+ * Returns whether the argument points to an OS widget that is
+ * implementing the receiver, i.e., one of my own handles
+ */
+boolean isMyHandle(int h) {
+ if (h==handle) return true;
+ if (h==tempHandle) return true;
+ if (h==boxHandle) return true;
+ return false;
+}
+void _connectChild (int h) {
+ // When we put a widget as a tool item, we don't know which item it is, yet.
+ OS.gtk_fixed_put(tempHandle, h, (short)0, (short)0);
+}
+
+
+/*
+ * === GEOMETRY ===
+ */
+
+boolean _setSize (int width, int height) { UtilFuncs.setSize(boxHandle, width, height); return true; }
+
+
+
+/**
+ * Returns the item at the given, zero-relative index in the
+ * receiver. Throws an exception if the index is out of range.
+ *
+ * @param index the index of the item to return
+ * @return the item at the given index
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public ToolItem getItem (int index) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return getItems()[index];
+}
+
+
+
+/**
+ * Returns the item at the given point in the receiver
+ * or null if no such item exists. The point is in the
+ * coordinate system of the receiver.
+ *
+ * @param point the point used to locate the item
+ * @return the item at the given point
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public ToolItem getItem (Point point) {
+ return null;
+}
+/**
+ * Returns the number of items contained in the receiver.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getItemCount () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ /* FIXME
+ * This code will return the wrong count for items,
+ * as list includes Window children
+ */
+// int list = OS.gtk_container_children (handle);
+// return OS.g_list_length (list);
+ // TEMPORARY CODE
+ return getItems ().length;
+}
+/**
+ * Returns an array of <code>TabItem</code>s which are the items
+ * in the receiver.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the items in the receiver
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public ToolItem [] getItems () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int count = 0;
+ int list = OS.gtk_container_children (handle);
+ int length = OS.g_list_length (list);
+ ToolItem [] result = new ToolItem [length];
+ for (int i=0; i<length; i++) {
+ int data = OS.g_list_nth_data (list, i);
+ Widget widget = WidgetTable.get (data);
+ if (widget instanceof ToolItem) {
+ result [count++] = (ToolItem) widget;
+ }
+ }
+ if (length == count) return result;
+ ToolItem [] newResult = new ToolItem [count];
+ System.arraycopy (result, 0, newResult, 0, count);
+ return newResult;
+}
+/**
+ * Returns the number of rows in the receiver. When
+ * the receiver has the <code>WRAP</code> style, the
+ * number of rows can be greater than one. Otherwise,
+ * the number of rows is always one.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+
+public int getRowCount () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return 1;
+}
+
+Control _childFromHandle(int h) {
+ Widget child = WidgetTable.get(h);
+ if (child==null) return null;
+ if (child instanceof ToolItem) return null; // ToolItems are not our children
+ return (Control)child;
+}
+
+/**
+ * Searches the receiver's list starting at the first item
+ * (index 0) until an item is found that is equal to the
+ * argument, and returns the index of that item. If no item
+ * is found, returns -1.
+ *
+ * @param item the search item
+ * @return the index of the item
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the tool item is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the tool item has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int indexOf (ToolItem item) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
+
+ // TEMPORARY CODE
+ ToolItem [] items = getItems ();
+ for (int i=0; i<items.length; i++) {
+ if (item == items[i]) return i;
+ }
+ return -1;
+}
+int processResize (int int0, int int1, int int2) {
+ ToolItem [] items = getItems ();
+ for (int i=0; i<items.length; i++) {
+ Control control = items [i].control;
+ if (control != null && !control.isDisposed ()) {
+ control.setBounds (items [i].getBounds ());
+ }
+ }
+ return 0;
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ boxHandle = tempHandle = 0;
+}
+
+void releaseWidget () {
+ ToolItem [] items = getItems ();
+ for (int i=0; i<items.length; i++) {
+ ToolItem item = items [i];
+ if (!item.isDisposed ()) {
+ item.releaseWidget ();
+ item.releaseHandle ();
+ }
+ }
+ items = null;
+ super.releaseWidget ();
+}
+
+static int checkStyle (int style) {
+ /*
+ * Even though it is legal to create this widget
+ * with scroll bars, they serve no useful purpose
+ * because they do not automatically scroll the
+ * widget's client area. The fix is to clear
+ * the SWT style.
+ */
+ return style; // & ~(SWT.H_SCROLL | SWT.V_SCROLL);
+}
+
+/*
+ * TEMPORARY CODE. Hack for Eclipse.
+ */
+public void setData (Object data) {
+ super.setData(data);
+ if (data == null) return;
+ if (data.getClass().getName().indexOf("org.eclipse.ui.internal.ShortcutBarPart") != -1)
+ OS.gtk_toolbar_set_orientation(handle, OS.GTK_ORIENTATION_VERTICAL);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ToolItem.java
new file mode 100644
index 0000000..e24667e
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/ToolItem.java
@@ -0,0 +1,732 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class represent a selectable user interface object
+ * that represents a button in a tool bar.
+ * <p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>PUSH, CHECK, RADIO, SEPARATOR, DROP_DOWN</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection</dd>
+ * </dl>
+ * </p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ */
+
+public class ToolItem extends Item {
+ int boxHandle;
+ ToolBar parent;
+ Control control;
+ Image hotImage, disabledImage;
+ int currentpixmap;
+ boolean drawHotImage;
+ int position;
+ boolean configured=false;
+ boolean shown=false;
+ private int tooltipsHandle;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>ToolBar</code>) and a style value
+ * describing its behavior and appearance. The item is added
+ * to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public ToolItem (ToolBar parent, int style) {
+ super (parent, checkStyle (style));
+ this.parent = parent;
+ position = parent.getItemCount ();
+ createWidget (position);
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>ToolBar</code>), a style value
+ * describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public ToolItem (ToolBar parent, int style, int index) {
+ super (parent, checkStyle (style));
+ this.parent = parent;
+ int count = parent.getItemCount ();
+ if (!(0 <= index && index <= count)) {
+ error (SWT.ERROR_ITEM_NOT_ADDED);
+ }
+ position = index;
+ createWidget (index);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control is selected, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * When <code>widgetSelected</code> is called when the mouse is over the arrow portion of a drop-down tool,
+ * the event object detail field contains the value <code>SWT.ARROW</code>.
+ * <code>widgetDefaultSelected</code> is not called.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener(SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection,typedListener);
+ addListener (SWT.DefaultSelection,typedListener);
+}
+static int checkStyle (int style) {
+ return checkBits (style, SWT.PUSH, SWT.CHECK, SWT.RADIO, SWT.SEPARATOR, SWT.DROP_DOWN, 0);
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+ int bits = SWT.SEPARATOR | SWT.RADIO | SWT.CHECK | SWT.PUSH;
+ switch (style & bits) {
+ case SWT.RADIO:
+ case SWT.CHECK:
+ _createToggleHandle(index); return;
+ case SWT.SEPARATOR:
+ _createSeparatorHandle(index); return;
+ case SWT.PUSH:
+ default:
+ _createPushHandle(index); return;
+ }
+}
+
+private void _createSeparatorHandle(int index) {
+ boxHandle = OS.gtk_event_box_new();
+ if (boxHandle==0) error(SWT.ERROR_NO_HANDLES);
+ boolean isVertical = (parent.getStyle()&SWT.VERTICAL) != 0;
+ handle = isVertical? OS.gtk_hseparator_new() : OS.gtk_vseparator_new();
+ if (handle==0) error(SWT.ERROR_NO_HANDLES);
+}
+private void _createPushHandle(int index) {
+ handle = OS.gtk_toolbar_insert_element (parent.handle,
+ OS.GTK_TOOLBAR_CHILD_BUTTON,
+ 0, new byte[1], null, null,
+ 0, 0, 0,
+ index);
+ configured=true;
+ shown=true;
+}
+private void _createToggleHandle(int index) {
+ handle = OS.gtk_toolbar_insert_element (parent.handle,
+ OS.GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
+ 0, new byte[1], null, null,
+ 0, 0, 0,
+ index);
+ configured=true;
+ shown=true;
+}
+
+
+void configure() {
+ // configure is done for non-separators
+ if (configured) return;
+ OS.gtk_toolbar_insert_widget (
+ parent.handle,
+ topHandle(),
+ new byte[1], new byte[1],
+ position);
+ OS.gtk_container_add(boxHandle, handle);
+}
+
+void showHandle() {
+ if (shown) return;
+ if ((parent.getStyle()&SWT.VERTICAL)!=0) OS.gtk_widget_set_usize(handle, 15, 3);
+ else OS.gtk_widget_set_usize(handle, 3, 15);
+ OS.gtk_widget_show(boxHandle);
+ OS.gtk_widget_show(handle);
+}
+
+void register() {
+ super.register ();
+ if (boxHandle != 0) WidgetTable.put (boxHandle, this);
+}
+
+void releaseHandle () {
+ super.releaseHandle ();
+ boxHandle = 0;
+}
+
+void deregister() {
+ super.deregister ();
+ if (boxHandle != 0) WidgetTable.remove (boxHandle);
+}
+
+int topHandle() {
+ return (boxHandle==0)? handle : boxHandle;
+}
+
+
+/**
+ * Returns a rectangle describing the receiver's size and location
+ * relative to its parent.
+ *
+ * @return the receiver's bounding rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Rectangle getBounds () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return new Rectangle (widget.alloc_x, widget.alloc_y, widget.alloc_width, widget.alloc_height);
+}
+/**
+ * Returns the control that is used to fill the bounds of
+ * the item when the items is a <code>SEPARATOR</code>.
+ *
+ * @return the control
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Control getControl () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return control;
+}
+
+/**
+ * Returns the receiver's disabled image if it has one, or null
+ * if it does not.
+ * <p>
+ * The disabled image is displayed when the receiver is disabled.
+ * </p>
+ *
+ * @return the receiver's disabled image
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Image getDisabledImage () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ error(SWT.ERROR_NOT_IMPLEMENTED);
+ return null;
+}
+
+public Display getDisplay () {
+ ToolBar parent = this.parent;
+ if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getDisplay ();
+}
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise.
+ * <p>
+ * A disabled control is typically not selectable from the
+ * user interface and draws with an inactive or "grayed" look.
+ * </p>
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getEnabled () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return (widget.flags & OS.GTK_SENSITIVE) != 0;
+}
+/**
+ * Returns the receiver's hot image if it has one, or null
+ * if it does not.
+ * <p>
+ * The hot image is displayed when the mouse enters the receiver.
+ * </p>
+ *
+ * @return the receiver's hot image
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Image getHotImage () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return null;
+}
+/**
+ * Returns the receiver's parent, which must be a <code>ToolBar</code>.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public ToolBar getParent () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent;
+}
+/**
+ * Returns <code>true</code> if the receiver is selected,
+ * and false otherwise.
+ * <p>
+ * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
+ * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
+ * it is selected when it is pushed.
+ * </p>
+ *
+ * @return the selection state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getSelection () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return false;
+ return OS.gtk_toggle_button_get_active (handle);
+}
+/**
+ * Returns the receiver's tool tip text, or null if it has not been set.
+ *
+ * @return the receiver's tool tip text
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public String getToolTipText () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return "";
+}
+/**
+ * Gets the width of the receiver.
+ *
+ * @return the width
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getWidth () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return widget.alloc_width;
+}
+void hookEvents () {
+ if ((style & SWT.SEPARATOR) != 0) return;
+ signal_connect(handle, "clicked", SWT.Selection, 2);
+ signal_connect(handle, "enter-notify-event", SWT.MouseEnter, 3);
+ signal_connect(handle, "leave-notify-event", SWT.MouseExit, 3);
+}
+/**
+ * Returns <code>true</code> if the receiver is enabled, and
+ * <code>false</code> otherwise.
+ * <p>
+ * A disabled control is typically not selectable from the
+ * user interface and draws with an inactive or "grayed" look.
+ * </p>
+ *
+ * @return the receiver's enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean isEnabled () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return getEnabled () && parent.isEnabled ();
+}
+
+int processMouseEnter (int int0, int int1, int int2) {
+ drawHotImage = (parent.style & SWT.FLAT) != 0 && hotImage != null;
+ if ( drawHotImage && (currentpixmap != 0) ) {
+ OS.gtk_pixmap_set (currentpixmap, hotImage.pixmap, hotImage.mask);
+ }
+ return 0;
+}
+
+int processMouseExit (int int0, int int1, int int2) {
+ if (drawHotImage) {
+ drawHotImage = false;
+ if (currentpixmap != 0 && image != null){
+ OS.gtk_pixmap_set (currentpixmap, image.pixmap, image.mask);
+ }
+ }
+ return 0;
+}
+/*
+int processPaint (int int0, int int1, int int2) {
+ if (ignorePaint) return 0;
+ Image currentImage = drawHotImage ? hotImage : image;
+ if (!getEnabled()) {
+ Display display = getDisplay ();
+ currentImage = disabledImage;
+ if (currentImage == null) {
+ currentImage = new Image (display, image, SWT.IMAGE_DISABLE);
+ }
+ }
+ if (currentpixmap != 0 && currentImage != null)
+ OS.gtk_pixmap_set (currentpixmap, currentImage.pixmap, currentImage.mask);
+ return 0;
+}
+*/
+int processSelection (int int0, int int1, int int2) {
+ if ((style & SWT.RADIO) != 0) {
+ this.setSelection (true);
+ ToolItem [] items = parent.getItems ();
+ int index = 0;
+ while (index < items.length && items [index] != this) index++;
+ ToolItem item;
+ int i = index;
+ while (--i >= 0 && ((item = items [i]).style & SWT.RADIO) != 0) {
+ item.setSelection (false);
+ }
+ i = index;
+ while (++i < items.length && ((item = items [i]).style & SWT.RADIO) != 0) {
+ item.setSelection (false);
+ }
+ }
+ Event event = new Event ();
+ postEvent (SWT.Selection, event);
+ return 0;
+}
+void releaseWidget () {
+ super.releaseWidget ();
+ tooltipsHandle = 0;
+ parent = null;
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is selected.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener(SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection,listener);
+}
+/**
+ * Sets the control that is used to fill the bounds of
+ * the item when the items is a <code>SEPARATOR</code>.
+ *
+ * @param control the new control
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
+ * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setControl (Control control) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & SWT.SEPARATOR) == 0) return;
+
+ this.control = control;
+ if (control==null) return;
+
+ // first, remove the current control from the box and throw it away
+ WidgetTable.remove(handle);
+ OS.gtk_widget_destroy(handle);
+ WidgetTable.remove(boxHandle);
+
+ // put the specified control in the box
+ handle = control.topHandle();
+ OS.gtk_widget_reparent(handle, boxHandle);
+ OS.gtk_widget_show(handle);
+ WidgetTable.put(handle, control);
+ WidgetTable.put(boxHandle, control);
+}
+/**
+ * Sets the receiver's disabled image to the argument, which may be
+ * null indicating that no disabled image should be displayed.
+ * <p>
+ * The disbled image is displayed when the receiver is disabled.
+ * </p>
+ *
+ * @param image the disabled image to display on the receiver (may be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setDisabledImage (Image image) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & SWT.SEPARATOR) != 0) return;
+ disabledImage = image;
+}
+/**
+ * Enables the receiver if the argument is <code>true</code>,
+ * and disables it otherwise.
+ * <p>
+ * A disabled control is typically
+ * not selectable from the user interface and draws with an
+ * inactive or "grayed" look.
+ * </p>
+ *
+ * @param enabled the new enabled state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setEnabled (boolean enabled) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_widget_set_sensitive (handle, enabled);
+}
+/**
+ * Sets the receiver's hot image to the argument, which may be
+ * null indicating that no hot image should be displayed.
+ * <p>
+ * The hot image is displayed when the mouse enters the receiver.
+ * </p>
+ *
+ * @param image the hot image to display on the receiver (may be null)
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setHotImage (Image image) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & SWT.SEPARATOR) != 0) return;
+ hotImage = image;
+}
+public void setImage (Image image) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ super.setImage (image);
+ if ((style & SWT.SEPARATOR) != 0) return;
+ int list = OS.gtk_container_children (handle);
+ if (list != 0) {
+ int widget = OS.g_list_nth_data (list, 0);
+ if (widget != 0) OS.gtk_widget_destroy (widget);
+ }
+ if (image != null) {
+ int pixmap = OS.gtk_pixmap_new (image.pixmap, image.mask);
+ OS.gtk_container_add (handle, pixmap);
+ OS.gtk_widget_show (pixmap);
+ currentpixmap = pixmap;
+ }
+}
+/**
+ * Sets the selection state of the receiver.
+ * <p>
+ * When the receiver is of type <code>CHECK</code> or <code>RADIO</code>,
+ * it is selected when it is checked. When it is of type <code>TOGGLE</code>,
+ * it is selected when it is pushed.
+ * </p>
+ *
+ * @param selected the new selection state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setSelection (boolean selected) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return;
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_toggle_button_set_active (handle, selected);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+}
+public void setText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if ((style & SWT.SEPARATOR) != 0) return;
+ text = string;
+ if ((style & SWT.ARROW) != 0) return;
+ int length = string.length ();
+ char [] text = new char [length + 1];
+ char [] pattern = new char [length + 1];
+ string.getChars (0, length, text, 0);
+ int i = 0, j = 0;
+ while (i < length) {
+ pattern [j] = ' ';
+ if (text [i] == '&') {
+ i++;
+ if (i < length && text [i] != '&') {
+ pattern [j] = '_';
+ }
+ }
+ text [j++] = text [i++];
+ }
+ while (j < i) {
+ text [j] = pattern [j] = '\0';
+ j++;
+ }
+ int list = OS.gtk_container_children (handle);
+ if (list != 0) {
+ int widget = OS.g_list_nth_data (list, 0);
+ if (widget != 0) OS.gtk_widget_destroy (widget);
+ }
+ byte [] buffer1 = Converter.wcsToMbcs (null, text);
+ int label = OS.gtk_label_new (buffer1);
+ byte [] buffer2 = Converter.wcsToMbcs (null, pattern);
+ OS.gtk_label_set_pattern (label, buffer2);
+ OS.gtk_container_add (handle, label);
+ OS.gtk_widget_show (label);
+}
+/**
+ * Sets the receiver's tool tip text to the argument, which
+ * may be null indicating that no tool tip text should be shown.
+ *
+ * @param string the new tool tip text (or null)
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setToolTipText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (tooltipsHandle == 0) tooltipsHandle = OS.gtk_tooltips_new();
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ OS.gtk_tooltips_set_tip(tooltipsHandle, handle, buffer, null);
+}
+/**
+ * Sets the width of the receiver.
+ *
+ * @param width the new width
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setWidth (int width) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((style & SWT.SEPARATOR) == 0) return;
+
+ Point size = control.computeSize(width, SWT.DEFAULT);
+ control.setSize(size);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Tracker.java
new file mode 100644
index 0000000..dfc7b30
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Tracker.java
@@ -0,0 +1,388 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * Instances of this class implement rubber banding rectangles.
+ *
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Move</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+public class Tracker extends Widget {
+ Composite parent;
+ Display display;
+ boolean tracking, stippled;
+ Rectangle [] rectangles = new Rectangle [0];
+
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a widget which will be the parent of the new instance (cannot be null)
+ * @param style the style of widget to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Tracker (Composite parent, int style) {
+ super (parent, style);
+ this.parent = parent;
+ display = parent.getDisplay ();
+}
+
+/**
+ * Constructs a new instance of this class given the display
+ * to create it on and a style value describing its behavior
+ * and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p><p>
+ * Note: Currently, null can be passed in for the display argument.
+ * This has the effect of creating the tracker on the currently active
+ * display if there is one. If there is no current display, the
+ * tracker is created on a "default" display. <b>Passing in null as
+ * the display argument is not considered to be good coding style,
+ * and may not be supported in a future release of SWT.</b>
+ * </p>
+ *
+ * @param display the display to create the tracker on
+ * @param style the style of control to construct
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ */
+public Tracker (Display display, int style) {
+ if (display == null) display = Display.getCurrent ();
+ if (display == null) display = Display.getDefault ();
+ if (!display.isValidThread ()) {
+ error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ }
+ this.style = style;
+ this.display = display;
+}
+
+
+
+/*
+ * === ADD / REMOVE LISTENERS ===
+ */
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the control is moved or resized, by sending
+ * it one of the messages defined in the <code>ControlListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ControlListener
+ * @see #removeControlListener
+ */
+public void addControlListener(ControlListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Move,typedListener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the control is moved or resized.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see ControlListener
+ * @see #addControlListener
+ */
+public void removeControlListener (ControlListener listener) {
+ checkWidget();
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Move, listener);
+}
+
+
+
+
+/*
+ * === PUBLIC ACCESSORS ===
+ */
+
+public Display getDisplay () {
+ return display;
+}
+
+/**
+ * Returns the bounds of the Rectangles being drawn.
+ *
+ * @return the bounds of the Rectangles being drawn
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Rectangle [] getRectangles () {
+ checkWidget();
+ return rectangles;
+}
+
+/**
+ * Returns <code>true</code> if the rectangles are drawn with a stippled line, <code>false</code> otherwise.
+ *
+ * @return the stippled effect of the rectangles
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getStippled () {
+ checkWidget();
+ return stippled;
+}
+
+/**
+ * Specify the rectangles that should be drawn.
+ *
+ * @param rectangles the bounds of the rectangles to be drawn
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setRectangles (Rectangle [] rectangles) {
+ checkWidget();
+ this.rectangles = rectangles;
+}
+
+/**
+ * Change the appearance of the line used to draw the rectangles.
+ *
+ * @param stippled <code>true</code> if rectangle should appear stippled
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setStippled (boolean stippled) {
+ checkWidget();
+ this.stippled = stippled;
+}
+
+
+
+/*
+ * === PUBLIC FUNCTIONALITY ===
+ */
+
+/**
+ * Stop displaying the tracker rectangles.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void close () {
+ checkWidget();
+ tracking = false;
+}
+
+/**
+ * Start displaying the Tracker rectangles.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean open () {
+ checkWidget();
+ int xWindow = calculateWindow();
+ boolean cancelled=false;
+ tracking = true;
+ drawRectangles ();
+
+ int[] newX = new int[1];
+ int[] newY = new int[1];
+ int[] oldX = new int[1];
+ int[] oldY = new int[1];
+ OS.gdk_window_get_pointer(xWindow, oldX,oldY, 0);
+
+ while (tracking) {
+ if (parent != null && parent.isDisposed ()) break;
+ int eventType = waitEvent();
+ switch (eventType) {
+ case OS.GDK_BUTTON_RELEASE:
+ case OS.GDK_MOTION_NOTIFY:
+ OS.gdk_window_get_pointer(xWindow, newX,newY, 0);
+ if (oldX [0] != newX [0] || oldY [0] != newY [0]) {
+ drawRectangles ();
+ for (int i=0; i<rectangles.length; i++) {
+ rectangles [i].x += newX [0] - oldX [0];
+ rectangles [i].y += newY [0] - oldY [0];
+ }
+ Event event = new Event();
+ event.x = newX[0];
+ event.y = newY[0];
+ sendEvent (SWT.Move,event);
+ drawRectangles ();
+ oldX [0] = newX [0]; oldY [0] = newY [0];
+ }
+ tracking = (eventType != OS.GDK_BUTTON_RELEASE);
+ break;
+ case OS.GDK_KEY_PRESS:
+// error(SWT.ERROR_NOT_IMPLEMENTED);
+ /*
+ XKeyEvent keyEvent = new XKeyEvent ();
+ OS.memmove (keyEvent, xEvent, XKeyEvent.sizeof);
+ if (keyEvent.keycode != 0) {
+ int [] keysym = new int [1];
+ OS.XLookupString (keyEvent, null, 0, keysym, null);
+ keysym [0] &= 0xFFFF;
+ tracking = keysym [0] != OS.XK_Escape && keysym [0] != OS.XK_Cancel;
+ cancelled = !tracking;
+ }*/
+ break;
+ } // switch
+ } // while
+ drawRectangles(); // clean up our mess
+ tracking = false;
+ return !cancelled;
+}
+
+
+
+private void drawRectangles () {
+ int xWindow = calculateWindow();
+ if (parent != null) {
+ if (parent.isDisposed ()) return;
+ parent.getShell ().update ();
+ } else {
+ display.update ();
+ }
+
+ int gc = OS.gdk_gc_new(xWindow);
+ if (gc==0) error(SWT.ERROR_UNSPECIFIED);
+
+ /* White foreground */
+ int colormap = OS.gdk_colormap_get_system();
+ GdkColor color = new GdkColor();
+ OS.gdk_color_white(colormap, color);
+ OS.gdk_gc_set_foreground(gc, color);
+
+ /* Draw on top of inferior widgets */
+ OS.gdk_gc_set_subwindow(gc, OS.GDK_INCLUDE_INFERIORS);
+
+ /* XOR */
+ OS.gdk_gc_set_function(gc, OS.GDK_XOR);
+
+ for (int i=0; i<rectangles.length; i++) {
+ Rectangle rect = rectangles [i];
+ OS.gdk_draw_rectangle(xWindow, gc, 0, rect.x, rect.y, rect.width, rect.height);
+ }
+ OS.gdk_gc_destroy(gc);
+}
+/*
+ * Wait for an event to show up.
+ * Return the event's type as a GdkEventType.
+ */
+private int waitEvent() {
+ int[] eventType = new int[1];
+ int eventPtr;
+
+ while (true) {
+ eventPtr = OS.gdk_event_get();
+ if (eventPtr != 0) {
+ // hack, must implement memmove properly
+ // GdkEvent event = new GdkEvent(eventPtr);
+ OS.memmove(eventType, eventPtr, 4);
+ OS.gdk_event_free(eventPtr);
+ return eventType[0];
+ }
+ else {
+ try { Thread.sleep(50); } catch (Exception ex) {}
+ }
+ }
+}
+
+/*
+ * Figure which GdkWindow we'll draw on.
+ * That's normally the root X window, or the parent's GdkWindow if we have a parent.
+ */
+private int calculateWindow() {
+ int answer;
+ if (parent == null) {
+ answer = OS.GDK_ROOT_PARENT();
+ } else {
+ answer = parent._gdkWindow();
+ }
+ if (answer==0) error(SWT.ERROR_UNSPECIFIED);
+ return answer;
+}
+
+public void setCursor (Cursor value) {
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Tree.java
new file mode 100644
index 0000000..0bc4953
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Tree.java
@@ -0,0 +1,820 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.*;
+
+
+/**
+ * Instances of this class provide a selectable user interface object
+ * that displays a hierarchy of items and issue notificiation when an
+ * item in the hierarchy is selected.
+ * <p>
+ * The item children that may be added to instances of this class
+ * must be of type <code>TreeItem</code>.
+ * </p><p>
+ * Note that although this class is a subclass of <code>Composite</code>,
+ * it does not make sense to add <code>Control</code> children to it,
+ * or set a layout on it.
+ * </p><p>
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>SINGLE, MULTI, CHECK</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Selection, DefaultSelection, Collapse, Expand</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+public class Tree extends Composite {
+ TreeItem [] items;
+ TreeItem selectedItem;
+
+ boolean ignoreExpand, ignoreCollapse;
+ TreeItem itemInInsertion;
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public Tree (Composite parent, int style) {
+ super (parent, checkStyle (style));
+}
+
+static int checkStyle (int style) {
+ /*
+ * To be compatible with Windows, force the H_SCROLL
+ * and V_SCROLL style bits. On Windows, it is not
+ * possible to create a tree without scroll bars.
+ */
+ style |= SWT.H_SCROLL | SWT.V_SCROLL;
+ return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
+}
+
+void createHandle (int index) {
+ state |= HANDLE;
+
+ eventBoxHandle = OS.gtk_fixed_new(); // false for homogeneous; doesn't really matter
+ if (eventBoxHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ scrolledHandle = OS.gtk_scrolled_window_new (0, 0);
+ if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
+ handle = OS.gtk_ctree_new (1, 0);
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+}
+
+void setHandleStyle() {
+ setSelectionPolicy();
+ if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) != 0) {
+ }
+ setScrollingPolicy();
+}
+
+void setSelectionPolicy() {
+ int selectionPolicy = ((style & SWT.MULTI) != 0)?
+ OS.GTK_SELECTION_EXTENDED :
+ OS.GTK_SELECTION_BROWSE;
+ OS.gtk_clist_set_selection_mode (handle, selectionPolicy);
+}
+
+void configure() {
+ _connectParent();
+ OS.gtk_container_add (eventBoxHandle, scrolledHandle);
+ OS.gtk_container_add (scrolledHandle, handle);
+}
+
+void showHandle() {
+ OS.gtk_widget_show (eventBoxHandle);
+ OS.gtk_widget_show (scrolledHandle);
+ OS.gtk_widget_show (handle);
+ OS.gtk_widget_realize (handle);
+}
+
+void hookEvents () {
+ //TO DO - get rid of enter/exit for mouse crossing border
+ super.hookEvents ();
+ signal_connect (handle, "tree_select_row", SWT.Selection, 4);
+ signal_connect (handle, "tree_expand", SWT.Expand, 3);
+ signal_connect (handle, "tree_collapse", SWT.Collapse, 3);
+}
+
+void createWidget (int index) {
+ super.createWidget (index);
+ items = new TreeItem [4];
+}
+
+int topHandle() { return eventBoxHandle; }
+int parentingHandle() { return eventBoxHandle; } // FIXME - Temporary placeholder
+boolean isMyHandle(int h) {
+ if (h==eventBoxHandle) return true;
+ if (h==scrolledHandle) return true;
+ if (h==handle) return true;
+ return false;
+}
+void _connectChild() {
+ error(SWT.ERROR_UNSPECIFIED);
+}
+Control[] _getChildren() {
+ return new Control[0];
+}
+
+
+/*
+ * === GEOMETRY ===
+ */
+
+
+protected Point _getClientAreaSize () {
+ return UtilFuncs.getSize(handle);
+}
+
+boolean _setSize(int width, int height) {
+ boolean differentExtent = UtilFuncs.setSize (eventBoxHandle, width,height);
+ UtilFuncs.setSize (scrolledHandle, width, height);
+ return differentExtent;
+}
+
+public Point computeSize (int wHint, int hHint, boolean changed) {
+ checkWidget ();
+ if (wHint == SWT.DEFAULT) wHint = 200;
+ //scrolledHandle
+ return _computeSize (wHint, hHint, changed);
+}
+
+
+/*
+ * === ADD/REMOVE LISTENERS ===
+ */
+
+
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the receiver's selection changes, by sending
+ * it one of the messages defined in the <code>SelectionListener</code>
+ * interface.
+ * <p>
+ * When <code>widgetSelected</code> is called, the item field of the event object is valid.
+ * If the reciever has <code>SWT.CHECK</code> style set and the check selection changes,
+ * the event object detail field contains the value <code>SWT.CHECK</code>.
+ * <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
+ * </p>
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #removeSelectionListener
+ * @see SelectionEvent
+ */
+public void addSelectionListener(SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Selection, typedListener);
+ addListener (SWT.DefaultSelection, typedListener);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when an item in the receiver is expanded or collapsed
+ * by sending it one of the messages defined in the <code>TreeListener</code>
+ * interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see TreeListener
+ * @see #removeTreeListener
+ */
+public void addTreeListener(TreeListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Expand, typedListener);
+ addListener (SWT.Collapse, typedListener);
+}
+
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when the receiver's selection changes.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see SelectionListener
+ * @see #addSelectionListener
+ */
+public void removeSelectionListener (SelectionListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ eventTable.unhook (SWT.Selection, listener);
+ eventTable.unhook (SWT.DefaultSelection, listener);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notified when items in the receiver are expanded or collapsed..
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see TreeListener
+ * @see #addTreeListener
+ */
+public void removeTreeListener(TreeListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Expand, listener);
+ eventTable.unhook (SWT.Collapse, listener);
+}
+
+/*
+ * === WIDGET SPECIFIC LOGIC ===
+ */
+
+void createItem (TreeItem item, int node, int index) {
+ int id = 0;
+ while (id < items.length && items [id] != null) id++;
+ if (id == items.length) {
+ TreeItem [] newItems = new TreeItem [items.length + 4];
+ System.arraycopy (items, 0, newItems, 0, items.length);
+ items = newItems;
+ }
+
+ /* Feature in GTK.
+ * When the selection policy is BROWSE (which is what we use for SINGLE),
+ * the first item added gets automatically selected. This leads to some
+ * nontrivial complications which one better avoid. The hack is to
+ * temporarily put a value other than GTK_SELECTION_BROWSE into the
+ * selectionMode field just for the insertion. Do not use the policy
+ * changing API because this will cause a selection callback.
+ */
+ int[] sm = new int[1];
+ OS.memmove(sm, handle+148, 1);
+ int selectionMode = sm[0];
+ sm[0] = OS.GTK_SELECTION_MULTIPLE;
+ OS.memmove(handle+148, sm, 1);
+
+ itemInInsertion = item;
+ item.handle = OS.gtk_ctree_insert_node (handle,
+ node, // parent
+ 0, // sibling
+ null, // text
+ (byte) 2, // extra space between icon and text
+ 0, 0, 0, 0, // open/close pixmap/mask
+ false, // isLeaf
+ false); // expanded
+ itemInInsertion = null;
+ OS.gtk_ctree_node_set_row_data (handle, item.handle, id + 1);
+
+ sm[0] = selectionMode;
+ OS.memmove(handle+148, sm, 1);
+
+ items [id] = item;
+}
+
+/*
+ * === SELECTION STORY ===
+ */
+
+/**
+ * Returns an array of <code>TreeItem</code>s that are currently
+ * selected in the receiver. An empty array indicates that no
+ * items are selected.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its selection, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ * @return an array representing the selection
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TreeItem[] getSelection () {
+ checkWidget();
+ return _getNativeSelection();
+}
+private TreeItem[] _getNativeSelection() {
+ GtkCList clist = new GtkCList ();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ switch (clist.selection_mode) {
+// case OS.GTK_SELECTION_SINGLE: return getSelection_single();
+ case OS.GTK_SELECTION_BROWSE: return getSelection_browse();
+// case OS.GTK_SELECTION_MULTIPLE: return getSelection_multiple();
+ case OS.GTK_SELECTION_EXTENDED: return getSelection_extended();
+ default: error(SWT.ERROR_UNSPECIFIED);
+ }
+ /* can never get here */
+ return null;
+}
+
+private TreeItem[] getSelection_browse () {
+ GtkCList clist = new GtkCList();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ if (clist.selection==0) return new TreeItem[0];
+ int length = OS.g_list_length (clist.selection);
+ if (length == 0) return new TreeItem[0];
+ int node = OS.g_list_nth_data (clist.selection, 0);
+ TreeItem[] answer = new TreeItem[1];
+ int index = OS.gtk_ctree_node_get_row_data(handle, node) - 1;
+ if ((index<0) && (itemInInsertion!=null)) answer[0] = itemInInsertion;
+ else answer[0] = items[index];
+ return answer;
+}
+private TreeItem[] getSelection_extended () {
+ GtkCList clist = new GtkCList();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ if (clist.selection==0) return new TreeItem[0];
+ int length = OS.g_list_length (clist.selection);
+ TreeItem[] result = new TreeItem[length];
+ for (int i=0; i<length; i++) {
+ int node = OS.g_list_nth_data (clist.selection, i);
+ int index = OS.gtk_ctree_node_get_row_data(handle, node) - 1;
+ result [i] = items [index];
+ }
+ return result;
+}
+
+/**
+ * Returns the number of selected items contained in the receiver.
+ *
+ * @return the number of selected items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getSelectionCount () {
+ checkWidget();
+ // Native way:
+ GtkCList clist = new GtkCList ();
+ OS.memmove(clist, handle, GtkCList.sizeof);
+ int selectionList = clist.selection;
+ if (selectionList==0) return 0;
+ return OS.g_list_length (clist.selection);
+}
+/**
+ * Sets the receiver's selection to be the given array of items.
+ * The current selected is first cleared, then the new items are
+ * selected.
+ *
+ * @param items the array of items
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if one of the item has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Tree#deselectAll()
+ */
+public void setSelection (TreeItem [] items) {
+ checkWidget();
+ if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
+ _deselectAll();
+ for (int i=0; i<items.length; i++) {
+ TreeItem item = items [i];
+ OS.gtk_ctree_select (handle, item.handle);
+ }
+}
+/**
+ * Selects all the items in the receiver.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void selectAll () {
+ checkWidget();
+ int rootNode = OS.gtk_ctree_node_nth(handle, 0);
+ if (rootNode==0) return; // empty
+ OS.gtk_ctree_select_recursive (handle, rootNode);
+}
+/**
+ * Deselects all selected items in the receiver.
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void deselectAll() {
+ checkWidget();
+ _deselectAll();
+}
+private void _deselectAll() {
+ int rootNode = OS.gtk_ctree_node_nth(handle, 0);
+ if (rootNode==0) return; // empty
+ OS.gtk_ctree_unselect_recursive (handle, rootNode);
+}
+
+
+/**
+ * Shows the selection. If the selection is already showing in the receiver,
+ * this method simply returns. Otherwise, the items are scrolled until
+ * the selection is visible.
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Tree#showItem(TreeItem)
+ */
+public void showSelection () {
+ checkWidget();
+ if (selectedItem != null) showItem (selectedItem);
+}
+
+void destroyItem (TreeItem item) {
+ int node = item.handle;
+ Callback GtkCTreeFunc = new Callback (this, "GtkCTreeDispose", 3);
+ int address = GtkCTreeFunc.getAddress ();
+ OS.gtk_ctree_post_recursive (handle, node, address, 0);
+ GtkCTreeFunc.dispose ();
+ ignoreCollapse = true;
+ OS.gtk_ctree_remove_node (handle, node);
+ ignoreCollapse = false;
+}
+
+/**
+ * Returns the item at the given point in the receiver
+ * or null if no such item exists. The point is in the
+ * coordinate system of the receiver.
+ *
+ * @param point the point used to locate the item
+ * @return the item at the given point
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TreeItem getItem(Point point) {
+ int itemHeight = getItemHeight();
+ int hitItemIndex = point.y / itemHeight;
+ TreeItem hitItem;
+ GtkCTree tree = new GtkCTree();
+ OS.memmove(tree, handle, GtkCTree.sizeof);
+ int [] row = new int [1];
+ int [] column = new int [1];
+ OS.gtk_clist_get_selection_info(handle, point.x, point.y, row, column);
+ int data=OS.g_list_nth(tree.row_list, row[0]);
+ for (int i = 0; i< items.length; i++)
+ if (items[i].handle==data)
+ return items[i];
+
+ return null;
+}
+
+public boolean forceFocus () {
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ boolean result = super.forceFocus();
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
+ return result;
+}
+/**
+ * Returns the number of items contained in the receiver
+ * that are direct item children of the receiver. The
+ * number that is returned is the number of roots in the
+ * tree.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getItemCount () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int root = OS.gtk_ctree_node_nth (handle, 0);
+ if (root == 0) return 0;
+ int data = OS.g_list_nth_data (root, 0);
+ GtkCTreeRow row = new GtkCTreeRow ();
+ OS.memmove (row, data, GtkCTreeRow.sizeof);
+ int glist = row.sibling;
+ if (glist == 0) return 0;
+ return OS.g_list_length (glist);
+}
+/**
+ * Returns the height of the area which would be used to
+ * display <em>one</em> of the items in the tree.
+ *
+ * @return the height of one item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getItemHeight () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ GtkCList clist = new GtkCList ();
+ OS.memmove (clist, handle, GtkCList.sizeof);
+ return clist.row_height;
+}
+/**
+ * Returns the number of items contained in the receiver
+ * that are direct item children of the receiver. These
+ * are the roots of the tree.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TreeItem [] getItems () {
+ checkWidget();
+
+ // The node corresponding to the 0th row
+ int root = OS.gtk_ctree_node_nth (handle, 0);
+ if (root == 0) return new TreeItem [0];
+
+ // The 0th row
+ int data = OS.g_list_nth_data (root, 0);
+ GtkCTreeRow row = new GtkCTreeRow ();
+ OS.memmove (row, data, GtkCTreeRow.sizeof);
+
+ int index = OS.gtk_ctree_node_get_row_data(handle, root) - 1;
+
+ int glist = row.sibling;
+ int count = OS.g_list_length (glist);
+ TreeItem [] result = new TreeItem [count+1];
+ result[0] = items[index];
+ for (int i=0; i<count; i++) {
+ int node = OS.g_list_nth (glist, i);
+ index = OS.gtk_ctree_node_get_row_data (handle, node) - 1;
+ result [i+1] = items [index];
+ }
+ return result;
+}
+
+/**
+ * Returns the receiver's parent item, which must be a
+ * <code>TreeItem</code> or null when the receiver is a
+ * root.
+ *
+ * @return the receiver's parent item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TreeItem getParentItem () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return null;
+}
+
+int processCollapse (int int0, int int1, int int2) {
+ if (ignoreCollapse) return 0;
+ int index = OS.gtk_ctree_node_get_row_data (handle, int0) - 1;
+ Event event = new Event ();
+ event.item = items [index];
+// OS.gtk_clist_freeze (handle);
+ sendEvent (SWT.Collapse, event);
+// OS.gtk_clist_thaw (handle);
+ return 0;
+}
+int processExpand (int int0, int int1, int int2) {
+ if (ignoreExpand) return 0;
+ int index = OS.gtk_ctree_node_get_row_data (handle, int0) - 1;
+ Event event = new Event ();
+ event.item = items [index];
+ OS.gtk_clist_freeze (handle);
+ sendEvent (SWT.Expand, event);
+ OS.gtk_clist_thaw (handle);
+ boolean [] expanded = new boolean [1];
+ OS.gtk_ctree_get_node_info (handle, int0, null, null, null, null, null, null, null, expanded);
+ if (!expanded [0]) {
+ ignoreExpand = true;
+ OS.gtk_ctree_expand (handle, int0);
+ ignoreExpand = false;
+ }
+ return 0;
+}
+int processSelection (int int0, int int1, int int2) {
+ if (itemInInsertion != null) selectedItem = itemInInsertion;
+ else {
+ int index = OS.gtk_ctree_node_get_row_data (handle, int0) - 1;
+ selectedItem = items [index];
+ }
+ Event event = new Event ();
+ event.item = selectedItem;
+ sendEvent (SWT.Selection, event);
+ return 0;
+}
+int processMouseDown (int callData, int arg1, int int2) {
+ OS.gtk_widget_grab_focus(handle);
+ GdkEventButton gdkEvent = new GdkEventButton ();
+ OS.memmove (gdkEvent, callData, GdkEventButton.sizeof);
+ int eventType = SWT.MouseDown;
+ if (gdkEvent.type == OS.GDK_2BUTTON_PRESS) {
+ GtkCTree tree = new GtkCTree();
+ OS.memmove(tree, handle, GtkCTree.sizeof);
+ int row=((int)gdkEvent.y-tree.voffset)/(tree.row_height+1);
+ int count = OS.g_list_length (tree.row_list);
+ if (row >= count) return 1;
+ int node = OS.g_list_nth(tree.row_list, row);
+ int data = OS.g_list_nth_data(node, 0);
+ GtkCTreeRow treerow = new GtkCTreeRow();
+ OS.memmove (treerow, data, GtkCTreeRow.sizeof);
+ if (OS.gtk_ctree_is_hot_spot(handle, (int)gdkEvent.x, (int)gdkEvent.y)){
+ sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
+ return 1;
+ }
+ if (treerow.children != 0) {
+ eventType = SWT.MouseDoubleClick;
+ sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
+ return 1;
+ }
+ int index = OS.gtk_ctree_node_get_row_data (handle, node) - 1;
+ selectedItem = items [index];
+ Event event = new Event ();
+ event.item=selectedItem;
+ if (selectedItem != null)
+ sendEvent (SWT.DefaultSelection, event);
+ }else{
+ sendMouseEvent (eventType, gdkEvent.button, gdkEvent.state, gdkEvent.time, (int)gdkEvent.x, (int)gdkEvent.y);
+ }
+ if (gdkEvent.button == 3 && menu != null) {
+ menu.setVisible (true);
+ }
+ return 1;
+}
+
+/**
+ * Removes all of the items from the receiver.
+ * <p>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void removeAll () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ OS.gtk_ctree_remove_node (handle, 0);
+ for (int i=0; i<items.length; i++) {
+ TreeItem item = items [i];
+ if (item != null && !item.isDisposed ()) {
+ item.releaseWidget ();
+ item.releaseHandle ();
+ }
+ }
+ items = new TreeItem [4];
+ selectedItem = null;
+}
+
+/**
+ * Shows the item. If the item is already showing in the receiver,
+ * this method simply returns. Otherwise, the items are scrolled
+ * and expanded until the item is visible.
+ *
+ * @param item the item to be shown
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the item is null</li>
+ * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Tree#showSelection()
+ */
+public void showItem (TreeItem item) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
+ int node = item.handle;
+ if (OS.gtk_ctree_node_is_visible (handle, node) != OS.GTK_VISIBILITY_NONE) {
+ return;
+ }
+ if (!OS.gtk_ctree_is_viewable (handle, node)) {
+ ignoreExpand = true;
+ int parent = node;
+ GtkCTreeRow row = new GtkCTreeRow ();
+ do {
+ int data = OS.g_list_nth_data (parent, 0);
+ OS.memmove (row, data, GtkCTreeRow.sizeof);
+ if ((parent = row.parent) == 0) break;
+ OS.gtk_ctree_expand (handle, parent);
+ } while (true);
+ ignoreExpand = false;
+ }
+ OS.gtk_ctree_node_moveto (handle, node, 0, 0.0f, 0.0f);
+}
+
+int GtkCTreeDispose (int ctree, int node, int data) {
+ int index = OS.gtk_ctree_node_get_row_data (ctree, node) - 1;
+ OS.gtk_ctree_node_set_row_data (ctree, node, 0);
+ TreeItem item = items [index];
+ if (item == selectedItem) selectedItem = null;
+ item.releaseWidget ();
+ item.releaseHandle ();
+ items [index] = null;
+ return 0;
+}
+void releaseWidget () {
+ for (int i=0; i<items.length; i++) {
+ TreeItem item = items [i];
+ if (item != null && !item.isDisposed ()) {
+ item.releaseWidget ();
+ item.releaseHandle ();
+ }
+ }
+ items = null;
+ selectedItem = null;
+ super.releaseWidget ();
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TreeItem.java
new file mode 100644
index 0000000..d1eaeee
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TreeItem.java
@@ -0,0 +1,518 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.graphics.*;
+import java.util.Vector;
+
+/**
+ * Instances of this class represent a selectable user interface object
+ * that represents a hierarchy of tree items in a tree widget.
+ *
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>(none)</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is <em>not</em> intended to be subclassed.
+ * </p>
+ */
+public class TreeItem extends Item {
+ Tree parent;
+ int index;
+
+/*
+ * === CONSTRUCTORS ===
+ */
+
+
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Tree</code> or a <code>TreeItem</code>)
+ * and a style value describing its behavior and appearance.
+ * The item is added to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TreeItem (Tree parent, int style) {
+ super (parent, style);
+ this.parent = parent;
+ parent.createItem (this, 0, -1);
+}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Tree</code> or a <code>TreeItem</code>),
+ * a style value describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TreeItem (Tree parent, int style, int index) {
+ super (parent, style);
+ if (index < 0) error (SWT.ERROR_INVALID_RANGE);
+ this.parent=parent;
+ parent.createItem (this, 0, -1);
+}
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Tree</code> or a <code>TreeItem</code>)
+ * and a style value describing its behavior and appearance.
+ * The item is added to the end of the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parentItem a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TreeItem (TreeItem parentItem, int style) {
+ super ( (checkNull(parentItem)).getParent(), style );
+ this.parent = parentItem.getParent ();
+ parent.createItem (this, parentItem.handle, -1);
+}
+private static TreeItem checkNull (TreeItem item) {
+ if (item == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ return item;
+}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * (which must be a <code>Tree</code> or a <code>TreeItem</code>),
+ * a style value describing its behavior and appearance, and the index
+ * at which to place it in the items maintained by its parent.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parentItem a composite control which will be the parent of the new instance (cannot be null)
+ * @param style the style of control to construct
+ * @param index the index to store the receiver in its parent
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see Widget#checkSubclass
+ * @see Widget#getStyle
+ */
+public TreeItem (TreeItem parentItem, int style, int position) {
+ super (parentItem.getParent (), style);
+ if (position < 0) error (SWT.ERROR_ITEM_NOT_ADDED);
+ this.parent = parentItem.getParent ();
+ parent.createItem (this, parentItem.handle, -1);
+}
+
+/**
+ * Returns a rectangle describing the receiver's size and location
+ * relative to its parent.
+ *
+ * @return the receiver's bounding rectangle
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Rectangle getBounds () {
+ checkWidget();
+ int CELL_SPACING=1;
+ int ctree = parent.handle;
+ GtkCTree tree = new GtkCTree();
+ OS.memmove(tree, ctree, GtkCTree.sizeof);
+
+ GtkAdjustment adjustment = new GtkAdjustment ();
+ OS.memmove (adjustment, tree.vadjustment, GtkAdjustment.sizeof);
+ float vaj = adjustment.value;
+ OS.memmove (adjustment, tree.hadjustment, GtkAdjustment.sizeof);
+ float haj = adjustment.value;
+ int columnHandle = tree.column;
+
+ int height=parent.getItemHeight();
+
+ int row_list = tree.row_list; int level=0;
+ int count = OS.g_list_length (row_list);
+ int index=0;
+ while (index<count) {
+ int data = OS.g_list_nth (row_list, index);
+ if (handle == data){
+ int rowHandle = OS.g_list_nth_data (row_list, index);
+ GtkCTreeRow row = new GtkCTreeRow();
+ OS.memmove(row, rowHandle, GtkCTreeRow.sizeof);
+ level = row.level;
+ break;
+ }
+ index++;
+ }
+ int y=height*index+(index+1)*CELL_SPACING+tree.voffset+2;
+
+ int [] buffer = new int [1]; byte [] spacing = new byte [1];
+ boolean [] is_leaf = new boolean [1], expanded = new boolean [1];
+ int [] pixmap_closed = new int [1], mask_closed= new int [1], pixmap_opened= new int [1], mask_opened= new int [1];
+ OS.gtk_ctree_get_node_info (ctree, handle, buffer, spacing, pixmap_closed, mask_closed, pixmap_opened, mask_opened, is_leaf, expanded);
+ int length = OS.strlen (buffer[0]);
+ byte [] buffer1 = new byte [length];
+ OS.memmove (buffer1, buffer[0], length);
+ int styleHandle = OS.gtk_ctree_node_get_row_style(ctree, handle);
+ if (styleHandle == 0)
+ styleHandle = OS.gtk_widget_get_style(ctree);
+ GtkStyle style = new GtkStyle();
+ OS.memmove(style, styleHandle, GtkStyle.sizeof);
+ int width = OS.gdk_string_width(style.font, buffer1);
+
+// x = (short)column.area_x+tree.tree_indent*(level-1)+spacing[0]+tree.hoffset;
+ int x = 33+tree.tree_indent*(level-1)+spacing[0]+tree.hoffset;
+
+ return new Rectangle (x, y, width, height);
+}
+
+/**
+ * Returns <code>true</code> if the receiver is checked,
+ * and false otherwise. When the parent does not have
+ * the <code>CHECK style, return false.
+ * <p>
+ *
+ * @return the checked state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getChecked () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((parent.style & SWT.CHECK) == 0) return false;
+ return false;
+}
+public Display getDisplay () {
+ if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return parent.getDisplay ();
+}
+/**
+ * Returns <code>true</code> if the receiver is expanded,
+ * and false otherwise.
+ * <p>
+ *
+ * @return the expanded state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getExpanded () {
+ checkWidget();
+ int treeHandle = parent.handle;
+ boolean [] buffer = new boolean [1];
+ OS.gtk_ctree_get_node_info (treeHandle, handle, null, null, null, null, null, null, null, buffer);
+ return buffer [0];
+}
+
+/**
+ * Returns <code>true</code> if the receiver is grayed,
+ * and false otherwise. When the parent does not have
+ * the <code>CHECK style, return false.
+ * <p>
+ *
+ * @return the grayed state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public boolean getGrayed() {
+
+ // NOT_IMPLEMENTED
+ return false;
+}
+
+/**
+ * Returns the number of items contained in the receiver
+ * that are direct item children of the receiver.
+ *
+ * @return the number of items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getItemCount () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int data = OS.g_list_nth_data (handle, 0);
+ GtkCTreeRow row = new GtkCTreeRow ();
+ OS.memmove (row, data, GtkCTreeRow.sizeof);
+ int glist = row.children;
+ if (glist == 0) return 0;
+ return OS.g_list_length (glist);
+}
+/**
+ * Returns an array of <code>TreeItem</code>s which are the
+ * direct item children of the receiver.
+ * <p>
+ * Note: This is not the actual structure used by the receiver
+ * to maintain its list of items, so modifying the array will
+ * not affect the receiver.
+ * </p>
+ *
+ * @return the receiver's items
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TreeItem [] getItems () {
+ checkWidget();
+ Vector items = _getItemsVector();
+ int s = items.size();
+ TreeItem[] answer = new TreeItem[s];
+ items.toArray(answer);
+ return answer;
+}
+private Vector _getItemsVector() {
+ Vector answer = new Vector();
+
+
+ int data = OS.g_list_nth_data (handle, 0);
+ GtkCTreeRow row = new GtkCTreeRow ();
+ OS.memmove (row, data, GtkCTreeRow.sizeof);
+ int glist = row.children;
+ if (glist == 0) return answer;
+ int ctree = parent.handle;
+ int count = OS.g_list_length (glist);
+
+ for (int i=0; i<count; i++) {
+ int node = OS.g_list_nth (glist, i);
+ int index = OS.gtk_ctree_node_get_row_data (ctree, node) - 1;
+ TreeItem item = parent.items [index];
+ if (item._getParentItem() == this) answer.add(item);
+ }
+
+ return answer;
+}
+
+/**
+ * Returns the receiver's parent, which must be a <code>Tree</code>.
+ *
+ * @return the receiver's parent
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public Tree getParent () {
+ checkWidget();
+ return parent;
+}
+/**
+ * Returns the receiver's parent item, which must be a
+ * <code>TreeItem</code> or null when the receiver is a
+ * root.
+ *
+ * @return the receiver's parent item
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public TreeItem getParentItem () {
+ checkWidget();
+ return _getParentItem();
+}
+private TreeItem _getParentItem () {
+ int data = OS.g_list_nth_data (handle, 0);
+ GtkCTreeRow row = new GtkCTreeRow ();
+ OS.memmove (row, data, GtkCTreeRow.sizeof);
+ if (row.parent == 0) return null;
+ int ctree = parent.handle;
+ int index = OS.gtk_ctree_node_get_row_data (ctree, row.parent) - 1;
+ return parent.items [index];
+}
+
+void releaseChild () {
+ super.releaseChild ();
+ parent.destroyItem (this);
+}
+void releaseWidget () {
+ super.releaseWidget ();
+ parent = null;
+}
+/**
+ * Sets the checked state of the receiver.
+ * <p>
+ *
+ * @param checked the new checked state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setChecked (boolean checked) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if ((parent.style & SWT.CHECK) == 0) return;
+}
+
+/**
+ * Sets the grayed state of the receiver.
+ * <p>
+ *
+ * @param checked the new grayed state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setGrayed(boolean grayed) { // NOT_IMPLEMENTED
+}
+
+/**
+ * Sets the expanded state of the receiver.
+ * <p>
+ *
+ * @param expanded the new expanded state
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void setExpanded (boolean expanded) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ int treeHandle = parent.handle;
+ if (expanded) {
+ parent.ignoreExpand = true;
+ OS.gtk_ctree_expand (treeHandle, handle);
+ parent.ignoreExpand = false;
+ } else {
+ parent.ignoreCollapse = true;
+ OS.gtk_ctree_collapse (treeHandle, handle);
+ parent.ignoreCollapse = false;
+ }
+}
+public void setImage (Image image) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ super.setImage (image);
+ int pixmap = 0, mask = 0;
+ if (image != null) {
+ pixmap = image.pixmap;
+ mask = image.mask;
+ }
+ int ctree = parent.handle;
+ byte [] buffer = Converter.wcsToMbcs (null, text, true);
+ byte [] spacing = new byte [1];
+ boolean [] is_leaf = new boolean [1], expanded = new boolean [1];
+ OS.gtk_ctree_get_node_info (ctree, handle, null, spacing, null, null, null, null, is_leaf, expanded);
+ OS.gtk_ctree_set_node_info (ctree, handle, buffer, spacing [0], pixmap, mask, pixmap, mask, is_leaf [0], expanded [0]);
+}
+/**
+ * This label will be displayed to the right of the bitmap,
+ * or, if the receiver doesn't have a bitmap to the right of
+ * the horizontal hierarchy connector line.
+ */
+public void setText (String string) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
+ super.setText (string);
+ int ctree = parent.handle;
+ byte [] buffer = Converter.wcsToMbcs (null, string, true);
+ byte [] spacing = new byte [1];
+ boolean [] is_leaf = new boolean [1], expanded = new boolean [1];
+ int [] pixmap_closed = new int [1], mask_closed= new int [1], pixmap_opened= new int [1], mask_opened= new int [1];
+ OS.gtk_ctree_get_node_info (ctree, handle, null, spacing, pixmap_closed, mask_closed, pixmap_opened, mask_opened, is_leaf, expanded);
+ OS.gtk_ctree_set_node_info (ctree, handle, buffer, spacing [0], pixmap_closed [0], mask_closed [0], pixmap_opened [0], mask_opened [0], is_leaf [0], expanded [0]);
+}
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Trim.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Trim.java
new file mode 100644
index 0000000..8f37202
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Trim.java
@@ -0,0 +1,10 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+class Trim {
+ int top=0, bottom=0, left=0, right=0;
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/UtilFuncs.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/UtilFuncs.java
new file mode 100644
index 0000000..a956c28
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/UtilFuncs.java
@@ -0,0 +1,141 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.gtk.*;
+
+/**
+ * This class contains static helpers wrapping some common
+ * widget-inspecific operations like get the size of a gtk widget.
+ */
+class UtilFuncs {
+
+/*
+ * === GEOMETRY ===
+ */
+
+static Point getLocation (int handle) {
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return new Point (widget.alloc_x, widget.alloc_y);
+}
+
+static boolean setLocation(int parentHandle, int handle, int x, int y) {
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ boolean sameOrigin = (widget.alloc_x == x && widget.alloc_y == y);
+
+ // GtkFixed does not leave us alone.
+ // Instead, it maintains its own list of geometries for the children.
+ // Moreover, it will post a RESIZE on the queue that will cause
+ // disturbance to all our brother; to avoid that, we temporarily
+ // clear the VISIBLE flag, and do the synchronous update ourselves
+ GtkObject gtkChild = new GtkObject();
+ OS.memmove (gtkChild, handle, GtkObject.sizeof);
+ OS.GTK_WIDGET_UNSET_FLAGS(handle, OS.GTK_VISIBLE);
+ OS.gtk_fixed_move(parentHandle, handle, (short)x, (short)y );
+ OS.memmove(handle, gtkChild, GtkObject.sizeof);
+
+
+// OS.gtk_widget_set_uposition(handle, (short)x, (short)y);
+ /*
+ byte[] aux_info_id = org.eclipse.swt.internal.Converter.wcsToMbcs (null, "gtk-aux-info", true);
+ int aux_info_key_id = OS.g_quark_from_static_string(aux_info_id);
+ if (aux_info_key_id == 0) SWT.error(SWT.ERROR_UNSPECIFIED);
+ int aux_info = OS.gtk_object_get_data_by_id(handle, aux_info_key_id);
+ int[] xy = new int[1];
+ // ???
+ OS.memmove(aux_info, xy, 4);
+ */
+
+ // force allocation update NOW
+ GtkAllocation alloc = new GtkAllocation();
+ alloc.x = (short) x;
+ alloc.y = (short) y;
+ alloc.width = (short) widget.alloc_width;
+ alloc.height = (short) widget.alloc_height;
+ OS.memmove(handle, widget, GtkWidget.sizeof);
+ OS.gtk_widget_size_allocate(handle, alloc);
+
+ return (!sameOrigin);
+}
+
+static Point getSize (int handle) {
+ if (handle==0) {
+ SWT.error(SWT.ERROR_UNSPECIFIED);
+ }
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ return new Point (widget.alloc_width, widget.alloc_height);
+}
+
+
+static boolean setSize(int handle, int width, int height) {
+ if (handle==0) {
+ SWT.error(SWT.ERROR_UNSPECIFIED);
+ }
+
+ /* Feature in Gtk.
+ * Gtk will refuse to set the size of any widget to anything smaller than 3x3.
+ */
+ if (height <= 3) height = 3;
+ if (width <= 3) width = 3;
+
+ // first, see if we actually need to change anything
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ int alloc_width = widget.alloc_width & 0xFFFF;
+ int alloc_height = widget.alloc_height & 0xFFFF;
+ if (alloc_width == width && alloc_height == height) {
+ return false;
+ }
+
+ OS.gtk_widget_set_usize (handle, width, height);
+ // force child allocation update
+ GtkAllocation alloc = new GtkAllocation();
+ alloc.x = (short) widget.alloc_x;
+ alloc.y = (short) widget.alloc_y;
+ alloc.width = (short) width;
+ alloc.height = (short) height;
+ OS.gtk_widget_size_allocate(handle, alloc);
+ return true;
+}
+
+static void setZeroSize(int handle) {
+ // CHEATING. For some reason,
+ // the it will refuse to change its size to anything smaller
+ setSize(handle, 3,3);
+}
+
+static int getFont(int widget) {
+ int hStyle = OS.gtk_widget_get_style(widget);
+ GtkStyle style = new GtkStyle();
+ OS.memmove(style, hStyle, GtkStyle.sizeof);
+ return style.font;
+}
+
+static void setFont(int handle, int font) {
+ OS.gtk_widget_ensure_style(handle);
+ // We can't just get the widget's style and set
+ // its font, because the style slot may point to the
+ // default font; therefore we have to obtain a clone
+ // of the style
+ GtkWidget widget = new GtkWidget ();
+ OS.memmove (widget, handle, GtkWidget.sizeof);
+ int hStyle = OS.gtk_style_copy(widget.style);
+ GtkStyle style = new GtkStyle();
+ OS.memmove(style, hStyle, GtkStyle.sizeof);
+
+ OS.gdk_font_unref(style.font);
+ style.font = font;
+ OS.memmove (hStyle, style, GtkStyle.sizeof);
+ OS.gtk_widget_set_style (handle, hStyle);
+}
+
+}
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Widget.java
new file mode 100644
index 0000000..11d68ee
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Widget.java
@@ -0,0 +1,885 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.gtk.*;
+import org.eclipse.swt.events.*;
+
+/**
+ * This class is the abstract superclass of all user interface objects.
+ * Widgets are created, disposed and issue notification to listeners
+ * when events occur which affect them.
+ * <dl>
+ * <dt><b>Styles:</b></dt>
+ * <dd>(none)</dd>
+ * <dt><b>Events:</b></dt>
+ * <dd>Dispose</dd>
+ * </dl>
+ * <p>
+ * IMPORTANT: This class is intended to be subclassed <em>only</em>
+ * within the SWT implementation. However, it has not been marked
+ * final to allow those outside of the SWT development team to implement
+ * patched versions of the class in order to get around specific
+ * limitations in advance of when those limitations can be addressed
+ * by the team. Any class built using subclassing to access the internals
+ * of this class will likely fail to compile or run between releases and
+ * may be strongly platform specific. Subclassing should not be attempted
+ * without an intimate and detailed understanding of the workings of the
+ * hierarchy. No support is provided for user-written classes which are
+ * implemented as subclasses of this class.
+ * </p>
+ *
+ * @see #checkSubclass
+ */
+
+public abstract class Widget {
+
+ public int handle;
+ int style, state;
+ EventTable eventTable;
+ Object data;
+ String [] keys;
+ Object [] values;
+
+ /* Global state flags */
+// static final int AUTOMATIC = 0x00000001;
+// static final int ACTIVE = 0x00000002;
+// static final int AUTOGRAB = 0x00000004;
+// static final int MULTIEXPOSE = 0x00000008;
+// static final int RESIZEREDRAW = 0x00000010;
+// static final int WRAP = 0x00000020;
+// static final int DISABLED = 0x00000040;
+// static final int HIDDEN = 0x00000080;
+// static final int FOREGROUND = 0x00000100;
+// static final int BACKGROUND = 0x00000200;
+ static final int DISPOSED = 0x00000400;
+ static final int HANDLE = 0x00000800;
+
+ static final int DEFAULT_WIDTH = 64;
+ static final int DEFAULT_HEIGHT = 64;
+ static final char Mnemonic = '&';
+
+/**
+ * Prevents uninitialized instances from being created outside the package.
+ */
+Widget () {}
+
+/**
+ * Constructs a new instance of this class given its parent
+ * and a style value describing its behavior and appearance.
+ * <p>
+ * The style value is either one of the style constants defined in
+ * class <code>SWT</code> which is applicable to instances of this
+ * class, or must be built by <em>bitwise OR</em>'ing together
+ * (that is, using the <code>int</code> "|" operator) two or more
+ * of those <code>SWT</code> style constants. The class description
+ * for all SWT widget classes should include a comment which
+ * describes the style constants which are applicable to the class.
+ * </p>
+ *
+ * @param parent a widget which will be the parent of the new instance (cannot be null)
+ * @param style the style of widget to construct
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
+ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
+ * </ul>
+ *
+ * @see SWT
+ * @see #checkSubclass
+ * @see #getStyle
+ */
+public Widget (Widget parent, int style) {
+ if (parent == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (!parent.isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ this.style = style;
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notifed when an event of the given type occurs. When the
+ * event does occur in the widget, the listener is notified by
+ * sending it the <code>handleEvent()</code> message.
+ *
+ * @param eventType the type of event to listen for
+ * @param listener the listener which should be notified when the event occurs
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Listener
+ * @see #removeListener
+ */
+public void addListener (int eventType, Listener handler) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) eventTable = new EventTable ();
+ eventTable.hook (eventType, handler);
+}
+/**
+ * Adds the listener to the collection of listeners who will
+ * be notifed when the widget is disposed. When the widget is
+ * disposed, the listener is notified by sending it the
+ * <code>widgetDisposed()</code> message.
+ *
+ * @param listener the listener which should be notified when the receiver is disposed
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see DisposeListener
+ * @see #removeDisposeListener
+ */
+public void addDisposeListener (DisposeListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener (listener);
+ addListener (SWT.Dispose, typedListener);
+}
+static int checkBits (int style, int int0, int int1, int int2, int int3, int int4, int int5) {
+ int mask = int0 | int1 | int2 | int3 | int4 | int5;
+ if ((style & mask) == 0) style |= int0;
+ if ((style & int0) != 0) style = (style & ~mask) | int0;
+ if ((style & int1) != 0) style = (style & ~mask) | int1;
+ if ((style & int2) != 0) style = (style & ~mask) | int2;
+ if ((style & int3) != 0) style = (style & ~mask) | int3;
+ if ((style & int4) != 0) style = (style & ~mask) | int4;
+ if ((style & int5) != 0) style = (style & ~mask) | int5;
+ return style;
+}
+/**
+ * Throws an <code>SWTException</code> if the receiver can not
+ * be accessed by the caller. This may include both checks on
+ * the state of the receiver and more generally on the entire
+ * execution context. This method <em>should</em> be called by
+ * widget implementors to enforce the standard SWT invariants.
+ * <p>
+ * Currently, it is an error to invoke any method (other than
+ * <code>isDisposed()</code>) on a widget that has had its
+ * <code>dispose()</code> method called. It is also an error
+ * to call widget methods from any thread that is different
+ * from the thread that created the widget.
+ * </p><p>
+ * In future releases of SWT, there may be more or fewer error
+ * checks and exceptions may be thrown for different reasons.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+protected void checkWidget () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+}
+
+/*
+ * HANDLE CODE
+ *
+ * HANDLE CODE 1: HANDLE CREATION CODE - The createWidget() cycle.
+ */
+
+void createWidget (int index) {
+ createHandle (index);
+ hookEvents ();
+ configure ();
+ setHandleStyle ();
+ register ();
+ setInitialSize ();
+ showHandle ();
+}
+
+void register () {
+ if (handle == 0) return;
+ if ((state & HANDLE) != 0) WidgetTable.put (handle, this);
+}
+
+void createHandle (int index) {}
+void configure () {}
+void setHandleStyle () {}
+void setInitialSize () {}
+void hookEvents () {}
+void showHandle () {}
+int paintHandle () { return 0; }
+
+/* HANDLE CODE 3:
+ * Handle Destruction
+ */
+
+void deregister () {
+ if (handle == 0) return;
+ if ((state & HANDLE) != 0) WidgetTable.remove (handle);
+}
+void destroyWidget () {
+ int topHandle = topHandle ();
+ releaseHandle ();
+ if (topHandle != 0 && (state & HANDLE) != 0) {
+ OS.gtk_widget_destroy (topHandle);
+ }
+}
+/**
+ * Disposes of the operating system resources associated with
+ * the receiver and all its descendents. After this method has
+ * been invoked, the receiver and all descendents will answer
+ * <code>true</code> when sent the message <code>isDisposed()</code>.
+ * Any internal connections between the widgets in the tree will
+ * have been removed to facilitate garbage collection.
+ * <p>
+ * NOTE: This method is not called recursively on the descendents
+ * of the receiver. This means that, widget implementers can not
+ * detect when a widget is being disposed of by re-implementing
+ * this method, but should instead listen for the <code>Dispose</code>
+ * event.
+ * </p>
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #addDisposeListener
+ * @see #removeDisposeListener
+ * @see #checkWidget
+ */
+public void dispose () {
+ /*
+ * Note: It is valid to attempt to dispose a widget
+ * more than once. If this happens, fail silently.
+ */
+ if (isDisposed()) return;
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ releaseChild ();
+ releaseWidget ();
+ destroyWidget ();
+}
+
+void error (int code) {
+ throw new SWTError (code);
+}
+
+
+
+/**
+ * Returns the application defined widget data associated
+ * with the receiver, or null if it has not been set. The
+ * <em>widget data</em> is a single, unnamed field that is
+ * stored with every widget.
+ * <p>
+ * Applications may put arbitrary objects in this field. If
+ * the object stored in the widget data needs to be notified
+ * when the widget is disposed of, it is the application's
+ * responsibility to hook the Dispose event on the widget and
+ * do so.
+ * </p>
+ *
+ * @return the widget data
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - when the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
+ * </ul>
+ *
+ * @see #setData
+ */
+public Object getData () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return data;
+}
+/**
+ * Returns the application defined property of the receiver
+ * with the specified name, or null if it has not been set.
+ * <p>
+ * Applications may have associated arbitrary objects with the
+ * receiver in this fashion. If the objects stored in the
+ * properties need to be notified when the widget is disposed
+ * of, it is the application's responsibility to hook the
+ * Dispose event on the widget and do so.
+ * </p>
+ *
+ * @param key the name of the property
+ * @return the value of the property or null if it has not been set
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #setData
+ */
+public Object getData (String key) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (keys == null) return null;
+ for (int i=0; i<keys.length; i++) {
+ if (keys [i].equals (key)) return values [i];
+ }
+ return null;
+}
+/**
+ * Returns the <code>Display</code> that is associated with
+ * the receiver.
+ * <p>
+ * A widget's display is either provided when it is created
+ * (for example, top level <code>Shell</code>s) or is the
+ * same as its parent's display.
+ * </p>
+ *
+ * @return the receiver's display
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public abstract Display getDisplay ();
+String getName () {
+// String string = getClass ().getName ();
+// int index = string.lastIndexOf ('.');
+// if (index == -1) return string;
+ String string = getClass ().getName ();
+ int index = string.length ();
+ while ((--index > 0) && (string.charAt (index) != '.'));
+ return string.substring (index + 1, string.length ());
+}
+String getNameText () {
+ return "";
+}
+/**
+ * Returns the receiver's style information.
+ * <p>
+ * Note that the value which is returned by this method <em>may
+ * not match</em> the value which was provided to the constructor
+ * when the receiver was created. This can occur when the underlying
+ * operating system does not support a particular combination of
+ * requested styles. For example, if the platform widget used to
+ * implement a particular SWT widget always has scroll bars, the
+ * result of calling this method would always have the
+ * <code>SWT.H_SCROLL</code> and <code>SWT.V_SCROLL</code> bits set.
+ * </p>
+ *
+ * @return the style bits
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public int getStyle () {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return style;
+}
+
+/**
+ * Returns <code>true</code> if the widget has been disposed,
+ * and <code>false</code> otherwise.
+ * <p>
+ * This method gets the dispose state for the widget.
+ * When a widget has been disposed, it is an error to
+ * invoke any other method using the widget.
+ * </p>
+ *
+ * @return <code>true</code> when the widget is disposed and <code>false</code> otherwise
+ */
+public boolean isDisposed () {
+ if (handle != 0) return false;
+ if ((state & HANDLE) != 0) return true;
+ return (state & DISPOSED) != 0;
+}
+
+/**
+ * Returns <code>true</code> if there are any listeners
+ * for the specified event type associated with the receiver,
+ * and <code>false</code> otherwise.
+ *
+ * @param eventType the type of event
+ * @return true if the event is hooked
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+protected boolean isListening (int eventType) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ return hooks (eventType);
+}
+
+
+/*
+ * Returns <code>true</code> if the specified eventType is
+ * hooked, and <code>false</code> otherwise. Implementations
+ * of SWT can avoid creating objects and sending events
+ * when an event happens in the operating system but
+ * there are no listeners hooked for the event.
+ *
+ * @param eventType the event to be checked
+ *
+ * @return <code>true</code> when the eventType is hooked and <code>false</code> otherwise
+ *
+ * @see #isListening
+ */
+boolean hooks (int eventType) {
+ if (eventTable == null) return false;
+ return eventTable.hooks (eventType);
+}
+
+boolean isValidThread () {
+ return getDisplay ().isValidThread ();
+}
+public boolean isValidWidget () {
+ if (handle != 0) return true;
+ if ((state & HANDLE) != 0) return false;
+ return (state & DISPOSED) == 0;
+}
+
+boolean isValidSubclass() {
+ return Display.isValidClass(getClass());
+}
+
+char mbcsToWcs (char ch) {
+ int key = ch & 0xFFFF;
+ if (key <= 0x7F) return ch;
+ byte [] buffer;
+ if (key <= 0xFF) {
+ buffer = new byte [1];
+ buffer [0] = (byte) key;
+ } else {
+ buffer = new byte [2];
+ buffer [0] = (byte) ((key >> 8) & 0xFF);
+ buffer [1] = (byte) (key & 0xFF);
+ }
+ char [] result = Converter.mbcsToWcs (null, buffer);
+ if (result.length == 0) return 0;
+ return result [0];
+}
+/**
+ * Notifies all of the receiver's listeners for events
+ * of the given type that one such event has occurred by
+ * invoking their <code>handleEvent()</code> method.
+ *
+ * @param eventType the type of event which has occurred
+ * @param event the event data
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the event is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ */
+public void notifyListeners (int eventType, Event event) {
+ checkWidget();
+ if (event == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ event.type = eventType;
+ event.widget = this;
+ eventTable.sendEvent (event);
+}
+void postEvent (int eventType) {
+ if (eventTable == null) return;
+ postEvent (eventType, new Event ());
+}
+void postEvent (int eventType, Event event) {
+ if (eventTable == null) return;
+ event.type = eventType;
+ event.widget = this;
+ getDisplay ().postEvent (event);
+}
+
+int processEvent (int eventNumber, int int0, int int1, int int2) {
+ switch (eventNumber) {
+ case SWT.Arm: return processArm (int0, int1, int2);
+ case SWT.Collapse: return processCollapse (int0, int1, int2);
+ case SWT.Expand: return processExpand (int0, int1, int2);
+ case SWT.Dispose: return processDispose (int0, int1, int2);
+ case SWT.DefaultSelection: return processDoubleSelection (int0, int1, int2);
+ case SWT.FocusIn: return processFocusIn (int0, int1, int2);
+ case SWT.FocusOut: return processFocusOut (int0, int1, int2);
+ case SWT.Help: return processHelp (int0, int1, int2);
+ case SWT.Hide: return processHide (int0, int1, int2);
+ case SWT.KeyDown: return processKeyDown (int0, int1, int2);
+ case SWT.KeyUp: return processKeyUp (int0, int1, int2);
+ case SWT.Iconify: return processIconify (int0, int1, int2);
+ case SWT.Deiconify: return processDeiconify (int0, int1, int2);
+ case SWT.Modify: return processModify (int0, int1, int2);
+ case SWT.MouseDown: return processMouseDown (int0, int1, int2);
+ case SWT.MouseEnter: return processMouseEnter (int0, int1, int2);
+ case SWT.MouseExit: return processMouseExit (int0, int1, int2);
+ case SWT.MouseHover: return processMouseHover (int0, int1, int2);
+ case SWT.MouseMove: return processMouseMove (int0, int1, int2);
+ case SWT.MouseUp: return processMouseUp (int0, int1, int2);
+ case SWT.Paint: return processPaint (int0, int1, int2);
+ case SWT.Resize: return processResize (int0, int1, int2);
+ case SWT.Show: return processShow (int0, int1, int2);
+ case SWT.Selection: return processSelection (int0, int1, int2);
+ case SWT.Verify: return processVerify (int0, int1, int2);
+ }
+ return 0;
+}
+
+int processArm (int int0, int int1, int int2) {
+ return 0;
+}
+
+/*
+ * Item expand/collapse in a tree.
+ */
+int processCollapse (int int0, int int1, int int2) {
+ return 1; // stop emission
+}
+int processExpand (int int0, int int1, int int2) {
+ return 1; // stop emission
+}
+
+/*
+ * Close a Shell, triggered by delete_event
+ */
+int processDispose (int arg0, int arg1, int int2) {
+ return 1;
+}
+
+/*
+ * The WM has Iconified/Deiconified a Shell.
+ * The Gtk event is map_event/unmap_event
+ */
+int processIconify (int int0, int int1, int int2) {
+ return 0;
+}
+int processDeiconify (int int0, int int1, int int2) {
+ return 0;
+}
+
+int processHelp (int int0, int int1, int int2) {
+ return 0;
+}
+int processHide (int int0, int int1, int int2) {
+ return 0;
+}
+int processFocusIn(int int0, int int1, int int2) {
+ return 0;
+}
+int processFocusOut(int int0, int int1, int int2) {
+ return 0;
+}
+int processKeyDown (int arg0, int arg1, int int2) {
+ return 0;
+}
+int processKeyUp (int arg0, int arg1, int int2) {
+ return 0;
+}
+int processModify (int arg0, int arg1, int int2) {
+ return 0;
+}
+int processMouseDown (int arg0, int arg1, int int2) {
+ return 0;
+}
+int processMouseEnter (int arg0, int arg1, int int2) {
+ return 0;
+}
+int processMouseExit (int arg0, int arg1, int int2) {
+ /* Do nothing */
+ return 0;
+}
+int processMouseHover (int arg0, int arg1, int int2) {
+ /* Do nothing */
+ return 0;
+}
+int processMouseMove (int arg0, int arg1, int int2) {
+ /* Do nothing */
+ /* Even though we do nothing, we still need to at least
+ * motify the X Server we are ready to process more events.
+ * However, only OS controls can receive this event.
+ */
+ return 0;
+}
+
+int processMouseUp (int arg0, int arg1, int int2) {
+ return 0;
+}
+int processPaint (int int0, int int1, int int2) {
+ return 0;
+}
+int processResize (int int0, int int1, int int2) {
+ return 0;
+}
+int processSelection (int int0, int int1, int int2) {
+ return 0;
+}
+int processShow (int int0, int int1, int int2) {
+ return 0;
+}
+int processDoubleSelection (int int0, int int1, int int2) {
+ return 0;
+}
+int processVerify (int int0, int int1, int int2) {
+ sendEvent (SWT.Verify);
+ return 0;
+}
+
+void signal_connect (int handle, String eventName, int swtEvent, int numArgs) {
+ byte [] buffer = Converter.wcsToMbcs (null, eventName, true);
+ int proc=0;
+ switch (numArgs) {
+ case 2: proc=getDisplay().windowProc2; break;
+ case 3: proc=getDisplay().windowProc3; break;
+ case 4: proc=getDisplay().windowProc4; break;
+ case 5: proc=getDisplay().windowProc5; break;
+ default: error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ OS.gtk_signal_connect (handle, buffer, proc, swtEvent);
+}
+void signal_connect_after (int handle, String eventName, int swtEvent, int numArgs) {
+ byte [] buffer = Converter.wcsToMbcs (null, eventName, true);
+ int proc=0;
+ switch (numArgs) {
+ case 2: proc=getDisplay().windowProc2; break;
+ case 3: proc=getDisplay().windowProc3; break;
+ case 4: proc=getDisplay().windowProc4; break;
+ case 5: proc=getDisplay().windowProc5; break;
+ default: error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ OS.gtk_signal_connect_after (handle, buffer, proc, swtEvent);
+}
+
+void releaseChild () {
+ /* Do nothing */
+}
+void releaseHandle () {
+ handle = 0;
+ state |= DISPOSED;
+}
+void releaseWidget () {
+ sendEvent (SWT.Dispose);
+ deregister ();
+ eventTable = null;
+ data = null;
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notifed when an event of the given type occurs.
+ *
+ * @param eventType the type of event to listen for
+ * @param listener the listener which should no longer be notified when the event occurs
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see Listener
+ * @see #addListener
+ */
+public void removeListener (int eventType, Listener handler) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (eventType, handler);
+}
+/**
+* Warning: API under construction.
+*/
+protected void removeListener (int eventType, SWTEventListener handler) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (handler == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (eventType, handler);
+}
+/**
+ * Removes the listener from the collection of listeners who will
+ * be notifed when the widget is disposed.
+ *
+ * @param listener the listener which should no longer be notified when the receiver is disposed
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see DisposeListener
+ * @see #removeDisposeListener
+ */
+public void removeDisposeListener (DisposeListener listener) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable == null) return;
+ eventTable.unhook (SWT.Dispose, listener);
+}
+void sendEvent (int eventType) {
+ if (eventTable == null) return;
+ sendEvent (eventType, new Event ());
+}
+void sendEvent (int eventType, Event event) {
+ if (eventTable == null) return;
+ event.widget = this;
+ event.type = eventType;
+ eventTable.sendEvent (event);
+}
+/**
+ * Sets the application defined widget data associated
+ * with the receiver to be the argument. The <em>widget
+ * data</em> is a single, unnamed field that is stored
+ * with every widget.
+ * <p>
+ * Applications may put arbitrary objects in this field. If
+ * the object stored in the widget data needs to be notified
+ * when the widget is disposed of, it is the application's
+ * responsibility to hook the Dispose event on the widget and
+ * do so.
+ * </p>
+ *
+ * @param data the widget data
+ *
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - when the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
+ * </ul>
+ */
+public void setData (Object data) {
+ checkWidget();
+ this.data = data;
+}
+/**
+ * Sets the application defined property of the receiver
+ * with the specified name to the given value.
+ * <p>
+ * Applications may associate arbitrary objects with the
+ * receiver in this fashion. If the objects stored in the
+ * properties need to be notified when the widget is disposed
+ * of, it is the application's responsibility to hook the
+ * Dispose event on the widget and do so.
+ * </p>
+ *
+ * @param key the name of the property
+ * @param value the new value for the property
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
+ * </ul>
+ * @exception SWTException <ul>
+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
+ * </ul>
+ *
+ * @see #getData
+ */
+public void setData (String key, Object value) {
+ if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
+
+ /* Remove the key/value pair */
+ if (value == null) {
+ if (keys == null) return;
+ int index = 0;
+ while (index < keys.length && !keys [index].equals (key)) index++;
+ if (index == keys.length) return;
+ if (keys.length == 1) {
+ keys = null;
+ values = null;
+ } else {
+ String [] newKeys = new String [keys.length - 1];
+ Object [] newValues = new Object [values.length - 1];
+ System.arraycopy (keys, 0, newKeys, 0, index);
+ System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index);
+ System.arraycopy (values, 0, newValues, 0, index);
+ System.arraycopy (values, index + 1, newValues, index, newValues.length - index);
+ keys = newKeys;
+ values = newValues;
+ }
+ return;
+ }
+
+ /* Add the key/value pair */
+ if (keys == null) {
+ keys = new String [] {key};
+ values = new Object [] {value};
+ return;
+ }
+ for (int i=0; i<keys.length; i++) {
+ if (keys [i].equals (key)) {
+ values [i] = value;
+ return;
+ }
+ }
+ String [] newKeys = new String [keys.length + 1];
+ Object [] newValues = new Object [values.length + 1];
+ System.arraycopy (keys, 0, newKeys, 0, keys.length);
+ System.arraycopy (values, 0, newValues, 0, values.length);
+ newKeys [keys.length] = key;
+ newValues [values.length] = value;
+ keys = newKeys;
+ values = newValues;
+}
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the receiver
+ */
+public String toString () {
+ String string = "*Disposed*";
+ if (!isDisposed ()) {
+ string = "*Wrong Thread*";
+ if (isValidThread ()) string = getNameText ();
+ }
+ return getName () + " {" + string + "}";
+}
+int topHandle () {
+ return handle;
+}
+char wcsToMbcs (char ch) {
+ int key = ch & 0xFFFF;
+ if (key <= 0x7F) return ch;
+ byte [] buffer = Converter.wcsToMbcs (null, new char [] {ch}, false);
+ if (buffer.length == 1) return (char) buffer [0];
+ if (buffer.length == 2) {
+ return (char) (((buffer [0] & 0xFF) << 8) | (buffer [1] & 0xFF));
+ }
+ return 0;
+}
+
+byte[] string2bytesConvertMnemonic(String string) {
+ //FIXME need to double _'s
+ char [] t = new char [string.length ()];
+ string.getChars (0, t.length, t, 0);
+ for (int i=0; i<t.length; i++) {if (t [i] == '&') t [i] = '_';}
+ return Converter.wcsToMbcs (null, t, true);
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/WidgetTable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/WidgetTable.java
new file mode 100644
index 0000000..df50651
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/WidgetTable.java
@@ -0,0 +1,89 @@
+package org.eclipse.swt.widgets;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved
+ */
+
+import org.eclipse.swt.internal.gtk.*;
+
+class WidgetTable {
+ static int FreeSlot = 0;
+ static int GrowSize = 1024;
+ static int [] IndexTable = new int [GrowSize];
+ static Widget [] WidgetTable = new Widget [GrowSize];
+ static {
+ for (int i=0; i<GrowSize-1; i++) IndexTable [i] = i + 1;
+ IndexTable [GrowSize - 1] = -1;
+ }
+
+public static synchronized Widget get (int handle) {
+ if (handle == 0) return null;
+ int index = OS.gtk_object_get_user_data (handle) - 1;
+ if (0 <= index && index < WidgetTable.length) return WidgetTable [index];
+ return null;
+}
+
+public synchronized static void put(int handle, Widget widget) {
+ if (handle == 0) return;
+ if (FreeSlot == -1) {
+ int length = (FreeSlot = IndexTable.length) + GrowSize;
+ int[] newIndexTable = new int[length];
+ Widget[] newWidgetTable = new Widget [length];
+ System.arraycopy (IndexTable, 0, newIndexTable, 0, FreeSlot);
+ System.arraycopy (WidgetTable, 0, newWidgetTable, 0, FreeSlot);
+ for (int i = FreeSlot; i < length - 1; i++) {
+ newIndexTable[i] = i + 1;
+ }
+ newIndexTable[length - 1] = -1;
+ IndexTable = newIndexTable;
+ WidgetTable = newWidgetTable;
+ }
+ int index = FreeSlot + 1;
+ OS.gtk_object_set_user_data (handle, index);
+ int oldSlot = FreeSlot;
+ FreeSlot = IndexTable[oldSlot];
+ IndexTable [oldSlot] = -2;
+ WidgetTable [oldSlot] = widget;
+}
+
+public static synchronized Widget remove (int handle) {
+ if (handle == 0) return null;
+ Widget widget = null;
+ int index = OS.gtk_object_get_user_data (handle) - 1;
+ if (0 <= index && index < WidgetTable.length) {
+ widget = WidgetTable [index];
+ WidgetTable [index] = null;
+ IndexTable [index] = FreeSlot;
+ FreeSlot = index;
+ OS.gtk_object_set_user_data (handle, 0);
+ }
+ return widget;
+}
+
+public static synchronized Shell [] shells () {
+ int length = 0;
+ for (int i=0; i<WidgetTable.length; i++) {
+ Widget widget = WidgetTable [i];
+ if (widget != null && widget instanceof Shell) length++;
+ }
+ int index = 0;
+ Shell [] result = new Shell [length];
+ for (int i=0; i<WidgetTable.length; i++) {
+ Widget widget = WidgetTable [i];
+ if (widget != null && widget instanceof Shell) {
+ result [index++] = (Shell) widget;
+ }
+ }
+ return result;
+}
+
+public static synchronized int size () {
+ int size = 0;
+ for (int i=0; i<WidgetTable.length; i++) {
+ if (WidgetTable [i] != null) size++;
+ }
+ return size;
+}
+
+}
diff --git a/bundles/org.eclipse.swt/about.html b/bundles/org.eclipse.swt/about.html
index 9a15e5c..cdf699c 100644
--- a/bundles/org.eclipse.swt/about.html
+++ b/bundles/org.eclipse.swt/about.html
@@ -21,10 +21,14 @@
</tr>
<tr>
<td>
-<p>1st November, 2001</p>
+<p>4th December, 2001</p>
<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in. The plug-in is provided to you under the terms and conditions of the
+<p>Eclipse.org makes available all content in this plug-in. Unless otherwise indicated below, the plug-in is provided to you under the terms and conditions of the
<a href="http://www.eclipse.org/legal/cpl-v05.html">Common Public License Version 0.5</a>. For purposes of the Common Public License, "Program" will mean the plug-in.</p>
+
+Sub-directories in this plug-in may contain portions distributed under different license agreements and/or notices. Details about these license agreements and notices are
+contained in "about.html" files ("Abouts") located in sub-directories in this plug-in. Such Abouts govern your use of the associated software in that directory, not the
+Common Public License.
</td></tr></table>
</body>
</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.swt/custom.xml b/bundles/org.eclipse.swt/custom.xml
index e0f0f27..ecb557d 100644
--- a/bundles/org.eclipse.swt/custom.xml
+++ b/bundles/org.eclipse.swt/custom.xml
@@ -53,6 +53,26 @@
<delete dir="${base}"/>
</target>
+ <target name="ws/gtk/swt-pi.jar" depends="init">
+ <ant antfile="${template}" target="jar">
+ <property name="mapping" value="Eclipse SWT PI/gtk/,Eclipse SWT PI/common_j2se/"/>
+ <property name="includes" value="Eclipse SWT PI/gtk/,Eclipse SWT PI/common_j2se/"/>
+ <property name="excludes" value="Eclipse SWT PI/gtk/library/"/>
+ <property name="dest" value="${basedir}/ws/gtk/swt-pi.jar"/>
+ <property name="compilePath" value=""/>
+ </ant>
+ </target>
+
+ <target name="ws/gtk/swt.jar" depends="init">
+ <ant antfile="${template}" target="jar">
+ <property name="mapping" value="Eclipse SWT/gtk/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/gtk/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/gtk/,Eclipse SWT Printing/common/,Eclipse SWT Program/gtk/,Eclipse SWT Program/common/,${emulatedswt}/widgets/CoolBar.java,${emulatedswt}/widgets/CoolItem.java,${emulatedswt}/internal/BidiUtil.java"/>
+ <property name="includes" value="Eclipse SWT/gtk/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/gtk/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/gtk/,Eclipse SWT Printing/common/,Eclipse SWT Program/gtk/,Eclipse SWT Program/common/,${emulatedswt}/widgets/CoolBar.java,${emulatedswt}/widgets/CoolItem.java,${emulatedswt}/internal/BidiUtil.java"/>
+ <property name="excludes" value="Eclipse SWT/common/library/"/>
+ <property name="dest" value="${basedir}/ws/gtk/swt.jar"/>
+ <property name="compilePath" value="ws/gtk/swt-pi.jar"/>
+ </ant>
+ </target>
+
<target name="ws/motif/swt.jar" depends="init">
<ant antfile="${template}" target="jar">
<property name="mapping" value="Eclipse SWT/motif/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/motif/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/motif/,Eclipse SWT Printing/common/,Eclipse SWT Program/motif/,Eclipse SWT Program/common/,Eclipse SWT/emulated/,Eclipse SWT PI/motif/,Eclipse SWT PI/common_j2se/"/>
@@ -83,14 +103,34 @@
</ant>
</target>
- <target name="jar" depends="init,ws/motif/swt.jar,ws/photon/swt.jar,ws/win32/swt.jar">
+ <target name="jar" depends="init,ws/gtk/swt-pi.jar,ws/gtk/swt.jar,ws/motif/swt.jar,ws/photon/swt.jar,ws/win32/swt.jar">
+ </target>
+
+ <target name="ws/gtk/swt-pisrc.zip" depends="init">
+ <property name="destroot" value="${basedir}"/>
+ <ant antfile="${template}" target="src">
+ <property name="mapping" value="Eclipse SWT PI/gtk/,Eclipse SWT PI/common_j2se/,Eclipse SWT PI/gtk/"/>
+ <property name="includes" value="Eclipse SWT PI/gtk/**/*.java,Eclipse SWT PI/common_j2se/**/*.java,Eclipse SWT PI/gtk/library/"/>
+ <property name="excludes" value=""/>
+ <property name="dest" value="${destroot}/ws/gtk/swt-pisrc.zip"/>
+ </ant>
+ </target>
+
+ <target name="ws/gtk/swtsrc.zip" depends="init">
+ <property name="destroot" value="${basedir}"/>
+ <ant antfile="${template}" target="src">
+ <property name="mapping" value="Eclipse SWT/gtk/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/gtk/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/gtk/,Eclipse SWT Printing/common/,Eclipse SWT Program/gtk/,Eclipse SWT Program/common/,Eclipse SWT/emulated/,Eclipse SWT/emulated/,Eclipse SWT/emulated/,Eclipse SWT/common/"/>
+ <property name="includes" value="Eclipse SWT/gtk/**/*.java,Eclipse SWT/common/**/*.java,Eclipse SWT/common_j2se/**/*.java,Eclipse SWT Custom Widgets/common/**/*.java,Eclipse SWT Drag and Drop/gtk/**/*.java,Eclipse SWT Drag and Drop/common/**/*.java,Eclipse SWT Printing/gtk/**/*.java,Eclipse SWT Printing/common/**/*.java,Eclipse SWT Program/gtk/**/*.java,Eclipse SWT Program/common/**/*.java,Eclipse SWT/emulated/**/CoolBar.java,Eclipse SWT/emulated/**/CoolItem.java,Eclipse SWT/emulated/**/BidiUtil.java,Eclipse SWT/common/library/"/>
+ <property name="excludes" value=""/>
+ <property name="dest" value="${destroot}/ws/gtk/swtsrc.zip"/>
+ </ant>
</target>
<target name="ws/motif/swtsrc.zip" depends="init">
<property name="destroot" value="${basedir}"/>
<ant antfile="${template}" target="src">
- <property name="mapping" value="Eclipse SWT/motif/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/motif/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/motif/,Eclipse SWT Printing/common/,Eclipse SWT Program/motif/,Eclipse SWT Program/common/,Eclipse SWT/emulated/,Eclipse SWT PI/motif/,Eclipse SWT PI/common_j2se/"/>
- <property name="includes" value="Eclipse SWT/motif/**/*.java,Eclipse SWT/common/**/*.java,Eclipse SWT/common_j2se/**/*.java,Eclipse SWT Custom Widgets/common/**/*.java,Eclipse SWT Drag and Drop/motif/**/*.java,Eclipse SWT Drag and Drop/common/**/*.java,Eclipse SWT Printing/motif/**/*.java,Eclipse SWT Printing/common/**/*.java,Eclipse SWT Program/motif/**/*.java,Eclipse SWT Program/common/**/*.java,Eclipse SWT/emulated/**/*.java,Eclipse SWT PI/motif/**/*.java,Eclipse SWT PI/common_j2se/**/*.java"/>
+ <property name="mapping" value="Eclipse SWT/motif/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/motif/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/motif/,Eclipse SWT Printing/common/,Eclipse SWT Program/motif/,Eclipse SWT Program/common/,Eclipse SWT/emulated/,Eclipse SWT PI/motif/,Eclipse SWT PI/common_j2se/,Eclipse SWT/common/,Eclipse SWT PI/motif/"/>
+ <property name="includes" value="Eclipse SWT/motif/**/*.java,Eclipse SWT/common/**/*.java,Eclipse SWT/common_j2se/**/*.java,Eclipse SWT Custom Widgets/common/**/*.java,Eclipse SWT Drag and Drop/motif/**/*.java,Eclipse SWT Drag and Drop/common/**/*.java,Eclipse SWT Printing/motif/**/*.java,Eclipse SWT Printing/common/**/*.java,Eclipse SWT Program/motif/**/*.java,Eclipse SWT Program/common/**/*.java,Eclipse SWT/emulated/**/*.java,Eclipse SWT PI/motif/**/*.java,Eclipse SWT PI/common_j2se/**/*.java,Eclipse SWT/common/library/,Eclipse SWT PI/motif/library/"/>
<property name="excludes" value=""/>
<property name="dest" value="${destroot}/ws/motif/swtsrc.zip"/>
</ant>
@@ -99,8 +139,8 @@
<target name="ws/photon/swtsrc.zip" depends="init">
<property name="destroot" value="${basedir}"/>
<ant antfile="${template}" target="src">
- <property name="mapping" value="Eclipse SWT/photon/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/photon/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/photon/,Eclipse SWT Printing/common/,Eclipse SWT Program/photon/,Eclipse SWT Program/common/,Eclipse SWT/emulated,Eclipse SWT PI/photon/,Eclipse SWT PI/common_j2se/"/>
- <property name="includes" value="Eclipse SWT/photon/**/*.java,Eclipse SWT/common/**/*.java,Eclipse SWT/common_j2se/**/*.java,Eclipse SWT Custom Widgets/common/**/*.java,Eclipse SWT Drag and Drop/photon/**/*.java,Eclipse SWT Drag and Drop/common/**/*.java,Eclipse SWT Printing/photon/**/*.java,Eclipse SWT Printing/common/**/*.java,Eclipse SWT Program/photon/**/*.java,Eclipse SWT Program/common/**/*.java,Eclipse SWT/emulated/**/*.java,Eclipse SWT PI/photon/**/*.java,Eclipse SWT PI/common_j2se/**/*.java"/>
+ <property name="mapping" value="Eclipse SWT/photon/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/photon/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Printing/photon/,Eclipse SWT Printing/common/,Eclipse SWT Program/photon/,Eclipse SWT Program/common/,Eclipse SWT/emulated,Eclipse SWT PI/photon/,Eclipse SWT PI/common_j2se/,Eclipse SWT/common/,Eclipse SWT PI/photon/"/>
+ <property name="includes" value="Eclipse SWT/photon/**/*.java,Eclipse SWT/common/**/*.java,Eclipse SWT/common_j2se/**/*.java,Eclipse SWT Custom Widgets/common/**/*.java,Eclipse SWT Drag and Drop/photon/**/*.java,Eclipse SWT Drag and Drop/common/**/*.java,Eclipse SWT Printing/photon/**/*.java,Eclipse SWT Printing/common/**/*.java,Eclipse SWT Program/photon/**/*.java,Eclipse SWT Program/common/**/*.java,Eclipse SWT/emulated/**/*.java,Eclipse SWT PI/photon/**/*.java,Eclipse SWT PI/common_j2se/**/*.java,Eclipse SWT/common/library/,Eclipse SWT PI/photon/library/"/>
<property name="excludes" value="${emulatedswt}/widgets/TabFolder.java,${emulatedswt}/widgets/TabItem.java"/>
<property name="dest" value="${destroot}/ws/photon/swtsrc.zip"/>
</ant>
@@ -109,21 +149,21 @@
<target name="ws/win32/swtsrc.zip" depends="init">
<property name="destroot" value="${basedir}"/>
<ant antfile="${template}" target="src">
- <property name="mapping" value="Eclipse SWT/win32/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT AWT/win32/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/win32/,Eclipse SWT Drag and Drop/common/,Eclipse SWT OLE Win32/win32/,Eclipse SWT Printing/win32/,Eclipse SWT Printing/common/,Eclipse SWT Program/win32/,Eclipse SWT Program/common/,Eclipse SWT PI/win32/,Eclipse SWT PI/common_j2se/"/>
- <property name="includes" value="Eclipse SWT/win32/**/*.java,Eclipse SWT/common/**/*.java,Eclipse SWT/common_j2se/**/*.java,Eclipse SWT AWT/win32/**/*.java,Eclipse SWT Custom Widgets/common/**/*.java,Eclipse SWT Drag and Drop/win32/**/*.java,Eclipse SWT Drag and Drop/common/**/*.java,Eclipse SWT OLE Win32/win32/**/*.java,Eclipse SWT Printing/win32/**/*.java,Eclipse SWT Printing/common/**/*.java,Eclipse SWT Program/win32/**/*.java,Eclipse SWT Program/common/**/*.java,Eclipse SWT PI/win32/**/*.java,Eclipse SWT PI/common_j2sse/**/*.java"/>
+ <property name="mapping" value="Eclipse SWT/win32/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT AWT/win32/,Eclipse SWT Custom Widgets/common/,Eclipse SWT Drag and Drop/win32/,Eclipse SWT Drag and Drop/common/,Eclipse SWT OLE Win32/win32/,Eclipse SWT Printing/win32/,Eclipse SWT Printing/common/,Eclipse SWT Program/win32/,Eclipse SWT Program/common/,Eclipse SWT PI/win32/,Eclipse SWT PI/common_j2se/,Eclipse SWT/common/,Eclipse SWT PI/win32/"/>
+ <property name="includes" value="Eclipse SWT/win32/**/*.java,Eclipse SWT/common/**/*.java,Eclipse SWT/common_j2se/**/*.java,Eclipse SWT AWT/win32/**/*.java,Eclipse SWT Custom Widgets/common/**/*.java,Eclipse SWT Drag and Drop/win32/**/*.java,Eclipse SWT Drag and Drop/common/**/*.java,Eclipse SWT OLE Win32/win32/**/*.java,Eclipse SWT Printing/win32/**/*.java,Eclipse SWT Printing/common/**/*.java,Eclipse SWT Program/win32/**/*.java,Eclipse SWT Program/common/**/*.java,Eclipse SWT PI/win32/**/*.java,Eclipse SWT PI/common_j2sse/**/*.java,Eclipse SWT/common/library/,Eclipse SWT PI/win32/library/"/>
<property name="excludes" value=""/>
<property name="dest" value="${destroot}/ws/win32/swtsrc.zip"/>
</ant>
</target>
- <target name="src" depends="init,ws/motif/swtsrc.zip,ws/photon/swtsrc.zip,ws/win32/swtsrc.zip">
+ <target name="src" depends="init,ws/gtk/swt-pisrc.zip,ws/gtk/swtsrc.zip,ws/motif/swtsrc.zip,ws/photon/swtsrc.zip,ws/win32/swtsrc.zip">
</target>
<target name="bin" depends="init">
<property name="destroot" value="${basedir}"/>
<ant antfile="${template}" target="bin">
<property name="includes" value="plugin.xml,plugin.properties,ws/,*.jar"/>
- <property name="excludes" value="Eclipse SWT Printing/common/,Eclipse SWT Printing/motif/,Eclipse SWT Printing/photon/,Eclipse SWT Printing/win32/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Drag and Drop/motif/,Eclipse SWT Drag and Drop/photon/,Eclipse SWT Drag and Drop/win32/,Eclipse SWT Program/common/,Eclipse SWT Program/motif/,Eclipse SWT Program/photon/,Eclipse SWT Program/win32/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT/motif/,Eclipse SWT/photon/,Eclipse SWT/win32/,Eclipse SWT/common_j2se/,Eclipse SWT PI/common_j2se/,Eclipse SWT PI/motif/,Eclipse SWT PI/photon/,Eclipse SWT PI/win32/,Eclipse SWT Custom Widgets/common/,Eclipse SWT AWT/win32/,Eclipse SWT OLE Win32/win32/,Eclipse SWT/emulated/"/>
+ <property name="excludes" value="Eclipse SWT Printing/common/,Eclipse SWT Printing/motif/,Eclipse SWT Printing/photon/,Eclipse SWT Printing/win32/,Eclipse SWT Printing/gtk/,Eclipse SWT Drag and Drop/common/,Eclipse SWT Drag and Drop/motif/,Eclipse SWT Drag and Drop/photon/,Eclipse SWT Drag and Drop/win32/,Eclipse SWT Drag and Drop/gtk/,Eclipse SWT Program/common/,Eclipse SWT Program/motif/,Eclipse SWT Program/photon/,Eclipse SWT Program/win32/,Eclipse SWT Program/gtk/,Eclipse SWT/common/,Eclipse SWT/common_j2se/,Eclipse SWT/motif/,Eclipse SWT/photon/,Eclipse SWT/win32/,Eclipse SWT/gtk/,Eclipse SWT/common_j2se/,Eclipse SWT PI/common_j2se/,Eclipse SWT PI/motif/,Eclipse SWT PI/photon/,Eclipse SWT PI/win32/,Eclipse SWT PI/gtk/,Eclipse SWT Custom Widgets/common/,Eclipse SWT AWT/win32/,Eclipse SWT OLE Win32/win32/,Eclipse SWT/emulated/"/>
<property name="dest" value="${destroot}"/>
</ant>
</target>
@@ -137,8 +177,8 @@
<target name="clean" depends="init">
<ant antfile="${template}" target="clean">
- <property name="jar" value="ws/motif/swt.jar,ws/photon/swt.jar,ws/win32/swt.jar"/>
- <property name="srczips" value="ws/motif/swtsrc.zip,ws/photon/swtsrc.zip,ws/win32/swtsrc.zip"/>
+ <property name="jar" value="ws/gtk/swt-pi.jar,ws/gtk/swt.jar,ws/motif/swt.jar,ws/photon/swt.jar,ws/win32/swt.jar"/>
+ <property name="srczips" value="ws/gtk/swt-pisrc.zip,ws/gtk/swtsrc.zip,ws/motif/swtsrc.zip,ws/photon/swtsrc.zip,ws/win32/swtsrc.zip"/>
</ant>
<delete>
<fileset dir="." includes="**/*.pdetemp"/>
diff --git a/bundles/org.eclipse.swt/plugin.xml b/bundles/org.eclipse.swt/plugin.xml
index 3fbba1b..4fe8d11 100755
--- a/bundles/org.eclipse.swt/plugin.xml
+++ b/bundles/org.eclipse.swt/plugin.xml
@@ -8,6 +8,9 @@
<!-- Runtime -->
<runtime>
+ <library name="$ws$/swt-pi.jar">
+ <export name="*"/>
+ </library>
<library name="$ws$/swt.jar">
<export name="*"/>
</library>
diff --git a/bundles/org.eclipse.swt/ws/gtk/about.html b/bundles/org.eclipse.swt/ws/gtk/about.html
new file mode 100644
index 0000000..ee4dc99
--- /dev/null
+++ b/bundles/org.eclipse.swt/ws/gtk/about.html
@@ -0,0 +1,59 @@
+<html>
+<head>
+<title>About</title>
+<style type="text/css">
+p, table, td, th { font-family: arial, helvetica, geneva; font-size: 10pt}
+pre { font-family: "Courier New", Courier, mono; font-size: 10pt}
+h2 { font-family: arial, helvetica, geneva; font-size: 18pt; font-weight: bold ; line-height: 14px}
+code { font-family: "Courier New", Courier, mono; font-size: 10pt}
+sup { font-family: arial,helvetica,geneva; font-size: 10px}
+h3 { font-family: arial, helvetica, geneva; font-size: 14pt; font-weight: bold}
+li { font-family: arial, helvetica, geneva; font-size: 10pt}
+h1 { font-family: arial, helvetica, geneva; font-size: 28px; font-weight: bold}
+body { font-family: arial, helvetica, geneva; font-size: 10pt; clip: rect( ); margin-top: 5mm; margin-left: 3mm}
+</style>
+</head>
+<body>
+<body lang=EN-US link=blue vlink=purple>
+<table border=0 cellspacing=5 cellpadding=2 width="100%" >
+ <tr>
+ <td align=LEFT valign=TOP colspan="2" bgcolor="#0080C0"><b><font color="#FFFFFF" face="Arial,Helvetica">About This Plug-in Sub-directory</font></b></td>
+ </tr>
+ <tr>
+ <td>
+<p>4th December, 2001</p>
+<h3>License</h3>
+<p>All content in this plug-in sub-directory ("Content") is made available by Eclipse.org under the following terms and conditions:</p>
+
+<p>The following two files shall be defined as the SWT:</p>
+<ul>
+ <li>libswt-linux-2018.so</li>
+ <li>swt.jar</li>
+</ul>
+
+<p>A. The SWT is licensed to you under the terms and conditions of the <a href="http://www.eclipse.org/legal/cpl-v05.html">Common Public License Version 0.5</a> ("CPL").
+For the purposes of the CPL the term "Program" shall mean the SWT.</p>
+
+<p>B. All other files contained in this sub-directory shall be defined as the GTK+ Binding. The GTK+ Binding contains portions of GTK+ ("Library"). GTK+ is made available
+by The Free Software Foundation. Use of the Library is governed by the terms and conditions of the
+<a href="http://www.gnu.org/licenses/lgpl.html">GNU Lesser General Public License Version 2.1</a> ("LGPL"). Use of the GTK+ Binding on a standalone basis, is also governed
+by the terms and conditions of the LGPL. A copy of the LGPL is provided with the Content.</p>
+
+<p>C. In accordance with Section 6 of the LGPL, you may combine or link a "work that uses the Library" (e.g. the SWT) with the Library to produce a work
+containing portions of the Library (e.g. the GTK+ Binding) and distribute that work under the terms of your choice (e.g. the CPL) provided you comply with all
+other terms and conditions of Section 6 as well as other Sections of the LGPL. Please note, if you modify the GTK+ Binding such modifications shall be
+governed by the terms and conditions of the LGPL. Also note, the terms of the CPL permit you to modify the combined work and the source code of the combined
+work is provided for debugging purposes so there is no need to reverse engineer the combined work.</p>
+
+<p>If you wish to provide Contributions related to the SWT, such Contributions shall be made under the terms of the CPL. If you wish to make
+Contributions related to the GTK+ Binding such Contributions shall be made under the terms of the LGPL and the CPL (with respect to portions
+of the contribution for which you are the copyright holder).</p>
+</td></tr></table>
+</body>
+</html>
+
+
+
+
+
+
diff --git a/bundles/org.eclipse.swt/ws/gtk/cpl-v05.html b/bundles/org.eclipse.swt/ws/gtk/cpl-v05.html
new file mode 100644
index 0000000..800c779
--- /dev/null
+++ b/bundles/org.eclipse.swt/ws/gtk/cpl-v05.html
@@ -0,0 +1,239 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<!-- saved from url=(0041)http://www.eclipse.org/legal/cpl-v05.html -->
+<HTML><HEAD><TITLE>Common Public License Version 0.5</TITLE>
+<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
+<META content="MSHTML 5.00.3315.2870" name=GENERATOR></HEAD>
+<BODY bgColor=#ffffff>
+<DIV align=center>
+<P>
+<TABLE border=0 cellPadding=10 cellSpacing=10 width="90%">
+ <TBODY>
+ <TR>
+ <TD vAlign=top width="75%"><FONT face="Arial, Helvetica, sans serif"
+ size=3>
+ <H1>Common Public License Version 0.5</H1><TT>
+ <P><FONT face="Courier New, Courier, mono">THE ACCOMPANYING PROGRAM IS
+ PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY
+ USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S
+ ACCEPTANCE OF THIS AGREEMENT. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><B>1. DEFINITIONS
+ </B></FONT></P>
+ <P><FONT face="Courier New, Courier, mono">"Contribution"
+means:</FONT></P>
+ <BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">a) in the case of the initial
+ Contributor, the initial code and documentation distributed under this
+ Agreement, and </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">b) in the case of each
+ subsequent Contributor:</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">i) changes to the Program,
+ and</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">ii) additions to the
+ Program;</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">where such changes and/or
+ additions to the Program originate from and are distributed by that
+ particular Contributor. A Contribution 'originates' from a Contributor
+ if it was added to the Program by such Contributor itself or anyone
+ acting on such Contributor's behalf. Contributions do not include
+ additions to the Program which: (i) are separate modules of software
+ distributed in conjunction with the Program under their own license
+ agreement, and (ii) are not derivative works of the
+ Program.</FONT></P></BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">"Contributor" means any person
+ or entity that distributes the Program. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">"Licensed Patents " mean patent
+ claims licensable by a Contributor which are necessarily infringed by the
+ use or sale of its Contribution alone or when combined with the
+ Program.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">"Program" means the
+ Contributions distributed in accordance with this Agreement. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">"Recipient" means anyone who
+ receives the Program under this Agreement, including all Contributors.
+ </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><B>2. GRANT OF
+ RIGHTS</B></FONT></P>
+ <BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">a) Subject to the terms of
+ this Agreement, each Contributor hereby grants Recipient a
+ non-exclusive, worldwide, royalty-free copyright license to reproduce,
+ prepare derivative works of, publicly display, publicly perform,
+ distribute and sublicense the Contribution of such Contributor, if any,
+ and such derivative works, in source code and object code
+ form.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">b) Subject to the terms of
+ this Agreement, each Contributor hereby grants Recipient a
+ non-exclusive, worldwide, royalty-free patent license under Licensed
+ Patents to make, use, sell, offer to sell, import and otherwise transfer
+ the Contribution of such Contributor, if any, in source code and object
+ code form. This patent license shall apply to the combination of the
+ Contribution and the Program if, at the time the Contribution is added
+ by the Contributor, such addition of the Contribution causes such
+ combination to be covered by the Licensed Patents. The patent license
+ shall not apply to any other combinations which include the
+ Contribution. No hardware per se is licensed hereunder.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">c) Recipient understands that
+ although each Contributor grants the licenses to its Contributions set
+ forth herein, no assurances are provided by any Contributor that the
+ Program does not infringe the patent or other intellectual property
+ rights of any other entity. Each Contributor disclaims any liability to
+ Recipient for claims brought by any other entity based on infringement
+ of intellectual property rights or otherwise. As a condition to
+ exercising the rights and licenses granted hereunder, each Recipient
+ hereby assumes sole responsibility to secure any other intellectual
+ property rights needed, if any. For example, if a third party patent
+ license is required to allow Recipient to distribute the Program, it is
+ Recipient's responsibility to acquire that license before distributing
+ the Program.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">d) Each Contributor
+ represents that to its knowledge it has sufficient copyright rights in
+ its Contribution, if any, to grant the copyright license set forth in
+ this Agreement.</FONT></P></BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>3.
+ REQUIREMENTS</STRONG> </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">A Contributor may choose to
+ distribute the Program in object code form under its own license
+ agreement, provided that: </FONT></P>
+ <BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">a) it complies with the terms
+ and conditions of this Agreement; and</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">b) its license
+ agreement:</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">i) effectively disclaims on
+ behalf of all Contributors all warranties and conditions, express and
+ implied, including warranties or conditions of title and
+ non-infringement, and implied warranties or conditions of
+ merchantability and fitness for a particular purpose; </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">ii) effectively excludes on
+ behalf of all Contributors all liability for damages, including direct,
+ indirect, special, incidental and consequential damages, such as lost
+ profits; </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">iii) states that any
+ provisions which differ from this Agreement are offered by that
+ Contributor alone and not by any other party; and </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">iv) states that source code
+ for the Program is available from such Contributor, and informs
+ licensees how to obtain it in a reasonable manner on or through a medium
+ customarily used for software exchange. </FONT></P></BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">When the Program is made
+ available in source code form:</FONT></P>
+ <BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">a) it must be made available
+ under this Agreement; and</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">b) a copy of this Agreement
+ must be included with each copy of the Program. </FONT></P></BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">Contributors may not remove or
+ alter any copyright notices contained within the Program.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">Each Contributor must identify
+ itself as the originator of its Contribution, if any, in a manner that
+ reasonably allows subsequent Recipients to identify the originator of the
+ Contribution. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>4. COMMERCIAL
+ DISTRIBUTION</STRONG> </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">Commercial distributors of
+ software may accept certain responsibilities with respect to end users,
+ business partners and the like. While this license is intended to
+ facilitate the commercial use of the Program, the Contributor who includes
+ the Program in a commercial product offering should do so in a manner
+ which does not create potential liability for other Contributors.
+ Therefore, if a Contributor includes the Program in a commercial product
+ offering, such Contributor ("Commercial Contributor") hereby agrees to
+ defend and indemnify every other Contributor ("Indemnified Contributor")
+ against any losses, damages and costs (collectively "Losses") arising from
+ claims, lawsuits and other legal actions brought by a third party against
+ the Indemnified Contributor to the extent caused by the acts or omissions
+ of such Commercial Contributor in connection with its distribution of the
+ Program in a commercial product offering. The obligations in this section
+ do not apply to any claims or Losses relating to any actual or alleged
+ intellectual property infringement. In order to qualify, an Indemnified
+ Contributor must: a) promptly notify the Commercial Contributor in writing
+ of such claim, and b) allow the Commercial Contributor to control, and
+ cooperate with the Commercial Contributor in, the defense and any related
+ settlement negotiations. The Indemnified Contributor may participate in
+ any such claim at its own expense. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">For example, a Contributor
+ might include the Program in a commercial product offering, Product X.
+ That Contributor is then a Commercial Contributor. If that Commercial
+ Contributor then makes performance claims, or offers warranties related to
+ Product X, those performance claims and warranties are such Commercial
+ Contributor's responsibility alone. Under this section, the Commercial
+ Contributor would have to defend claims against the other Contributors
+ related to those performance claims and warranties, and if a court
+ requires any other Contributor to pay any damages as a result, the
+ Commercial Contributor must pay those damages. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>5. NO
+ WARRANTY</STRONG></FONT></P>
+ <P><FONT face="Courier New, Courier, mono">EXCEPT AS EXPRESSLY SET FORTH
+ IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+ WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+ WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+ NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ Each Recipient is solely responsible for determining the appropriateness
+ of using and distributing the Program and assumes all risks associated
+ with its exercise of rights under this Agreement, including but not
+ limited to the risks and costs of program errors, compliance with
+ applicable laws, damage to or loss of data, programs or equipment, and
+ unavailability or interruption of operations. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>6. DISCLAIMER OF
+ LIABILITY </STRONG></FONT></P>
+ <P><FONT face="Courier New, Courier, mono">EXCEPT AS EXPRESSLY SET FORTH
+ IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY
+ LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY
+ RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>7.
+ GENERAL</STRONG></FONT></P>
+ <P><FONT face="Courier New, Courier, mono">If any provision of this
+ Agreement is invalid or unenforceable under applicable law, it shall not
+ affect the validity or enforceability of the remainder of the terms of
+ this Agreement, and without further action by the parties hereto, such
+ provision shall be reformed to the minimum extent necessary to make such
+ provision valid and enforceable. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">If Recipient institutes patent
+ litigation against a Contributor with respect to a patent applicable to
+ software (including a cross-claim or counterclaim in a lawsuit), then any
+ patent licenses granted by that Contributor to such Recipient under this
+ Agreement shall terminate as of the date such litigation is filed. In
+ addition, If Recipient institutes patent litigation against any entity
+ (including a cross-claim or counterclaim in a lawsuit) alleging that the
+ Program itself (excluding combinations of the Program with other software
+ or hardware) infringes such Recipient's patent(s), then such Recipient's
+ rights granted under Section 2(b) shall terminate as of the date such
+ litigation is filed.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">All Recipient's rights under
+ this Agreement shall terminate if it fails to comply with any of the
+ material terms or conditions of this Agreement and does not cure such
+ failure in a reasonable period of time after becoming aware of such
+ noncompliance. If all Recipient's rights under this Agreement terminate,
+ Recipient agrees to cease use and distribution of the Program as soon as
+ reasonably practicable. However, Recipient's obligations under this
+ Agreement and any licenses granted by Recipient relating to the Program
+ shall continue and survive. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">Everyone is permitted to copy
+ and distribute copies of this Agreement, but in order to avoid
+ inconsistency the Agreement is copyrighted and may only be modified in the
+ following manner. The Agreement Steward reserves the right to publish new
+ versions (including revisions) of this Agreement from time to time. No one
+ other than the Agreement Steward has the right to modify this Agreement.
+ IBM is the initial Agreement Steward. IBM may assign the responsibility to
+ serve as the Agreement Steward to a suitable separate entity. Each new
+ version of the Agreement will be given a distinguishing version number.
+ The Program (including Contributions) may always be distributed subject to
+ the version of the Agreement under which it was received. In addition,
+ after a new version of the Agreement is published, Contributor may elect
+ to distribute the Program (including its Contributions) under the new
+ version. Except as expressly stated in Sections 2(a) and 2(b) above,
+ Recipient receives no rights or licenses to the intellectual property of
+ any Contributor under this Agreement, whether expressly, by implication,
+ estoppel or otherwise. All rights in the Program not expressly granted
+ under this Agreement are reserved. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">This Agreement is governed by
+ the laws of the State of New York and the intellectual property laws of
+ the United States of America. No party to this Agreement will bring a
+ legal action under this Agreement more than one year after the cause of
+ action arose. Each party waives its rights to a jury trial in any
+ resulting litigation.</FONT></P></TT></FONT></TD></TR></TBODY></TABLE>
+<P></P></DIV></BODY></HTML>
diff --git a/bundles/org.eclipse.swt/ws/gtk/lgpl-v21.txt b/bundles/org.eclipse.swt/ws/gtk/lgpl-v21.txt
new file mode 100644
index 0000000..3f50d04
--- /dev/null
+++ b/bundles/org.eclipse.swt/ws/gtk/lgpl-v21.txt
@@ -0,0 +1,506 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
+
+
diff --git a/bundles/org.eclipse.swt/ws/gtk/libswt-linux-2018.so b/bundles/org.eclipse.swt/ws/gtk/libswt-linux-2018.so
new file mode 100644
index 0000000..0b6b917
--- /dev/null
+++ b/bundles/org.eclipse.swt/ws/gtk/libswt-linux-2018.so
Binary files differ
diff --git a/bundles/org.eclipse.swt/ws/gtk/libswt-pi-linux-2018.so b/bundles/org.eclipse.swt/ws/gtk/libswt-pi-linux-2018.so
new file mode 100644
index 0000000..c10cf2f
--- /dev/null
+++ b/bundles/org.eclipse.swt/ws/gtk/libswt-pi-linux-2018.so
Binary files differ
diff --git a/bundles/org.eclipse.swt/ws/gtk/libswt-pixbuf-linux-2018.so b/bundles/org.eclipse.swt/ws/gtk/libswt-pixbuf-linux-2018.so
new file mode 100644
index 0000000..a7b6be7
--- /dev/null
+++ b/bundles/org.eclipse.swt/ws/gtk/libswt-pixbuf-linux-2018.so
Binary files differ
diff --git a/bundles/org.eclipse.swt/ws/gtk1x/about.html b/bundles/org.eclipse.swt/ws/gtk1x/about.html
new file mode 100644
index 0000000..ee4dc99
--- /dev/null
+++ b/bundles/org.eclipse.swt/ws/gtk1x/about.html
@@ -0,0 +1,59 @@
+<html>
+<head>
+<title>About</title>
+<style type="text/css">
+p, table, td, th { font-family: arial, helvetica, geneva; font-size: 10pt}
+pre { font-family: "Courier New", Courier, mono; font-size: 10pt}
+h2 { font-family: arial, helvetica, geneva; font-size: 18pt; font-weight: bold ; line-height: 14px}
+code { font-family: "Courier New", Courier, mono; font-size: 10pt}
+sup { font-family: arial,helvetica,geneva; font-size: 10px}
+h3 { font-family: arial, helvetica, geneva; font-size: 14pt; font-weight: bold}
+li { font-family: arial, helvetica, geneva; font-size: 10pt}
+h1 { font-family: arial, helvetica, geneva; font-size: 28px; font-weight: bold}
+body { font-family: arial, helvetica, geneva; font-size: 10pt; clip: rect( ); margin-top: 5mm; margin-left: 3mm}
+</style>
+</head>
+<body>
+<body lang=EN-US link=blue vlink=purple>
+<table border=0 cellspacing=5 cellpadding=2 width="100%" >
+ <tr>
+ <td align=LEFT valign=TOP colspan="2" bgcolor="#0080C0"><b><font color="#FFFFFF" face="Arial,Helvetica">About This Plug-in Sub-directory</font></b></td>
+ </tr>
+ <tr>
+ <td>
+<p>4th December, 2001</p>
+<h3>License</h3>
+<p>All content in this plug-in sub-directory ("Content") is made available by Eclipse.org under the following terms and conditions:</p>
+
+<p>The following two files shall be defined as the SWT:</p>
+<ul>
+ <li>libswt-linux-2018.so</li>
+ <li>swt.jar</li>
+</ul>
+
+<p>A. The SWT is licensed to you under the terms and conditions of the <a href="http://www.eclipse.org/legal/cpl-v05.html">Common Public License Version 0.5</a> ("CPL").
+For the purposes of the CPL the term "Program" shall mean the SWT.</p>
+
+<p>B. All other files contained in this sub-directory shall be defined as the GTK+ Binding. The GTK+ Binding contains portions of GTK+ ("Library"). GTK+ is made available
+by The Free Software Foundation. Use of the Library is governed by the terms and conditions of the
+<a href="http://www.gnu.org/licenses/lgpl.html">GNU Lesser General Public License Version 2.1</a> ("LGPL"). Use of the GTK+ Binding on a standalone basis, is also governed
+by the terms and conditions of the LGPL. A copy of the LGPL is provided with the Content.</p>
+
+<p>C. In accordance with Section 6 of the LGPL, you may combine or link a "work that uses the Library" (e.g. the SWT) with the Library to produce a work
+containing portions of the Library (e.g. the GTK+ Binding) and distribute that work under the terms of your choice (e.g. the CPL) provided you comply with all
+other terms and conditions of Section 6 as well as other Sections of the LGPL. Please note, if you modify the GTK+ Binding such modifications shall be
+governed by the terms and conditions of the LGPL. Also note, the terms of the CPL permit you to modify the combined work and the source code of the combined
+work is provided for debugging purposes so there is no need to reverse engineer the combined work.</p>
+
+<p>If you wish to provide Contributions related to the SWT, such Contributions shall be made under the terms of the CPL. If you wish to make
+Contributions related to the GTK+ Binding such Contributions shall be made under the terms of the LGPL and the CPL (with respect to portions
+of the contribution for which you are the copyright holder).</p>
+</td></tr></table>
+</body>
+</html>
+
+
+
+
+
+
diff --git a/bundles/org.eclipse.swt/ws/gtk1x/cpl-v05.html b/bundles/org.eclipse.swt/ws/gtk1x/cpl-v05.html
new file mode 100644
index 0000000..800c779
--- /dev/null
+++ b/bundles/org.eclipse.swt/ws/gtk1x/cpl-v05.html
@@ -0,0 +1,239 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<!-- saved from url=(0041)http://www.eclipse.org/legal/cpl-v05.html -->
+<HTML><HEAD><TITLE>Common Public License Version 0.5</TITLE>
+<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
+<META content="MSHTML 5.00.3315.2870" name=GENERATOR></HEAD>
+<BODY bgColor=#ffffff>
+<DIV align=center>
+<P>
+<TABLE border=0 cellPadding=10 cellSpacing=10 width="90%">
+ <TBODY>
+ <TR>
+ <TD vAlign=top width="75%"><FONT face="Arial, Helvetica, sans serif"
+ size=3>
+ <H1>Common Public License Version 0.5</H1><TT>
+ <P><FONT face="Courier New, Courier, mono">THE ACCOMPANYING PROGRAM IS
+ PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY
+ USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S
+ ACCEPTANCE OF THIS AGREEMENT. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><B>1. DEFINITIONS
+ </B></FONT></P>
+ <P><FONT face="Courier New, Courier, mono">"Contribution"
+means:</FONT></P>
+ <BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">a) in the case of the initial
+ Contributor, the initial code and documentation distributed under this
+ Agreement, and </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">b) in the case of each
+ subsequent Contributor:</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">i) changes to the Program,
+ and</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">ii) additions to the
+ Program;</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">where such changes and/or
+ additions to the Program originate from and are distributed by that
+ particular Contributor. A Contribution 'originates' from a Contributor
+ if it was added to the Program by such Contributor itself or anyone
+ acting on such Contributor's behalf. Contributions do not include
+ additions to the Program which: (i) are separate modules of software
+ distributed in conjunction with the Program under their own license
+ agreement, and (ii) are not derivative works of the
+ Program.</FONT></P></BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">"Contributor" means any person
+ or entity that distributes the Program. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">"Licensed Patents " mean patent
+ claims licensable by a Contributor which are necessarily infringed by the
+ use or sale of its Contribution alone or when combined with the
+ Program.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">"Program" means the
+ Contributions distributed in accordance with this Agreement. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">"Recipient" means anyone who
+ receives the Program under this Agreement, including all Contributors.
+ </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><B>2. GRANT OF
+ RIGHTS</B></FONT></P>
+ <BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">a) Subject to the terms of
+ this Agreement, each Contributor hereby grants Recipient a
+ non-exclusive, worldwide, royalty-free copyright license to reproduce,
+ prepare derivative works of, publicly display, publicly perform,
+ distribute and sublicense the Contribution of such Contributor, if any,
+ and such derivative works, in source code and object code
+ form.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">b) Subject to the terms of
+ this Agreement, each Contributor hereby grants Recipient a
+ non-exclusive, worldwide, royalty-free patent license under Licensed
+ Patents to make, use, sell, offer to sell, import and otherwise transfer
+ the Contribution of such Contributor, if any, in source code and object
+ code form. This patent license shall apply to the combination of the
+ Contribution and the Program if, at the time the Contribution is added
+ by the Contributor, such addition of the Contribution causes such
+ combination to be covered by the Licensed Patents. The patent license
+ shall not apply to any other combinations which include the
+ Contribution. No hardware per se is licensed hereunder.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">c) Recipient understands that
+ although each Contributor grants the licenses to its Contributions set
+ forth herein, no assurances are provided by any Contributor that the
+ Program does not infringe the patent or other intellectual property
+ rights of any other entity. Each Contributor disclaims any liability to
+ Recipient for claims brought by any other entity based on infringement
+ of intellectual property rights or otherwise. As a condition to
+ exercising the rights and licenses granted hereunder, each Recipient
+ hereby assumes sole responsibility to secure any other intellectual
+ property rights needed, if any. For example, if a third party patent
+ license is required to allow Recipient to distribute the Program, it is
+ Recipient's responsibility to acquire that license before distributing
+ the Program.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">d) Each Contributor
+ represents that to its knowledge it has sufficient copyright rights in
+ its Contribution, if any, to grant the copyright license set forth in
+ this Agreement.</FONT></P></BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>3.
+ REQUIREMENTS</STRONG> </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">A Contributor may choose to
+ distribute the Program in object code form under its own license
+ agreement, provided that: </FONT></P>
+ <BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">a) it complies with the terms
+ and conditions of this Agreement; and</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">b) its license
+ agreement:</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">i) effectively disclaims on
+ behalf of all Contributors all warranties and conditions, express and
+ implied, including warranties or conditions of title and
+ non-infringement, and implied warranties or conditions of
+ merchantability and fitness for a particular purpose; </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">ii) effectively excludes on
+ behalf of all Contributors all liability for damages, including direct,
+ indirect, special, incidental and consequential damages, such as lost
+ profits; </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">iii) states that any
+ provisions which differ from this Agreement are offered by that
+ Contributor alone and not by any other party; and </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">iv) states that source code
+ for the Program is available from such Contributor, and informs
+ licensees how to obtain it in a reasonable manner on or through a medium
+ customarily used for software exchange. </FONT></P></BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">When the Program is made
+ available in source code form:</FONT></P>
+ <BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">a) it must be made available
+ under this Agreement; and</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">b) a copy of this Agreement
+ must be included with each copy of the Program. </FONT></P></BLOCKQUOTE>
+ <P><FONT face="Courier New, Courier, mono">Contributors may not remove or
+ alter any copyright notices contained within the Program.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">Each Contributor must identify
+ itself as the originator of its Contribution, if any, in a manner that
+ reasonably allows subsequent Recipients to identify the originator of the
+ Contribution. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>4. COMMERCIAL
+ DISTRIBUTION</STRONG> </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">Commercial distributors of
+ software may accept certain responsibilities with respect to end users,
+ business partners and the like. While this license is intended to
+ facilitate the commercial use of the Program, the Contributor who includes
+ the Program in a commercial product offering should do so in a manner
+ which does not create potential liability for other Contributors.
+ Therefore, if a Contributor includes the Program in a commercial product
+ offering, such Contributor ("Commercial Contributor") hereby agrees to
+ defend and indemnify every other Contributor ("Indemnified Contributor")
+ against any losses, damages and costs (collectively "Losses") arising from
+ claims, lawsuits and other legal actions brought by a third party against
+ the Indemnified Contributor to the extent caused by the acts or omissions
+ of such Commercial Contributor in connection with its distribution of the
+ Program in a commercial product offering. The obligations in this section
+ do not apply to any claims or Losses relating to any actual or alleged
+ intellectual property infringement. In order to qualify, an Indemnified
+ Contributor must: a) promptly notify the Commercial Contributor in writing
+ of such claim, and b) allow the Commercial Contributor to control, and
+ cooperate with the Commercial Contributor in, the defense and any related
+ settlement negotiations. The Indemnified Contributor may participate in
+ any such claim at its own expense. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">For example, a Contributor
+ might include the Program in a commercial product offering, Product X.
+ That Contributor is then a Commercial Contributor. If that Commercial
+ Contributor then makes performance claims, or offers warranties related to
+ Product X, those performance claims and warranties are such Commercial
+ Contributor's responsibility alone. Under this section, the Commercial
+ Contributor would have to defend claims against the other Contributors
+ related to those performance claims and warranties, and if a court
+ requires any other Contributor to pay any damages as a result, the
+ Commercial Contributor must pay those damages. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>5. NO
+ WARRANTY</STRONG></FONT></P>
+ <P><FONT face="Courier New, Courier, mono">EXCEPT AS EXPRESSLY SET FORTH
+ IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+ WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+ WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+ NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ Each Recipient is solely responsible for determining the appropriateness
+ of using and distributing the Program and assumes all risks associated
+ with its exercise of rights under this Agreement, including but not
+ limited to the risks and costs of program errors, compliance with
+ applicable laws, damage to or loss of data, programs or equipment, and
+ unavailability or interruption of operations. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>6. DISCLAIMER OF
+ LIABILITY </STRONG></FONT></P>
+ <P><FONT face="Courier New, Courier, mono">EXCEPT AS EXPRESSLY SET FORTH
+ IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY
+ LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY
+ RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono"><STRONG>7.
+ GENERAL</STRONG></FONT></P>
+ <P><FONT face="Courier New, Courier, mono">If any provision of this
+ Agreement is invalid or unenforceable under applicable law, it shall not
+ affect the validity or enforceability of the remainder of the terms of
+ this Agreement, and without further action by the parties hereto, such
+ provision shall be reformed to the minimum extent necessary to make such
+ provision valid and enforceable. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">If Recipient institutes patent
+ litigation against a Contributor with respect to a patent applicable to
+ software (including a cross-claim or counterclaim in a lawsuit), then any
+ patent licenses granted by that Contributor to such Recipient under this
+ Agreement shall terminate as of the date such litigation is filed. In
+ addition, If Recipient institutes patent litigation against any entity
+ (including a cross-claim or counterclaim in a lawsuit) alleging that the
+ Program itself (excluding combinations of the Program with other software
+ or hardware) infringes such Recipient's patent(s), then such Recipient's
+ rights granted under Section 2(b) shall terminate as of the date such
+ litigation is filed.</FONT></P>
+ <P><FONT face="Courier New, Courier, mono">All Recipient's rights under
+ this Agreement shall terminate if it fails to comply with any of the
+ material terms or conditions of this Agreement and does not cure such
+ failure in a reasonable period of time after becoming aware of such
+ noncompliance. If all Recipient's rights under this Agreement terminate,
+ Recipient agrees to cease use and distribution of the Program as soon as
+ reasonably practicable. However, Recipient's obligations under this
+ Agreement and any licenses granted by Recipient relating to the Program
+ shall continue and survive. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">Everyone is permitted to copy
+ and distribute copies of this Agreement, but in order to avoid
+ inconsistency the Agreement is copyrighted and may only be modified in the
+ following manner. The Agreement Steward reserves the right to publish new
+ versions (including revisions) of this Agreement from time to time. No one
+ other than the Agreement Steward has the right to modify this Agreement.
+ IBM is the initial Agreement Steward. IBM may assign the responsibility to
+ serve as the Agreement Steward to a suitable separate entity. Each new
+ version of the Agreement will be given a distinguishing version number.
+ The Program (including Contributions) may always be distributed subject to
+ the version of the Agreement under which it was received. In addition,
+ after a new version of the Agreement is published, Contributor may elect
+ to distribute the Program (including its Contributions) under the new
+ version. Except as expressly stated in Sections 2(a) and 2(b) above,
+ Recipient receives no rights or licenses to the intellectual property of
+ any Contributor under this Agreement, whether expressly, by implication,
+ estoppel or otherwise. All rights in the Program not expressly granted
+ under this Agreement are reserved. </FONT></P>
+ <P><FONT face="Courier New, Courier, mono">This Agreement is governed by
+ the laws of the State of New York and the intellectual property laws of
+ the United States of America. No party to this Agreement will bring a
+ legal action under this Agreement more than one year after the cause of
+ action arose. Each party waives its rights to a jury trial in any
+ resulting litigation.</FONT></P></TT></FONT></TD></TR></TBODY></TABLE>
+<P></P></DIV></BODY></HTML>
diff --git a/bundles/org.eclipse.swt/ws/gtk1x/lgpl-v21.txt b/bundles/org.eclipse.swt/ws/gtk1x/lgpl-v21.txt
new file mode 100644
index 0000000..3f50d04
--- /dev/null
+++ b/bundles/org.eclipse.swt/ws/gtk1x/lgpl-v21.txt
@@ -0,0 +1,506 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
+
+
diff --git a/bundles/org.eclipse.swt/ws/gtk1x/libswt-linux-2018.so b/bundles/org.eclipse.swt/ws/gtk1x/libswt-linux-2018.so
new file mode 100644
index 0000000..0b6b917
--- /dev/null
+++ b/bundles/org.eclipse.swt/ws/gtk1x/libswt-linux-2018.so
Binary files differ
diff --git a/bundles/org.eclipse.swt/ws/gtk1x/libswt-pi-linux-2018.so b/bundles/org.eclipse.swt/ws/gtk1x/libswt-pi-linux-2018.so
new file mode 100644
index 0000000..c10cf2f
--- /dev/null
+++ b/bundles/org.eclipse.swt/ws/gtk1x/libswt-pi-linux-2018.so
Binary files differ
diff --git a/bundles/org.eclipse.swt/ws/gtk1x/libswt-pixbuf-linux-2018.so b/bundles/org.eclipse.swt/ws/gtk1x/libswt-pixbuf-linux-2018.so
new file mode 100644
index 0000000..a7b6be7
--- /dev/null
+++ b/bundles/org.eclipse.swt/ws/gtk1x/libswt-pixbuf-linux-2018.so
Binary files differ