EaseChatToolbar.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /************************************************************
  2. * * Hyphenate CONFIDENTIAL
  3. * __________________
  4. * Copyright (C) 2016 Hyphenate Inc. All rights reserved.
  5. *
  6. * NOTICE: All information contained herein is, and remains
  7. * the property of Hyphenate Inc.
  8. * Dissemination of this information or reproduction of this material
  9. * is strictly forbidden unless prior written permission is obtained
  10. * from Hyphenate Inc.
  11. */
  12. #import <UIKit/UIKit.h>
  13. #import "EaseFaceView.h"
  14. #import "EaseTextView.h"
  15. #import "EaseRecordView.h"
  16. #import "EaseChatBarMoreView.h"
  17. #import "EaseChatToolbarItem.h"
  18. #define kTouchToRecord NSEaseLocalizedString(@"message.toolBar.record.touch", @"hold down to talk")
  19. #define kTouchToFinish NSEaseLocalizedString(@"message.toolBar.record.send", @"loosen to send")
  20. @protocol EMChatToolbarDelegate;
  21. @interface EaseChatToolbar : UIView
  22. @property (weak, nonatomic) id<EMChatToolbarDelegate> delegate;
  23. @property (nonatomic) UIImage *backgroundImage;
  24. @property (nonatomic, readonly) EMChatToolbarType chatBarType;
  25. @property (nonatomic, readonly) CGFloat inputViewMaxHeight;
  26. @property (nonatomic, readonly) CGFloat inputViewMinHeight;
  27. @property (nonatomic, readonly) CGFloat horizontalPadding;
  28. @property (nonatomic, readonly) CGFloat verticalPadding;
  29. @property (strong, nonatomic) NSArray *inputViewLeftItems;
  30. @property (strong, nonatomic) NSArray *inputViewRightItems;
  31. @property (strong, nonatomic) EaseTextView *inputTextView;
  32. @property (strong, nonatomic) UIView *moreView;
  33. @property (strong, nonatomic) UIView *faceView;
  34. @property (strong, nonatomic) UIView *recordView;
  35. - (instancetype)initWithFrame:(CGRect)frame
  36. type:(EMChatToolbarType)type;
  37. /**
  38. * Initializa chat bar
  39. * @param horizontalPadding default 8
  40. * @param verticalPadding default 5
  41. * @param inputViewMinHeight default 36
  42. * @param inputViewMaxHeight default 150
  43. * @param type default EMChatToolbarTypeGroup
  44. */
  45. - (instancetype)initWithFrame:(CGRect)frame
  46. horizontalPadding:(CGFloat)horizontalPadding
  47. verticalPadding:(CGFloat)verticalPadding
  48. inputViewMinHeight:(CGFloat)inputViewMinHeight
  49. inputViewMaxHeight:(CGFloat)inputViewMaxHeight
  50. type:(EMChatToolbarType)type;
  51. /*!
  52. @method
  53. @brief 获取chatToolBar默认的高度
  54. @discussion
  55. @result 返回chatToolBar默认的高度
  56. */
  57. + (CGFloat)defaultHeight;
  58. - (void)cancelTouchRecord;
  59. /*!
  60. @method
  61. @brief 切换底部的菜单视图
  62. @discussion
  63. @param bottomView 待切换的菜单
  64. @result
  65. */
  66. - (void)willShowBottomView:(UIView *)bottomView;
  67. @end
  68. @protocol EMChatToolbarDelegate <NSObject>
  69. @optional
  70. /*
  71. * 文字输入框开始编辑
  72. *
  73. * @param inputTextView 输入框对象
  74. */
  75. - (void)inputTextViewDidBeginEditing:(EaseTextView *)inputTextView;
  76. /*
  77. * 文字输入框将要开始编辑
  78. *
  79. * @param inputTextView 输入框对象
  80. */
  81. - (void)inputTextViewWillBeginEditing:(EaseTextView *)inputTextView;
  82. /*
  83. * 发送文字消息,可能包含系统自带表情
  84. *
  85. * @param text 文字消息
  86. */
  87. - (void)didSendText:(NSString *)text;
  88. /*
  89. * 发送文字消息,可能包含系统自带表情
  90. *
  91. * @param text 文字消息
  92. * @param ext 扩展消息
  93. */
  94. - (void)didSendText:(NSString *)text withExt:(NSDictionary*)ext;
  95. /*
  96. * 在光标location位置处是否插入字符@
  97. *
  98. * @param location 光标位置
  99. */
  100. - (BOOL)didInputAtInLocation:(NSUInteger)location;
  101. /*
  102. * 在光标location位置处是否删除字符@
  103. *
  104. * @param location 光标位置
  105. */
  106. - (BOOL)didDeleteCharacterFromLocation:(NSUInteger)location;
  107. /*
  108. * 发送第三方表情,不会添加到文字输入框中
  109. *
  110. * @param faceLocalPath 选中的表情的本地路径
  111. */
  112. - (void)didSendFace:(NSString *)faceLocalPath;
  113. /*
  114. * 按下录音按钮开始录音
  115. */
  116. - (void)didStartRecordingVoiceAction:(UIView *)recordView;
  117. /*
  118. * 手指向上滑动取消录音
  119. */
  120. - (void)didCancelRecordingVoiceAction:(UIView *)recordView;
  121. /*
  122. * 松开手指完成录音
  123. */
  124. - (void)didFinishRecoingVoiceAction:(UIView *)recordView;
  125. /*
  126. * 当手指离开按钮的范围内时,主要为了通知外部的HUD
  127. */
  128. - (void)didDragOutsideAction:(UIView *)recordView;
  129. /*
  130. * 当手指再次进入按钮的范围内时,主要也是为了通知外部的HUD
  131. */
  132. - (void)didDragInsideAction:(UIView *)recordView;
  133. @required
  134. /*
  135. * 高度变到toHeight
  136. */
  137. - (void)chatToolbarDidChangeFrameToHeight:(CGFloat)toHeight;
  138. @end