6#include <qpa/qplatformtheme.h>
13#include <qpa/qplatformscreen.h>
14#include <private/qguiapplication_p.h>
15#include <private/qwindow_p.h>
16#include <QtGui/private/qcoregraphics_p.h>
42 result << QString::fromNSString(
string);
48 NSMutableArray<NSString *> *
result = [NSMutableArray<NSString *> arrayWithCapacity:
list.
size()];
50 [
result addObject:
string.toNSString()];
78 return NSDragOperationNone;
83 NSDragOperation nsActions = NSDragOperationNone;
106 if (
dnd_enums[
i].mac_code == NSDragOperationEvery)
133 return qt_objc_cast<QNSView *>(
view);
144 bool forceTransform =
true;
145 CFTypeRef
value = CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(),
146 CFSTR(
"LSUIElement"));
148 CFTypeID valueType = CFGetTypeID(
value);
151 if (valueType == CFStringGetTypeID())
152 forceTransform = !(QString::fromCFString(
static_cast<CFStringRef
>(
value)).toInt());
153 else if (valueType == CFBooleanGetTypeID())
154 forceTransform = !CFBooleanGetValue(
static_cast<CFBooleanRef
>(
value));
155 else if (valueType == CFNumberGetTypeID()) {
157 CFNumberGetValue(
static_cast<CFNumberRef
>(
value), kCFNumberIntType, &valueAsInt);
158 forceTransform = !valueAsInt;
162 if (forceTransform) {
163 value = CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(),
164 CFSTR(
"LSBackgroundOnly"));
166 CFTypeID valueType = CFGetTypeID(
value);
167 if (valueType == CFBooleanGetTypeID())
168 forceTransform = !CFBooleanGetValue(
static_cast<CFBooleanRef
>(
value));
169 else if (valueType == CFStringGetTypeID())
170 forceTransform = !(QString::fromCFString(
static_cast<CFStringRef
>(
value)).toInt());
171 else if (valueType == CFNumberGetTypeID()) {
173 CFNumberGetValue(
static_cast<CFNumberRef
>(
value), kCFNumberIntType, &valueAsInt);
174 forceTransform = !valueAsInt;
179 if (forceTransform) {
180 [[NSApplication sharedApplication] setActivationPolicy:NSApplicationActivationPolicyRegular];
187 CFTypeRef
string = CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), CFSTR(
"CFBundleName"));
189 appName = QString::fromCFString(
static_cast<CFStringRef
>(
string));
193 if (arg0.contains(
"/")) {
195 appName = parts.at(parts.count() - 1);
246 if (buttonNum >= 0 && buttonNum <= 31)
269 switch (
event.type) {
270 case NSEventTypeRightMouseUp:
271 case NSEventTypeRightMouseDown:
288 switch (
event.type) {
289 case NSEventTypeLeftMouseDown:
290 case NSEventTypeRightMouseDown:
291 case NSEventTypeOtherMouseDown:
294 case NSEventTypeLeftMouseUp:
295 case NSEventTypeRightMouseUp:
296 case NSEventTypeOtherMouseUp:
299 case NSEventTypeLeftMouseDragged:
300 case NSEventTypeRightMouseDragged:
301 case NSEventTypeOtherMouseDragged:
304 case NSEventTypeMouseMoved:
341 static const NSBundle *appKit = [NSBundle bundleForClass:NSApplication.class];
366@synthesize okButton = _okButton;
371- (instancetype)initWithPanelDelegate:(
id<QNSPanelDelegate>)panelDelegate
373 if ((
self = [super initWithFrame:NSZeroRect])) {
375 _okButton = [
self createButtonWithTitle:QPlatformDialogHelper::Ok];
376 _okButton.action =
@selector(onOkClicked);
377 _okButton.target = panelDelegate;
378 _cancelButton = [
self createButtonWithTitle:QPlatformDialogHelper::Cancel];
394 [_cancelButton release];
404 NSButton *
button = [[NSButton alloc] initWithFrame:NSZeroRect];
405 button.buttonType = NSButtonTypeMomentaryLight;
406 button.bezelStyle = NSBezelStyleRounded;
410 button.title = (NSString *)cleanTitle.toCFString();
412 [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSControlSizeRegular]];
413 [
self addSubview:button];
419 static const CGFloat ButtonMinWidth = 78.0;
420 static const CGFloat ButtonMinHeight = 32.0;
421 static const CGFloat ButtonSpacing = 0.0;
422 static const CGFloat ButtonTopMargin = 0.0;
423 static const CGFloat ButtonBottomMargin = 7.0;
424 static const CGFloat ButtonSideMargin = 9.0;
428 [
self.okButton sizeToFit];
429 NSSize okSizeHint =
self.okButton.frame.
size;
431 [
self.cancelButton sizeToFit];
432 NSSize cancelSizeHint =
self.cancelButton.frame.
size;
435 qMax(okSizeHint.width, cancelSizeHint.width)),
438 qMax(okSizeHint.height, cancelSizeHint.height));
440 NSRect okRect = { {
frameSize.width - ButtonSideMargin - buttonWidth,
441 ButtonBottomMargin },
442 { buttonWidth, buttonHeight } };
443 self.okButton.frame = okRect;
444 self.okButton.needsDisplay = YES;
446 NSRect cancelRect = { { okRect.origin.x - ButtonSpacing - buttonWidth,
447 ButtonBottomMargin },
448 { buttonWidth, buttonHeight } };
449 self.cancelButton.frame = cancelRect;
450 self.cancelButton.needsDisplay = YES;
453 if (!
self.panelContents)
460 const CGFloat buttonBoxHeight = ButtonBottomMargin + buttonHeight + ButtonTopMargin;
461 const NSRect panelContentsFrame = NSMakeRect(
463 buttonBoxHeight +
self.panelContentsMargins.bottom,
465 frameSize.height - buttonBoxHeight - (
self.panelContentsMargins.top +
self.panelContentsMargins.bottom));
466 self.panelContents.frame = panelContentsFrame;
467 self.panelContents.needsDisplay = YES;
469 self.needsDisplay = YES;
483 InputMethodQueryResult
result;
484 static QMetaEnum queryEnum = QMetaEnum::fromType<Qt::InputMethodQuery>();
485 for (
int i = 0;
i < queryEnum.keyCount(); ++
i) {
501 if (
range.location == NSNotFound) {
503 debug.nospace() <<
"{NSNotFound, " <<
range.length <<
"}";
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
Type
This enum type defines the valid event types in Qt.
static QGuiApplicationPrivate * instance()
static QPlatformTheme * platformTheme()
qsizetype size() const noexcept
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString left(qsizetype n) const &
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
qsizetype size() const noexcept
Returns the number of characters in this string.
QString right(qsizetype n) const &
Combined button and popup list for selecting options.
Qt::MouseButtons cocoaMouseButtons2QtMouseButtons(NSInteger pressedMouseButtons)
Returns the Qt::MouseButtons that corresponds to an NSEvent.pressedMouseButtons.
NSString * qt_mac_AppKitString(NSString *table, NSString *key)
QNSView * qnsview_cast(NSView *view)
Returns the view cast to a QNSview if possible.
QEvent::Type cocoaEvent2QtMouseEvent(NSEvent *event)
Returns the QEvent::Type that corresponds to an NSEvent.type.
Qt::DropActions qt_mac_mapNSDragOperations(NSDragOperation nsActions)
QString qt_mac_applicationName()
QPointF qt_mac_flip(const QPointF &pos, const QRectF &reference)
Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum)
Returns the Qt::Button that corresponds to an NSEvent.buttonNumber.
QStringList qt_mac_NSArrayToQStringList(NSArray< NSString * > *array)
QDebug operator<<(QDebug debug, const NSRange &range)
void qt_mac_transformProccessToForegroundApplication()
NSDragOperation qt_mac_mapDropActions(Qt::DropActions actions)
static dndenum_mapper dnd_enums[]
Qt::DropAction qt_mac_mapNSDragOperation(NSDragOperation nsActions)
QString qt_mac_removeAmpersandEscapes(QString s)
NSEdgeInsets _panelContentsMargins
InputMethodQueryResult queryInputMethod(QObject *object, Qt::InputMethodQueries queries)
NSDragOperation qt_mac_mapDropAction(Qt::DropAction action)
NSMutableArray< NSString * > * qt_mac_QStringListToNSMutableArray(const QStringList &list)
Qt::MouseButtons currentlyPressedMouseButtons()
Returns the Qt::MouseButtons that corresponds to an NSEvent.pressedMouseButtons.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_LOGGING_CATEGORY(name,...)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLenum GLenum GLenum input
GLenum GLenum GLsizei void * table
static constexpr QSize frameSize(const T &frame)
QFileSelector selector
[1]