mac_touchbar_common.h 849 B

1234567891011121314151617181920212223242526272829303132
  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. #import <AppKit/NSImage.h>
  9. #import <Foundation/Foundation.h>
  10. namespace TouchBar {
  11. constexpr auto kCircleDiameter = 30;
  12. template <typename Callable>
  13. void CustomEnterToCocoaEventLoop(Callable callable) {
  14. id block = [^{ callable(); } copy]; // Don't forget to -release.
  15. [block
  16. performSelectorOnMainThread:@selector(invoke)
  17. withObject:nil
  18. waitUntilDone:true];
  19. // [block performSelector:@selector(invoke) withObject:nil afterDelay:d];
  20. [block release];
  21. }
  22. int WidthFromString(NSString *s);
  23. NSImage *CreateNSImageFromStyleIcon(const style::icon &icon, int size);
  24. } // namespace TouchBar