summaryrefslogtreecommitdiffstats
path: root/src/widgets/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/platforms')
-rw-r--r--src/widgets/platforms/mac/qapplication_mac.mm1
-rw-r--r--src/widgets/platforms/mac/qcocoamenuloader_mac.mm2
-rw-r--r--src/widgets/platforms/mac/qcocoamenuloader_mac_p.h2
-rw-r--r--src/widgets/platforms/mac/qt_cocoa_helpers_mac.mm85
-rw-r--r--src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h9
-rw-r--r--src/widgets/platforms/mac/qt_widget_helpers_mac.mm113
-rw-r--r--src/widgets/platforms/mac/qt_widget_helpers_mac_p.h65
7 files changed, 179 insertions, 98 deletions
diff --git a/src/widgets/platforms/mac/qapplication_mac.mm b/src/widgets/platforms/mac/qapplication_mac.mm
index cb1f0cdbe4..5868849836 100644
--- a/src/widgets/platforms/mac/qapplication_mac.mm
+++ b/src/widgets/platforms/mac/qapplication_mac.mm
@@ -181,7 +181,6 @@ static struct {
static bool app_do_modal = false; // modal mode
extern QWidgetList *qt_modal_stack; // stack of modal widgets
extern bool qt_tab_all_widgets; // from qapplication.cpp
-bool qt_mac_app_fullscreen = false;
bool qt_scrollbar_jump_to_pos = false;
static bool qt_mac_collapse_on_dblclick = true;
extern int qt_antialiasing_threshold; // from qapplication.cpp
diff --git a/src/widgets/platforms/mac/qcocoamenuloader_mac.mm b/src/widgets/platforms/mac/qcocoamenuloader_mac.mm
index da11c3a1c6..3516ad18d3 100644
--- a/src/widgets/platforms/mac/qcocoamenuloader_mac.mm
+++ b/src/widgets/platforms/mac/qcocoamenuloader_mac.mm
@@ -40,7 +40,6 @@
****************************************************************************/
#include "qmacdefines_mac.h"
-#ifdef QT_MAC_USE_COCOA
#include <qaction.h>
#include <qcoreapplication.h>
#include <private/qcocoamenuloader_mac_p.h>
@@ -261,4 +260,3 @@ QT_USE_NAMESPACE
[NSApp orderFrontCharacterPalette:sender];
}
@end
-#endif // QT_MAC_USE_COCOA
diff --git a/src/widgets/platforms/mac/qcocoamenuloader_mac_p.h b/src/widgets/platforms/mac/qcocoamenuloader_mac_p.h
index 1e637fdc39..9da200a24e 100644
--- a/src/widgets/platforms/mac/qcocoamenuloader_mac_p.h
+++ b/src/widgets/platforms/mac/qcocoamenuloader_mac_p.h
@@ -54,7 +54,6 @@
//
#include "qmacdefines_mac.h"
-#ifdef QT_MAC_USE_COCOA
#import <Cocoa/Cocoa.h>
@interface QT_MANGLE_NAMESPACE(QCocoaMenuLoader) : NSResponder
@@ -91,5 +90,4 @@
- (void)orderFrontCharacterPalette:(id)sender;
@end
-#endif // QT_MAC_USE_COCOA
#endif // QCOCOAMENULOADER_P_H
diff --git a/src/widgets/platforms/mac/qt_cocoa_helpers_mac.mm b/src/widgets/platforms/mac/qt_cocoa_helpers_mac.mm
index 97ed7f7e39..8227a888f7 100644
--- a/src/widgets/platforms/mac/qt_cocoa_helpers_mac.mm
+++ b/src/widgets/platforms/mac/qt_cocoa_helpers_mac.mm
@@ -319,24 +319,6 @@ void macWindowFlush(void * /*OSWindowRef*/ window)
#endif
}
-void * /*NSImage */qt_mac_create_nsimage(const QPixmap &pm)
-{
- QMacCocoaAutoReleasePool pool;
- if(QCFType<CGImageRef> image = pm.toMacCGImageRef()) {
- NSImage *newImage = 0;
- NSRect imageRect = NSMakeRect(0.0, 0.0, CGImageGetWidth(image), CGImageGetHeight(image));
- newImage = [[NSImage alloc] initWithSize:imageRect.size];
- [newImage lockFocus];
- {
- CGContextRef imageContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
- CGContextDrawImage(imageContext, *(CGRect*)&imageRect, image);
- }
- [newImage unlockFocus];
- return newImage;
- }
- return 0;
-}
-
void qt_mac_update_mouseTracking(QWidget *widget)
{
#ifdef QT_MAC_USE_COCOA
@@ -695,27 +677,6 @@ Qt::KeyboardModifiers qt_cocoaModifiers2QtModifiers(ulong modifierFlags)
return qtMods;
}
-NSString *qt_mac_removePrivateUnicode(NSString* string)
-{
- int len = [string length];
- if (len) {
- QVarLengthArray <unichar, 10> characters(len);
- bool changed = false;
- for (int i = 0; i<len; i++) {
- characters[i] = [string characterAtIndex:i];
- // check if they belong to key codes in private unicode range
- // currently we need to handle only the NSDeleteFunctionKey
- if (characters[i] == NSDeleteFunctionKey) {
- characters[i] = NSDeleteCharacter;
- changed = true;
- }
- }
- if (changed)
- return [NSString stringWithCharacters:characters.data() length:len];
- }
- return string;
-}
-
Qt::KeyboardModifiers qt_cocoaDragOperation2QtModifiers(uint dragOperations)
{
Qt::KeyboardModifiers qtMods =Qt::NoModifier;
@@ -1625,39 +1586,6 @@ void qt_mac_constructQIconFromIconRef(const IconRef icon, const IconRef overlayI
}
#ifdef QT_MAC_USE_COCOA
-void qt_mac_menu_collapseSeparators(void */*NSMenu **/ theMenu, bool collapse)
-{
- QMacCocoaAutoReleasePool pool;
- OSMenuRef menu = static_cast<OSMenuRef>(theMenu);
- if (collapse) {
- bool previousIsSeparator = true; // setting to true kills all the separators placed at the top.
- NSMenuItem *previousItem = nil;
-
- NSArray *itemArray = [menu itemArray];
- for (unsigned int i = 0; i < [itemArray count]; ++i) {
- NSMenuItem *item = reinterpret_cast<NSMenuItem *>([itemArray objectAtIndex:i]);
- if ([item isSeparatorItem]) {
- [item setHidden:previousIsSeparator];
- }
-
- if (![item isHidden]) {
- previousItem = item;
- previousIsSeparator = ([previousItem isSeparatorItem]);
- }
- }
-
- // We now need to check the final item since we don't want any separators at the end of the list.
- if (previousItem && previousIsSeparator)
- [previousItem setHidden:YES];
- } else {
- NSArray *itemArray = [menu itemArray];
- for (unsigned int i = 0; i < [itemArray count]; ++i) {
- NSMenuItem *item = reinterpret_cast<NSMenuItem *>([itemArray objectAtIndex:i]);
- if (QAction *action = reinterpret_cast<QAction *>([item tag]))
- [item setHidden:!action->isVisible()];
- }
- }
-}
class CocoaPostMessageAfterEventLoopExitHelp : public QObject
{
@@ -1701,19 +1629,6 @@ void qt_cocoaPostMessageAfterEventLoopExit(id target, SEL selector, int argCount
#endif
-QMacCocoaAutoReleasePool::QMacCocoaAutoReleasePool()
-{
-#ifndef QT_MAC_USE_COCOA
- NSApplicationLoad();
-#endif
- pool = (void*)[[NSAutoreleasePool alloc] init];
-}
-
-QMacCocoaAutoReleasePool::~QMacCocoaAutoReleasePool()
-{
- [(NSAutoreleasePool*)pool release];
-}
-
void qt_mac_post_retranslateAppMenu()
{
#ifdef QT_MAC_USE_COCOA
diff --git a/src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h b/src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h
index 14be29e61c..070ecfb030 100644
--- a/src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h
+++ b/src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h
@@ -143,14 +143,11 @@ void qt_mac_update_mouseTracking(QWidget *widget);
OSStatus qt_mac_drawCGImage(CGContextRef cg, const CGRect *inbounds, CGImageRef);
bool qt_mac_checkForNativeSizeGrip(const QWidget *widget);
void qt_dispatchTabletProximityEvent(void * /*NSEvent * */ tabletEvent);
-#ifdef QT_MAC_USE_COCOA
bool qt_dispatchKeyEventWithCocoa(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent);
// These methods exists only for supporting unified mode.
void macDrawRectOnTop(void * /*OSWindowRef */ window);
void macSyncDrawingOnFirstInvocation(void * /*OSWindowRef */window);
void qt_cocoaStackChildWindowOnTopOfOtherChildren(QWidget *widget);
-void qt_mac_menu_collapseSeparators(void * /*NSMenu */ menu, bool collapse);
-#endif
bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent);
void qt_dispatchModifiersChanged(void * /*NSEvent * */flagsChangedEvent, QWidget *widgetToGetEvent);
bool qt_mac_handleTabletEvent(void * /*QCocoaView * */view, void * /*NSEvent * */event);
@@ -163,7 +160,7 @@ QPixmap qt_mac_convert_iconref(const IconRef icon, int width, int height);
void qt_mac_constructQIconFromIconRef(const IconRef icon, const IconRef overlayIcon, QIcon *retIcon,
QStyle::StandardPixmap standardIcon = QStyle::SP_CustomBase);
-#if QT_MAC_USE_COCOA && __OBJC__
+#ifdef __OBJC__
struct DnDParams
{
NSView *view;
@@ -217,7 +214,6 @@ inline QString qt_mac_NSStringToQString(const NSString *nsstr)
inline NSString *qt_mac_QStringToNSString(const QString &qstr)
{ return [reinterpret_cast<const NSString *>(QCFString::toCFStringRef(qstr)) autorelease]; }
-#ifdef QT_MAC_USE_COCOA
class QCocoaPostMessageArgs {
public:
id target;
@@ -242,7 +238,6 @@ public:
};
void qt_cocoaPostMessage(id target, SEL selector, int argCount=0, id arg1=0, id arg2=0);
void qt_cocoaPostMessageAfterEventLoopExit(id target, SEL selector, int argCount=0, id arg1=0, id arg2=0);
-#endif
#endif
@@ -301,11 +296,9 @@ public:
void qt_mac_post_retranslateAppMenu();
-#ifdef QT_MAC_USE_COCOA
void qt_mac_display(QWidget *widget);
void qt_mac_setNeedsDisplay(QWidget *widget);
void qt_mac_setNeedsDisplayInRect(QWidget *widget, QRegion region);
-#endif // QT_MAC_USE_COCOA
// Utility functions to ease the use of Core Graphics contexts.
diff --git a/src/widgets/platforms/mac/qt_widget_helpers_mac.mm b/src/widgets/platforms/mac/qt_widget_helpers_mac.mm
new file mode 100644
index 0000000000..2fe72be553
--- /dev/null
+++ b/src/widgets/platforms/mac/qt_widget_helpers_mac.mm
@@ -0,0 +1,113 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ ** All rights reserved.
+ ** Contact: Nokia Corporation (qt-info@nokia.com)
+ **
+ ** This file is part of the QtGui module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** GNU Lesser General Public License Usage
+ ** This file may be used under the terms of the GNU Lesser General Public
+ ** License version 2.1 as published by the Free Software Foundation and
+ ** appearing in the file LICENSE.LGPL included in the packaging of this
+ ** file. Please review the following information to ensure the GNU Lesser
+ ** General Public License version 2.1 requirements will be met:
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Nokia gives you certain additional
+ ** rights. These rights are described in the Nokia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU General
+ ** Public License version 3.0 as published by the Free Software Foundation
+ ** and appearing in the file LICENSE.GPL included in the packaging of this
+ ** file. Please review the following information to ensure the GNU General
+ ** Public License version 3.0 requirements will be met:
+ ** http://www.gnu.org/copyleft/gpl.html.
+ **
+ ** Other Usage
+ ** Alternatively, this file may be used in accordance with the terms and
+ ** conditions contained in a signed written agreement between you and Nokia.
+ **
+ **
+ **
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include <private/qt_widget_helpers_mac_p.h>
+
+#include <QtCore>
+#include <QtGui>
+
+//
+// Globabal variables
+//
+bool qt_mac_app_fullscreen = false;
+
+//
+// QMacCocoaAutoReleasePool
+//
+QMacCocoaAutoReleasePool::QMacCocoaAutoReleasePool()
+{
+ pool = (void*)[[NSAutoreleasePool alloc] init];
+}
+
+QMacCocoaAutoReleasePool::~QMacCocoaAutoReleasePool()
+{
+ [(NSAutoreleasePool*)pool release];
+}
+
+//
+// Functions
+//
+void * /*NSImage */qt_mac_create_nsimage(const QPixmap &pm)
+{
+ QMacCocoaAutoReleasePool pool;
+ qWarning("Unimplemented: qt_mac_create_nsimage");
+#if 0
+ if(QCFType<CGImageRef> image = pm.toMacCGImageRef()) {
+ NSImage *newImage = 0;
+ NSRect imageRect = NSMakeRect(0.0, 0.0, CGImageGetWidth(image), CGImageGetHeight(image));
+ newImage = [[NSImage alloc] initWithSize:imageRect.size];
+ [newImage lockFocus];
+ {
+ CGContextRef imageContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
+ CGContextDrawImage(imageContext, *(CGRect*)&imageRect, image);
+ }
+ [newImage unlockFocus];
+ return newImage;
+ }
+#endif
+ return 0;
+}
+
+
+QString qt_mac_removeMnemonics(const QString &original)
+{
+ QString returnText(original.size(), 0);
+ int finalDest = 0;
+ int currPos = 0;
+ int l = original.length();
+ while (l) {
+ if (original.at(currPos) == QLatin1Char('&')
+ && (l == 1 || original.at(currPos + 1) != QLatin1Char('&'))) {
+ ++currPos;
+ --l;
+ if (l == 0)
+ break;
+ }
+ returnText[finalDest] = original.at(currPos);
+ ++currPos;
+ ++finalDest;
+ --l;
+ }
+ returnText.truncate(finalDest);
+ return returnText;
+}
+
+
diff --git a/src/widgets/platforms/mac/qt_widget_helpers_mac_p.h b/src/widgets/platforms/mac/qt_widget_helpers_mac_p.h
new file mode 100644
index 0000000000..64f7e0a721
--- /dev/null
+++ b/src/widgets/platforms/mac/qt_widget_helpers_mac_p.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ ** All rights reserved.
+ ** Contact: Nokia Corporation (qt-info@nokia.com)
+ **
+ ** This file is part of the QtGui module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** GNU Lesser General Public License Usage
+ ** This file may be used under the terms of the GNU Lesser General Public
+ ** License version 2.1 as published by the Free Software Foundation and
+ ** appearing in the file LICENSE.LGPL included in the packaging of this
+ ** file. Please review the following information to ensure the GNU Lesser
+ ** General Public License version 2.1 requirements will be met:
+ ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Nokia gives you certain additional
+ ** rights. These rights are described in the Nokia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU General
+ ** Public License version 3.0 as published by the Free Software Foundation
+ ** and appearing in the file LICENSE.GPL included in the packaging of this
+ ** file. Please review the following information to ensure the GNU General
+ ** Public License version 3.0 requirements will be met:
+ ** http://www.gnu.org/copyleft/gpl.html.
+ **
+ ** Other Usage
+ ** Alternatively, this file may be used in accordance with the terms and
+ ** conditions contained in a signed written agreement between you and Nokia.
+ **
+ **
+ **
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#ifndef QT_WIDGET_HELPERS_MAC_P_H
+#define QT_WIDGET_HELPERS_MAC_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It provides helper functions
+// for the QWidget implementation on Mac OS X. This header file may
+// change from version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qt_mac_p.h>
+
+class QPixmap;
+class QString;
+
+void * /*NSImage */qt_mac_create_nsimage(const QPixmap &pm);
+QString qt_mac_removeMnemonics(const QString &original);
+
+
+#endif //QT_WIDGET_HELPERS_MAC_P_H