if (OS.GTK_VERSION < OS.VERSION (2, 4, 0)) {
if (OS.GTK_VERSION >= OS.VERSION (2, 4, 0)) { if (!hasFocus ()) return 0; int  result = super.gtk_key_press_event (widget, event); if (result != 0) return result; int index = 0; while (index < itemCount) { if (items [index].hasFocus ()) break; index++; } GdkEventKey gdkEvent = new GdkEventKey (); OS.memmove (gdkEvent, event, GdkEventKey.sizeof); boolean next = false; switch (gdkEvent.keyval) { case OS.GDK_Up: case OS.GDK_Left: next = false; break; case OS.GDK_Down: case OS.GDK_Right: next = true; break; default: return result; } int start = index, offset = next ? 1 : -1; while ((index = (index + offset + itemCount) % itemCount) != start) { ExpandItem item = items [index]; if (item.setFocus ()) return result; } return result; } else {
int /*long*/ gtk_key_press_event (int /*long*/ widget, int /*long*/ event) {	if (OS.GTK_VERSION < OS.VERSION (2, 4, 0)) {		if (focusIndex != -1) {			ExpandItem item = items [focusIndex];			GdkEventKey keyEvent = new GdkEventKey ();			OS.memmove (keyEvent, event, GdkEventKey.sizeof);			switch (keyEvent.keyval) {				case OS.GDK_Return:				case OS.GDK_space:					Event ev = new Event ();					ev.item = item;					sendEvent (item.expanded ? SWT.Collapse :SWT.Expand, ev);					item.expanded = !item.expanded;					showItem (focusIndex);					break;				case OS.GDK_Up:				case OS.GDK_KP_Up:					if (focusIndex > 0) {						item.redraw ();						focusIndex--;						items [focusIndex].redraw ();					}					break;				case OS.GDK_Down:				case OS.GDK_KP_Down:					if (focusIndex < itemCount - 1) {						item.redraw ();						focusIndex++;						items [focusIndex].redraw ();					}					break;			}		}	}	return super.gtk_key_press_event (widget, event);}