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));
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:
357@synthesize okButton = _okButton;
362- (instancetype)initWithPanelDelegate:(
id<QNSPanelDelegate>)panelDelegate
364 if ((
self = [super initWithFrame:NSZeroRect])) {
366 _okButton = [
self createButtonWithTitle:QPlatformDialogHelper::Ok];
367 _okButton.action =
@selector(onOkClicked);
368 _okButton.target = panelDelegate;
369 _cancelButton = [
self createButtonWithTitle:QPlatformDialogHelper::Cancel];
385 [_cancelButton release];
395 NSButton *
button = [[NSButton alloc] initWithFrame:NSZeroRect];
396 button.buttonType = NSButtonTypeMomentaryLight;
397 button.bezelStyle = NSBezelStyleRounded;
401 button.title = (NSString *)cleanTitle.toCFString();
402 ((NSButtonCell *)
button.cell).font =
403 [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSControlSizeRegular]];
404 [
self addSubview:button];
410 static const CGFloat ButtonMinWidth = 78.0;
411 static const CGFloat ButtonMinHeight = 32.0;
412 static const CGFloat ButtonSpacing = 0.0;
413 static const CGFloat ButtonTopMargin = 0.0;
414 static const CGFloat ButtonBottomMargin = 7.0;
415 static const CGFloat ButtonSideMargin = 9.0;
419 [
self.okButton sizeToFit];
420 NSSize okSizeHint =
self.okButton.frame.
size;
422 [
self.cancelButton sizeToFit];
423 NSSize cancelSizeHint =
self.cancelButton.frame.
size;
426 qMax(okSizeHint.width, cancelSizeHint.width)),
429 qMax(okSizeHint.height, cancelSizeHint.height));
431 NSRect okRect = { {
frameSize.
width - ButtonSideMargin - buttonWidth,
432 ButtonBottomMargin },
433 { buttonWidth, buttonHeight } };
434 self.okButton.frame = okRect;
435 self.okButton.needsDisplay = YES;
437 NSRect cancelRect = { { okRect.origin.x - ButtonSpacing - buttonWidth,
438 ButtonBottomMargin },
439 { buttonWidth, buttonHeight } };
440 self.cancelButton.frame = cancelRect;
441 self.cancelButton.needsDisplay = YES;
444 if (!
self.panelContents)
451 const CGFloat buttonBoxHeight = ButtonBottomMargin + buttonHeight + ButtonTopMargin;
452 const NSRect panelContentsFrame = NSMakeRect(
454 buttonBoxHeight +
self.panelContentsMargins.bottom,
457 self.panelContents.frame = panelContentsFrame;
458 self.panelContents.needsDisplay = YES;
460 self.needsDisplay = YES;
474 InputMethodQueryResult
result;
475 static QMetaEnum queryEnum = QMetaEnum::fromType<Qt::InputMethodQuery>();
492 if (
range.location == NSNotFound) {
494 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
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString right(qsizetype n) const
Returns a substring that contains the n rightmost characters of the string.
QStringList split(const QString &sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Splits the string into substrings wherever sep occurs, and returns the list of those strings.
qsizetype size() const
Returns the number of characters in this string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString left(qsizetype n) const
Returns a substring that contains the n leftmost characters of the string.
QString trimmed() const &
bool toBool() const
Returns the variant as a bool if the variant has userType() Bool.
Combined button and popup list for selecting options.
Qt::MouseButtons cocoaMouseButtons2QtMouseButtons(NSInteger pressedMouseButtons)
Returns the Qt::MouseButtons that corresponds to an NSEvent.pressedMouseButtons.
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
static constexpr QSize frameSize(const T &frame)
QFileSelector selector
[1]