/* This file is part of Telegram Desktop, the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "platform/mac/touchbar/mac_touchbar_common.h" #ifndef OS_OSX #import NSImage *qt_mac_create_nsimage(const QPixmap &pm); namespace TouchBar { int WidthFromString(NSString *s) { return (int)ceil( [[NSTextField labelWithString:s] frame].size.width) * 1.2; } NSImage *CreateNSImageFromStyleIcon(const style::icon &icon, int size) { const auto instance = icon.instance(QColor(255, 255, 255, 255), 100); auto pixmap = QPixmap::fromImage(instance); pixmap.setDevicePixelRatio(cRetinaFactor()); NSImage *image = [qt_mac_create_nsimage(pixmap) autorelease]; [image setSize:NSMakeSize(size, size)]; return image; } } // namespace TouchBar #endif // OS_OSX