Mercurial > projects > dwt-mac
diff dwt/widgets/Widget.d @ 37:642f460a0908
Fixed a lot of compile errors, a "hello world" app compiles now
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Fri, 10 Oct 2008 12:29:48 +0200 |
parents | dfcc6c4c4317 |
children | d8635bb48c7c |
line wrap: on
line diff
--- a/dwt/widgets/Widget.d Tue Oct 07 12:56:18 2008 +0200 +++ b/dwt/widgets/Widget.d Fri Oct 10 12:29:48 2008 +0200 @@ -146,11 +146,11 @@ display = parent.display; } -void callSuper(objc.id id, int selector, int arg0) { +void callSuper(objc.id id, String selector, objc.id arg0) { objc_super super_struct; super_struct.receiver = id; - super_struct.cls = OS.objc_msgSend(id, OS.sel_superclass); - OS.objc_msgSendSuper(super_struct, selector, arg0); + super_struct.cls = cast(objc.Class) OS.objc_msgSend(id, OS.sel_superclass); + OS.objc_msgSendSuper(&super_struct, selector, arg0); } bool acceptsFirstResponder () { @@ -314,7 +314,7 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -protected void checkWidget () { +public void checkWidget () { Display display = this.display; if (display is null) error (DWT.ERROR_WIDGET_DISPOSED); if (display.thread !is Thread.getThis ()) error (DWT.ERROR_THREAD_INVALID_ACCESS); @@ -331,13 +331,13 @@ void createHandle () { } -/*void createJNIRef () { +void createJNIRef () { jniRef = OS.NewGlobalRef(this); if (jniRef is 0) error (DWT.ERROR_NO_HANDLES); -}*/ +} void createWidget () { - //createJNIRef (); + createJNIRef (); createHandle (); } @@ -385,8 +385,8 @@ void drawRect(objc.id id, NSRect rect) { objc_super super_struct; super_struct.receiver = id; - super_struct.cls = OS.objc_msgSend(id, OS.sel_superclass); - OS.objc_msgSendSuper(super_struct, OS.sel_drawRect_1, rect); + super_struct.cls = cast(objc.Class) OS.objc_msgSend(id, OS.sel_superclass); + OS.objc_msgSendSuper(&super_struct, OS.sel_drawRect_1, rect); } void drawWidget (int control, int context, int damageRgn, int visibleRgn, int theEvent) { @@ -613,7 +613,7 @@ } bool isValidSubclass () { - return Display.isValidClass (getClass ()); + return Display.isValidClass (this.classinfo); } bool isValidThread () { @@ -751,8 +751,8 @@ void releaseHandle () { state |= DISPOSED; display = null; - //if (jniRef !is 0) OS.DeleteGlobalRef(jniRef); - //jniRef = 0; + if (jniRef !is 0) OS.DeleteGlobalRef(jniRef); + jniRef = 0; } void releaseParent () { @@ -963,10 +963,10 @@ */ public void setData (Object data) { checkWidget(); - if (SAFARI_EVENTS_FIX_KEY.equals (data)) { + /*if (SAFARI_EVENTS_FIX_KEY.equals (data)) { state |= SAFARI_EVENTS_FIX; return; - } + }*/ if ((state & KEYED_DATA) !is 0) { (cast(ArrayWrapperObject) this.data).array [0] = data; } else { @@ -1006,7 +1006,8 @@ if ((state & KEYED_DATA) !is 0) { table = (cast(ArrayWrapperObject) data).array; while (index < table.length) { - if (key.equals (table [index])) break; + String tablekey = (cast(ArrayWrapperString)table[index]).array; + if (key.equals (tablekey)) break; index += 2; } } @@ -1015,15 +1016,16 @@ if (index is table.length) { Object [] newTable = new Object [table.length + 2]; System.arraycopy (table, 0, newTable, 0, table.length); - data = table = newTable; + table = newTable; + data = new ArrayWrapperObject( table ); } } else { table = new Object [3]; table [0] = data; - data = table; + data = new ArrayWrapperObject( table ); state |= KEYED_DATA; } - table [index] = key; + table [index] = new ArrayWrapperString( key ); table [index + 1] = value; } else { if ((state & KEYED_DATA) !is 0) { @@ -1036,7 +1038,7 @@ Object [] newTable = new Object [length]; System.arraycopy (table, 0, newTable, 0, index); System.arraycopy (table, index + 2, newTable, index, length - index); - data = newTable; + data = new ArrayWrapperObject( newTable ); } } } @@ -1251,7 +1253,7 @@ string = "*Wrong Thread*"; if (isValidThread ()) string = getNameText (); } - return getName () + " {" + string + "}"; + return getName () ~ " {" ~ string ~ "}"; } void willSelectTabViewItem(int tabView, int tabViewItem) { @@ -1270,7 +1272,7 @@ } void windowSendEvent(objc.id id, objc.id event) { - callSuper(objc.id, OS.sel_sendEvent_1, event); + callSuper(id, OS.sel_sendEvent_1, event); } bool windowShouldClose(int window) {