ButtonItemData.swift 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // ButtonItemData.swift
  3. // TUIRoomKit
  4. //
  5. // Created by janejntang on 2023/1/10.
  6. // Copyright © 2023 Tencent. All rights reserved.
  7. //
  8. import Foundation
  9. import Combine
  10. typealias ButtonStateBinderClosure = (ButtonItemView ,inout Set<AnyCancellable>)->Void
  11. class ButtonItemData {
  12. enum ButtonType {
  13. case muteAudioItemType
  14. case muteVideoItemType
  15. case raiseHandItemType
  16. case leaveSeatItemType
  17. case shareScreenItemType
  18. case moreItemType
  19. case switchCamaraItemType
  20. case raiseHandApplyItemType
  21. case reportItemType
  22. case normal
  23. }
  24. enum Orientation {
  25. case left
  26. case right
  27. }
  28. var buttonType: ButtonType = .normal
  29. var normalIcon: String = ""
  30. var selectedIcon: String = ""
  31. var disabledIcon: String = ""
  32. var normalTitle: String = ""
  33. var selectedTitle: String = ""
  34. var titleFont: UIFont?
  35. var titleColor: UIColor?
  36. var resourceBundle: Bundle = Bundle.main
  37. var action: ((Any)->Void)?
  38. var normalImage: UIImage? {
  39. return UIImage(named: normalIcon, in: resourceBundle, compatibleWith: nil)?.checkOverturn()
  40. }
  41. var selectedImage: UIImage? {
  42. return UIImage(named: selectedIcon, in: resourceBundle, compatibleWith: nil)?.checkOverturn()
  43. }
  44. var disabledImage: UIImage? {
  45. return UIImage(named: disabledIcon, in: resourceBundle, compatibleWith: nil)?.checkOverturn()
  46. }
  47. var hasNotice: Bool = false
  48. var noticeText: String = ""
  49. var cornerRadius: CGFloat?
  50. var hasLineView: Bool = false
  51. var orientation: Orientation = .left
  52. var imageSize: CGSize?
  53. var size: CGSize?
  54. var backgroundColor: UIColor?
  55. var isSelect: Bool = false
  56. var isEnabled: Bool = true
  57. var isHidden: Bool = false
  58. var alpha: CGFloat = 1
  59. var bindStateClosure: ButtonStateBinderClosure?
  60. }