//
//  LCBaseObject-ForSublcassers.h
//  LogoistCore
//
//  Created by Mendel Kucharzeck on 14.12.11.
//  Copyright 2011 AvisNocturna Software. All rights reserved.
//

#import "LCBaseObject.h"

@protocol LCCanvasProtocol;

@class LCBaseObjectHandle;
@class LCBaseObjectTool;
@class LCCanvasBaseLayer;
@class LCCanvasRootLayer;

@interface LCBaseObject (ForSublcassers)

//Mask
- (CGImageRef) maskImageRefWithMaskRect:(CGRect)maskRect andPaddedRect:(CGRect)paddedRect andTranslatedPaddedRect:(CGRect)translatedPaddedRect withZoomFactor:(float)zoomFactor inCanvas:(id <LCCanvasProtocol>)canvas;

//Rect in Canvas
- (CGRect) rectForObjectInCanvas:(id <LCCanvasProtocol>)canvas;
- (CGPoint) pointToUseAsCenterForRotationInCanvas:(id <LCCanvasProtocol>)canvas;
- (float) rotationForObjectInCanvas:(id <LCCanvasProtocol>)canvas;
- (void) moveByDelta:(CGPoint)point;
- (void) rotateByDelta:(float)rotateDelta;
- (BOOL) includeInSizeToFitOfCanvas;        //Defaults to YES, for background for example should be no

//Dragging
- (void) willBeginDraggingWithPoint:(CGPoint)point;
- (void) draggedToPoint:(CGPoint)point;
- (void) didEndDraggingWithPoint:(CGPoint)point;

//Container
- (void) willBeAddedToObjectsContainer:(LCObjectsContainer*)container;
- (void) willBeRemovedFromObjectsContainer:(LCObjectsContainer*)container;
- (void) objectsChanged:(NSSet*)objects inObjectsContainer:(LCObjectsContainer*)container;
+ (BOOL) wantsObjectsChangedCalls;  //Pass no for better performance, defaults to no
- (void) setStandardSizeOfObjectForContainer:(LCObjectsContainer*)container;
- (void) objectsContainerChangedSize:(LCObjectsContainer*)container;

//Name & Icon
@property (readonly) NSString *displayName;
+ (NSString*) objectIconName;
- (CGImageRef) customObjectIcon;    //If NULL is returned, objectIconName is used

//Property Edit
@property (readonly) NSArray *customPropertyEditDictionaries;

//Handles
- (NSArray*) handlesForCanvas:(LCCanvasRootLayer*)canvas;

- (void) willBeginMovingHandle:(LCBaseObjectHandle*)handle;
- (void) handleHasBeenMoved:(LCBaseObjectHandle*)handle withDelta:(CGPoint)delta withProportionalModifier:(BOOL)proportionalModifier;
- (void) didFinishMovingHandle:(LCBaseObjectHandle*)handle;
- (void) mouseUpInsideHandle:(LCBaseObjectHandle*)handle;

- (float) opacityForHandle:(LCBaseObjectHandle*)handle withLastMousePosition:(CGPoint)point;

//Tools
- (NSArray*) availableTools;                        //Defaults to NULL
- (NSString*) toolIdentifierToSelectFirst;

- (BOOL) mouseDownWithTool:(LCBaseObjectTool*)tool atPoint:(CGPoint)point withModifiers:(NSInteger)modifiers onLayer:(LCCanvasBaseLayer*)layer inCanvasRootLayer:(LCCanvasRootLayer*)canvasRootLayer;   //Defaults to NO, will be handled standard way
- (BOOL) mouseDraggedWithTool:(LCBaseObjectTool*)tool fromPoint:(CGPoint)fromPoint toPoint:(CGPoint)toPoint withModifiers:(NSInteger)modifiers onLayer:(LCCanvasBaseLayer*)layer inCanvasRootLayer:(LCCanvasRootLayer*)canvasRootLayer; //Defaults to NO, will be handled standard way
- (BOOL) mouseUpWithTool:(LCBaseObjectTool*)tool atPoint:(CGPoint)point withModifiers:(NSInteger)modifiers onLayer:(LCCanvasBaseLayer*)layer inCanvasRootLayer:(LCCanvasRootLayer*)canvasRootLayer;     //Defaults to NO, will be handled standard way

- (NSArray*) availableToolActions;                  //Return NSDictionaries with actionString and target and title keys

//Event Overrides
- (BOOL) handleDeleteEventInCanvas:(LCCanvasRootLayer*)canvasRootLayer;     //For example remove selected handles if selected, defaults to NO=not handled

//Filter
+ (BOOL) supportsFilterClass:(Class)filterClass;    //Defaults to YES except for LCFlipFilter
- (BOOL) renderFilters;                             //Defaults to YES, if no all filters are not rendered. Useful for deactivating filters if handles are dragged
- (BOOL) needsToDrawMaskIfNoCompletelyOpaqueMaskReplaceFilterIsPresent; //Defaults to NO, relevant to objects like LCImageObject

//Distorter
+ (BOOL) supportsDistorter;     //Defaults to NO

//Scaling
+ (BOOL) supportsScaling;       //Defaults to NO

//Snapping
- (NSArray*) snappingPoints;

//Convert to Path
//- (void) convertToPathObject;         //Implement if supported

//Presets
+ (BOOL) isCompatbileToFilterPresetCategory:(NSString*)categoryName;    //Returns YES for all except for Backgrounds and for Image prefix
- (BOOL) isCompatbileToFilterPresetCategory:(NSString*)categoryName;    //Returns YES as default, can be used to rule out categories on a per-object basis

@end
