mac_touchbar_controls.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. namespace Media {
  9. namespace Player {
  10. struct TrackState;
  11. } // namespace Player
  12. } // namespace Media
  13. @class NSButton;
  14. @class NSCustomTouchBarItem;
  15. @class NSImage;
  16. @class NSSliderTouchBarItem;
  17. namespace TouchBar {
  18. [[nodiscard]] API_AVAILABLE(macos(10.12.2))
  19. NSButton *CreateTouchBarButton(
  20. NSImage *image,
  21. rpl::lifetime &lifetime,
  22. Fn<void()> callback);
  23. [[nodiscard]] API_AVAILABLE(macos(10.12.2))
  24. NSButton *CreateTouchBarButton(
  25. const style::icon &icon,
  26. rpl::lifetime &lifetime,
  27. Fn<void()> callback);
  28. [[nodiscard]] API_AVAILABLE(macos(10.12.2))
  29. NSButton *CreateTouchBarButtonWithTwoStates(
  30. NSImage *icon1,
  31. NSImage *icon2,
  32. rpl::lifetime &lifetime,
  33. Fn<void(bool)> callback,
  34. bool firstState,
  35. rpl::producer<bool> stateChanged = rpl::never<bool>());
  36. [[nodiscard]] API_AVAILABLE(macos(10.12.2))
  37. NSButton *CreateTouchBarButtonWithTwoStates(
  38. const style::icon &icon1,
  39. const style::icon &icon2,
  40. rpl::lifetime &lifetime,
  41. Fn<void(bool)> callback,
  42. bool firstState,
  43. rpl::producer<bool> stateChanged = rpl::never<bool>());
  44. [[nodiscard]] API_AVAILABLE(macos(10.12.2))
  45. NSSliderTouchBarItem *CreateTouchBarSlider(
  46. NSString *itemId,
  47. rpl::lifetime &lifetime,
  48. Fn<void(bool, double, double)> callback,
  49. rpl::producer<Media::Player::TrackState> stateChanged);
  50. [[nodiscard]] API_AVAILABLE(macos(10.12.2))
  51. NSCustomTouchBarItem *CreateTouchBarTrackPosition(
  52. NSString *itemId,
  53. rpl::producer<Media::Player::TrackState> stateChanged);
  54. } // namespace TouchBar