ChatBar.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2012-2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. #import <UIKit/UIKit.h>
  21. #import "CustomResponderTextView.h"
  22. #import "HPGrowingTextView.h"
  23. #import "QuoteView.h"
  24. @class ChatBar, Contact;
  25. @protocol ChatBarDelegate <NSObject>
  26. - (void)chatBar:(ChatBar*)chatBar didChangeHeight:(CGFloat)height;
  27. - (void)chatBar:(ChatBar*)chatBar didSendText:(NSString*)text;
  28. - (void)chatBar:(ChatBar*)chatBar didSendImageData:(NSData*)image;
  29. - (void)chatBar:(ChatBar*)chatBar didSendGIF:(NSData*)gifData fallbackImage:(UIImage*)image;
  30. - (void)chatBarWillStartTyping:(ChatBar*)chatBar;
  31. - (void)chatBarDidStopTyping:(ChatBar*)chatBar;
  32. - (void)chatBarDidPushAddButton:(ChatBar*)chatBar;
  33. - (void)chatBarDidAddQuote;
  34. - (UIInterfaceOrientation)interfaceOrientationForChatBar:(ChatBar*)chatBar;
  35. - (BOOL)canBecomeFirstResponder;
  36. - (void)chatBarTapped:(ChatBar*)chatBar;
  37. - (UIView *)chatContainterView;
  38. @end
  39. @interface ChatBar : UIImageView <UITextViewDelegate, UIGestureRecognizerDelegate, PasteImageHandler, HPGrowingTextViewDelegate, QuoteViewDelegate>
  40. @property (nonatomic, retain) HPGrowingTextView *chatInput;
  41. @property (nonatomic, retain) UIButton *sendButton;
  42. @property (nonatomic, retain) UIButton *addButton;
  43. @property (readwrite) NSString* text;
  44. @property (nonatomic, weak) id<ChatBarDelegate> delegate;
  45. @property (nonatomic) BOOL resettingKeyboard;
  46. @property (nonatomic) BOOL canSendAudio;
  47. - (void)clearChatInput;
  48. - (void)resizeChatInput;
  49. - (void)checkEnableSendButton;
  50. - (void)stopTyping;
  51. - (void)refresh;
  52. - (void)addQuotedText:(NSString*)quotedText quotedContact:(Contact*)contact;
  53. - (void)addQuotedMessage:(BaseMessage *)quotedMessage;
  54. - (void)resetKeyboardType:(BOOL)resetType;
  55. - (void)setupMentions:(NSArray *)OEMemberListOfGroup;
  56. - (NSString *)formattedMentionText;
  57. - (void)updateMentionsFromDraft:(NSString *)draft;
  58. @end