Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Shingarov2002-03-13 07:58:36 +0000
committerBoris Shingarov2002-03-13 07:58:36 +0000
commit6b636e0a1fc7b4f23b26678b2fe7a7f24250b286 (patch)
treeef52db61f6f53b2ae21902976ef0cda5aa9a0098
parent4d5a3e8b5d94248231fd53c1ca3283bdc137dcde (diff)
downloadeclipse.platform.swt-GTK2.tar.gz
eclipse.platform.swt-GTK2.tar.xz
eclipse.platform.swt-GTK2.zip
*** empty log message ***GTK2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt-gdk.c6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/swt-gdk.c6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java144
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java123
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/graphics/Device.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TabFolder.java144
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/Tree.java123
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk1x/org/eclipse/swt/widgets/TreeItem.java14
10 files changed, 244 insertions, 340 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt-gdk.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt-gdk.c
index b5381e9175..7e4441b7eb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt-gdk.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/swt-gdk.c
@@ -860,6 +860,12 @@ JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1drawable_1get_1
}
}
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1drawable_1get_1depth
+ (JNIEnv *env, jclass that, jint drawable)
+{
+ return (jint)gdk_drawable_get_depth((GdkDrawable*)drawable);
+}
+
JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1get_1origin
(JNIEnv *env, jclass that, jint window, jintArray x, jintArray y)
{
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/swt-gdk.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/swt-gdk.c
index b5381e9175..7e4441b7eb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/swt-gdk.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk1x/library/swt-gdk.c
@@ -860,6 +860,12 @@ JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1drawable_1get_1
}
}
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1drawable_1get_1depth
+ (JNIEnv *env, jclass that, jint drawable)
+{
+ return (jint)gdk_drawable_get_depth((GdkDrawable*)drawable);
+}
+
JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_OS_gdk_1window_1get_1origin
(JNIEnv *env, jclass that, jint window, jintArray x, jintArray y)
{
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
index b8ba9dabaf..a7953b3750 100644
--- 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
@@ -268,8 +268,7 @@ FontData[] getScalableFontList(String faceName) {
FontData[] answer;
// if (faceName==null) {
answer = new FontData[2];
- answer[0] = new FontData("Sans");
- answer[1] = new FontData("Serif");
+ answer[0] = new FontData("helvetica", 12, SWT.ROMAN);
// }
return answer;
}
@@ -277,7 +276,7 @@ FontData[] getNonScalableFontList(String faceName) {
FontData[] answer;
// if (faceName==null) {
answer = new FontData[1];
- answer[0] = new FontData("Monospace");
+ answer[0] = new FontData("fixed", 12, SWT.ROMAN);
// }
return answer;
}
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
index 4633a87d09..d4ea81235a 100644
--- 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
@@ -34,10 +34,10 @@ import org.eclipse.swt.events.*;
* </p>
*/
public class TabFolder extends Composite {
- int notebookHandle;
+
+ int topHandle;
TabItem [] items;
-
/*
* == CONSTRUCTORS ==
*/
@@ -75,42 +75,40 @@ public TabFolder (Composite parent, int style) {
}
/*
- * == HANDLE DANCES, FIRST SPECIES ==
+ * == Handle code ==
*/
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();
+ topHandle = OS.eclipse_fixed_new();
+ handle = OS.gtk_notebook_new ();
+ boxHandle = OS.gtk_event_box_new();
+ fixedHandle = OS.eclipse_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);
+ parent._connectChild(topHandle);
+ OS.gtk_container_add(topHandle, handle);
+ OS.gtk_container_add(topHandle, boxHandle);
+ OS.gtk_container_add(boxHandle, fixedHandle);
+ OS.eclipse_fixed_set_location(topHandle, boxHandle, 2, 33); /* FIXME */
}
void showHandle() {
- OS.gtk_widget_show(eventBoxHandle);
- OS.gtk_widget_show(fixedHandle);
- OS.gtk_widget_show(notebookHandle);
+ OS.gtk_widget_show(topHandle);
OS.gtk_widget_show(handle);
- OS.gtk_widget_realize (notebookHandle);
- OS.gtk_widget_realize (handle);
+ OS.gtk_widget_show(boxHandle);
+ OS.gtk_widget_show(fixedHandle);
}
void register () {
super.register ();
- WidgetTable.put (notebookHandle, this);
+ WidgetTable.put (topHandle, this);
}
void hookEvents () {
super.hookEvents ();
- signal_connect (notebookHandle, "size_allocate", SWT.Resize, 3);
- signal_connect (notebookHandle, "switch_page", SWT.Selection, 4);
+ signal_connect (handle, "switch_page", SWT.Selection, 4);
}
void createWidget (int index) {
@@ -118,21 +116,18 @@ void createWidget (int index) {
items = new TabItem [4];
}
-int topHandle () { return eventBoxHandle; }
-int paintHandle () { return notebookHandle; }
-int parentingHandle () { return handle; }
+int topHandle () { return topHandle; }
+public int paintHandle () { return boxHandle; } /* can't do much :-( */
+int parentingHandle () { return fixedHandle; }
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;
+ if (h==topHandle) return true;
+ return super.isMyHandle(h);
}
public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget ();
//notebookHandle
- int width = _computeSize(wHint, hHint, changed).x;
+/* int width = _computeSize(wHint, hHint, changed).x;
int height = 0;
Point size;
if (layout != null) {
@@ -148,36 +143,37 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
height = Math.max (height, size.y);
Rectangle trim = computeTrim (0, 0, width, height);
width = trim.width; height = trim.height;
- return new Point (width, height);
+ return new Point (width, height);*/
+ /* FIXME */
+ return new Point(300,300);
}
/**
-* Computes the widget trim.
-*/
+ * 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 ****
+ * === 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);
+void _setSize(int width, int height) {
+ OS.eclipse_fixed_set_size(parent.parentingHandle(), topHandle(), width, height);
+ /* FIXME */
+ int w = Math.max(width - 4, 1);
+ int h = Math.max(height - 35, 1);
+ OS.eclipse_fixed_set_size(topHandle, handle, w, h);
layoutCurrent();
- return differentExtent;
}
public Rectangle getClientArea () {
checkWidget();
- 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);
+ int[] sz = new int[2];
+ OS.eclipse_fixed_get_size(topHandle, boxHandle, sz);
+ return new Rectangle(0,0, sz[0], sz[1]);
}
void layoutCurrent() {
@@ -190,7 +186,7 @@ void layoutCurrent() {
}
void createItem (TabItem item, int index) {
- int list = OS.gtk_container_children (notebookHandle);
+ int list = OS.gtk_container_children (handle);
int itemCount = OS.g_list_length (list);
if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_ITEM_NOT_ADDED);
if (itemCount == items.length) {
@@ -200,16 +196,15 @@ void createItem (TabItem item, int index) {
}
// create a new label
- byte [] buffer = new byte [] {0};
- int labelHandle = OS.gtk_label_new (buffer);
+ int labelHandle = OS.gtk_label_new ("");
// create a new fake page
- int stubPage = OS.gtk_fixed_new();
+ int stubPage = OS.eclipse_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_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_notebook_append_page(handle, stubPage, labelHandle);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
OS.gtk_widget_show(labelHandle);
OS.gtk_widget_show(stubPage);
@@ -218,7 +213,7 @@ void createItem (TabItem item, int index) {
item.handle = labelHandle;
System.arraycopy (items, index, items, index + 1, itemCount++ - index);
items [index] = item;
- OS.gtk_notebook_set_show_tabs (notebookHandle, true);
+ OS.gtk_notebook_set_show_tabs (handle, true);
}
/**
@@ -262,7 +257,7 @@ void destroyItem (TabItem item) {
index++;
}
if (index == itemCount) error (SWT.ERROR_ITEM_NOT_REMOVED);
- OS.gtk_notebook_remove_page (notebookHandle, index);
+ OS.gtk_notebook_remove_page (handle, index);
System.arraycopy (items, index + 1, items, index, --itemCount - index);
items [itemCount] = null;
item.handle = 0;
@@ -284,9 +279,8 @@ void destroyItem (TabItem item) {
*/
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);
+ checkWidget();
+ int list = OS.gtk_container_children (handle);
int itemCount = OS.g_list_length (list);
if (!(0 <= index && index < itemCount)) error (SWT.ERROR_CANNOT_GET_ITEM);
return items [index];
@@ -302,10 +296,9 @@ public TabItem getItem (int index) {
* </ul>
*/
public int getItemCount () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ checkWidget();
//return itemCount;
- int list = OS.gtk_container_children (notebookHandle);
+ int list = OS.gtk_container_children (handle);
return OS.g_list_length (list);
}
/**
@@ -325,9 +318,8 @@ public int getItemCount () {
* </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);
+ checkWidget();
+ int list = OS.gtk_container_children (handle);
int itemCount = OS.g_list_length (list);
TabItem [] result = new TabItem [itemCount];
System.arraycopy (items, 0, result, 0, itemCount);
@@ -350,9 +342,8 @@ public TabItem [] getItems () {
* </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);
+ checkWidget();
+ int index = OS.gtk_notebook_get_current_page (handle);
if (index == -1) return new TabItem [0];
return new TabItem [] {items [index]};
}
@@ -368,9 +359,8 @@ public TabItem [] getSelection () {
* </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);
+ checkWidget();
+ return OS.gtk_notebook_get_current_page (handle);
}
/**
@@ -391,10 +381,9 @@ public int getSelectionIndex () {
* </ul>
*/
public int indexOf (TabItem item) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ checkWidget();
if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- int list = OS.gtk_container_children (notebookHandle);
+ int list = OS.gtk_container_children (handle);
int itemCount = OS.g_list_length (list);
for (int i=0; i<itemCount; i++) {
if (items [i] == item) return i;
@@ -403,7 +392,7 @@ public int indexOf (TabItem item) {
}
int processSelection (int int0, int int1, int int2) {
- int index = OS.gtk_notebook_get_current_page (notebookHandle);
+ int index = OS.gtk_notebook_get_current_page (handle);
if (index != -1) {
Control control = items [index].getControl ();
if (control != null && !control.isDisposed ()) {
@@ -462,9 +451,9 @@ public void removeSelectionListener (SelectionListener listener) {
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);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_notebook_set_page (handle, index);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
}
/**
@@ -480,8 +469,7 @@ public void setSelection (int index) {
* </ul>
*/
public void setSelection (TabItem [] items) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ checkWidget();
if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
if (items.length == 0) {
setSelection (-1);
@@ -499,11 +487,11 @@ public void setSelection (TabItem [] items) {
void deregister () {
super.deregister ();
- WidgetTable.remove (notebookHandle);
+ WidgetTable.remove (topHandle);
}
void releaseChildren() {
- int list = OS.gtk_container_children (notebookHandle);
+ int list = OS.gtk_container_children (handle);
int itemCount = OS.g_list_length (list);
for (int i=0; i<itemCount; i++) {
TabItem item = items [i];
@@ -530,7 +518,7 @@ void releaseChildren() {
void releaseHandle () {
super.releaseHandle ();
- notebookHandle = 0;
+ boxHandle = 0;
}
void releaseWidget () {
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
index a11053681d..c84686edbe 100644
--- 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
@@ -89,14 +89,9 @@ static int checkStyle (int style) {
return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
}
-Point _getClientAreaSize () {
- return UtilFuncs.getSize(handle);
-}
-
-boolean _setSize(int width, int height) {
- if (!UtilFuncs.setSize (eventBoxHandle, width, height)) return false;
- UtilFuncs.setSize (scrolledHandle, width, height);
- return true;
+void _setSize(int width, int height) {
+ OS.eclipse_fixed_set_size(parent.parentingHandle(), topHandle(), width, height);
+ OS.eclipse_fixed_set_size(fixedHandle, scrolledHandle, width, height);
}
/**
@@ -163,23 +158,16 @@ public void addTreeListener(TreeListener listener) {
public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget ();
if (wHint == SWT.DEFAULT) wHint = 200;
- return _computeSize (wHint, hHint, changed);
-}
-
-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);
+ return computeNativeSize (scrolledHandle, wHint, hHint, changed);
}
void createHandle (int index) {
state |= HANDLE;
- eventBoxHandle = OS.gtk_event_box_new();
- if (eventBoxHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+ boxHandle = OS.gtk_event_box_new();
+ if (boxHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- fixedHandle = OS.gtk_fixed_new ();
+ fixedHandle = OS.eclipse_fixed_new ();
if (fixedHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
scrolledHandle = OS.gtk_scrolled_window_new(0,0);
@@ -188,13 +176,30 @@ void createHandle (int index) {
handle = OS.gtk_ctree_new (1, 0);
if (handle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
}
+void configure() {
+ parent._connectChild(topHandle());
+ OS.gtk_container_add (boxHandle, fixedHandle);
+ OS.gtk_container_add (fixedHandle, scrolledHandle);
+ OS.gtk_container_add (scrolledHandle, 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_unselect_row", SWT.Selection, 4);
+ signal_connect (handle, "tree_expand", SWT.Expand, 3);
+ signal_connect (handle, "tree_collapse", SWT.Collapse, 3);
+}
+
+int topHandle() { return boxHandle; }
+int parentingHandle() { return fixedHandle; }
int createCheckPixmap(boolean checked) {
/*
* The box will occupy the whole item width.
*/
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
+ GtkCList clist = new GtkCList (handle);
int check_height = clist.row_height-1;
int check_width = check_height;
@@ -313,8 +318,7 @@ int findSibling (int node, int index) {
int depth = 1;
if (node != 0) {
int data = OS.g_list_nth_data (node, 0);
- GtkCTreeRow row = new GtkCTreeRow ();
- OS.memmove (row, data);
+ GtkCTreeRow row = new GtkCTreeRow (data);
depth = row.level + 1;
}
Index = 0;
@@ -383,8 +387,7 @@ int getItemCount (int node) {
int depth = 1;
if (node != 0) {
int data = OS.g_list_nth_data (node, 0);
- GtkCTreeRow row = new GtkCTreeRow ();
- OS.memmove (row, data);
+ GtkCTreeRow row = new GtkCTreeRow (data);
depth = row.level + 1;
}
Count = 0;
@@ -408,8 +411,7 @@ int getItemCount (int node) {
*/
public int getItemHeight () {
checkWidget ();
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
+ GtkCList clist = new GtkCList (handle);
return clist.row_height + CELL_SPACING;
}
@@ -439,8 +441,7 @@ TreeItem [] getItems (int node) {
int depth = 1;
if (node != 0) {
int data = OS.g_list_nth_data (node, 0);
- GtkCTreeRow row = new GtkCTreeRow ();
- OS.memmove (row, data);
+ GtkCTreeRow row = new GtkCTreeRow (data);
depth = row.level + 1;
}
Count = 0;
@@ -494,8 +495,7 @@ public TreeItem getParentItem () {
*/
public TreeItem[] getSelection () {
checkWidget();
- GtkCList clist = new GtkCList();
- OS.memmove (clist, handle, GtkCList.sizeof);
+ GtkCList clist = new GtkCList(handle);
if (clist.selection == 0) return new TreeItem [0];
int length = OS.g_list_length (clist.selection);
TreeItem [] result = new TreeItem [length];
@@ -519,8 +519,7 @@ public TreeItem[] getSelection () {
*/
public int getSelectionCount () {
checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
+ GtkCList clist = new GtkCList (handle);
if (clist.selection == 0) return 0;
return OS.g_list_length (clist.selection);
}
@@ -555,25 +554,6 @@ int GtkCTreeDispose (int ctree, int node, int data) {
return 0;
}
-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_unselect_row", SWT.Selection, 4);
- signal_connect (handle, "tree_expand", SWT.Expand, 3);
- signal_connect (handle, "tree_collapse", SWT.Collapse, 3);
-}
-
-int topHandle() { return eventBoxHandle; }
-int parentingHandle() { return fixedHandle; }
-
-boolean isMyHandle(int h) {
- if (h==fixedHandle) return true;
- if (h==scrolledHandle) return true;
- if (h==handle) return true;
- return false;
-}
-
int processCollapse (int int0, int int1, int int2) {
int index = OS.gtk_ctree_node_get_row_data (handle, int0) - 1;
Event event = new Event ();
@@ -609,7 +589,7 @@ int processExpand (int int0, int int1, int int2) {
int processMouseDown (int callData, int arg1, int int2) {
doubleSelected = false;
int result = super.processMouseDown (callData, arg1, int2);
- if ((style & SWT.MULTI) != 0) selected = true;
+/* if ((style & SWT.MULTI) != 0) selected = true;
double[] px = new double[1];
double[] py = new double[1];
OS.gdk_event_get_coords(callData, px, py);
@@ -621,10 +601,8 @@ int processMouseDown (int callData, int arg1, int int2) {
if (code != 0) {
int node = OS.gtk_ctree_node_nth (handle, row [0]);
int crow = OS.g_list_nth_data (node, 0);
- GtkCTreeRow row_data = new GtkCTreeRow ();
- OS.memmove (row_data, crow);
- GtkCTree ctree = new GtkCTree();
- OS.memmove (ctree, handle);
+ GtkCTreeRow row_data = new GtkCTreeRow (crow);
+ GtkCTree ctree = new GtkCTree(handle);
int nX = ctree.hoffset + ctree.tree_indent * row_data.level - 2;
int nY = ctree.voffset + (ctree.row_height + 1) * row [0] + 2;
int [] unused = new int [1], check_width = new int [1], check_height = new int [1];
@@ -655,7 +633,7 @@ int processMouseDown (int callData, int arg1, int int2) {
int code = OS.gtk_clist_get_selection_info (handle, x, y, row, column);
if (code != 0) doubleSelected = true;
}
- }
+ }*/
return result;
}
@@ -679,8 +657,7 @@ int processMouseUp (int callData, int arg1, int int2) {
int x = (int)(px[0]), y = (int)(py[0]);
if (!OS.gtk_ctree_is_hot_spot (handle, x, y)) {
if ((style & SWT.SINGLE) != 0) {
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
+ GtkCList clist = new GtkCList (handle);
int list = clist.selection;
if (list != 0 && OS.g_list_length (list) != 0) {
int node = OS.g_list_nth_data (list, 0);
@@ -700,8 +677,7 @@ int processMouseUp (int callData, int arg1, int int2) {
int code = OS.gtk_clist_get_selection_info (handle, x, y, row, column);
if (code != 0) {
int focus = OS.gtk_ctree_node_nth (handle, row [0]);
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
+ GtkCList clist = new GtkCList (handle);
if (selected && clist.selection != 0) {
int length = OS.g_list_length (clist.selection);
for (int i=0; i<length; i++) {
@@ -731,8 +707,7 @@ int processSelection (int int0, int int1, int int2) {
selected = true;
return 0;
}
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
+ GtkCList clist = new GtkCList (handle);
int focus = OS.gtk_ctree_node_nth (handle, clist.focus_row);
if (focus != int0) return 0;
if ((style & SWT.MULTI) != 0) selected = false;
@@ -888,19 +863,6 @@ public void setSelection (TreeItem [] items) {
if (index != length) error (SWT.ERROR_INVALID_ARGUMENT);
}
-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);
-
- if ((style & SWT.CHECK) != 0) {
- uncheck = createCheckPixmap(false);
- check = createCheckPixmap(true);
- }
-}
-
/**
* Shows the selection. If the selection is already showing in the receiver,
* this method simply returns. Otherwise, the items are scrolled until
@@ -918,8 +880,7 @@ void showHandle() {
*/
public void showSelection () {
checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
+ GtkCList clist = new GtkCList (handle);
if (clist.selection == 0) return;
if (OS.g_list_length (clist.selection) == 0) return;
int node = OS.g_list_nth_data (clist.selection, 0);
@@ -954,11 +915,11 @@ public void showItem (TreeItem item) {
if (visibility != OS.GTK_VISIBILITY_NONE) return;
if (!OS.gtk_ctree_is_viewable (handle, node)) {
int parent = node;
- GtkCTreeRow row = new GtkCTreeRow ();
+ GtkCTreeRow row;
OS.gtk_signal_handler_block_by_data (handle, SWT.Expand);
do {
int data = OS.g_list_nth_data (parent, 0);
- OS.memmove (row, data, GtkCTreeRow.sizeof);
+ row = new GtkCTreeRow(data);
if ((parent = row.parent) == 0) break;
OS.gtk_ctree_expand (handle, parent);
} while (true);
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
index 870ca3c1cd..ed65b5a39e 100644
--- 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
@@ -194,9 +194,8 @@ static TreeItem checkNull (TreeItem item) {
*/
public Rectangle getBounds () {
int ctree = parent.handle;
- GtkCTree tree = new GtkCTree();
- OS.memmove(tree, ctree, GtkCTree.sizeof);
-
+ GtkCTree tree = new GtkCTree(ctree);
+/*
double haj = OS.gtk_adjustment_get_value(tree.hadjustment);
double vaj = OS.gtk_adjustment_get_value(tree.vadjustment);
@@ -229,14 +228,14 @@ public Rectangle getBounds () {
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(styleHandle);
+ GtkStyle style = new GtkStyle(styleHandle);*/
/* FIXME */
int width = 50; /*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;
+/* int x = 33+tree.tree_indent*(level-1)+spacing[0]+tree.hoffset;*/
- return new Rectangle (x, y, width, height);
+ return new Rectangle (0, 0, 40, 10);
}
/**
@@ -371,8 +370,7 @@ public Tree getParent () {
public TreeItem getParentItem () {
checkWidget();
int data = OS.g_list_nth_data (handle, 0);
- GtkCTreeRow row = new GtkCTreeRow ();
- OS.memmove (row, data, GtkCTreeRow.sizeof);
+ GtkCTreeRow row = new GtkCTreeRow (data);
if (row.parent == 0) return null;
int ctree = parent.handle;
int index = OS.gtk_ctree_node_get_row_data (ctree, row.parent) - 1;
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
index b8ba9dabaf..a7953b3750 100644
--- 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
@@ -268,8 +268,7 @@ FontData[] getScalableFontList(String faceName) {
FontData[] answer;
// if (faceName==null) {
answer = new FontData[2];
- answer[0] = new FontData("Sans");
- answer[1] = new FontData("Serif");
+ answer[0] = new FontData("helvetica", 12, SWT.ROMAN);
// }
return answer;
}
@@ -277,7 +276,7 @@ FontData[] getNonScalableFontList(String faceName) {
FontData[] answer;
// if (faceName==null) {
answer = new FontData[1];
- answer[0] = new FontData("Monospace");
+ answer[0] = new FontData("fixed", 12, SWT.ROMAN);
// }
return answer;
}
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
index 4633a87d09..d4ea81235a 100644
--- 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
@@ -34,10 +34,10 @@ import org.eclipse.swt.events.*;
* </p>
*/
public class TabFolder extends Composite {
- int notebookHandle;
+
+ int topHandle;
TabItem [] items;
-
/*
* == CONSTRUCTORS ==
*/
@@ -75,42 +75,40 @@ public TabFolder (Composite parent, int style) {
}
/*
- * == HANDLE DANCES, FIRST SPECIES ==
+ * == Handle code ==
*/
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();
+ topHandle = OS.eclipse_fixed_new();
+ handle = OS.gtk_notebook_new ();
+ boxHandle = OS.gtk_event_box_new();
+ fixedHandle = OS.eclipse_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);
+ parent._connectChild(topHandle);
+ OS.gtk_container_add(topHandle, handle);
+ OS.gtk_container_add(topHandle, boxHandle);
+ OS.gtk_container_add(boxHandle, fixedHandle);
+ OS.eclipse_fixed_set_location(topHandle, boxHandle, 2, 33); /* FIXME */
}
void showHandle() {
- OS.gtk_widget_show(eventBoxHandle);
- OS.gtk_widget_show(fixedHandle);
- OS.gtk_widget_show(notebookHandle);
+ OS.gtk_widget_show(topHandle);
OS.gtk_widget_show(handle);
- OS.gtk_widget_realize (notebookHandle);
- OS.gtk_widget_realize (handle);
+ OS.gtk_widget_show(boxHandle);
+ OS.gtk_widget_show(fixedHandle);
}
void register () {
super.register ();
- WidgetTable.put (notebookHandle, this);
+ WidgetTable.put (topHandle, this);
}
void hookEvents () {
super.hookEvents ();
- signal_connect (notebookHandle, "size_allocate", SWT.Resize, 3);
- signal_connect (notebookHandle, "switch_page", SWT.Selection, 4);
+ signal_connect (handle, "switch_page", SWT.Selection, 4);
}
void createWidget (int index) {
@@ -118,21 +116,18 @@ void createWidget (int index) {
items = new TabItem [4];
}
-int topHandle () { return eventBoxHandle; }
-int paintHandle () { return notebookHandle; }
-int parentingHandle () { return handle; }
+int topHandle () { return topHandle; }
+public int paintHandle () { return boxHandle; } /* can't do much :-( */
+int parentingHandle () { return fixedHandle; }
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;
+ if (h==topHandle) return true;
+ return super.isMyHandle(h);
}
public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget ();
//notebookHandle
- int width = _computeSize(wHint, hHint, changed).x;
+/* int width = _computeSize(wHint, hHint, changed).x;
int height = 0;
Point size;
if (layout != null) {
@@ -148,36 +143,37 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
height = Math.max (height, size.y);
Rectangle trim = computeTrim (0, 0, width, height);
width = trim.width; height = trim.height;
- return new Point (width, height);
+ return new Point (width, height);*/
+ /* FIXME */
+ return new Point(300,300);
}
/**
-* Computes the widget trim.
-*/
+ * 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 ****
+ * === 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);
+void _setSize(int width, int height) {
+ OS.eclipse_fixed_set_size(parent.parentingHandle(), topHandle(), width, height);
+ /* FIXME */
+ int w = Math.max(width - 4, 1);
+ int h = Math.max(height - 35, 1);
+ OS.eclipse_fixed_set_size(topHandle, handle, w, h);
layoutCurrent();
- return differentExtent;
}
public Rectangle getClientArea () {
checkWidget();
- 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);
+ int[] sz = new int[2];
+ OS.eclipse_fixed_get_size(topHandle, boxHandle, sz);
+ return new Rectangle(0,0, sz[0], sz[1]);
}
void layoutCurrent() {
@@ -190,7 +186,7 @@ void layoutCurrent() {
}
void createItem (TabItem item, int index) {
- int list = OS.gtk_container_children (notebookHandle);
+ int list = OS.gtk_container_children (handle);
int itemCount = OS.g_list_length (list);
if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_ITEM_NOT_ADDED);
if (itemCount == items.length) {
@@ -200,16 +196,15 @@ void createItem (TabItem item, int index) {
}
// create a new label
- byte [] buffer = new byte [] {0};
- int labelHandle = OS.gtk_label_new (buffer);
+ int labelHandle = OS.gtk_label_new ("");
// create a new fake page
- int stubPage = OS.gtk_fixed_new();
+ int stubPage = OS.eclipse_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_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_notebook_append_page(handle, stubPage, labelHandle);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
OS.gtk_widget_show(labelHandle);
OS.gtk_widget_show(stubPage);
@@ -218,7 +213,7 @@ void createItem (TabItem item, int index) {
item.handle = labelHandle;
System.arraycopy (items, index, items, index + 1, itemCount++ - index);
items [index] = item;
- OS.gtk_notebook_set_show_tabs (notebookHandle, true);
+ OS.gtk_notebook_set_show_tabs (handle, true);
}
/**
@@ -262,7 +257,7 @@ void destroyItem (TabItem item) {
index++;
}
if (index == itemCount) error (SWT.ERROR_ITEM_NOT_REMOVED);
- OS.gtk_notebook_remove_page (notebookHandle, index);
+ OS.gtk_notebook_remove_page (handle, index);
System.arraycopy (items, index + 1, items, index, --itemCount - index);
items [itemCount] = null;
item.handle = 0;
@@ -284,9 +279,8 @@ void destroyItem (TabItem item) {
*/
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);
+ checkWidget();
+ int list = OS.gtk_container_children (handle);
int itemCount = OS.g_list_length (list);
if (!(0 <= index && index < itemCount)) error (SWT.ERROR_CANNOT_GET_ITEM);
return items [index];
@@ -302,10 +296,9 @@ public TabItem getItem (int index) {
* </ul>
*/
public int getItemCount () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ checkWidget();
//return itemCount;
- int list = OS.gtk_container_children (notebookHandle);
+ int list = OS.gtk_container_children (handle);
return OS.g_list_length (list);
}
/**
@@ -325,9 +318,8 @@ public int getItemCount () {
* </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);
+ checkWidget();
+ int list = OS.gtk_container_children (handle);
int itemCount = OS.g_list_length (list);
TabItem [] result = new TabItem [itemCount];
System.arraycopy (items, 0, result, 0, itemCount);
@@ -350,9 +342,8 @@ public TabItem [] getItems () {
* </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);
+ checkWidget();
+ int index = OS.gtk_notebook_get_current_page (handle);
if (index == -1) return new TabItem [0];
return new TabItem [] {items [index]};
}
@@ -368,9 +359,8 @@ public TabItem [] getSelection () {
* </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);
+ checkWidget();
+ return OS.gtk_notebook_get_current_page (handle);
}
/**
@@ -391,10 +381,9 @@ public int getSelectionIndex () {
* </ul>
*/
public int indexOf (TabItem item) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ checkWidget();
if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
- int list = OS.gtk_container_children (notebookHandle);
+ int list = OS.gtk_container_children (handle);
int itemCount = OS.g_list_length (list);
for (int i=0; i<itemCount; i++) {
if (items [i] == item) return i;
@@ -403,7 +392,7 @@ public int indexOf (TabItem item) {
}
int processSelection (int int0, int int1, int int2) {
- int index = OS.gtk_notebook_get_current_page (notebookHandle);
+ int index = OS.gtk_notebook_get_current_page (handle);
if (index != -1) {
Control control = items [index].getControl ();
if (control != null && !control.isDisposed ()) {
@@ -462,9 +451,9 @@ public void removeSelectionListener (SelectionListener listener) {
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);
+ OS.gtk_signal_handler_block_by_data (handle, SWT.Selection);
+ OS.gtk_notebook_set_page (handle, index);
+ OS.gtk_signal_handler_unblock_by_data (handle, SWT.Selection);
}
/**
@@ -480,8 +469,7 @@ public void setSelection (int index) {
* </ul>
*/
public void setSelection (TabItem [] items) {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (!isValidWidget ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ checkWidget();
if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
if (items.length == 0) {
setSelection (-1);
@@ -499,11 +487,11 @@ public void setSelection (TabItem [] items) {
void deregister () {
super.deregister ();
- WidgetTable.remove (notebookHandle);
+ WidgetTable.remove (topHandle);
}
void releaseChildren() {
- int list = OS.gtk_container_children (notebookHandle);
+ int list = OS.gtk_container_children (handle);
int itemCount = OS.g_list_length (list);
for (int i=0; i<itemCount; i++) {
TabItem item = items [i];
@@ -530,7 +518,7 @@ void releaseChildren() {
void releaseHandle () {
super.releaseHandle ();
- notebookHandle = 0;
+ boxHandle = 0;
}
void releaseWidget () {
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
index a11053681d..c84686edbe 100644
--- 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
@@ -89,14 +89,9 @@ static int checkStyle (int style) {
return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
}
-Point _getClientAreaSize () {
- return UtilFuncs.getSize(handle);
-}
-
-boolean _setSize(int width, int height) {
- if (!UtilFuncs.setSize (eventBoxHandle, width, height)) return false;
- UtilFuncs.setSize (scrolledHandle, width, height);
- return true;
+void _setSize(int width, int height) {
+ OS.eclipse_fixed_set_size(parent.parentingHandle(), topHandle(), width, height);
+ OS.eclipse_fixed_set_size(fixedHandle, scrolledHandle, width, height);
}
/**
@@ -163,23 +158,16 @@ public void addTreeListener(TreeListener listener) {
public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget ();
if (wHint == SWT.DEFAULT) wHint = 200;
- return _computeSize (wHint, hHint, changed);
-}
-
-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);
+ return computeNativeSize (scrolledHandle, wHint, hHint, changed);
}
void createHandle (int index) {
state |= HANDLE;
- eventBoxHandle = OS.gtk_event_box_new();
- if (eventBoxHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
+ boxHandle = OS.gtk_event_box_new();
+ if (boxHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- fixedHandle = OS.gtk_fixed_new ();
+ fixedHandle = OS.eclipse_fixed_new ();
if (fixedHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
scrolledHandle = OS.gtk_scrolled_window_new(0,0);
@@ -188,13 +176,30 @@ void createHandle (int index) {
handle = OS.gtk_ctree_new (1, 0);
if (handle == 0) SWT.error (SWT.ERROR_NO_HANDLES);
}
+void configure() {
+ parent._connectChild(topHandle());
+ OS.gtk_container_add (boxHandle, fixedHandle);
+ OS.gtk_container_add (fixedHandle, scrolledHandle);
+ OS.gtk_container_add (scrolledHandle, 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_unselect_row", SWT.Selection, 4);
+ signal_connect (handle, "tree_expand", SWT.Expand, 3);
+ signal_connect (handle, "tree_collapse", SWT.Collapse, 3);
+}
+
+int topHandle() { return boxHandle; }
+int parentingHandle() { return fixedHandle; }
int createCheckPixmap(boolean checked) {
/*
* The box will occupy the whole item width.
*/
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
+ GtkCList clist = new GtkCList (handle);
int check_height = clist.row_height-1;
int check_width = check_height;
@@ -313,8 +318,7 @@ int findSibling (int node, int index) {
int depth = 1;
if (node != 0) {
int data = OS.g_list_nth_data (node, 0);
- GtkCTreeRow row = new GtkCTreeRow ();
- OS.memmove (row, data);
+ GtkCTreeRow row = new GtkCTreeRow (data);
depth = row.level + 1;
}
Index = 0;
@@ -383,8 +387,7 @@ int getItemCount (int node) {
int depth = 1;
if (node != 0) {
int data = OS.g_list_nth_data (node, 0);
- GtkCTreeRow row = new GtkCTreeRow ();
- OS.memmove (row, data);
+ GtkCTreeRow row = new GtkCTreeRow (data);
depth = row.level + 1;
}
Count = 0;
@@ -408,8 +411,7 @@ int getItemCount (int node) {
*/
public int getItemHeight () {
checkWidget ();
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
+ GtkCList clist = new GtkCList (handle);
return clist.row_height + CELL_SPACING;
}
@@ -439,8 +441,7 @@ TreeItem [] getItems (int node) {
int depth = 1;
if (node != 0) {
int data = OS.g_list_nth_data (node, 0);
- GtkCTreeRow row = new GtkCTreeRow ();
- OS.memmove (row, data);
+ GtkCTreeRow row = new GtkCTreeRow (data);
depth = row.level + 1;
}
Count = 0;
@@ -494,8 +495,7 @@ public TreeItem getParentItem () {
*/
public TreeItem[] getSelection () {
checkWidget();
- GtkCList clist = new GtkCList();
- OS.memmove (clist, handle, GtkCList.sizeof);
+ GtkCList clist = new GtkCList(handle);
if (clist.selection == 0) return new TreeItem [0];
int length = OS.g_list_length (clist.selection);
TreeItem [] result = new TreeItem [length];
@@ -519,8 +519,7 @@ public TreeItem[] getSelection () {
*/
public int getSelectionCount () {
checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
+ GtkCList clist = new GtkCList (handle);
if (clist.selection == 0) return 0;
return OS.g_list_length (clist.selection);
}
@@ -555,25 +554,6 @@ int GtkCTreeDispose (int ctree, int node, int data) {
return 0;
}
-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_unselect_row", SWT.Selection, 4);
- signal_connect (handle, "tree_expand", SWT.Expand, 3);
- signal_connect (handle, "tree_collapse", SWT.Collapse, 3);
-}
-
-int topHandle() { return eventBoxHandle; }
-int parentingHandle() { return fixedHandle; }
-
-boolean isMyHandle(int h) {
- if (h==fixedHandle) return true;
- if (h==scrolledHandle) return true;
- if (h==handle) return true;
- return false;
-}
-
int processCollapse (int int0, int int1, int int2) {
int index = OS.gtk_ctree_node_get_row_data (handle, int0) - 1;
Event event = new Event ();
@@ -609,7 +589,7 @@ int processExpand (int int0, int int1, int int2) {
int processMouseDown (int callData, int arg1, int int2) {
doubleSelected = false;
int result = super.processMouseDown (callData, arg1, int2);
- if ((style & SWT.MULTI) != 0) selected = true;
+/* if ((style & SWT.MULTI) != 0) selected = true;
double[] px = new double[1];
double[] py = new double[1];
OS.gdk_event_get_coords(callData, px, py);
@@ -621,10 +601,8 @@ int processMouseDown (int callData, int arg1, int int2) {
if (code != 0) {
int node = OS.gtk_ctree_node_nth (handle, row [0]);
int crow = OS.g_list_nth_data (node, 0);
- GtkCTreeRow row_data = new GtkCTreeRow ();
- OS.memmove (row_data, crow);
- GtkCTree ctree = new GtkCTree();
- OS.memmove (ctree, handle);
+ GtkCTreeRow row_data = new GtkCTreeRow (crow);
+ GtkCTree ctree = new GtkCTree(handle);
int nX = ctree.hoffset + ctree.tree_indent * row_data.level - 2;
int nY = ctree.voffset + (ctree.row_height + 1) * row [0] + 2;
int [] unused = new int [1], check_width = new int [1], check_height = new int [1];
@@ -655,7 +633,7 @@ int processMouseDown (int callData, int arg1, int int2) {
int code = OS.gtk_clist_get_selection_info (handle, x, y, row, column);
if (code != 0) doubleSelected = true;
}
- }
+ }*/
return result;
}
@@ -679,8 +657,7 @@ int processMouseUp (int callData, int arg1, int int2) {
int x = (int)(px[0]), y = (int)(py[0]);
if (!OS.gtk_ctree_is_hot_spot (handle, x, y)) {
if ((style & SWT.SINGLE) != 0) {
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
+ GtkCList clist = new GtkCList (handle);
int list = clist.selection;
if (list != 0 && OS.g_list_length (list) != 0) {
int node = OS.g_list_nth_data (list, 0);
@@ -700,8 +677,7 @@ int processMouseUp (int callData, int arg1, int int2) {
int code = OS.gtk_clist_get_selection_info (handle, x, y, row, column);
if (code != 0) {
int focus = OS.gtk_ctree_node_nth (handle, row [0]);
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
+ GtkCList clist = new GtkCList (handle);
if (selected && clist.selection != 0) {
int length = OS.g_list_length (clist.selection);
for (int i=0; i<length; i++) {
@@ -731,8 +707,7 @@ int processSelection (int int0, int int1, int int2) {
selected = true;
return 0;
}
- GtkCList clist = new GtkCList ();
- OS.memmove (clist, handle, GtkCList.sizeof);
+ GtkCList clist = new GtkCList (handle);
int focus = OS.gtk_ctree_node_nth (handle, clist.focus_row);
if (focus != int0) return 0;
if ((style & SWT.MULTI) != 0) selected = false;
@@ -888,19 +863,6 @@ public void setSelection (TreeItem [] items) {
if (index != length) error (SWT.ERROR_INVALID_ARGUMENT);
}
-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);
-
- if ((style & SWT.CHECK) != 0) {
- uncheck = createCheckPixmap(false);
- check = createCheckPixmap(true);
- }
-}
-
/**
* Shows the selection. If the selection is already showing in the receiver,
* this method simply returns. Otherwise, the items are scrolled until
@@ -918,8 +880,7 @@ void showHandle() {
*/
public void showSelection () {
checkWidget();
- GtkCList clist = new GtkCList ();
- OS.memmove(clist, handle, GtkCList.sizeof);
+ GtkCList clist = new GtkCList (handle);
if (clist.selection == 0) return;
if (OS.g_list_length (clist.selection) == 0) return;
int node = OS.g_list_nth_data (clist.selection, 0);
@@ -954,11 +915,11 @@ public void showItem (TreeItem item) {
if (visibility != OS.GTK_VISIBILITY_NONE) return;
if (!OS.gtk_ctree_is_viewable (handle, node)) {
int parent = node;
- GtkCTreeRow row = new GtkCTreeRow ();
+ GtkCTreeRow row;
OS.gtk_signal_handler_block_by_data (handle, SWT.Expand);
do {
int data = OS.g_list_nth_data (parent, 0);
- OS.memmove (row, data, GtkCTreeRow.sizeof);
+ row = new GtkCTreeRow(data);
if ((parent = row.parent) == 0) break;
OS.gtk_ctree_expand (handle, parent);
} while (true);
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
index 870ca3c1cd..ed65b5a39e 100644
--- 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
@@ -194,9 +194,8 @@ static TreeItem checkNull (TreeItem item) {
*/
public Rectangle getBounds () {
int ctree = parent.handle;
- GtkCTree tree = new GtkCTree();
- OS.memmove(tree, ctree, GtkCTree.sizeof);
-
+ GtkCTree tree = new GtkCTree(ctree);
+/*
double haj = OS.gtk_adjustment_get_value(tree.hadjustment);
double vaj = OS.gtk_adjustment_get_value(tree.vadjustment);
@@ -229,14 +228,14 @@ public Rectangle getBounds () {
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(styleHandle);
+ GtkStyle style = new GtkStyle(styleHandle);*/
/* FIXME */
int width = 50; /*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;
+/* int x = 33+tree.tree_indent*(level-1)+spacing[0]+tree.hoffset;*/
- return new Rectangle (x, y, width, height);
+ return new Rectangle (0, 0, 40, 10);
}
/**
@@ -371,8 +370,7 @@ public Tree getParent () {
public TreeItem getParentItem () {
checkWidget();
int data = OS.g_list_nth_data (handle, 0);
- GtkCTreeRow row = new GtkCTreeRow ();
- OS.memmove (row, data, GtkCTreeRow.sizeof);
+ GtkCTreeRow row = new GtkCTreeRow (data);
if (row.parent == 0) return null;
int ctree = parent.handle;
int index = OS.gtk_ctree_node_get_row_data (ctree, row.parent) - 1;

Back to the top