diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index a4d26574..977c305e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -49,7 +49,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - run: mvn -B install --file pom.xml + run: mvn -B install --file pom.xml -DskipTest # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl diff --git a/README.md b/README.md index 566ba0c3..d261107c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ [![GitHub Packages](https://github.com/umjammer/rococoa/actions/workflows/maven-publish.yml/badge.svg)](https://github.com/umjammer/rococoa/actions/workflows/maven-publish.yml) +[![CodeQL](https://github.com/umjammer/rococoa/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/umjammer/rococoa/actions/workflows/codeql-analysis.yml) #  Welcome to Rococoa @@ -27,3 +28,10 @@ any other problems. * [Limitations](https://github.com/iterate-ch/rococoa/blob/wiki/Limitations.md) * [Help Wanted](https://github.com/iterate-ch/rococoa/blob/wiki/HelpWanted.md) * [How To](https://github.com/iterate-ch/rococoa/blob/wiki/HowTo.md) + +## TODO + + * https://github.com/ibinti/bugvm + * http://cocoawithlove.com/2009/10/how-blocks-are-implemented-and.html + * http://www.opensource.apple.com/source/libclosure/libclosure-38/BlockImplementation.txt + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 5261ad01..f399ae6d 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ org.rococoa rococoa-parent pom - 0.8.3 + 0.8.4 rococoa-auto @@ -203,6 +203,14 @@ cglib 3.3.0 + + + org.junit + junit-bom + 5.8.1 + pom + import + @@ -218,19 +226,16 @@ org.junit.jupiter junit-jupiter-api - 5.6.2 test org.junit.jupiter junit-jupiter-engine - 5.6.2 test org.junit.platform junit-platform-commons - 1.6.2 test diff --git a/rococoa-auto/pom.xml b/rococoa-auto/pom.xml index 327de62f..12d115c6 100644 --- a/rococoa-auto/pom.xml +++ b/rococoa-auto/pom.xml @@ -10,7 +10,7 @@ org.rococoa rococoa-parent - 0.8.3 + 0.8.4 Rococoa Autogenerated Cocoa Package diff --git a/rococoa-cocoa/pom.xml b/rococoa-cocoa/pom.xml index 930d4dd2..5c3c46ba 100644 --- a/rococoa-cocoa/pom.xml +++ b/rococoa-cocoa/pom.xml @@ -10,7 +10,7 @@ org.rococoa rococoa-parent - 0.8.3 + 0.8.4 Rococoa Cocoa Mappings @@ -23,7 +23,7 @@ maven-surefire-plugin - 3.0.0-M4 + 3.0.0-M5 once false diff --git a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/appkit/AppKitLibrary.java b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/appkit/AppKitLibrary.java index 37b5e6d6..60985c58 100644 --- a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/appkit/AppKitLibrary.java +++ b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/appkit/AppKitLibrary.java @@ -19,7 +19,10 @@ package org.rococoa.cocoa.appkit; +import java.util.Collections; + import org.rococoa.cocoa.foundation.NSRect; +import org.rococoa.internal.RococoaTypeMapper; import com.sun.jna.Library; import com.sun.jna.Native; @@ -28,9 +31,9 @@ * @author paulloy */ public interface AppKitLibrary extends Library { - - public static final AppKitLibrary INSTANCE = (AppKitLibrary) Native.loadLibrary("AppKit", AppKitLibrary.class); - void NSRectFill (NSRect aRect); + public static final AppKitLibrary INSTANCE = Native.load( + "AppKit", AppKitLibrary.class, Collections.singletonMap(Library.OPTION_TYPE_MAPPER, new RococoaTypeMapper())); + void NSRectFill (NSRect aRect); } diff --git a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/appkit/NSColor.java b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/appkit/NSColor.java index b3bbeb74..800de2b6 100644 --- a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/appkit/NSColor.java +++ b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/appkit/NSColor.java @@ -1,36 +1,1017 @@ /* - * Copyright 2007, 2008, 2009 Duncan McGregor + * Copyright (c) 2002-2009 David Kocher. All rights reserved. * - * This file is part of Rococoa, a library to allow Java to talk to Cocoa. + * http://cyberduck.ch/ * - * Rococoa is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * Rococoa is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. + * GNU General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public License - * along with Rococoa. If not, see . + * Bug fixes, suggestions and comments should be sent to: + * dkocher@cyberduck.ch */ package org.rococoa.cocoa.appkit; - +import org.rococoa.ObjCClass; +import org.rococoa.cocoa.CGFloat; +import org.rococoa.cocoa.foundation.NSArray; +import org.rococoa.cocoa.foundation.NSCopying; import org.rococoa.cocoa.foundation.NSObject; -import org.rococoa.Rococoa; +import org.rococoa.cocoa.foundation.NSPasteboard; -/** - * @author paulloy - */ -public abstract class NSColor extends NSObject { - public static final _Class CLASS = Rococoa.createClass("NSColor", _Class.class); //$NON-NLS-1$ - public abstract class _Class extends NSObject._class_ { - public abstract NSColor clearColor(); + +/// native declaration : :35 +public abstract class NSColor extends NSObject implements NSCopying { + @SuppressWarnings("hiding") + private static final _Class CLASS = org.rococoa.Rococoa.createClass("NSColor", _Class.class); + + public static NSColor whiteColor() { + return CLASS.whiteColor(); + } + + public static NSColor darkGrayColor() { + return CLASS.darkGrayColor(); + } + + public static NSColor blueColor() { + return CLASS.blueColor(); + } + + public static NSColor redColor() { + return CLASS.redColor(); + } + + /** + * Original signature : NSColor* controlShadowColor()
+ * Dark border for controls
+ * native declaration : :86 + */ + public static NSColor controlShadowColor() { + return CLASS.controlShadowColor(); + } + + /** + * Original signature : NSColor* controlDarkShadowColor()
+ * Darker border for controls
+ * native declaration : :87 + */ + public static NSColor controlDarkShadowColor() { + return CLASS.controlDarkShadowColor(); + } + + /** + * Original signature : NSColor* controlColor()
+ * Control face and old window background color
+ * native declaration : :88 + */ + public static NSColor controlColor() { + return CLASS.controlColor(); + } + + /** + * Original signature : NSColor* controlHighlightColor()
+ * Light border for controls
+ * native declaration : :89 + */ + public static NSColor controlHighlightColor() { + return CLASS.controlShadowColor(); + } + + /** + * Original signature : NSColor* controlLightHighlightColor()
+ * Lighter border for controls
+ * native declaration : :90 + */ + public static NSColor controlLightHighlightColor() { + return CLASS.controlShadowColor(); + } + + /** + * Original signature : NSColor* controlTextColor()
+ * Text on controls
+ * native declaration : :91 + */ + public static NSColor controlTextColor() { + return CLASS.controlTextColor(); + } + + /** + * Original signature : NSColor* controlBackgroundColor()
+ * Background of large controls (browser, tableview, clipview, ...)
+ * native declaration : :92 + */ + public static NSColor controlBackgroundColor() { + return CLASS.controlBackgroundColor(); + } + + /** + * Original signature : NSColor* selectedControlColor()
+ * Control face for selected controls
+ * native declaration : :93 + */ + public static NSColor selectedControlColor() { + return CLASS.selectedControlColor(); + } + + /** + * Original signature : NSColor* secondarySelectedControlColor()
+ * Color for selected controls when control is not active (that is, not focused)
+ * native declaration : :94 + */ + public static NSColor secondarySelectedControlColor() { + return CLASS.secondarySelectedControlColor(); + } + + /** + * Original signature : NSColor* selectedControlTextColor()
+ * Text on selected controls
+ * native declaration : :95 + */ + public static NSColor selectedControlTextColor() { + return CLASS.controlShadowColor(); + } + + /** + * Original signature : NSColor* disabledControlTextColor()
+ * Text on disabled controls
+ * native declaration : :96 + */ + public static NSColor disabledControlTextColor() { + return CLASS.disabledControlTextColor(); + } + + /** + * Original signature : NSColor* textColor()
+ * Document text
+ * native declaration : :97 + */ + public static NSColor textColor() { + return CLASS.textColor(); + } + + /** + * Original signature : NSColor* textBackgroundColor()
+ * Document text background
+ * native declaration : :98 + */ + public static NSColor textBackgroundColor() { + return CLASS.textBackgroundColor(); + } + + /** + * Original signature : NSColor* selectedTextColor()
+ * Selected document text
+ * native declaration : :99 + */ + public static NSColor selectedTextColor() { + return CLASS.selectedTextColor(); + } + + /** + * Original signature : NSColor* selectedTextBackgroundColor()
+ * Selected document text background
+ * native declaration : :100 + */ + public static NSColor selectedTextBackgroundColor() { + return CLASS.selectedTextBackgroundColor(); + } + + /** + * Original signature : NSColor* gridColor()
+ * Grids in controls
+ * native declaration : :101 + */ + public static NSColor gridColor() { + return CLASS.gridColor(); + } + + /** + * Original signature : NSColor* keyboardFocusIndicatorColor()
+ * Keyboard focus ring around controls
+ * native declaration : :102 + */ + public static NSColor keyboardFocusIndicatorColor() { + return CLASS.keyboardFocusIndicatorColor(); + } + + /** + * Original signature : NSColor* windowBackgroundColor()
+ * Background fill for window contents
+ * native declaration : :103 + */ + public static NSColor windowBackgroundColor() { + return CLASS.windowBackgroundColor(); + } + + /** + * Original signature : NSColor* scrollBarColor()
+ * Scroll bar slot color
+ * native declaration : :105 + */ + public static NSColor scrollBarColor() { + return CLASS.scrollBarColor(); + } + + /** + * Original signature : NSColor* knobColor()
+ * Knob face color for controls
+ * native declaration : :106 + */ + public static NSColor knobColor() { + return CLASS.knobColor(); + } + + /** + * Original signature : NSColor* selectedKnobColor()
+ * Knob face color for selected controls
+ * native declaration : :107 + */ + public static NSColor selectedKnobColor() { + return CLASS.selectedKnobColor(); + } + + /** + * Original signature : NSColor* windowFrameColor()
+ * Window frames
+ * native declaration : :109 + */ + public static NSColor windowFrameColor() { + return CLASS.windowFrameColor(); } - + + /** + * Original signature : NSColor* windowFrameTextColor()
+ * Text on window frames
+ * native declaration : :110 + */ + public static NSColor windowFrameTextColor() { + return CLASS.windowFrameTextColor(); + } + + /** + * Original signature : NSColor* selectedMenuItemColor()
+ * Highlight color for menus
+ * native declaration : :112 + */ + public static NSColor selectedMenuItemColor() { + return CLASS.selectedMenuItemColor(); + } + + /** + * Original signature : NSColor* selectedMenuItemTextColor()
+ * Highlight color for menu text
+ * native declaration : :113 + */ + public static NSColor selectedMenuItemTextColor() { + return CLASS.selectedMenuItemTextColor(); + } + + /** + * Original signature : NSColor* highlightColor()
+ * Highlight color for UI elements (this is abstract and defines the color all highlights tend toward)
+ * native declaration : :115 + */ + public static NSColor highlightColor() { + return CLASS.highlightColor(); + } + + /** + * Original signature : NSColor* shadowColor()
+ * Shadow color for UI elements (this is abstract and defines the color all shadows tend toward)
+ * native declaration : :116 + */ + public static NSColor shadowColor() { + return CLASS.shadowColor(); + } + + /** + * Original signature : NSColor* headerColor()
+ * Background color for header cells in Table/OutlineView
+ * native declaration : :118 + */ + public static NSColor headerColor() { + return CLASS.headerColor(); + } + + /** + * Original signature : NSColor* headerTextColor()
+ * Text color for header cells in Table/OutlineView
+ * native declaration : :119 + */ + public static NSColor headerTextColor() { + return CLASS.headerTextColor(); + } + + /** + * Original signature : NSColor* alternateSelectedControlColor()
+ * Similar to selectedControlColor; for use in lists and tables
+ * native declaration : :122 + */ + public static NSColor alternateSelectedControlColor() { + return CLASS.alternateSelectedControlColor(); + } + + /** + * Original signature : NSColor* alternateSelectedControlTextColor()
+ * Similar to selectedControlTextColor; see alternateSelectedControlColor
+ * native declaration : :123 + */ + public static NSColor alternateSelectedControlTextColor() { + return CLASS.alternateSelectedControlTextColor(); + } + + public interface _Class extends ObjCClass { + /** + * Create NSCalibratedWhiteColorSpace colors.
+ * Original signature : NSColor* colorWithCalibratedWhite(CGFloat, CGFloat)
+ * native declaration : :39 + */ + NSColor colorWithCalibratedWhite_alpha(CGFloat white, CGFloat alpha); + + /** + * Create NSCalibratedRGBColorSpace colors.
+ * Original signature : NSColor* colorWithCalibratedHue(CGFloat, CGFloat, CGFloat, CGFloat)
+ * native declaration : :44 + */ + NSColor colorWithCalibratedHue_saturation_brightness_alpha(CGFloat hue, CGFloat saturation, CGFloat brightness, CGFloat alpha); + + /** + * Original signature : NSColor* colorWithCalibratedRed(CGFloat, CGFloat, CGFloat, CGFloat)
+ * native declaration : :45 + */ + NSColor colorWithCalibratedRed_green_blue_alpha(CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha); + + /** + * Create colors in various device color spaces. In PostScript these colorspaces correspond directly to the device-dependent operators setgray, sethsbcolor, setrgbcolor, and setcmykcolor.
+ * Original signature : NSColor* colorWithDeviceWhite(CGFloat, CGFloat)
+ * native declaration : :50 + */ + NSColor colorWithDeviceWhite_alpha(CGFloat white, CGFloat alpha); + + /** + * Original signature : NSColor* colorWithDeviceHue(CGFloat, CGFloat, CGFloat, CGFloat)
+ * native declaration : :51 + */ + NSColor colorWithDeviceHue_saturation_brightness_alpha(CGFloat hue, CGFloat saturation, CGFloat brightness, CGFloat alpha); + + /** + * Original signature : NSColor* colorWithDeviceRed(CGCGFloat, CGCGFloat, CGCGFloat, CGCGFloat)
+ * native declaration : :52 + */ + NSColor colorWithDeviceRed_green_blue_alpha(CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha); + + /** + * Original signature : NSColor* colorWithDeviceCyan(CGFloat, CGFloat, CGFloat, CGFloat, CGFloat)
+ * native declaration : :53 + */ + NSColor colorWithDeviceCyan_magenta_yellow_black_alpha(CGFloat cyan, CGFloat magenta, CGFloat yellow, CGFloat black, CGFloat alpha); + + /** + * Create named colors from standard color catalogs (such as Pantone).
+ * Original signature : NSColor* colorWithCatalogName(NSString*, NSString*)
+ * native declaration : :58 + */ + NSColor colorWithCatalogName_colorName(com.sun.jna.Pointer listName, com.sun.jna.Pointer colorName); + + /** + * Create colors with arbitrary colorspace. The number of components in the provided array should match the number dictated by the specified colorspace, plus one for alpha (supply 1.0 for opaque colors); otherwise an exception will be raised. If the colorspace is one which cannot be used with NSColors, nil is returned.
+ * Original signature : NSColor* colorWithColorSpace(NSColorSpace*, const CGFloat*, NSInteger)
+ * native declaration : :64 + */ + NSColor colorWithColorSpace_components_count(com.sun.jna.Pointer space, CGFloat components[], int numberOfComponents); + + /** + * Create colors with arbitrary colorspace. The number of components in the provided array should match the number dictated by the specified colorspace, plus one for alpha (supply 1.0 for opaque colors); otherwise an exception will be raised. If the colorspace is one which cannot be used with NSColors, nil is returned.
+ * Original signature : NSColor* colorWithColorSpace(NSColorSpace*, const CGFloat*, NSInteger)
+ * native declaration : :64 + */ + NSColor colorWithColorSpace_components_count(com.sun.jna.Pointer space, java.nio.FloatBuffer components, int numberOfComponents); + + /** + * Some convenience methods to create colors in the calibrated color spaces...
+ * Original signature : NSColor* blackColor()
+ * 0.0 white
+ * native declaration : :70 + */ + NSColor blackColor(); + + /** + * Original signature : NSColor* darkGrayColor()
+ * 0.333 white
+ * native declaration : :71 + */ + NSColor darkGrayColor(); + + /** + * Original signature : NSColor* lightGrayColor()
+ * 0.667 white
+ * native declaration : :72 + */ + NSColor lightGrayColor(); + + /** + * Original signature : NSColor* whiteColor()
+ * 1.0 white
+ * native declaration : :73 + */ + NSColor whiteColor(); + + /** + * Original signature : NSColor* grayColor()
+ * 0.5 white
+ * native declaration : :74 + */ + NSColor grayColor(); + + /** + * Original signature : NSColor* redColor()
+ * 1.0, 0.0, 0.0 RGB
+ * native declaration : :75 + */ + NSColor redColor(); + + /** + * Original signature : NSColor* greenColor()
+ * 0.0, 1.0, 0.0 RGB
+ * native declaration : :76 + */ + NSColor greenColor(); + + /** + * Original signature : NSColor* blueColor()
+ * 0.0, 0.0, 1.0 RGB
+ * native declaration : :77 + */ + NSColor blueColor(); + + /** + * Original signature : NSColor* cyanColor()
+ * 0.0, 1.0, 1.0 RGB
+ * native declaration : :78 + */ + NSColor cyanColor(); + + /** + * Original signature : NSColor* yellowColor()
+ * 1.0, 1.0, 0.0 RGB
+ * native declaration : :79 + */ + NSColor yellowColor(); + + /** + * Original signature : NSColor* magentaColor()
+ * 1.0, 0.0, 1.0 RGB
+ * native declaration : :80 + */ + NSColor magentaColor(); + + /** + * Original signature : NSColor* orangeColor()
+ * 1.0, 0.5, 0.0 RGB
+ * native declaration : :81 + */ + NSColor orangeColor(); + + /** + * Original signature : NSColor* purpleColor()
+ * 0.5, 0.0, 0.5 RGB
+ * native declaration : :82 + */ + NSColor purpleColor(); + + /** + * Original signature : NSColor* brownColor()
+ * 0.6, 0.4, 0.2 RGB
+ * native declaration : :83 + */ + NSColor brownColor(); + + /** + * Original signature : NSColor* clearColor()
+ * 0.0 white, 0.0 alpha
+ * native declaration : :84 + */ + NSColor clearColor(); + + /** + * Original signature : NSColor* controlShadowColor()
+ * Dark border for controls
+ * native declaration : :86 + */ + NSColor controlShadowColor(); + + /** + * Original signature : NSColor* controlDarkShadowColor()
+ * Darker border for controls
+ * native declaration : :87 + */ + NSColor controlDarkShadowColor(); + + /** + * Original signature : NSColor* controlColor()
+ * Control face and old window background color
+ * native declaration : :88 + */ + NSColor controlColor(); + + /** + * Original signature : NSColor* controlHighlightColor()
+ * Light border for controls
+ * native declaration : :89 + */ + NSColor controlHighlightColor(); + + /** + * Original signature : NSColor* controlLightHighlightColor()
+ * Lighter border for controls
+ * native declaration : :90 + */ + NSColor controlLightHighlightColor(); + + /** + * Original signature : NSColor* controlTextColor()
+ * Text on controls
+ * native declaration : :91 + */ + NSColor controlTextColor(); + + /** + * Original signature : NSColor* controlBackgroundColor()
+ * Background of large controls (browser, tableview, clipview, ...)
+ * native declaration : :92 + */ + NSColor controlBackgroundColor(); + + /** + * Original signature : NSColor* selectedControlColor()
+ * Control face for selected controls
+ * native declaration : :93 + */ + NSColor selectedControlColor(); + + /** + * Original signature : NSColor* secondarySelectedControlColor()
+ * Color for selected controls when control is not active (that is, not focused)
+ * native declaration : :94 + */ + NSColor secondarySelectedControlColor(); + + /** + * Original signature : NSColor* selectedControlTextColor()
+ * Text on selected controls
+ * native declaration : :95 + */ + NSColor selectedControlTextColor(); + + /** + * Original signature : NSColor* disabledControlTextColor()
+ * Text on disabled controls
+ * native declaration : :96 + */ + NSColor disabledControlTextColor(); + + /** + * Original signature : NSColor* textColor()
+ * Document text
+ * native declaration : :97 + */ + NSColor textColor(); + + /** + * Original signature : NSColor* textBackgroundColor()
+ * Document text background
+ * native declaration : :98 + */ + NSColor textBackgroundColor(); + + /** + * Original signature : NSColor* selectedTextColor()
+ * Selected document text
+ * native declaration : :99 + */ + NSColor selectedTextColor(); + + /** + * Original signature : NSColor* selectedTextBackgroundColor()
+ * Selected document text background
+ * native declaration : :100 + */ + NSColor selectedTextBackgroundColor(); + + /** + * Original signature : NSColor* gridColor()
+ * Grids in controls
+ * native declaration : :101 + */ + NSColor gridColor(); + + /** + * Original signature : NSColor* keyboardFocusIndicatorColor()
+ * Keyboard focus ring around controls
+ * native declaration : :102 + */ + NSColor keyboardFocusIndicatorColor(); + + /** + * Original signature : NSColor* windowBackgroundColor()
+ * Background fill for window contents
+ * native declaration : :103 + */ + NSColor windowBackgroundColor(); + + /** + * Original signature : NSColor* scrollBarColor()
+ * Scroll bar slot color
+ * native declaration : :105 + */ + NSColor scrollBarColor(); + + /** + * Original signature : NSColor* knobColor()
+ * Knob face color for controls
+ * native declaration : :106 + */ + NSColor knobColor(); + + /** + * Original signature : NSColor* selectedKnobColor()
+ * Knob face color for selected controls
+ * native declaration : :107 + */ + NSColor selectedKnobColor(); + + /** + * Original signature : NSColor* windowFrameColor()
+ * Window frames
+ * native declaration : :109 + */ + NSColor windowFrameColor(); + + /** + * Original signature : NSColor* windowFrameTextColor()
+ * Text on window frames
+ * native declaration : :110 + */ + NSColor windowFrameTextColor(); + + /** + * Original signature : NSColor* selectedMenuItemColor()
+ * Highlight color for menus
+ * native declaration : :112 + */ + NSColor selectedMenuItemColor(); + + /** + * Original signature : NSColor* selectedMenuItemTextColor()
+ * Highlight color for menu text
+ * native declaration : :113 + */ + NSColor selectedMenuItemTextColor(); + + /** + * Original signature : NSColor* highlightColor()
+ * Highlight color for UI elements (this is abstract and defines the color all highlights tend toward)
+ * native declaration : :115 + */ + NSColor highlightColor(); + + /** + * Original signature : NSColor* shadowColor()
+ * Shadow color for UI elements (this is abstract and defines the color all shadows tend toward)
+ * native declaration : :116 + */ + NSColor shadowColor(); + + /** + * Original signature : NSColor* headerColor()
+ * Background color for header cells in Table/OutlineView
+ * native declaration : :118 + */ + NSColor headerColor(); + + /** + * Original signature : NSColor* headerTextColor()
+ * Text color for header cells in Table/OutlineView
+ * native declaration : :119 + */ + NSColor headerTextColor(); + + /** + * Original signature : NSColor* alternateSelectedControlColor()
+ * Similar to selectedControlColor; for use in lists and tables
+ * native declaration : :122 + */ + NSColor alternateSelectedControlColor(); + + /** + * Original signature : NSColor* alternateSelectedControlTextColor()
+ * Similar to selectedControlTextColor; see alternateSelectedControlColor
+ * native declaration : :123 + */ + NSColor alternateSelectedControlTextColor(); + + /** + * Original signature : NSArray* controlAlternatingRowBackgroundColors()
+ * Standard colors for alternating colored rows in tables and lists (for instance, light blue/white; don't assume just two colors)
+ * native declaration : :127 + */ + NSArray controlAlternatingRowBackgroundColors(); + /** + * native declaration : :133
+ * Conversion Error : /// Original signature : NSColor* colorForControlTint(null)
+ * + (NSColor*)colorForControlTint:(null)controlTint; // pass in valid tint to get rough color matching. returns default if invalid tint
+ * (Argument controlTint cannot be converted) + */ + /** + * Original signature : currentControlTint()
+ * returns current system control tint
+ * native declaration : :136 + */ + com.sun.jna.Pointer currentControlTint(); + + /** + * Pasteboard methods
+ * Original signature : NSColor* colorFromPasteboard(NSPasteboard*)
+ * native declaration : :243 + */ + NSColor colorFromPasteboard(NSPasteboard pasteBoard); + + /** + * Pattern methods. Note that colorWithPatternImage: mistakenly returns a non-autoreleased color in 10.1.x and earlier. This has been fixed in (NSAppKitVersionNumber >= NSAppKitVersionNumberWithPatternColorLeakFix), for apps linked post-10.1.x.
+ * Original signature : NSColor* colorWithPatternImage(NSImage*)
+ * native declaration : :248 + */ + NSColor colorWithPatternImage(NSImage image); + + /** + * Global flag for determining whether an application supports alpha. This flag is consulted when an application imports alpha (through color dragging, for instance). The value of this flag also determines whether the color panel has an opacity slider. This value is YES by default, indicating that the opacity components of imported colors will be set to 1.0. If an application wants alpha, it can either set the "NSIgnoreAlpha" default to NO or call the set method below.
+ * This method provides a global approach to removing alpha which might not always be appropriate. Applications which need to import alpha sometimes should set this flag to NO and explicitly make colors opaque in cases where it matters to them.
+ * Original signature : void setIgnoresAlpha(BOOL)
+ * native declaration : :260 + */ + void setIgnoresAlpha(boolean flag); + + /** + * Original signature : BOOL ignoresAlpha()
+ * native declaration : :261 + */ + boolean ignoresAlpha(); + + /** + * Original signature : NSColor* colorWithCIColor(CIColor*)
+ * from NSQuartzCoreAdditions native declaration : :268 + */ +// NSColor colorWithCIColor(CIColor color); + } + + /** + * Original signature : NSColor* highlightWithLevel(CGFloat)
+ * val = 0 => receiver, val = 1 => highlightColor
+ * native declaration : :130 + */ + public abstract NSColor highlightWithLevel(CGFloat val); + + /** + * Original signature : NSColor* shadowWithLevel(CGFloat)
+ * val = 0 => receiver, val = 1 => shadowColor
+ * native declaration : :131 + */ + public abstract NSColor shadowWithLevel(CGFloat val); + + /** + * Set the color: Sets the fill and stroke colors in the current drawing context. If the color doesn't know about alpha, it's set to 1.0. Should be implemented by subclassers.
+ * Original signature : void set()
+ * native declaration : :142 + */ public abstract void set(); + + /** + * Set the fill or stroke colors individually. These should be implemented by subclassers.
+ * Original signature : void setFill()
+ * native declaration : :147 + */ + public abstract void setFill(); + + /** + * Original signature : void setStroke()
+ * native declaration : :148 + */ + public abstract void setStroke(); + + /** + * Get the color space of the color. Should be implemented by subclassers.
+ * Original signature : NSString* colorSpaceName()
+ * native declaration : :153 + */ + public abstract com.sun.jna.Pointer colorSpaceName(); + + /** + * Convert the color to another colorspace, using a colorspace name. This may return nil if the specified conversion cannot be done. The abstract implementation of this method returns the receiver if the specified colorspace matches that of the receiver; otherwise it returns nil. Subclassers who can convert themselves to other colorspaces override this method to do something better.
+ * The version of this method which takes a device description allows the color to specialize itself for the given device. Device descriptions can be obtained from windows, screens, and printers with the "deviceDescription" method.
+ * If device is nil then the current device (as obtained from the currently lockFocus'ed view's window or, if printing, the current printer) is used. The method without the device: argument passes nil for the device.
+ * If colorSpace is nil, then the most appropriate color space is used.
+ * Original signature : NSColor* colorUsingColorSpaceName(NSString*)
+ * native declaration : :164 + */ + public abstract NSColor colorUsingColorSpaceName(com.sun.jna.Pointer colorSpace); + + /** + * Original signature : NSColor* colorUsingColorSpaceName(NSString*, NSDictionary*)
+ * native declaration : :165 + */ + public abstract NSColor colorUsingColorSpaceName_device(com.sun.jna.Pointer colorSpace, com.sun.jna.Pointer deviceDescription); + + /** + * colorUsingColorSpace: will convert existing color to a new colorspace and create a new color, which will likely have different component values but look the same. It will return the same color if the colorspace is already the same as the one specified. Will return nil if conversion is not possible.
+ * Original signature : NSColor* colorUsingColorSpace(NSColorSpace*)
+ * native declaration : :171 + */ + public abstract NSColor colorUsingColorSpace(com.sun.jna.Pointer space); + + /** + * Blend using the NSCalibratedRGB color space. Both colors are converted into the calibrated RGB color space, and they are blended by taking fraction of color and 1 - fraction of the receiver. The result is in the calibrated RGB color space. If the colors cannot be converted into the calibrated RGB color space the blending fails and nil is returned.
+ * Original signature : NSColor* blendedColorWithFraction(CGFloat, NSColor*)
+ * native declaration : :177 + */ + public abstract NSColor blendedColorWithFraction_ofColor(CGFloat fraction, NSColor color); + + /** + * Returns a color in the same color space as the receiver with the specified alpha component. The abstract implementation of this method returns the receiver if alpha is 1.0, otherwise it returns nil; subclassers who have explicit opacity components override this method to actually return a color with the specified alpha.
+ * Original signature : NSColor* colorWithAlphaComponent(CGFloat)
+ * native declaration : :182 + */ + public abstract NSColor colorWithAlphaComponent(CGFloat alpha); + + /** + * Get the catalog and color name of standard colors from catalogs. These colors are special colors which are usually looked up on each device by their name.
+ * Original signature : NSString* catalogNameComponent()
+ * native declaration : :189 + */ + public abstract String catalogNameComponent(); + + /** + * Original signature : NSString* colorNameComponent()
+ * native declaration : :190 + */ + public abstract String colorNameComponent(); + + /** + * Return localized versions of the above.
+ * Original signature : NSString* localizedCatalogNameComponent()
+ * native declaration : :194 + */ + public abstract String localizedCatalogNameComponent(); + + /** + * Original signature : NSString* localizedColorNameComponent()
+ * native declaration : :195 + */ + public abstract String localizedColorNameComponent(); + + /** + * Get the red, green, or blue components of NSCalibratedRGB or NSDeviceRGB colors.
+ * Original signature : CGFloat redComponent()
+ * native declaration : :199 + */ + public abstract CGFloat redComponent(); + + /** + * Original signature : CGFloat greenComponent()
+ * native declaration : :200 + */ + public abstract CGFloat greenComponent(); + + /** + * Original signature : CGFloat blueComponent()
+ * native declaration : :201 + */ + public abstract CGFloat blueComponent(); + + /** + * Original signature : void getRed(CGFloat*, CGFloat*, CGFloat*, CGFloat*)
+ * native declaration : :202 + */ + public abstract void getRed_green_blue_alpha(CGFloat red, CGFloat green, CGFloat blue, CGFloat alpha); + + /** + * Get the components of NSCalibratedRGB or NSDeviceRGB colors as hue, saturation, or brightness.
+ * Original signature : CGFloat hueComponent()
+ * native declaration : :206 + */ + public abstract CGFloat hueComponent(); + + /** + * Original signature : CGFloat saturationComponent()
+ * native declaration : :207 + */ + public abstract CGFloat saturationComponent(); + + /** + * Original signature : CGFloat brightnessComponent()
+ * native declaration : :208 + */ + public abstract CGFloat brightnessComponent(); + + /** + * Original signature : void getHue(CGFloat*, CGFloat*, CGFloat*, CGFloat*)
+ * native declaration : :209 + */ + public abstract void getHue_saturation_brightness_alpha(java.nio.FloatBuffer hue, java.nio.FloatBuffer saturation, java.nio.FloatBuffer brightness, java.nio.FloatBuffer alpha); + + /** + * Get the white component of NSCalibratedWhite or NSDeviceWhite colors.
+ * Original signature : CGFloat whiteComponent()
+ * native declaration : :214 + */ + public abstract CGFloat whiteComponent(); + + /** + * Original signature : void getWhite(CGFloat*, CGFloat*)
+ * native declaration : :215 + */ + public abstract void getWhite_alpha(java.nio.FloatBuffer white, java.nio.FloatBuffer alpha); + + /** + * Get the CMYK components of NSDeviceCMYK colors.
+ * Original signature : CGFloat cyanComponent()
+ * native declaration : :220 + */ + public abstract CGFloat cyanComponent(); + + /** + * Original signature : CGFloat magentaComponent()
+ * native declaration : :221 + */ + public abstract CGFloat magentaComponent(); + + /** + * Original signature : CGFloat yellowComponent()
+ * native declaration : :222 + */ + public abstract CGFloat yellowComponent(); + + /** + * Original signature : CGFloat blackComponent()
+ * native declaration : :223 + */ + public abstract CGFloat blackComponent(); + + /** + * Original signature : void getCyan(CGFloat*, CGFloat*, CGFloat*, CGFloat*, CGFloat*)
+ * native declaration : :224 + */ + public abstract void getCyan_magenta_yellow_black_alpha(java.nio.FloatBuffer cyan, java.nio.FloatBuffer magenta, java.nio.FloatBuffer yellow, java.nio.FloatBuffer black, java.nio.FloatBuffer alpha); + + /** + * For colors with custom colorspace; get the colorspace and individual floating point components, including alpha. Note that all these methods will work for other NSColors which have floating point components. They will raise exceptions otherwise, like other existing colorspace-specific methods.
+ * Original signature : NSColorSpace* colorSpace()
+ * native declaration : :230 + */ + public abstract com.sun.jna.Pointer colorSpace(); + + /** + * Original signature : NSInteger numberOfComponents()
+ * native declaration : :231 + */ + public abstract int numberOfComponents(); + + /** + * Original signature : void getComponents(CGFloat*)
+ * native declaration : :232 + */ + public abstract void getComponents(java.nio.FloatBuffer components); + + /** + * Get the alpha component. For colors which do not have alpha components, this will return 1.0 (opaque).
+ * Original signature : CGFloat alphaComponent()
+ * native declaration : :238 + */ + public abstract CGFloat alphaComponent(); + + /** + * Original signature : void writeToPasteboard(NSPasteboard*)
+ * native declaration : :244 + */ + public abstract void writeToPasteboard(NSPasteboard pasteBoard); + + /** + * Original signature : NSImage* patternImage()
+ * native declaration : :249 + */ + public abstract NSImage patternImage(); + /** + * native declaration : :253
+ * Conversion Error : /**
+ * * Draws the color and adorns it to indicate the type of color. Used by colorwells, swatches, and other UI objects that need to display colors. Implementation in NSColor simply draws the color (with an indication of transparency if the color isn't fully opaque); subclassers can draw more stuff as they see fit.
+ * * Original signature : void drawSwatchInRect(null)
+ * * /
+ * - (void)drawSwatchInRect:(null)rect; (Argument rect cannot be converted) + */ } diff --git a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/appkit/NSImage.java b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/appkit/NSImage.java new file mode 100644 index 00000000..d3afa43b --- /dev/null +++ b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/appkit/NSImage.java @@ -0,0 +1,501 @@ +/* + * Copyright (c) 2002-2009 David Kocher. All rights reserved. + * + * http://cyberduck.ch/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Bug fixes, suggestions and comments should be sent to: + * dkocher@cyberduck.ch + */ + +package org.rococoa.cocoa.appkit; + +import org.rococoa.ObjCClass; +import org.rococoa.cocoa.CGFloat; +import org.rococoa.cocoa.foundation.NSArray; +import org.rococoa.cocoa.foundation.NSCopying; +import org.rococoa.cocoa.foundation.NSData; +import org.rococoa.cocoa.foundation.NSDictionary; +import org.rococoa.cocoa.foundation.NSObject; +import org.rococoa.cocoa.foundation.NSPasteboard; +import org.rococoa.cocoa.foundation.NSRect; +import org.rococoa.cocoa.foundation.NSSize; +import org.rococoa.cocoa.foundation.NSURL; + + +/// native declaration : :41 +public abstract class NSImage extends NSObject implements NSCopying { + @SuppressWarnings("hiding") + private static final _Class CLASS = org.rococoa.Rococoa.createClass("NSImage", _Class.class); + + /// native declaration : :13 + public static final int NSImageLoadStatusCompleted = 0; + /// native declaration : :14 + public static final int NSImageLoadStatusCancelled = 1; + /// native declaration : :15 + public static final int NSImageLoadStatusInvalidData = 2; + /// native declaration : :16 + public static final int NSImageLoadStatusUnexpectedEOF = 3; + /// native declaration : :17 + public static final int NSImageLoadStatusReadError = 4; + /** + * unspecified. use image rep's default
+ * native declaration : :22 + */ + public static final int NSImageCacheDefault = 0; + /** + * always generate a cache when drawing
+ * native declaration : :23 + */ + public static final int NSImageCacheAlways = 1; + /** + * cache if cache size is smaller than original data
+ * native declaration : :24 + */ + public static final int NSImageCacheBySize = 2; + /** + * never cache, always draw direct
+ * native declaration : :25 + */ + public static final int NSImageCacheNever = 3; + + public static NSImage imageNamed(String name) { + return CLASS.imageNamed(name); + } + + public static NSImage imageWithData(NSData data) { + return CLASS.alloc().initWithData(data); + } + + public static NSImage imageWithSize(NSSize size) { + return CLASS.alloc().initWithSize(size); + } + + public static NSImage imageWithContentsOfFile(String filename) { + return CLASS.alloc().initWithContentsOfFile(filename); + } + + public interface _Class extends ObjCClass { + /** + * Original signature : id imageNamed(NSString*)
+ * If this finds & creates the image, only name is saved when archived
+ * native declaration : :73 + */ + NSImage imageNamed(String name); + + /** + * These return union of all the types registered with NSImageRep.
+ * Original signature : NSArray* imageUnfilteredFileTypes()
+ * native declaration : :138 + */ + NSArray imageUnfilteredFileTypes(); + + /** + * Original signature : NSArray* imageUnfilteredPasteboardTypes()
+ * native declaration : :139 + */ + NSArray imageUnfilteredPasteboardTypes(); + + /** + * Original signature : NSArray* imageFileTypes()
+ * native declaration : :140 + */ + NSArray imageFileTypes(); + + /** + * Original signature : NSArray* imagePasteboardTypes()
+ * native declaration : :141 + */ + NSArray imagePasteboardTypes(); + + /** + * Original signature : NSArray* imageTypes()
+ * native declaration : :144 + */ + NSArray imageTypes(); + + /** + * Original signature : NSArray* imageUnfilteredTypes()
+ * native declaration : :145 + */ + NSArray imageUnfilteredTypes(); + + /** + * Original signature : BOOL canInitWithPasteboard(NSPasteboard*)
+ * native declaration : :148 + */ + boolean canInitWithPasteboard(NSPasteboard pasteBoard); + + NSImage alloc(); + } + + /** + * native declaration : :75
+ * Conversion Error : NSSize + */ + public abstract NSImage initWithSize(NSSize aSize); + + /** + * Original signature : id initWithData(NSData*)
+ * When archived, saves contents
+ * native declaration : :76 + */ + public abstract NSImage initWithData(NSData data); + + /** + * Original signature : id initWithContentsOfFile(NSString*)
+ * When archived, saves contents
+ * native declaration : :77 + */ + public abstract NSImage initWithContentsOfFile(String fileName); + + /** + * Original signature : id initWithContentsOfURL(NSURL*)
+ * When archived, saves contents
+ * native declaration : :78 + */ + public abstract NSImage initWithContentsOfURL(NSURL url); + + /** + * Original signature : id initByReferencingFile(NSString*)
+ * When archived, saves fileName
+ * native declaration : :79 + */ + public abstract NSImage initByReferencingFile(String fileName); + + /** + * Original signature : id initByReferencingURL(NSURL*)
+ * When archived, saves url, supports progressive loading
+ * native declaration : :81 + */ + public abstract NSImage initByReferencingURL(NSURL url); + /** + * native declaration : :84
+ * Conversion Error : /// Original signature : id initWithIconRef(null)
+ * - (id)initWithIconRef:(null)iconRef; (Argument iconRef cannot be converted) + */ + /** + * Original signature : id initWithPasteboard(NSPasteboard*)
+ * native declaration : :86 + */ + public abstract NSImage initWithPasteboard(NSPasteboard pasteboard); + + /** + * native declaration : :88
+ * Conversion Error : NSSize + */ + public abstract void setSize(NSSize aSize); + + /** + * native declaration : :89
+ * Conversion Error : NSSize + */ + public abstract NSSize size(); + + /** + * Original signature : BOOL setName(NSString*)
+ * native declaration : :90 + */ + public abstract boolean setName(String string); + + /** + * Original signature : NSString* name()
+ * native declaration : :91 + */ + public abstract String name(); + + /** + * Original signature : void setScalesWhenResized(BOOL)
+ * native declaration : :92 + */ + public abstract void setScalesWhenResized(boolean flag); + + /** + * Original signature : BOOL scalesWhenResized()
+ * native declaration : :93 + */ + public abstract boolean scalesWhenResized(); + + /** + * Original signature : void setDataRetained(BOOL)
+ * native declaration : :94 + */ + public abstract void setDataRetained(boolean flag); + + /** + * Original signature : BOOL isDataRetained()
+ * native declaration : :95 + */ + public abstract boolean isDataRetained(); + + /** + * Original signature : void setCachedSeparately(BOOL)
+ * native declaration : :96 + */ + public abstract void setCachedSeparately(boolean flag); + + /** + * Original signature : BOOL isCachedSeparately()
+ * native declaration : :97 + */ + public abstract boolean isCachedSeparately(); + + /** + * Original signature : void setCacheDepthMatchesImageDepth(BOOL)
+ * native declaration : :98 + */ + public abstract void setCacheDepthMatchesImageDepth(boolean flag); + + /** + * Original signature : BOOL cacheDepthMatchesImageDepth()
+ * native declaration : :99 + */ + public abstract boolean cacheDepthMatchesImageDepth(); + + /** + * Original signature : public abstract void setBackgroundColor(NSColor*)
+ * native declaration : :100 + */ + public abstract void setBackgroundColor(com.sun.jna.Pointer aColor); + + /** + * Original signature : NSColor* backgroundColor()
+ * native declaration : :101 + */ + public abstract NSColor backgroundColor(); + + /** + * Original signature : public abstract void setUsesEPSOnResolutionMismatch(BOOL)
+ * native declaration : :102 + */ + public abstract void setUsesEPSOnResolutionMismatch(boolean flag); + + /** + * Original signature : BOOL usesEPSOnResolutionMismatch()
+ * native declaration : :103 + */ + public abstract boolean usesEPSOnResolutionMismatch(); + + /** + * Original signature : public abstract void setPrefersColorMatch(BOOL)
+ * native declaration : :104 + */ + public abstract void setPrefersColorMatch(boolean flag); + + /** + * Original signature : BOOL prefersColorMatch()
+ * native declaration : :105 + */ + public abstract boolean prefersColorMatch(); + + /** + * Original signature : public abstract void setMatchesOnMultipleResolution(BOOL)
+ * native declaration : :106 + */ + public abstract void setMatchesOnMultipleResolution(boolean flag); + + /** + * Original signature : BOOL matchesOnMultipleResolution()
+ * native declaration : :107 + */ + public abstract boolean matchesOnMultipleResolution(); + /** + * native declaration : :108
+ * Conversion Error : /// Original signature : public abstract void dissolveToPoint(null, CGFloat)
+ * - (void)dissolveToPoint:(null)point fraction:(CGFloat)aFloat; (Argument point cannot be converted) + */ + /** + * native declaration : :109
+ * Conversion Error : /// Original signature : public abstract void dissolveToPoint(null, null, CGFloat)
+ * - (void)dissolveToPoint:(null)point fromRect:(null)rect fraction:(CGFloat)aFloat; (Argument point cannot be converted) + */ + /** + * native declaration : :110
+ * Conversion Error : /// Original signature : public abstract void compositeToPoint(null, null)
+ * - (void)compositeToPoint:(null)point operation:(null)op; (Argument point cannot be converted) + */ + /** + * native declaration : :111
+ * Conversion Error : /// Original signature : public abstract void compositeToPoint(null, null, null)
+ * - (void)compositeToPoint:(null)point fromRect:(null)rect operation:(null)op; (Argument point cannot be converted) + */ + /** + * native declaration : :112
+ * Conversion Error : /// Original signature : public abstract void compositeToPoint(null, null, CGFloat)
+ * - (void)compositeToPoint:(null)point operation:(null)op fraction:(CGFloat)delta; (Argument point cannot be converted) + */ + /** + * native declaration : :113
+ * Conversion Error : /// Original signature : public abstract void compositeToPoint(null, null, null, CGFloat)
+ * - (void)compositeToPoint:(null)point fromRect:(null)rect operation:(null)op fraction:(CGFloat)delta; (Argument point cannot be converted) + */ + /** + * native declaration : :114
+ * Conversion Error : /// Original signature : public abstract void drawAtPoint(null, null, null, CGFloat)
+ * - (void)drawAtPoint:(null)point fromRect:(null)fromRect operation:(null)op fraction:(CGFloat)delta; (Argument point cannot be converted) + */ + /** + * native declaration : :115
+ * Conversion Error : /// Original signature : public abstract void drawInRect(null, null, null, CGFloat)
+ * - (void)drawInRect:(null)rect fromRect:(null)fromRect operation:(null)op fraction:(CGFloat)delta; (Argument rect cannot be converted) + */ + public abstract void drawInRect_fromRect_operation_fraction(NSRect rect, NSRect fromRect, int operation, CGFloat delta); + + public void drawInRect(NSRect rect, NSRect fromRect, int operation, double delta) { + this.drawInRect_fromRect_operation_fraction(rect, fromRect, operation, new CGFloat(delta)); + } + + /** + * native declaration : :116
+ * Conversion Error : /// Original signature : BOOL drawRepresentation(NSImageRep*, null)
+ * - (BOOL)drawRepresentation:(NSImageRep*)imageRep inRect:(null)rect; (Argument rect cannot be converted) + */ + /** + * Original signature : public abstract void recache()
+ * native declaration : :117 + */ + public abstract void recache(); + + /** + * Original signature : NSData* TIFFRepresentation()
+ * native declaration : :118 + */ + public abstract /*com.sun.jna.Pointer*/NSData TIFFRepresentation(); + /** + * native declaration : :119
+ * Conversion Error : /// Original signature : NSData* TIFFRepresentationUsingCompression(null, float)
+ * - (NSData*)TIFFRepresentationUsingCompression:(null)comp factor:(float)aFloat; (Argument comp cannot be converted) + */ + /** + * Original signature : NSArray* representations()
+ * native declaration : :121 + */ + public abstract com.sun.jna.Pointer representations(); + + /** + * Original signature : public abstract void addRepresentations(NSArray*)
+ * native declaration : :122 + */ + public abstract void addRepresentations(NSArray imageReps); + + /** + * Original signature : public abstract void addRepresentation(NSImageRep*)
+ * native declaration : :123 + */ + public abstract void addRepresentation(com.sun.jna.Pointer imageRep); + + /** + * Original signature : public abstract void removeRepresentation(NSImageRep*)
+ * native declaration : :124 + */ + public abstract void removeRepresentation(com.sun.jna.Pointer imageRep); + + /** + * Original signature : BOOL isValid()
+ * native declaration : :126 + */ + public abstract boolean isValid(); + + /** + * Original signature : public abstract void lockFocus()
+ * native declaration : :127 + */ + public abstract void lockFocus(); + + /** + * Original signature : public abstract void lockFocusOnRepresentation(NSImageRep*)
+ * native declaration : :128 + */ + public abstract void lockFocusOnRepresentation(com.sun.jna.Pointer imageRepresentation); + + /** + * Original signature : public abstract void unlockFocus()
+ * native declaration : :129 + */ + public abstract void unlockFocus(); + + /** + * Original signature : NSImageRep* bestRepresentationForDevice(NSDictionary*)
+ * native declaration : :131 + */ + public abstract com.sun.jna.Pointer bestRepresentationForDevice(NSDictionary deviceDescription); + + /** + * Original signature : public abstract void setDelegate(id)
+ * native declaration : :133 + */ + public abstract void setDelegate(org.rococoa.ID anObject); + + /** + * Original signature : id delegate()
+ * native declaration : :134 + */ + public abstract org.rococoa.ID delegate(); + + /** + * Original signature : public abstract void setFlipped(BOOL)
+ * native declaration : :150 + */ + public abstract void setFlipped(boolean flag); + + /** + * Original signature : BOOL isFlipped()
+ * native declaration : :151 + */ + public abstract boolean isFlipped(); + + /** + * Original signature : public abstract void cancelIncrementalLoad()
+ * native declaration : :154 + */ + public abstract void cancelIncrementalLoad(); + + /** + * Original signature : public abstract void setCacheMode(NSImageCacheMode)
+ * native declaration : :156 + */ + public abstract void setCacheMode(int mode); + + /** + * Original signature : NSImageCacheMode cacheMode()
+ * native declaration : :157 + */ + public abstract int cacheMode(); + + /** + * The alignmentRect of an image is metadata that a client may use to help determine layout. The bottom of the rect gives the baseline of the image. The other edges give similar information in other directions.
+ * A 20x20 image of a phone icon with a glow might specify an alignmentRect of {{2,2},{16,16}} that excludes the glow. NSButtonCell can take advantage of the alignmentRect to place the image in the same visual location as an 16x16 phone icon without the glow. A 5x5 star that should render high when aligned with text might specify a rect of {{0,-7},{5,12}}.
+ * The alignmentRect of an image has no effect on methods such as drawInRect:fromRect:operation:Fraction: or drawAtPoint:fromRect:operation:fraction:. It is the client's responsibility to take the alignmentRect into account where applicable.
+ * The default alignmentRect of an image is {{0,0},imageSize}. The rect is adjusted when setSize: is called.
+ * Original signature : alignmentRect()
+ * native declaration : :169 + */ + public abstract NSObject alignmentRect(); + /** + * native declaration : :170
+ * Conversion Error : /// Original signature : public abstract void setAlignmentRect(null)
+ * - (void)setAlignmentRect:(null)rect; (Argument rect cannot be converted) + */ + /** + * The 'template' property is metadata that allows clients to be smarter about image processing. An image should be marked as a template if it is basic glpyh-like black and white art that is intended to be processed into derived images for use on screen.
+ * NSButtonCell applies effects to images based on the state of the button. For example, images are shaded darker when the button is pressed. If a template image is set on a cell, the cell can apply more sophisticated effects. For example, it may be processed into an image that looks engraved when drawn into a cell whose interiorBackgroundStyle is NSBackgroundStyleRaised, like on a textured button.
+ * Original signature : BOOL isTemplate()
+ * native declaration : :176 + */ + public abstract boolean isTemplate(); + + /** + * Original signature : public abstract void setTemplate(BOOL)
+ * native declaration : :177 + */ + public abstract void setTemplate(boolean isTemplate); +} \ No newline at end of file diff --git a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/foundation/NSCoder.java b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/foundation/NSCoder.java index 9a5ca97f..beca847b 100644 --- a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/foundation/NSCoder.java +++ b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/foundation/NSCoder.java @@ -19,14 +19,11 @@ package org.rococoa.cocoa.foundation; -import org.rococoa.cocoa.foundation.NSObject; - /** * @author paulloy */ public abstract class NSCoder extends NSObject { - - public abstract void encodeObject_forKey (NSObject objv, NSString key); - public abstract NSObject decodeObjectForKey(NSString mountainNameString); - + + public abstract void encodeObject_forKey (NSObject objv, NSString key); + public abstract NSObject decodeObjectForKey(NSString mountainNameString); } diff --git a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTKit.java b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTKit.java index bc626c22..b2975ae8 100644 --- a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTKit.java +++ b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTKit.java @@ -23,8 +23,9 @@ import com.sun.jna.Native; @SuppressWarnings("nls") +@Deprecated public interface QTKit extends Library { - + public static QTKit instance = (QTKit) Native.loadLibrary("QTKit", QTKit.class); } diff --git a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTMedia.java b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTMedia.java index 8a0b2bc4..cf9f0ff7 100755 --- a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTMedia.java +++ b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTMedia.java @@ -27,6 +27,7 @@ import com.sun.jna.Pointer; @SuppressWarnings("nls") +@Deprecated public @RunOnMainThread abstract class QTMedia extends NSObject { public static final String QTMediaDurationAttribute = "QTMediaDurationAttribute"; diff --git a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTMovie.java b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTMovie.java index 3083ce8c..25a479ed 100755 --- a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTMovie.java +++ b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTMovie.java @@ -29,9 +29,9 @@ import org.rococoa.ObjCObjectByReference; import org.rococoa.Rococoa; import org.rococoa.RunOnMainThread; +import org.rococoa.cocoa.appkit.NSImage; import org.rococoa.cocoa.foundation.NSArray; import org.rococoa.cocoa.foundation.NSDictionary; -import org.rococoa.cocoa.foundation.NSImage; import org.rococoa.cocoa.foundation.NSString; import com.sun.jna.Pointer; @@ -45,19 +45,20 @@ * @author duncan * */ +@Deprecated public @RunOnMainThread abstract class QTMovie extends NSObject { - + // Loading the QTMovie class has to happen on the main thread private static final _Class CLASS = - Foundation.callOnMainThread(new Callable<_Class>() { + Foundation.callOnMainThread(new Callable<_Class>() { public _Class call() throws Exception { return Rococoa.wrap(Foundation.getClass("QTMovie"), _Class.class); //$NON-NLS-1$ - } - }); - - // Creating instances has to happen on the main thread + } + }); + + // Creating instances has to happen on the main thread public static @RunOnMainThread abstract class _Class implements org.rococoa.ObjCClass {//extends NSObject._class_ { - public abstract QTMovie movie(); + public abstract QTMovie movie(); public abstract QTMovie movieWithFile_error(String fileName, ObjCObjectByReference errorReference); public abstract QTMovie movieWithAttributes_error(NSDictionary attributes, ObjCObjectByReference errorReference); public abstract QTMovie movieWithQuickTimeMovie_disposeWhenDone_error(Pointer movie, boolean b, ObjCObjectByReference errorReference); @@ -71,12 +72,12 @@ public _Class call() throws Exception { public static final long QTMovieLoadStateError = -1L; public static final long QTMovieLoadStateLoading = 1000L; public static final long QTMovieLoadStateComplete = 100000L; - + public static final String QTMovieFlatten = "QTMovieFlatten"; //$NON-NLS-1$ public static final String QTMovieExport = "QTMovieExport"; //$NON-NLS-1$ public static final String QTMovieExportType = "QTMovieExportType"; //$NON-NLS-1$ public static final String QTMovieEditableAttribute = "QTMovieEditableAttribute"; //$NON-NLS-1$ - + public static QTMovie movie() { return CLASS.movie(); } @@ -95,15 +96,15 @@ public static QTMovie movieWithQuickTimeMovie_disposeWhenDone_error(Pointer movi } public abstract QTTime duration(); - + public abstract void gotoBeginning(); - + public abstract void gotoEnd(); - + public abstract void play(); - + public abstract void stop(); - + public abstract void stepBackward(); public abstract void stepForward(); diff --git a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTMovieView.java b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTMovieView.java index 8eac4858..acf3e37b 100644 --- a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTMovieView.java +++ b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTMovieView.java @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Lesser General Public License * along with Rococoa. If not, see . */ - + package org.rococoa.cocoa.qtkit; import java.util.concurrent.Callable; @@ -27,27 +27,27 @@ import org.rococoa.RunOnMainThread; +@Deprecated public @RunOnMainThread abstract class QTMovieView extends NSObject { - + public static final _Class CLASS = new _Class(); - + public static class _Class { public QTMovieView create() { return Foundation.callOnMainThread(new Callable() { public QTMovieView call() throws Exception { return Rococoa.create("QTMovieView", QTMovieView.class); //$NON-NLS-1$ - }}); + }}); } } - + public abstract void setMovie(QTMovie movie); - - public abstract void setControllerVisible(boolean isVisible); - - public abstract void setPreservesAspectRatio(boolean b); - - public abstract void play(NSObject sender); - - public abstract QTMovie movie(); + public abstract void setControllerVisible(boolean isVisible); + + public abstract void setPreservesAspectRatio(boolean b); + + public abstract void play(NSObject sender); + + public abstract QTMovie movie(); } diff --git a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTTime.java b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTTime.java index 4f4f4b0d..83df3706 100644 --- a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTTime.java +++ b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTTime.java @@ -16,12 +16,13 @@ * You should have received a copy of the GNU Lesser General Public License * along with Rococoa. If not, see . */ - + package org.rococoa.cocoa.qtkit; import com.sun.jna.Structure; //long long timeValue; long timeScale; long flags; +@Deprecated public class QTTime extends QTTimeByReference implements Structure.ByValue { public QTTime() { @@ -35,5 +36,4 @@ public QTTime(long timeValue, int timeScale, int flags) { public QTTime(long timeValue, int timeScale) { super(timeValue, timeScale); } - } diff --git a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTTimeByReference.java b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTTimeByReference.java index bc453f45..dc894bdc 100644 --- a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTTimeByReference.java +++ b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTTimeByReference.java @@ -25,6 +25,7 @@ import com.sun.jna.NativeLong; import com.sun.jna.Structure; +@Deprecated public class QTTimeByReference extends Structure { public long timeValue; @@ -79,7 +80,7 @@ public boolean equals(Object obj) { } @Override - protected List getFieldOrder() { + protected List getFieldOrder() { return Arrays.asList("timeValue", "timeScale", "flags"); } } diff --git a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTTimeRange.java b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTTimeRange.java index a8a8281a..c584f509 100644 --- a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTTimeRange.java +++ b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTTimeRange.java @@ -24,6 +24,7 @@ import com.sun.jna.Structure; +@Deprecated public class QTTimeRange extends Structure implements Structure.ByValue { public QTTime time; @@ -38,7 +39,7 @@ public QTTimeRange(QTTime time, QTTime duration) { } @Override - protected List getFieldOrder() { + protected List getFieldOrder() { return Arrays.asList("time", "duration"); } diff --git a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTTrack.java b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTTrack.java index f2f04bd2..fdc7bb62 100755 --- a/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTTrack.java +++ b/rococoa-cocoa/src/main/java/org/rococoa/cocoa/qtkit/QTTrack.java @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Lesser General Public License * along with Rococoa. If not, see . */ - + package org.rococoa.cocoa.qtkit; import org.rococoa.ID; @@ -27,19 +27,20 @@ import com.sun.jna.Pointer; @SuppressWarnings("nls") +@Deprecated public @RunOnMainThread abstract class QTTrack extends NSObject { public static final String QTTrackTimeScaleAttribute = "QTTrackTimeScaleAttribute"; public static final String QTTrackBoundsAttribute = "QTTrackBoundsAttribute"; public static final String QTTrackDimensionsAttribute = "QTTrackDimensionsAttribute"; - + public abstract QTMovie movie(); - + public abstract QTMedia media(); - + public abstract boolean isEnabled(); public abstract void setEnabled(boolean enabled); - + public abstract float volume(); public abstract void setVolume(float level); public abstract NSObject attributeForKey(String key); @@ -48,5 +49,4 @@ public abstract NSDictionary trackAttributes(); public abstract void setTrackAttributes(NSDictionary trackAttributes); public abstract Pointer quickTimeTrack(); - } diff --git a/rococoa-cocoa/src/test/java/org/rococoa/cocoa/qtkit/QTMovieTest.java b/rococoa-cocoa/src/test/java/org/rococoa/cocoa/qtkit/QTMovieTest.java index 461d1c19..38091a3b 100644 --- a/rococoa-cocoa/src/test/java/org/rococoa/cocoa/qtkit/QTMovieTest.java +++ b/rococoa-cocoa/src/test/java/org/rococoa/cocoa/qtkit/QTMovieTest.java @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Lesser General Public License * along with Rococoa. If not, see . */ - + package org.rococoa.cocoa.qtkit; import com.sun.jna.Platform; @@ -38,8 +38,8 @@ import org.rococoa.test.RococoaTestCase; -@SuppressWarnings("nls") -@Disabled("by vavi") +@SuppressWarnings("deprecation") +@Disabled("deprecated") public class QTMovieTest extends RococoaTestCase { static String testMovieFile = "testdata/DrWho.mov"; @@ -100,7 +100,7 @@ private QTMovie loadMovie(String filename) { // // null); - NSMutableDictionary attributes = NSMutableDictionary.CLASS.dictionaryWithCapacity(2); + NSMutableDictionary attributes = NSMutableDictionary.dictionaryWithCapacity(2); attributes.setValue_forKey(NSString.CLASS.stringWithString(filename), QTMovie.QTMovieFileNameAttribute); attributes.setValue_forKey(NSNumber.CLASS.numberWithBool(false), diff --git a/rococoa-contrib/pom.xml b/rococoa-contrib/pom.xml index 8e8c2d47..f25f80ee 100644 --- a/rococoa-contrib/pom.xml +++ b/rococoa-contrib/pom.xml @@ -10,7 +10,7 @@ org.rococoa rococoa-parent - 0.8.3 + 0.8.4 Rococoa Contrib diff --git a/rococoa-contrib/src/main/java/org/rococoa/cocoa/NSApplication.java b/rococoa-contrib/src/main/java/org/rococoa/cocoa/NSApplication.java index b13a6753..2e6784f4 100644 --- a/rococoa-contrib/src/main/java/org/rococoa/cocoa/NSApplication.java +++ b/rococoa-contrib/src/main/java/org/rococoa/cocoa/NSApplication.java @@ -23,7 +23,7 @@ import org.rococoa.ObjCClass; import org.rococoa.Rococoa; import org.rococoa.RunOnMainThread; -import org.rococoa.cocoa.foundation.NSImage; +import org.rococoa.cocoa.appkit.NSImage; import org.rococoa.cocoa.foundation.NSInteger; import org.rococoa.cocoa.foundation.NSObject; diff --git a/rococoa-contrib/src/main/java/org/rococoa/contrib/appkit/NSSpeechSynthesizer.java b/rococoa-contrib/src/main/java/org/rococoa/contrib/appkit/NSSpeechSynthesizer.java index 655331a5..5a6dcd47 100755 --- a/rococoa-contrib/src/main/java/org/rococoa/contrib/appkit/NSSpeechSynthesizer.java +++ b/rococoa-contrib/src/main/java/org/rococoa/contrib/appkit/NSSpeechSynthesizer.java @@ -103,11 +103,11 @@ public _Class() {} /** Interface to be implemented by Java objects that want to be informed about events reported to the speech syntheszier's delegate*/ public interface NSSpeechSynthesizerDelegate { - public void speechSynthesizer_didEncounterErrorAtIndex_ofString_message(NSSpeechSynthesizer sender, Integer characterIndex, String text, String errorMessage); - public void speechSynthesizer_didEncounterSyncMessage(NSSpeechSynthesizer sender, String syncFlag); - public void speechSynthesizer_didFinishSpeaking(NSSpeechSynthesizer sender, boolean success); - public void speechSynthesizer_willSpeakPhoneme(NSSpeechSynthesizer sender, short phonemeOpcode); - public void speechSynthesizer_willSpeakWord_ofString(NSSpeechSynthesizer sender, NSRange wordToSpeak, String text); + void speechSynthesizer_didEncounterErrorAtIndex_ofString_message(NSSpeechSynthesizer sender, Integer characterIndex, String text, String errorMessage); + void speechSynthesizer_didEncounterSyncMessage(NSSpeechSynthesizer sender, String syncFlag); + void speechSynthesizer_didFinishSpeaking(NSSpeechSynthesizer sender, boolean success); + void speechSynthesizer_willSpeakPhoneme(NSSpeechSynthesizer sender, short phonemeOpcode); + void speechSynthesizer_willSpeakWord_ofString(NSSpeechSynthesizer sender, NSRange wordToSpeak, String text); } /** Construct a new synthesizer that speaks with a specified voice. @@ -140,7 +140,7 @@ public static NSVoice defaultVoice() { */ public static List availableVoices() { NSArray availableVoices = CLASS.availableVoices(); - List result = new ArrayList(availableVoices.count()); + List result = new ArrayList<>(availableVoices.count()); for (int i=0; i < availableVoices.count(); i++) { result.add(new NSVoice(CLASS.attributesForVoice(availableVoices.objectAtIndex(i).toString()))); } @@ -462,7 +462,7 @@ public void setPitchMod(float modulation) { */ public List getPhonemeInfo() { NSArray infos = Rococoa.cast(getProperty(SpeechProperty.PhonemeSymbolsProperty), NSArray.class); - List result = new ArrayList(infos.count()); + List result = new ArrayList<>(infos.count()); for(int i=0; i < infos.count(); i++) { NSDictionary phonemeInfo = Rococoa.cast(infos.objectAtIndex(i), NSDictionary.class); result.add(new NSSpeechPhonemeInfo(NSMutableDictionary.dictionaryWithDictionary(phonemeInfo))); @@ -602,7 +602,7 @@ public void reset() { * @param uri a file URI to send output to, pass null to switch back to the computer speakers */ public void setOutputToFileURL(URI uri) { - setProperty(SpeechProperty.OutputToFileURLProperty, uri != null ? NSURL.CLASS.URLWithString(uri.toString()) : null); + setProperty(SpeechProperty.OutputToFileURLProperty, uri != null ? NSURL.URLWithString(uri.toString()) : null); } /** Speak the given string to a file @@ -611,7 +611,7 @@ public void setOutputToFileURL(URI uri) { * @return true if the synthesis began successfully */ public boolean startSpeakingStringToURL(String text, URI uri) { - return startSpeakingString_toURL(NSString.stringWithString(text), NSURL.CLASS.URLWithString(uri.toString())); + return startSpeakingString_toURL(NSString.stringWithString(text), NSURL.URLWithString(uri.toString())); } //Those methods that will simply be called directly are public, the rest are 'package' - wrapper methods can be found above. diff --git a/rococoa-contrib/src/main/java/org/rococoa/contrib/growl/Growl.java b/rococoa-contrib/src/main/java/org/rococoa/contrib/growl/Growl.java index d7ae5ae4..aa611c85 100644 --- a/rococoa-contrib/src/main/java/org/rococoa/contrib/growl/Growl.java +++ b/rococoa-contrib/src/main/java/org/rococoa/contrib/growl/Growl.java @@ -25,9 +25,9 @@ import org.rococoa.cocoa.NSApplication; import org.rococoa.cocoa.NSDistributedNotificationCenter; +import org.rococoa.cocoa.appkit.NSImage; import org.rococoa.cocoa.foundation.NSArray; import org.rococoa.cocoa.foundation.NSDictionary; -import org.rococoa.cocoa.foundation.NSImage; import org.rococoa.cocoa.foundation.NSMutableDictionary; import org.rococoa.cocoa.foundation.NSNumber; import org.rococoa.cocoa.foundation.NSObject; @@ -208,7 +208,7 @@ public final boolean register() { ); // Make the Dictionary - NSDictionary regDict = NSDictionary.dictionaryWithObjects_forKeys(objects, keys); + NSDictionary regDict = NSDictionary.dictionaryWithObjectsForKeys(objects, keys); theCenter.postNotification( GROWL_APP_REGISTRATION, // notificationName diff --git a/rococoa-core/pom.xml b/rococoa-core/pom.xml index 94bb284c..b40e3dcf 100644 --- a/rococoa-core/pom.xml +++ b/rococoa-core/pom.xml @@ -9,7 +9,7 @@ org.rococoa rococoa-parent - 0.8.3 + 0.8.4 Rococoa Core @@ -26,6 +26,7 @@ org.rococoa.Rococoa + org.rococoa.ObjCBlocks true @@ -61,6 +62,7 @@ Rococoa.m ProxyForJava.m + ObjCBlocks.m test.m @@ -86,6 +88,7 @@ Rococoa.m ProxyForJava.m + ObjCBlocks.m @@ -110,7 +113,7 @@ maven-surefire-plugin - 3.0.0-M4 + 3.0.0-M5