mac_touchbar_main.mm 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #include "platform/mac/touchbar/mac_touchbar_main.h"
  8. #include "platform/mac/touchbar/items/mac_formatter_item.h"
  9. #include "platform/mac/touchbar/items/mac_pinned_chats_item.h"
  10. #include "platform/mac/touchbar/items/mac_scrubber_item.h"
  11. #include "platform/mac/touchbar/mac_touchbar_common.h"
  12. #include "window/window_controller.h"
  13. #include "window/window_session_controller.h"
  14. #import <AppKit/NSCustomTouchBarItem.h>
  15. using namespace TouchBar::Main;
  16. #pragma mark - TouchBarMain
  17. @interface TouchBarMain()
  18. @end // @interface TouchBarMain
  19. @implementation TouchBarMain
  20. - (id)init:(not_null<Window::Controller*>)controller
  21. touchBarSwitches:(rpl::producer<>)touchBarSwitches {
  22. self = [super init];
  23. if (!self) {
  24. return self;
  25. }
  26. auto *pin = [[[NSCustomTouchBarItem alloc]
  27. initWithIdentifier:kPinnedPanelItemIdentifier] autorelease];
  28. pin.view = [[[PinnedDialogsPanel alloc]
  29. init:(&controller->sessionController()->session())
  30. destroyEvent:std::move(touchBarSwitches)] autorelease];
  31. auto *sticker = [[[StickerEmojiPopover alloc]
  32. init:controller
  33. identifier:kPopoverPickerItemIdentifier] autorelease];
  34. auto *format = [[[TextFormatPopover alloc]
  35. init:kPopoverInputItemIdentifier] autorelease];
  36. self.templateItems = [NSSet setWithArray:@[pin, sticker, format]];
  37. return self;
  38. }
  39. @end // @implementation TouchBarMain