MauiKit Controls

mauimacos.mm
1#include "mauimacos.h"
2
3#include <Cocoa/Cocoa.h>
4#import <CoreFoundation/CoreFoundation.h>
5#import <ApplicationServices/ApplicationServices.h>
6
7#include <QUrl>
8
9MAUIMacOS::MAUIMacOS(QObject *parent) : AbstractPlatform(parent)
10{
11
12}
13
15{
16 Q_UNUSED(winId)
17
18// if(winId == -1)
19// {
20// QWindowList windows = QGuiApplication::allWindows();
21// QWindow* win = windows.first();
22// winId = win->winId();
23// }
24
25// NSView *nativeView = reinterpret_cast<NSView *>(winId);
26// NSWindow* nativeWindow = [nativeView window];
27
28// [nativeWindow setStyleMask:[nativeWindow styleMask] | NSFullSizeContentViewWindowMask | NSWindowTitleHidden ];
29// [nativeWindow setTitlebarAppearsTransparent:YES];
30// [nativeWindow setMovableByWindowBackground:YES];
31}
32
33
34
35void MAUIMacOS::runApp(const QString &app, const QList<QUrl> &files)
36{
37 CFURLRef appUrl = QUrl::fromLocalFile(app).toCFURL();
38
39 CFMutableArrayRef cfaFiles =
40 CFArrayCreateMutable(kCFAllocatorDefault,
41 files.count(),
42 &kCFTypeArrayCallBacks);
43 for (const QUrl &url: files) {
44 CFURLRef u = url.toCFURL();
45 CFArrayAppendValue(cfaFiles, u);
46 CFRelease(u);
47 }
48
49 LSLaunchURLSpec inspec;
50 inspec.appURL = appUrl;
51 inspec.itemURLs = cfaFiles;
52 inspec.asyncRefCon = NULL;
53 inspec.launchFlags = kLSLaunchDefaults + kLSLaunchAndDisplayErrors;
54 inspec.passThruParams = NULL;
55
56 OSStatus ret;
57 ret = LSOpenFromURLSpec(&inspec, NULL);
58 CFRelease(appUrl);
59}
60
61void MAUIMacOS::shareFiles(const QList<QUrl> &urls)
62{
63 Q_UNUSED(urls)
64}
65
66void MAUIMacOS::shareText(const QString &urls)
67{
68Q_UNUSED(urls)
69}
70
71
72bool MAUIMacOS::hasKeyboard()
73{
74return true;
75}
76
77bool MAUIMacOS::hasMouse()
78{
79 return true;
80}
81
The AbstractPlatform class Defines abstract methods and properties that are common to be implemeted b...
static void runApp(const QString &app, const QList< QUrl > &files)
runApp
Definition mauimacos.cpp:31
static void removeTitlebarFromWindow(long winId=-1)
removeTitlebarFromWindow
Definition mauimacos.cpp:10
qsizetype count() const const
QUrl fromLocalFile(const QString &localFile)
CFURLRef toCFURL() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:56:16 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.