1 /* 2 Copyright (c) 2020, Lukas Holecek <hluk@email.cz> 3 4 This file is part of CopyQ. 5 6 CopyQ is free software: you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 CopyQ is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with CopyQ. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef MACPLATFORMWINDOW_H 21 #define MACPLATFORMWINDOW_H 22 23 #include "platform/platformwindow.h" 24 25 // For WId 26 #include <QWidget> 27 28 #ifdef __OBJC__ 29 @class NSWindow; 30 @class NSRunningApplication; 31 #else 32 using NSWindow = void; 33 using NSRunningApplication = void; 34 #endif 35 36 class MacPlatformWindow final : public PlatformWindow 37 { 38 public: 39 MacPlatformWindow(); 40 explicit MacPlatformWindow(WId wid); 41 explicit MacPlatformWindow(NSRunningApplication *runningApplication); 42 43 virtual ~MacPlatformWindow(); 44 45 /** 46 * Return window title text of current window. 47 * 48 * On OS X, this gets the title of the application instead of the window. 49 */ 50 QString getTitle(); 51 52 void raise(); 53 void pasteClipboard(); 54 void copy(); 55 56 private: 57 // Don't allow copies 58 Q_DISABLE_COPY(MacPlatformWindow) 59 60 long int m_windowNumber; 61 NSWindow *m_window; 62 NSRunningApplication *m_runningApplication; 63 }; 64 65 #endif // MACPLATFORMWINDOW_H 66