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; } }
/** * Overlay badge image. * * @param badge Overlay * @param icon Icon * @return Cached icon */ @Override protected NSImage badge(final NSImage badge, final NSImage icon) { NSImage f = NSImage.imageWithSize(icon.size()); f.lockFocus(); icon.drawInRect(new NSRect(new NSPoint(0, 0), icon.size()), NSZeroRect, NSGraphics.NSCompositeSourceOver, 1.0f); badge.drawInRect(new NSRect(new NSPoint(0, 0), badge.size()), NSZeroRect, NSGraphics.NSCompositeSourceOver, 1.0f); f.unlockFocus(); return f; }
public void drawInRect(NSRect rect, NSRect fromRect, int operation, double delta) { this.drawInRect_fromRect_operation_fraction(rect, fromRect, operation, new CGFloat(delta)); }
@Override public NSImage image() { final NSImage image = IconCacheFactory.<NSImage>get().iconNamed(String.format("%s.tiff", "outline"), 16); image.setTemplate(true); return image; } },
image = NSImage.imageWithContentsOfFile(name); image = NSImage.imageNamed(String.format("%d-%s", width, name)); if(null == image) { image = NSImage.imageNamed(name);
public static NSImage imageWithData(NSData data) { return CLASS.alloc().initWithData(data); }
public static NSImage imageWithContentsOfFile(String filename) { return CLASS.alloc().initWithContentsOfFile(filename); }
public static NSImage imageWithSize(NSSize size) { return CLASS.alloc().initWithSize(size); }
public NSImage image() { final NSImage image = IconCacheFactory.<NSImage>get().iconNamed(String.format("%s.tiff", name()), 16); image.setTemplate(true); return image; } }
@Action public void setAddBookmarkButton(NSButton addBookmarkButton) { this.addBookmarkButton = addBookmarkButton; this.addBookmarkButton.setTarget(this.id()); this.addBookmarkButton.setAction(Foundation.selector("addBookmarkButtonClicked:")); this.addBookmarkButton.image().setTemplate(true); }
@Action public void setEditBookmarkButton(NSButton editBookmarkButton) { this.editBookmarkButton = editBookmarkButton; this.editBookmarkButton.setEnabled(false); this.editBookmarkButton.setTarget(this.id()); this.editBookmarkButton.setAction(Foundation.selector("editBookmarkButtonClicked:")); this.editBookmarkButton.image().setTemplate(true); }
@Action public void setDeleteBookmarkButton(NSButton deleteBookmarkButton) { this.deleteBookmarkButton = deleteBookmarkButton; this.deleteBookmarkButton.setEnabled(false); this.deleteBookmarkButton.setTarget(this.id()); this.deleteBookmarkButton.setAction(Foundation.selector("deleteBookmarkButtonClicked:")); this.deleteBookmarkButton.image().setTemplate(true); }
@Action public void setUpButton(NSSegmentedControl upButton) { this.upButton = upButton; this.upButton.setTarget(this.id()); this.upButton.setAction(Foundation.selector("upButtonClicked:")); this.upButton.setImage_forSegment(IconCacheFactory.<NSImage>get().iconNamed("nav-up.tiff"), NavigationSegment.up.position()); this.upButton.imageForSegment(NavigationSegment.up.position()).setTemplate(true); }
@Action public void setNavigationButton(NSSegmentedControl navigationButton) { this.navigationButton = navigationButton; this.navigationButton.setTarget(this.id()); this.navigationButton.setAction(Foundation.selector("navigationButtonClicked:")); final NSSegmentedCell cell = Rococoa.cast(this.navigationButton.cell(), NSSegmentedCell.class); this.navigationButton.setImage_forSegment(IconCacheFactory.<NSImage>get().iconNamed("nav-backward.tiff"), NavigationSegment.back.position()); this.navigationButton.imageForSegment(NavigationSegment.back.position()).setTemplate(true); cell.setToolTip_forSegment(LocaleFactory.localizedString("Back", "Main"), NavigationSegment.back.position()); this.navigationButton.setImage_forSegment(IconCacheFactory.<NSImage>get().iconNamed("nav-forward.tiff"), NavigationSegment.forward.position()); this.navigationButton.imageForSegment(NavigationSegment.forward.position()).setTemplate(true); cell.setToolTip_forSegment(LocaleFactory.localizedString("Forward", "Main"), NavigationSegment.forward.position()); }
image.setTemplate(true); m.setImage(image); m.setRepresentedObject(bytes);