boolean hasDefaultButton () { NSArray windows = application.windows(); long /*int*/ count = windows.count(); for (int i = 0; i < count; i++) { NSWindow window = new NSWindow(windows.objectAtIndex(i)); if (window.defaultButtonCell() != null) { return true; } } return false; }
public static NSArray arrayWithObject(id anObject) { long /*int*/ result = OS.objc_msgSend(OS.class_NSArray, OS.sel_arrayWithObject_, anObject != null ? anObject.id : 0); return result != 0 ? new NSArray(result) : null; }
int indexOf (NSTableColumn column) { return (int)/*64*/((NSTableView)view).tableColumns().indexOfObjectIdenticalTo(column); }
id getCellForColumnAndRowParameter(id parameter, int childID) { id returnValue = null; NSArray parameterObject = new NSArray(parameter.id); if (parameterObject.count() == 2) { AccessibleTableEvent event = new AccessibleTableEvent(this); event.column = new NSNumber(parameterObject.objectAtIndex(0)).intValue(); event.row = new NSNumber(parameterObject.objectAtIndex(1)).intValue(); for (int i = 0; i < accessibleTableListenersSize(); i++) { AccessibleTableListener listener = (AccessibleTableListener)accessibleTableListeners.elementAt(i); listener.getCell(event); returnValue = event.accessible.delegate; } } return returnValue; }
void update (boolean all) { // checkWidget(); NSArray isPainting = display.isPainting; if (isPainting.containsObject(view)) return; for (int i = 0, length = (int)/*64*/isPainting.count(); i < length; i++) { NSView view = new NSView(isPainting.objectAtIndex(i)); if (view.isDescendantOf(this.view)) return; } if (isResizing()) return; Shell shell = getShell(); NSWindow window = shell.deferFlushing && shell.scrolling ? view.window() : null; try { if (window != null) { window.retain(); window.disableFlushWindow(); } //TODO - not all view.displayIfNeeded (); } finally { if (window != null) { window.enableFlushWindow(); window.release(); } } }
long /*int*/ accessibilityAttributeNames(long /*int*/ id, long /*int*/ sel) { long /*int*/ returnValue = super.accessibilityAttributeNames(id, sel); if (id == accessibleHandle()) { if ((style & (SWT.CHECK|SWT.RADIO)) !=0) { NSArray baseArray = new NSArray(returnValue); NSMutableArray ourNames = NSMutableArray.arrayWithCapacity(baseArray.count() + 1); ourNames.addObjectsFromArray(baseArray); ourNames.addObject(OS.NSAccessibilityValueAttribute); returnValue = ourNames.id; } else if ((style & SWT.DROP_DOWN) != 0) { NSArray baseArray = new NSArray(returnValue); NSMutableArray ourNames = NSMutableArray.arrayWithCapacity(baseArray.count() + 1); ourNames.addObjectsFromArray(baseArray); ourNames.addObject(OS.NSAccessibilityChildrenAttribute); returnValue = ourNames.id; } } else { returnValue = super.accessibilityAttributeNames(id, sel); } return returnValue; }
NSScreen getPrimaryScreen () { NSArray screens = NSScreen.screens(); return new NSScreen(screens.objectAtIndex(0)); }
id getVisibleColumnsAttribute(int childID) { if (accessibleTableListenersSize() == 0) return null; id returnValue = null; AccessibleTableEvent event = new AccessibleTableEvent(this); for (int i = 0; i < accessibleTableListenersSize(); i++) { AccessibleTableListener listener = (AccessibleTableListener)accessibleTableListeners.elementAt(i); listener.getVisibleColumns(event); } if (event.accessibles != null) { NSMutableArray array = NSMutableArray.arrayWithCapacity(event.accessibles.length); Accessible[] accessibles = event.accessibles; for (int i = 0; i < accessibles.length; i++) { Accessible acc = accessibles[i]; array.addObject(acc.delegate); } returnValue = array; } return returnValue == null ? NSArray.array() : returnValue; }
boolean writeSelectionToPasteboard(long /*int*/ id, long /*int*/ sel, long /*int*/ pasteboardObj, long /*int*/ typesObj) { boolean result = false; NSPasteboard pboard = new NSPasteboard(pasteboardObj); NSArray types = new NSArray(typesObj); NSMutableArray typesToDeclare = NSMutableArray.arrayWithCapacity(2); NSString type; for (long /*int*/ i = 0; i < supportedPboardTypes.count(); i++) { type = new NSString(supportedPboardTypes.objectAtIndex(i)); if (types.containsObject(type)) typesToDeclare.addObject(type); } if (typesToDeclare.count() > 0) { pboard.declareTypes(typesToDeclare, view); for (long /*int*/ i = 0; i < typesToDeclare.count(); i++) { type = new NSString(typesToDeclare.objectAtIndex(i)); if (writeSelectionToPasteboard(pboard, type)) result = true; } } return result; }
return NSArray.arrayWithObject(nextView.view).id; else return NSArray.array().id; } else if (attributeName.isEqualToString (OS.NSAccessibilityPreviousContentsAttribute)) { Control[] children = parent._getChildren(); return NSArray.arrayWithObject(nextView.view).id; else return NSArray.array().id;
void copyToClipboard (char [] buffer) { if (buffer.length == 0) return; NSPasteboard pasteboard = NSPasteboard.generalPasteboard (); if (pasteboard == null) return; pasteboard.declareTypes (NSArray.arrayWithObject (OS.NSStringPboardType), null); pasteboard.setString (NSString.stringWithCharacters (buffer, buffer.length), OS.NSStringPboardType); }
NSArray accessibilityActionNames() { if (actionNames != null) return retainedAutoreleased(actionNames); actionNames = accessible.internal_accessibilityActionNames(childID); actionNames.retain(); return retainedAutoreleased(actionNames); }
public void internal_dispose_SWTAccessibleDelegate() { if (actionNames != null) actionNames.release(); actionNames = null; if (attributeNames != null) attributeNames.release(); attributeNames = null; if (parameterizedAttributeNames != null) parameterizedAttributeNames.release(); parameterizedAttributeNames = null; if (delegateJniRef != 0) OS.DeleteGlobalRef(delegateJniRef); delegateJniRef = 0; OS.object_setInstanceVariable(this.id, SWT_OBJECT, 0); }
boolean acceptsFirstResponder (long /*int*/ id, long /*int*/ sel) { if ((state & CANVAS) != 0) { if ((style & SWT.NO_FOCUS) == 0 && hooksKeys ()) { if (contentView().subviews().count() == 0) return true; } return false; } return super.acceptsFirstResponder (id, sel); }
boolean readSelectionFromPasteboard(long /*int*/ id, long /*int*/ sel, long /*int*/ pasteboard) { boolean result = false; NSPasteboard pboard = new NSPasteboard(pasteboard); NSArray availableTypes = pboard.types(); NSString type; for (long /*int*/ i = 0; i < supportedPboardTypes.count(); i++) { if (result) break; type = new NSString(supportedPboardTypes.objectAtIndex(i)); if (availableTypes.containsObject(type)) { result = readSelectionFromPasteboard(pboard, type); } } return result; }
return 1; } else if (sel == OS.sel_application_openFiles_) { NSArray files = new NSArray(arg1); long /*int*/ count = files.count(); for (int i=0; i<count; i++) { String file = new NSString(files.objectAtIndex(i)).getString(); Event event = new Event(); event.text = file;
long /*int*/ accessibilityActionNames(long /*int*/ id, long /*int*/ sel) { long /*int*/ returnValue = super.accessibilityActionNames(id, sel); if (id == accessibleHandle()) { if ((style & SWT.DROP_DOWN) != 0) { NSArray baseArray = new NSArray(returnValue); NSMutableArray ourNames = NSMutableArray.arrayWithCapacity(baseArray.count() + 1); ourNames.addObjectsFromArray(baseArray); ourNames.addObject(OS.NSAccessibilityShowMenuAction); returnValue = ourNames.id; } } else { returnValue = super.accessibilityActionNames(id, sel); } return returnValue; }
boolean tableView_shouldReorderColumn_toColumn(long /*int*/ id, long /*int*/ sel, long /*int*/ aTableView, long /*int*/ currentColIndex, long /*int*/ newColIndex) { // Check column should never move and no column can be dragged to the left of it, if present. if ((style & SWT.CHECK) != 0) { if (currentColIndex == 0) return false; if (newColIndex == 0) return false; } NSTableView widget = new NSTableView(aTableView); id nsColumn = widget.tableColumns().objectAtIndex(currentColIndex); for (int i = 0; i < columnCount; i++) { if (columns[i].nsColumn.id == nsColumn.id) { return columns[i].movable; } } return true; }