/*
    IBObjectIntegration.h
    Interface Builder Kit
    Copyright 2006-2009 Apple Inc.
    All rights reserved.

    The Interface Builder Kit framework extends the NSObject class by adding methods to discover identity information, field editor and inspector information, pasteboard types, and other such elements.  Interface Builder uses these methods to discover relevant information about the views and objects on your custom plug-ins. You typically do not call these methods directly. Instead, you override them to customize the behavior for your views and objects.  Because these methods are relevant only in the context of Interface Builder, it is recommended that you implement these methods in a category on your class and include the category code only in your Interface Builder plug-in.
*/

#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5

#import <Cocoa/Cocoa.h>

@class IBDocument;

/* Keys for values of the keypath dictionary */
extern NSString * const IBAttributeKeyPaths;
extern NSString * const IBToOneRelationshipKeyPaths;
extern NSString * const IBToManyRelationshipKeyPaths;
extern NSString * const IBLocalizableStringKeyPaths;
extern NSString * const IBLocalizableGeometryKeyPaths;
extern NSString * const IBAdditionalLocalizableKeyPaths;


@interface NSObject (IBObjectIntegration)

/* The default label and image for the object. */
- (NSString *)ibDefaultLabel;
- (NSImage *)ibDefaultImage;

/* Subclasses can override these to provide additional keypaths and inspector classes. */
- (void)ibPopulateKeyPaths:(NSMutableDictionary *)keyPaths;
- (void)ibPopulateAttributeInspectorClasses:(NSMutableArray *)classes;
- (void)ibPopulateSizeInspectorClasses:(NSMutableArray *)classes;

/* Returns the rect for the child and the object at a specific location. Overrides of these methods should typically incorporate the results of a call through to super. */
- (NSRect)ibRectForChild:(id)child inWindowController:(NSWindowController *)controller;
- (id)ibObjectAtLocation:(NSPoint)windowPoint inWindowController:(NSWindowController *)controller;

/* Returns the collection of children this object contains at the time of creation. Overrides of this method should call through to super and append additional objects to the return value. Classes that override this method should also override ibCanRemoveChildren: or ibRemoveChildren: to block or allow deletion of child objects. */
- (NSArray *)ibDefaultChildren;

/* Callbacks for customizing deletion behavior. Implementations should call through to super. To block deletion, override ibCanRemoveChildren: and check the argument. If you wish to block deletion, return NO, otherwise call through to super. Implementations should not directly return YES. To allow deletion, override ibRemoveChildren:, call through to super, check the argument, and only remove references to objects the overriding class is directly responsible for adding. For example, it is the responsibility of NSView, not NSBox, to remove subviews. */
- (BOOL)ibCanRemoveChildren:(NSSet *)objects;
- (void)ibRemoveChildren:(NSSet *)objects;

/* Determines if the child view is moveable and/or resizable by users. If the overriding class is not directly responsible for integrating childView as a child, call through to super. */
- (BOOL)ibIsChildViewUserMovable:(NSView *)childView;
- (BOOL)ibIsChildViewUserSizable:(NSView *)childView;

/* Determines if the child should be selected with just one click. If the overriding class is not directly responsible for integrating child, call through to super. */
- (BOOL)ibIsChildInitiallySelectable:(id)child;

/* Customization points for integrated objects and views. Implementations should call through to super. */
- (void)ibAwakeInDesignableDocument:(IBDocument *)document; 
- (void)ibDidAddToDesignableDocument:(IBDocument *)document;
- (void)ibDidRemoveFromDesignableDocument:(IBDocument *)document;

@end

#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 */
