|
| 1 | +/* Copyright © 2007-2009, The Sequential Project |
| 2 | +All rights reserved. |
| 3 | +
|
| 4 | +Redistribution and use in source and binary forms, with or without |
| 5 | +modification, are permitted provided that the following conditions are met: |
| 6 | + * Redistributions of source code must retain the above copyright |
| 7 | + notice, this list of conditions and the following disclaimer. |
| 8 | + * Redistributions in binary form must reproduce the above copyright |
| 9 | + notice, this list of conditions and the following disclaimer in the |
| 10 | + documentation and/or other materials provided with the distribution. |
| 11 | + * Neither the name of the the Sequential Project nor the |
| 12 | + names of its contributors may be used to endorse or promote products |
| 13 | + derived from this software without specific prior written permission. |
| 14 | +
|
| 15 | +THIS SOFTWARE IS PROVIDED BY THE SEQUENTIAL PROJECT ''AS IS'' AND ANY |
| 16 | +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 17 | +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 18 | +DISCLAIMED. IN NO EVENT SHALL THE SEQUENTIAL PROJECT BE LIABLE FOR ANY |
| 19 | +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 20 | +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 21 | +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 22 | +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 | +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 24 | +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ |
| 25 | +#import <AppKit/AppKit.h> |
| 26 | + |
| 27 | +// Other Sources |
| 28 | +#import "PGGeometryTypes.h" |
| 29 | + |
| 30 | +enum { |
| 31 | + AENoIcon = 0, |
| 32 | + AEPlayIcon = 1, |
| 33 | + AEPauseIcon = 2, |
| 34 | + AEStopIcon = 3 |
| 35 | +}; |
| 36 | +typedef NSUInteger AEIconType; |
| 37 | + |
| 38 | +@interface NSBezierPath(PGAppKitAdditions) |
| 39 | + |
| 40 | ++ (NSBezierPath *)PG_bezierPathWithRoundRect:(NSRect)aRect cornerRadius:(CGFloat)radius; |
| 41 | ++ (void)PG_drawIcon:(AEIconType)type inRect:(NSRect)r; |
| 42 | ++ (void)PG_drawSpinnerInRect:(NSRect)aRect startAtPetal:(NSInteger)petal; |
| 43 | + |
| 44 | +- (void)PG_fillUsingOperation:(NSCompositingOperation)op; |
| 45 | + |
| 46 | +@end |
| 47 | + |
| 48 | +@interface NSColor(PGAppKitAdditions) |
| 49 | + |
| 50 | ++ (NSColor *)PG_bezelBackgroundColor; |
| 51 | ++ (NSColor *)PG_bezelForegroundColor; |
| 52 | +- (NSColor *)PG_checkerboardPatternColor; |
| 53 | +- (NSColor *)PG_patternColorWithImage:(NSImage *)image fraction:(CGFloat)fraction; |
| 54 | + |
| 55 | +@end |
| 56 | + |
| 57 | +@interface NSControl(PGAppKitAdditions) |
| 58 | + |
| 59 | +- (void)PG_setAttributedStringValue:(NSAttributedString *)str; // Keeps existing attributes. |
| 60 | + |
| 61 | +@end |
| 62 | + |
| 63 | +@interface NSEvent(PGAppKitAdditions) |
| 64 | + |
| 65 | +- (NSPoint)PG_locationInView:(NSView *)view; |
| 66 | + |
| 67 | +@end |
| 68 | + |
| 69 | +@interface NSImageRep(PGAppKitAdditions) |
| 70 | + |
| 71 | +- (id)PG_thumbnailWithMaxSize:(NSSize)size orientation:(PGOrientation)orientation opaque:(BOOL)opaque; |
| 72 | + |
| 73 | +@end |
| 74 | + |
| 75 | +@interface NSMenu(PGAppKitAdditions) |
| 76 | + |
| 77 | +- (void)PG_removeAllItems; // -[NSMenu removeAllItems] requires 10.6. |
| 78 | + |
| 79 | +@end |
| 80 | + |
| 81 | +@interface NSMenuItem(PGAppKitAdditions) |
| 82 | + |
| 83 | +- (void)PG_addAfterItem:(NSMenuItem *)anItem; |
| 84 | +- (void)PG_removeFromMenu; |
| 85 | +- (BOOL)PG_performAction; // Uses undocumented calls to highlight the item appropriately. Returns whether the item was enabled (and the action was performed). |
| 86 | + |
| 87 | +@end |
| 88 | + |
| 89 | +@interface NSScreen(PGAppKitAdditions) |
| 90 | + |
| 91 | ++ (NSScreen *)PG_mainScreen; // Returns the real main screen. |
| 92 | +- (BOOL)PG_setDesktopImageURL:(NSURL *)URL; |
| 93 | + |
| 94 | +@end |
| 95 | + |
| 96 | +@interface NSView(PGAppKitAdditions) |
| 97 | + |
| 98 | +- (void)PG_setEnabled:(BOOL)enabled recursive:(BOOL)recursive; |
| 99 | +- (BOOL)PG_isActive; |
| 100 | + |
| 101 | +@end |
| 102 | + |
| 103 | +@interface NSWindow(PGAppKitAdditions) |
| 104 | + |
| 105 | +- (NSRect)PG_contentRect; |
| 106 | +- (void)PG_setContentRect:(NSRect)aRect; |
| 107 | + |
| 108 | +@end |
0 commit comments