class OFHttpService;
class OFHttpServiceRequestContainer;
@class OFUser;

class OFImageViewHttpServiceObserver : public OFHttpServiceObserver
{
public:
	OFImageViewHttpServiceObserver(OFDelegate const& onSuccess, OFDelegate const& onFailure);
	
	void onFinishedDownloading(OFHttpServiceRequestContainer* info);
	void onFailedDownloading(OFHttpServiceRequestContainer* info);
	
private:
	OFDelegate mSuccessDelegate;
	OFDelegate mFailedDelegate;
};

@interface OFImageView : UIControl< OFCallbackable >
{
@private
	UIImage* mDefaultImage;
	
	NSString* mImageUrl;
	UIImage* mImage;

	BOOL mShouldScaleImageToFillRect;
	BOOL mShouldShowLoadingIndicator;
	
	float mCrossFadeDuration;	
	UIImage* mImageFadingIn;
	float mFadingImageAlpha;
	NSTimer* mFadingTimer;
	
	UIActivityIndicatorView* mLoadingView;
	
	OFPointer<OFHttpService> mHttpService;
	OFPointer<OFImageViewHttpServiceObserver> mHttpServiceObserver;
	
	CGPathRef mBorderPath;
	BOOL mUseSharpCorners;
	BOOL mUsingCustomBorderPath;
	
	OFDelegate mDelegate;
	BOOL mUseFacebookOverlay;
	UIImageView* mFacebookOverlay;
	
	NSString* mImageFrameFileName;
	BOOL mUnframed;
	UIImageView* mImageFrame;
}

- (bool)canReceiveCallbacksNow;

@property (nonatomic, assign) BOOL shouldScaleImageToFillRect;
@property (nonatomic, retain) UIImage* image;
@property (nonatomic, retain) NSString* imageUrl;
@property (nonatomic, assign) BOOL useFacebookOverlay;
@property (nonatomic, assign) BOOL useSharpCorners;
@property (nonatomic, assign) BOOL unframed;
@property (nonatomic, assign) float crossFadeDuration;
@property (nonatomic, assign) BOOL shouldShowLoadingIndicator;

- (void)setImageUrl:(NSString*)imageUrl crossFading:(BOOL)shouldCrossFade;

- (void)showLoadingIndicator;

- (void)setDefaultImage:(UIImage*)defaultImage;

- (void)useLocalPlayerProfilePictureDefault;
- (void)useOtherPlayerProfilePictureDefault;
- (void)useGameCenterProfilePicture;

- (void)useProfilePictureFromUser:(OFUser*)user;

- (void)setImageDownloadFinishedDelegate:(OFDelegate const&)delegate;

- (void)setCustomClippingPath:(CGPathRef)path;

@end
