

#import <UIKit/UIKit.h>
#import "BHExpandingTextViewInternal.h"

@class BHExpandingTextView;

@protocol BHExpandingTextViewDelegate <NSObject>

@optional
- (BOOL)expandingTextViewShouldBeginEditing:(BHExpandingTextView *)expandingTextView;
- (BOOL)expandingTextViewShouldEndEditing:(BHExpandingTextView *)expandingTextView;

- (void)expandingTextViewDidBeginEditing:(BHExpandingTextView *)expandingTextView;
- (void)expandingTextViewDidEndEditing:(BHExpandingTextView *)expandingTextView;

- (BOOL)expandingTextView:(BHExpandingTextView *)expandingTextView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text;
- (void)expandingTextViewDidChange:(BHExpandingTextView *)expandingTextView;

- (void)expandingTextView:(BHExpandingTextView *)expandingTextView willChangeHeight:(float)height;
- (void)expandingTextView:(BHExpandingTextView *)expandingTextView didChangeHeight:(float)height;

- (void)expandingTextViewDidChangeSelection:(BHExpandingTextView *)expandingTextView;
- (BOOL)expandingTextViewShouldReturn:(BHExpandingTextView *)expandingTextView;
@end

@interface BHExpandingTextView : UIView <UITextViewDelegate>

@property (nonatomic, strong) UITextView *internalTextView;

@property (nonatomic, assign) NSUInteger maximumNumberOfLines;
@property (nonatomic, assign) NSUInteger minimumNumberOfLines;
@property (nonatomic, assign) BOOL animateHeightChange;

@property (nonatomic, weak) id<BHExpandingTextViewDelegate> delegate;
@property (nonatomic, copy) NSString *text;
@property (nonatomic, copy) UIFont *font;
@property (nonatomic, copy) UIColor *textColor;
@property (nonatomic) UITextAlignment textAlignment;
@property (nonatomic) NSRange selectedRange;
@property (nonatomic,getter=isEditable) BOOL editable;
@property (nonatomic) UIDataDetectorTypes dataDetectorTypes __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_3_0);
@property (nonatomic) UIReturnKeyType returnKeyType;
@property (nonatomic, strong) UIImageView *textViewBackgroundImage;
@property (nonatomic,copy) NSString *placeholder;
- (BOOL)hasText;
- (void)scrollRangeToVisible:(NSRange)range;
- (void)clearText;

@end
