public NSRect(Rectangle2D rect) { this.origin = new NSPoint(rect.getX(), rect.getY()); this.size = new NSSize(rect.getWidth(), rect.getHeight()); }
public NSRect(double w, double h) { this.origin = new NSPoint(0, 0); this.size = new NSSize(w, h); }
public NSRect(Point2D origin, Dimension2D size) { this.origin = new NSPoint(origin); this.size = new NSSize(size); }
public NSRect() { this(new NSPoint(0, 0), new NSSize()); }
private NSImage convert(final String name, final NSImage icon, final Integer width, final Integer height) { if(StringUtils.endsWith(name, "pdf")) { icon.setTemplate(true); } if(null == width || null == height) { log.debug(String.format("Return default size for %s", icon.name())); return icon; } // Cache sized image icon.setName(String.format("%d-%s", width, name)); icon.setSize(new NSSize(width, height)); return icon; } }
public NSSize windowWillResize_toSize(final NSWindow window, final NSSize newSize) { // Only allow horizontal sizing return new NSSize(newSize.width.doubleValue(), window.frame().size.height.doubleValue()); }
if(event != null) { NSPoint dragPosition = view.convertPoint_fromView(event.locationInWindow(), null); NSRect imageRect = new NSRect(new NSPoint(dragPosition.x.doubleValue() - 16, dragPosition.y.doubleValue() - 16), new NSSize(32, 32)); view.dragPromisedFilesOfTypes(NSMutableArray.arrayWithObject(fileTypes.iterator().next()), imageRect, this.id(), true, event);
/** * Resize window frame to fit the content view of the currently selected tab. */ private void resize() { final NSRect windowFrame = NSWindow.contentRectForFrameRect_styleMask(window.frame(), window.styleMask()); final double height = this.getMinWindowHeight(); final NSRect frameRect = new NSRect( new NSPoint(windowFrame.origin.x.doubleValue(), windowFrame.origin.y.doubleValue() + windowFrame.size.height.doubleValue() - height), new NSSize(windowFrame.size.width.doubleValue(), height) ); window.setFrame_display_animate(NSWindow.frameRectForContentRect_styleMask(frameRect, window.styleMask()), true, window.isVisible()); }
@Override public void setWindow(NSWindow window) { window.setExcludedFromWindowsMenu(true); window.setFrameAutosaveName("Preferences"); window.setContentMinSize(window.frame().size); window.setContentMaxSize(new NSSize(800, window.frame().size.height.doubleValue())); super.setWindow(window); }
@Override public void setWindow(final NSWindow window) { window.setContentMinSize(window.frame().size); window.setContentMaxSize(new NSSize(600, window.frame().size.height.doubleValue())); this.addObserver(new BookmarkObserver() { @Override public void change(final Host bookmark) { window.setTitle(BookmarkNameProvider.toString(bookmark)); } }); super.setWindow(window); cascade = this.cascade(cascade); }
@Override public void setWindow(NSWindow window) { window.setFrameAutosaveName("Transfers"); window.setContentMinSize(new NSSize(400d, 150d)); window.setMovableByWindowBackground(true); window.setTitle(LocaleFactory.localizedString("Transfers")); if(window.respondsToSelector(Foundation.selector("setTabbingIdentifier:"))) { window.setTabbingIdentifier(preferences.getProperty("queue.window.tabbing.identifier")); } super.setWindow(window); }
@Override public void setWindow(final NSWindow window) { window.setFrameAutosaveName("Info"); window.setHidesOnDeactivate(false); window.setShowsResizeIndicator(true); window.setContentMinSize(window.frame().size); window.setContentMaxSize(new NSSize(600, window.frame().size.height.doubleValue())); super.setWindow(window); if(!preferences.getBoolean("browser.info.inspector")) { cascade = this.cascade(cascade); } }
/** * @param rowIndexes is the list of row numbers that will be participating in the drag. * @return To refuse the drag, return false. To start a drag, return true and place * the drag data onto pboard (data, owner, and so on). * @see NSTableView.DataSource * Invoked by view after it has been determined that a drag should begin, but before the drag has been started. * The drag image and other drag-related information will be set up and provided by the table view once this call * returns with true. */ @Override public boolean tableView_writeRowsWithIndexes_toPasteboard(final NSTableView view, final NSIndexSet rowIndexes, final NSPasteboard pboard) { for(NSUInteger index = rowIndexes.firstIndex(); !index.equals(NSIndexSet.NSNotFound); index = rowIndexes.indexGreaterThanIndex(index)) { pasteboard.add(this.getSource().get(index.intValue())); } NSEvent event = NSApplication.sharedApplication().currentEvent(); if(event != null) { NSPoint dragPosition = view.convertPoint_fromView(event.locationInWindow(), null); NSRect imageRect = new NSRect(new NSPoint(dragPosition.x.doubleValue() - 16, dragPosition.y.doubleValue() - 16), new NSSize(32, 32)); // Writing a promised file of the host as a bookmark file to the clipboard view.dragPromisedFilesOfTypes(NSArray.arrayWithObject("duck"), imageRect, this.id(), true, event); return true; } return false; }
@Action public void setDonateButton(NSButton button) { if(!Factory.Platform.osversion.matches("10\\.(7|8|9).*")) { button.setTitle(LocaleFactory.localizedString("Get a registration key!", "License")); button.setAction(Foundation.selector("donateMenuClicked:")); button.sizeToFit(); NSView view = NSView.create(); view.setFrameSize(new NSSize(button.frame().size.width.doubleValue() + 10d, button.frame().size.height.doubleValue())); view.addSubview(button); accessoryView = NSTitlebarAccessoryViewController.create(); accessoryView.setLayoutAttribute(NSTitlebarAccessoryViewController.NSLayoutAttributeRight); accessoryView.setView(view); } }
@Override public void setWindow(NSWindow window) { // Save frame rectangle window.setFrameAutosaveName("Browser"); window.setTitle(preferences.getProperty("application.name")); window.setMiniwindowImage(IconCacheFactory.<NSImage>get().iconNamed("cyberduck-document.icns")); window.setMovableByWindowBackground(true); window.setCollectionBehavior(window.collectionBehavior() | NSWindow.NSWindowCollectionBehavior.NSWindowCollectionBehaviorFullScreenPrimary); window.setContentMinSize(new NSSize(600d, 200d)); if(window.respondsToSelector(Foundation.selector("setTabbingIdentifier:"))) { window.setTabbingIdentifier(preferences.getProperty("browser.window.tabbing.identifier")); } super.setWindow(window); // Accept file promises from history tab window.registerForDraggedTypes(NSArray.arrayWithObject(NSPasteboard.FilesPromisePboardType)); cascade = this.cascade(cascade); }
button.setAction(bandwidth.action()); item.setView(button); item.setMaxSize(new NSSize(button.frame().size.width.doubleValue(), button.frame().size.height.doubleValue())); return item; button.selectItemAtIndex(button.indexOfItemWithRepresentedObject(preferences.getProperty("queue.connections.limit"))); item.setView(button); item.setMaxSize(new NSSize(button.frame().size.width.doubleValue(), button.frame().size.height.doubleValue())); return item;
button.setNumberOfVisibleItems(bookmarks.size() > 10 ? new NSInteger(10) : new NSInteger(bookmarks.size())); item.setView(button); item.setMaxSize(new NSSize(button.frame().size.width.doubleValue(), button.frame().size.height.doubleValue())); return item;