ClipboardProxy(Display display) { this.display = display; getFunc = new Callback( this, "getFunc", 4); //$NON-NLS-1$ if (getFunc.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); clearFunc = new Callback( this, "clearFunc", 2); //$NON-NLS-1$ if (clearFunc.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); }
static private Callback newCallback (Object object, String method, int argCount) { Callback callback = new Callback (object, method, argCount); if (callback.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); return callback; }
ClipboardProxy(Display display) { this.display = display; getFunc = new Callback( this, "getFunc", 4); //$NON-NLS-1$ if (getFunc.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); clearFunc = new Callback( this, "clearFunc", 2); //$NON-NLS-1$ if (clearFunc.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); }
static private Callback newCallback (Object object, String method, int argCount) { Callback callback = new Callback (object, method, argCount); if (callback.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); return callback; }
ClipboardProxy(Display display) { this.display = display; getFunc = new Callback( this, "getFunc", 4); //$NON-NLS-1$ if (getFunc.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); clearFunc = new Callback( this, "clearFunc", 2); //$NON-NLS-1$ if (clearFunc.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); }
static private Callback newCallback (Object object, String method, int argCount) { Callback callback = new Callback (object, method, argCount); if (callback.getAddress () == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); return callback; }
void addWindowSubclass () { int /*long*/ hwndChild = OS.GetWindow (browser.handle, OS.GW_CHILD); if (SubclassProc == null) { SubclassProc = new Callback (MozillaDelegate.class, "windowProc", 4); //$NON-NLS-1$ MozillaProc = OS.GetWindowLongPtr (hwndChild, OS.GWL_WNDPROC); } OS.SetWindowLongPtr (hwndChild, OS.GWL_WNDPROC, SubclassProc.getAddress ()); }
public XPCOMObject (int[] argCounts) { int /*long*/[] callbackAddresses = new int /*long*/[argCounts.length + OS_OFFSET]; synchronized (Callbacks) { for (int i = 0, length = argCounts.length; i < length; i++) { if ((Callbacks[i + OS_OFFSET][argCounts[i]]) == null) { Callbacks[i + OS_OFFSET][argCounts[i]] = new Callback (getClass (), "callback"+i, argCounts[i] + 1, true, XPCOM.NS_ERROR_FAILURE); //$NON-NLS-1$ } callbackAddresses[i + OS_OFFSET] = Callbacks[i + OS_OFFSET][argCounts[i]].getAddress (); if (callbackAddresses[i + OS_OFFSET] == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); } } int /*long*/ pVtable = C.malloc (C.PTR_SIZEOF * (argCounts.length + OS_OFFSET)); XPCOM.memmove (pVtable, callbackAddresses, C.PTR_SIZEOF * (argCounts.length + OS_OFFSET)); ppVtable = C.malloc (C.PTR_SIZEOF); XPCOM.memmove (ppVtable, new int /*long*/[] {pVtable}, C.PTR_SIZEOF); ObjectMap.put (new LONG (ppVtable), this); }
public XPCOMObject (int[] argCounts) { long /*int*/[] callbackAddresses = new long /*int*/[argCounts.length + OS_OFFSET]; synchronized (Callbacks) { for (int i = 0, length = argCounts.length; i < length; i++) { if ((Callbacks[i + OS_OFFSET][argCounts[i]]) == null) { Callbacks[i + OS_OFFSET][argCounts[i]] = new Callback (getClass (), "callback"+i, argCounts[i] + 1, true, XPCOM.NS_ERROR_FAILURE); //$NON-NLS-1$ } callbackAddresses[i + OS_OFFSET] = Callbacks[i + OS_OFFSET][argCounts[i]].getAddress (); if (callbackAddresses[i + OS_OFFSET] == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); } } long /*int*/ pVtable = C.malloc (C.PTR_SIZEOF * (argCounts.length + OS_OFFSET)); XPCOM.memmove (pVtable, callbackAddresses, C.PTR_SIZEOF * (argCounts.length + OS_OFFSET)); ppVtable = C.malloc (C.PTR_SIZEOF); XPCOM.memmove (ppVtable, new long /*int*/[] {pVtable}, C.PTR_SIZEOF); ObjectMap.put (new LONG (ppVtable), this); }
public XPCOMObject (int[] argCounts) { int /*long*/[] callbackAddresses = new int /*long*/[argCounts.length + OS_OFFSET]; synchronized (Callbacks) { for (int i = 0, length = argCounts.length; i < length; i++) { if ((Callbacks[i + OS_OFFSET][argCounts[i]]) == null) { Callbacks[i + OS_OFFSET][argCounts[i]] = new Callback (getClass (), "callback"+i, argCounts[i] + 1, true, XPCOM.NS_ERROR_FAILURE); //$NON-NLS-1$ } callbackAddresses[i + OS_OFFSET] = Callbacks[i + OS_OFFSET][argCounts[i]].getAddress (); if (callbackAddresses[i + OS_OFFSET] == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); } } int /*long*/ pVtable = C.malloc (C.PTR_SIZEOF * (argCounts.length + OS_OFFSET)); XPCOM.memmove (pVtable, callbackAddresses, C.PTR_SIZEOF * (argCounts.length + OS_OFFSET)); ppVtable = C.malloc (C.PTR_SIZEOF); XPCOM.memmove (ppVtable, new int /*long*/[] {pVtable}, C.PTR_SIZEOF); ObjectMap.put (new LONG (ppVtable), this); }
public XPCOMObject (int[] argCounts) { long /*int*/[] callbackAddresses = new long /*int*/[argCounts.length + OS_OFFSET]; synchronized (Callbacks) { for (int i = 0, length = argCounts.length; i < length; i++) { if ((Callbacks[i + OS_OFFSET][argCounts[i]]) == null) { Callbacks[i + OS_OFFSET][argCounts[i]] = new Callback (getClass (), "callback"+i, argCounts[i] + 1, true, XPCOM.NS_ERROR_FAILURE); //$NON-NLS-1$ } callbackAddresses[i + OS_OFFSET] = Callbacks[i + OS_OFFSET][argCounts[i]].getAddress (); if (callbackAddresses[i + OS_OFFSET] == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); } } long /*int*/ pVtable = C.malloc (C.PTR_SIZEOF * (argCounts.length + OS_OFFSET)); XPCOM.memmove (pVtable, callbackAddresses, C.PTR_SIZEOF * (argCounts.length + OS_OFFSET)); ppVtable = C.malloc (C.PTR_SIZEOF); XPCOM.memmove (ppVtable, new long /*int*/[] {pVtable}, C.PTR_SIZEOF); ObjectMap.put (new LONG (ppVtable), this); }
public XPCOMObject (int[] argCounts) { int /*long*/[] callbackAddresses = new int /*long*/[argCounts.length + OS_OFFSET]; synchronized (Callbacks) { for (int i = 0, length = argCounts.length; i < length; i++) { if ((Callbacks[i + OS_OFFSET][argCounts[i]]) == null) { Callbacks[i + OS_OFFSET][argCounts[i]] = new Callback (getClass (), "callback"+i, argCounts[i] + 1, true, XPCOM.NS_ERROR_FAILURE); //$NON-NLS-1$ } callbackAddresses[i + OS_OFFSET] = Callbacks[i + OS_OFFSET][argCounts[i]].getAddress (); if (callbackAddresses[i + OS_OFFSET] == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); } } int /*long*/ pVtable = C.malloc (C.PTR_SIZEOF * (argCounts.length + OS_OFFSET)); XPCOM.memmove (pVtable, callbackAddresses, C.PTR_SIZEOF * (argCounts.length + OS_OFFSET)); ppVtable = C.malloc (C.PTR_SIZEOF); XPCOM.memmove (ppVtable, new int /*long*/[] {pVtable}, C.PTR_SIZEOF); ObjectMap.put (new LONG (ppVtable), this); }
void initClasses () { String className = "SWTPrintPanelDelegate"; if (OS.objc_lookUpClass (className) != 0) return; dialogCallback5 = new Callback(getClass(), "dialogProc", 5); long /*int*/ dialogProc5 = dialogCallback5.getAddress(); if (dialogProc5 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); byte[] types = {'*','\0'}; int size = C.PTR_SIZEOF, align = C.PTR_SIZEOF == 4 ? 2 : 3; long /*int*/ cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0); OS.class_addIvar(cls, SWT_OBJECT, size, (byte)align, types); OS.class_addMethod(cls, OS.sel_panelDidEnd_returnCode_contextInfo_, dialogProc5, "@:@i@"); OS.objc_registerClassPair(cls); }
public COMObject(int[] argCounts) { int /*long*/[] callbackAddresses = new int /*long*/[argCounts.length]; synchronized (Callbacks) { for (int i = 0, length = argCounts.length; i < length; i++){ if ((Callbacks[i][argCounts[i]]) == null) { Callbacks[i][argCounts[i]] = new Callback(this.getClass(), "callback"+i, argCounts[i] + 1, true, COM.E_FAIL); //$NON-NLS-1$ if (Callbacks[i][argCounts[i]].getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); } callbackAddresses[i] = Callbacks[i][argCounts[i]].getAddress(); } } int /*long*/ pVtable = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, OS.PTR_SIZEOF * argCounts.length); COM.MoveMemory(pVtable, callbackAddresses, OS.PTR_SIZEOF * argCounts.length); ppVtable = OS.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, OS.PTR_SIZEOF); COM.MoveMemory(ppVtable, new int /*long*/[] {pVtable}, OS.PTR_SIZEOF); ObjectMap.put(new LONG(ppVtable), this); }
void convertRgn(NSAffineTransform transform) { long /*int*/ newRgn = OS.NewRgn(); Callback callback = new Callback(this, "convertRgn", 4); long /*int*/ proc = callback.getAddress(); if (proc == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); this.transform = transform; OS.QDRegionToRects(handle, OS.kQDParseRegionFromTopLeft, proc, newRgn); this.transform = null; callback.dispose(); OS.CopyRgn(newRgn, handle); OS.DisposeRgn(newRgn); }
static int /*long*/ gtkPrinterFromPrinterData(PrinterData data) { gtk_init(); Callback printerCallback = new Callback(Printer.class, "GtkPrinterFunc_FindNamedPrinter", 2); //$NON-NLS-1$ int /*long*/ GtkPrinterFunc_FindNamedPrinter = printerCallback.getAddress(); if (GtkPrinterFunc_FindNamedPrinter == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); findPrinter = 0; findData = data; OS.gtk_enumerate_printers(GtkPrinterFunc_FindNamedPrinter, 0, 0, true); /* * This call to gdk_threads_leave() is a temporary work around * to avoid deadlocks when gdk_threads_init() is called by native * code outside of SWT (i.e AWT, etc). It ensures that the current * thread leaves the GTK lock acquired by the function above. */ OS.gdk_threads_leave(); printerCallback.dispose (); return findPrinter; }
void sort (int /*long*/ hParent, boolean all) { int itemCount = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETCOUNT, 0, 0); if (itemCount == 0 || itemCount == 1) return; hFirstIndexOf = hLastIndexOf = 0; itemCount = -1; if (sortDirection == SWT.UP || sortDirection == SWT.NONE) { OS.SendMessage (handle, OS.TVM_SORTCHILDREN, all ? 1 : 0, hParent); } else { Callback compareCallback = new Callback (this, "CompareFunc", 3); int /*long*/ lpfnCompare = compareCallback.getAddress (); TVSORTCB psort = new TVSORTCB (); psort.hParent = hParent; psort.lpfnCompare = lpfnCompare; psort.lParam = sortColumn == null ? 0 : indexOf (sortColumn); OS.SendMessage (handle, OS.TVM_SORTCHILDRENCB, all ? 1 : 0, psort); compareCallback.dispose (); } }
void initClasses () { String className = "SWTTextAttachmentCell"; if (OS.objc_lookUpClass(className) != 0) return; textLayoutCallback2 = new Callback(getClass(), "textLayoutProc", 2); long /*int*/ proc2 = textLayoutCallback2.getAddress(); if (proc2 == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); long /*int*/ cellBaselineOffsetProc = OS.CALLBACK_cellBaselineOffset(proc2); long /*int*/ cellSizeProc = OS.CALLBACK_NSTextAttachmentCell_cellSize(proc2); byte[] types = {'*','\0'}; int size = C.PTR_SIZEOF, align = C.PTR_SIZEOF == 4 ? 2 : 3; long /*int*/ cls = OS.objc_allocateClassPair(OS.class_NSCell, className, 0); OS.class_addIvar(cls, SWT_OBJECT, size, (byte)align, types); OS.class_addProtocol(cls, OS.protocol_NSTextAttachmentCell); OS.class_addMethod(cls, OS.sel_cellSize, cellSizeProc, "@:"); OS.class_addMethod(cls, OS.sel_cellBaselineOffset, cellBaselineOffsetProc, "@:"); OS.objc_registerClassPair(cls); }
NSBezierPath getPath() { Callback callback = new Callback(this, "regionToRects", 4); if (callback.getAddress() == 0) SWT.error(SWT.ERROR_NO_MORE_CALLBACKS); NSBezierPath path = NSBezierPath.bezierPath(); path.retain(); OS.QDRegionToRects(handle, OS.kQDParseRegionFromTopLeft, callback.getAddress(), path.id); callback.dispose(); if (path.isEmpty()) path.appendBezierPathWithRect(new NSRect()); return path; }
NSBezierPath getPath(long /*int*/ region) { Callback callback = new Callback(this, "regionToRects", 4); if (callback.getAddress() == 0) error(SWT.ERROR_NO_MORE_CALLBACKS); NSBezierPath path = NSBezierPath.bezierPath(); path.retain(); OS.QDRegionToRects(region, OS.kQDParseRegionFromTopLeft, callback.getAddress(), path.id); callback.dispose(); if (path.isEmpty()) path.appendBezierPathWithRect(new NSRect()); return path; }