diff options
Diffstat (limited to 'src')
32 files changed, 0 insertions, 2286 deletions
diff --git a/src/macextras/doc/QtMacExtras/AppKit/AppKit.h b/src/macextras/doc/QtMacExtras/AppKit/AppKit.h deleted file mode 100644 index 29e2004..0000000 --- a/src/macextras/doc/QtMacExtras/AppKit/AppKit.h +++ /dev/null @@ -1 +0,0 @@ -// Dummy header used in documentation build diff --git a/src/macextras/doc/QtMacExtras/Cocoa/Cocoa.h b/src/macextras/doc/QtMacExtras/Cocoa/Cocoa.h deleted file mode 100644 index 29e2004..0000000 --- a/src/macextras/doc/QtMacExtras/Cocoa/Cocoa.h +++ /dev/null @@ -1 +0,0 @@ -// Dummy header used in documentation build diff --git a/src/macextras/doc/QtMacExtras/CoreFoundation/CoreFoundation.h b/src/macextras/doc/QtMacExtras/CoreFoundation/CoreFoundation.h deleted file mode 100644 index 29e2004..0000000 --- a/src/macextras/doc/QtMacExtras/CoreFoundation/CoreFoundation.h +++ /dev/null @@ -1 +0,0 @@ -// Dummy header used in documentation build diff --git a/src/macextras/doc/QtMacExtras/qmacextrasglobal.h b/src/macextras/doc/QtMacExtras/qmacextrasglobal.h deleted file mode 100644 index 93de6b4..0000000 --- a/src/macextras/doc/QtMacExtras/qmacextrasglobal.h +++ /dev/null @@ -1 +0,0 @@ -#include "../../qmacextrasglobal.h" diff --git a/src/macextras/doc/QtMacExtras/qmactoolbaritem.h b/src/macextras/doc/QtMacExtras/qmactoolbaritem.h deleted file mode 100644 index 43acd61..0000000 --- a/src/macextras/doc/QtMacExtras/qmactoolbaritem.h +++ /dev/null @@ -1 +0,0 @@ -#include "../../qmactoolbaritem.h" diff --git a/src/macextras/doc/QtMacExtrasDoc b/src/macextras/doc/QtMacExtrasDoc deleted file mode 100644 index b7f32c9..0000000 --- a/src/macextras/doc/QtMacExtrasDoc +++ /dev/null @@ -1,5 +0,0 @@ -#include "qmacextrasglobal.h" -#include "qmacfunctions.h" -#include "qmacpasteboardmime.h" -#include "qmactoolbar.h" -#include "qmactoolbaritem.h" diff --git a/src/macextras/doc/qtmacextras.qdocconf b/src/macextras/doc/qtmacextras.qdocconf deleted file mode 100644 index 6c02ada..0000000 --- a/src/macextras/doc/qtmacextras.qdocconf +++ /dev/null @@ -1,58 +0,0 @@ -include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) -include($QT_INSTALL_DOCS/config/exampleurl-qtmacextras.qdocconf) - -project = QtMacExtras -description = Qt Mac Extras Reference Documentation -version = $QT_VERSION - -exampledirs += ../../../examples/macextras \ - snippets - -examplesinstallpath = macextras - -# Add a generic 'Qt Code Sample' thumbnail in Qt Creator for all examples -manifestmeta.thumbnail.names += "QtMacExtras/*" - -# dummy module header for clang, found under doc/ -moduleheader = QtMacExtrasDoc - -# pass include paths to clang -includepaths += -I . \ - -I .. \ - -I ./QtMacExtras - -clangdefines += Q_OS_OSX Q_OS_MACOS QT_PLATFORM_UIKIT - -headerdirs += .. -sourcedirs += .. -imagedirs += images - -Cpp.ignoretokens += Q_MACEXTRAS_EXPORT - -depends += qtcore qtgui qtwidgets qtdoc - -qhp.projects = QtMacExtras - -qhp.QtMacExtras.file = qtmacextras.qhp - -qhp.QtMacExtras.namespace = org.qt-project.qtmacextras.$QT_VERSION_TAG - -qhp.QtMacExtras.indexTitle = Qt Mac Extras -qhp.QtMacExtras.indexRoot = - -qhp.QtMacExtras.filterAttributes = qtmacextras $QT_VERSION qtrefdoc -qhp.QtMacExtras.customFilters.Qt.name = QtMacExtras $QT_VERSION -qhp.QtMacExtras.customFilters.Qt.filterAttributes = qtmacextras $QT_VERSION - -qhp.QtMacExtras.virtualFolder = qtmacextras -qhp.QtMacExtras.subprojects = classes examples -qhp.QtMacExtras.subprojects.classes.title = C++ Classes and Namespaces -qhp.QtMacExtras.subprojects.classes.indexTitle = Qt Mac Extras C++ Classes -qhp.QtMacExtras.subprojects.classes.selectors = class function namespace fake:headerfile -qhp.QtMacExtras.subprojects.classes.sortPages = true -qhp.QtMacExtras.subprojects.examples.title = Examples -qhp.QtMacExtras.subprojects.examples.indexTitle = Qt Mac Extras Examples -qhp.QtMacExtras.subprojects.examples.selectors = fake:example - -navigation.landingpage = "Qt Mac Extras" -navigation.cppclassespage = "Qt Mac Extras C++ Classes" diff --git a/src/macextras/doc/snippets/code/use-qtmacextras.cpp b/src/macextras/doc/snippets/code/use-qtmacextras.cpp deleted file mode 100644 index d7ebd2e..0000000 --- a/src/macextras/doc/snippets/code/use-qtmacextras.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [include] -#include <QtMacExtras> -//! [include] diff --git a/src/macextras/doc/snippets/code/use-qtmacextras.pro b/src/macextras/doc/snippets/code/use-qtmacextras.pro deleted file mode 100644 index b0496bb..0000000 --- a/src/macextras/doc/snippets/code/use-qtmacextras.pro +++ /dev/null @@ -1,3 +0,0 @@ -#! [link] -QT += macextras -#! [link] diff --git a/src/macextras/doc/src/qtmacextras-examples.qdoc b/src/macextras/doc/src/qtmacextras-examples.qdoc deleted file mode 100644 index 2eddb5d..0000000 --- a/src/macextras/doc/src/qtmacextras-examples.qdoc +++ /dev/null @@ -1,39 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - -\group examples-qtmacextras -\title Qt Mac Extras Examples -\brief Examples for the Qt Mac Extras module. -\ingroup all-examples - -Here is a list of example applications demonstrating the functionality -provided by the \l{Qt Mac Extras} module. - -\note These examples work only on \l{Qt for macOS}{\macos} operating system. -*/ diff --git a/src/macextras/doc/src/qtmacextras-index.qdoc b/src/macextras/doc/src/qtmacextras-index.qdoc deleted file mode 100644 index 587ed9b..0000000 --- a/src/macextras/doc/src/qtmacextras-index.qdoc +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page qtmacextras-index.html - \title Qt Mac Extras - \brief Provides functionality specific to the \macos operating system. - - Qt Mac Extras provide classes and functions that enable you to use - miscellaneous functionality specific to the \macos and iOS operating systems. - - \section1 Getting Started - - To include the definitions of the module's classes and functions, use the - following include statement: - - \snippet code/use-qtmacextras.cpp include - - To link against the module, add this line to your qmake .pro file: - - \snippet code/use-qtmacextras.pro link - - \section1 Examples - - \list - \li \l {Qt Mac Extras Examples} - \endlist - - \section1 API Reference - - \list - \li \l {Qt Mac Extras C++ Classes}{C++ Classes and Namespaces} - \endlist -*/ diff --git a/src/macextras/doc/src/qtmacextras-module-cpp.qdoc b/src/macextras/doc/src/qtmacextras-module-cpp.qdoc deleted file mode 100644 index 6da19e1..0000000 --- a/src/macextras/doc/src/qtmacextras-module-cpp.qdoc +++ /dev/null @@ -1,38 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \module QtMacExtras - \title Qt Mac Extras C++ Classes - \brief Provides classes and functions specific to \macos and iOS operating systems. - - \ingroup modules - \ingroup technology-apis - \qtvariable macextras - - \sa QMacCocoaViewContainer, QMacNativeWidget -*/ diff --git a/src/macextras/macextras-lib.pri b/src/macextras/macextras-lib.pri deleted file mode 100644 index 41a6234..0000000 --- a/src/macextras/macextras-lib.pri +++ /dev/null @@ -1,37 +0,0 @@ -INCLUDEPATH += $$PWD - -PUBLIC_HEADERS += \ - $$PWD/qmacfunctions.h \ - -PRIVATE_HEADERS += $$PWD/qmacfunctions_p.h -OBJECTIVE_SOURCES += $$PWD/qmacfunctions.mm - -LIBS_PRIVATE += -framework Foundation - -macos { - PUBLIC_HEADERS += \ - $$PWD/qmactoolbar.h \ - $$PWD/qmactoolbaritem.h \ - - PRIVATE_HEADERS += \ - $$PWD/qmactoolbar_p.h \ - $$PWD/qmactoolbardelegate_p.h \ - $$PWD/qnstoolbar_p.h - - OBJECTIVE_SOURCES += \ - $$PWD/qmacfunctions_mac.mm \ - $$PWD/qmactoolbar.mm \ - $$PWD/qmactoolbaritem.mm \ - $$PWD/qmactoolbardelegate.mm \ - $$PWD/qnstoolbar.mm - - greaterThan(QT_MAJOR_VERSION, 4) { - PUBLIC_HEADERS += $$PWD/qmacpasteboardmime.h - OBJECTIVE_SOURCES += $$PWD/qmacpasteboardmime.mm - } - - QT_PRIVATE += widgets - LIBS_PRIVATE += -framework AppKit -} - -HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS diff --git a/src/macextras/macextras.pro b/src/macextras/macextras.pro deleted file mode 100644 index 42e6142..0000000 --- a/src/macextras/macextras.pro +++ /dev/null @@ -1,9 +0,0 @@ -TARGET = QtMacExtras - -QT_PRIVATE += gui-private core-private - -include($$PWD/macextras-lib.pri) - -QMAKE_DOCS = $$PWD/doc/qtmacextras.qdocconf - -load(qt_module) diff --git a/src/macextras/qmacextrasglobal.h b/src/macextras/qmacextrasglobal.h deleted file mode 100644 index af0f0c4..0000000 --- a/src/macextras/qmacextrasglobal.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMACEXTRASGLOBAL_H -#define QMACEXTRASGLOBAL_H - -#include <QtCore/qglobal.h> - -QT_BEGIN_NAMESPACE - -#if defined(QT_BUILD_MACEXTRAS_LIB) -# define Q_MACEXTRAS_EXPORT Q_DECL_EXPORT -#else -# define Q_MACEXTRAS_EXPORT Q_DECL_IMPORT -#endif - -QT_END_NAMESPACE - -#endif // QMACEXTRASGLOBAL_H diff --git a/src/macextras/qmacfunctions.h b/src/macextras/qmacfunctions.h deleted file mode 100644 index 1ea919d..0000000 --- a/src/macextras/qmacfunctions.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMACFUNCTIONS_H -#define QMACFUNCTIONS_H - -#if 0 -#pragma qt_class(QtMac) -#endif - -#include <QtMacExtras/qmacextrasglobal.h> - -typedef struct CGImage *CGImageRef; - -QT_BEGIN_NAMESPACE - -class QPixmap; -class QWindow; - -namespace QtMac -{ - -Q_MACEXTRAS_EXPORT QPixmap fromCGImageRef(CGImageRef image); - -#ifdef Q_OS_OSX -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -Q_MACEXTRAS_EXPORT bool isMainWindow(QWindow *window); -#endif -#endif // Q_OS_OSX -} - -QT_END_NAMESPACE - -#endif // QMACFUNCTIONS_H diff --git a/src/macextras/qmacfunctions.mm b/src/macextras/qmacfunctions.mm deleted file mode 100644 index 5250971..0000000 --- a/src/macextras/qmacfunctions.mm +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmacfunctions.h" - -#include <QByteArray> -#include <QPixmap> -#include <QUrl> -#include <QString> - -#include "qmacfunctions_p.h" - -#import <Foundation/Foundation.h> - -#ifdef Q_OS_IOS - #import <CoreGraphics/CoreGraphics.h> -#endif - -#include <QtGui/private/qcoregraphics_p.h> - -QT_BEGIN_NAMESPACE - -/*! - \namespace QtMac - \inmodule QtMacExtras - \since 5.2 - \brief The QtMac namespace contains miscellaneous functionality specific to the \macos and iOS operating systems. - \inheaderfile QtMac - */ - -/*! - \fn CGContextRef QtMac::currentCGContext() - - Returns the current CoreGraphics context. -*/ - -namespace QtMac -{ -/*! - \fn QPixmap QtMac::fromCGImageRef(CGImageRef image) - - Returns a QPixmap that is equivalent to the given \a image. - - This function is not available in Qt 5.x until 5.0.2 and will return a null pixmap in earlier versions. - - \sa toCGImageRef(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} -*/ -QPixmap fromCGImageRef(CGImageRef image) -{ - return QPixmap::fromImage(qt_mac_toQImage(image)); -} - -} // namespace QtMac - -QT_END_NAMESPACE diff --git a/src/macextras/qmacfunctions_mac.mm b/src/macextras/qmacfunctions_mac.mm deleted file mode 100644 index 466391a..0000000 --- a/src/macextras/qmacfunctions_mac.mm +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#import <Cocoa/Cocoa.h> -#import <AppKit/NSApplication.h> - -#include "qmacfunctions.h" -#include "qmacfunctions_p.h" - -#include <QtCore/QString> - -#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0) -#include <QtGui/QWindow> -#include <QtWidgets/QMenu> -#include <QtWidgets/QMenuBar> -#include <qpa/qplatformmenu.h> -#endif - -QT_BEGIN_NAMESPACE - -namespace QtMac -{ -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -/*! - \fn bool QtMac::isMainWindow(QWindow *window) - - Returns whether the given QWindow \a window is the application's main window -*/ -bool isMainWindow(QWindow *window) -{ - NSWindow *macWindow = static_cast<NSWindow*>( - QGuiApplication::platformNativeInterface()->nativeResourceForWindow("nswindow", window)); - if (!macWindow) - return false; - - return [macWindow isMainWindow]; -} -#endif - -} // namespace QtMac - -QT_END_NAMESPACE diff --git a/src/macextras/qmacfunctions_p.h b/src/macextras/qmacfunctions_p.h deleted file mode 100644 index 74606ef..0000000 --- a/src/macextras/qmacfunctions_p.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMACFUNCTIONS_P_H -#define QMACFUNCTIONS_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qmacfunctions.h" - -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -#include <QtCore/QDebug> -#include <QtGui/QGuiApplication> -#include <qpa/qplatformnativeinterface.h> - -QT_BEGIN_NAMESPACE - -inline QPlatformNativeInterface::NativeResourceForIntegrationFunction resolvePlatformFunction(const QByteArray &functionName) -{ - QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); - QPlatformNativeInterface::NativeResourceForIntegrationFunction function = - nativeInterface->nativeResourceFunctionForIntegration(functionName); - if (!function) - qWarning() << "Qt could not resolve function" << functionName - << "from QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()"; - return function; -} -#endif - -QT_END_NAMESPACE - -#endif // QMACFUNCTIONS_P_H diff --git a/src/macextras/qmacpasteboardmime.h b/src/macextras/qmacpasteboardmime.h deleted file mode 100644 index 7128fe7..0000000 --- a/src/macextras/qmacpasteboardmime.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtMacExtras of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#if !defined(QMACMIME_H) && !defined(QMIME_H) -#define QMACMIME_H - -#include <QtMacExtras/qmacextrasglobal.h> - -#include <QtCore/QString> -#include <QtCore/QStringList> -#include <QtCore/QByteArray> -#include <QtCore/QList> -#include <QtCore/QVariant> -#include <QtCore/QMimeData> - -#include <CoreFoundation/CoreFoundation.h> - -QT_BEGIN_NAMESPACE - -Q_MACEXTRAS_EXPORT void qRegisterDraggedTypes(const QStringList &types); - -// Duplicate of QMacPasteboardMime in the Cocoa Platform Plugin. Keep in sync! -class Q_MACEXTRAS_EXPORT QMacPasteboardMime { - char type; -public: - enum QMacPasteboardMimeType { MIME_DND=0x01, - MIME_CLIP=0x02, - MIME_QT_CONVERTOR=0x04, - MIME_QT3_CONVERTOR=0x08, - MIME_ALL=MIME_DND|MIME_CLIP - }; - explicit QMacPasteboardMime(char); - virtual ~QMacPasteboardMime(); - - virtual QString convertorName() = 0; - virtual bool canConvert(const QString &mime, QString flav) = 0; - virtual QString mimeFor(QString flav) = 0; - virtual QString flavorFor(const QString &mime) = 0; - virtual QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav) = 0; - virtual QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav) = 0; - virtual int count(QMimeData *mimeData); -}; - -QT_END_NAMESPACE - -#endif - diff --git a/src/macextras/qmacpasteboardmime.mm b/src/macextras/qmacpasteboardmime.mm deleted file mode 100644 index 44bdacb..0000000 --- a/src/macextras/qmacpasteboardmime.mm +++ /dev/null @@ -1,223 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtMacExtras of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <Cocoa/Cocoa.h> -#include "qmacpasteboardmime.h" -#include "qmacfunctions_p.h" - -#include <QtCore/qlogging.h> -#include <qpa/qplatformnativeinterface.h> - -QT_BEGIN_NAMESPACE - -/*! - \fn void qRegisterDraggedTypes(const QStringList &types) - \relates QMacPasteboardMime - - Registers the given \a types as custom pasteboard types. - - This function should be called to enable the Drag and Drop events - for custom pasteboard types on Cocoa implementations. This is required - in addition to a QMacPasteboardMime subclass implementation. By default - drag and drop is enabled for all standard pasteboard types. - - \sa QMacPasteboardMime -*/ -void qRegisterDraggedTypes(const QStringList &types) -{ - QPlatformNativeInterface::NativeResourceForIntegrationFunction function = resolvePlatformFunction("registerdraggedtypes"); - if (function) { - typedef void (*RegisterDraggedTypesFunction)(const QStringList &types); - reinterpret_cast<RegisterDraggedTypesFunction>(function)(types); - } -} - -/*! - \class QMacPasteboardMime - \inmodule QtMacExtras - \since 5.2 - \brief The QMacPasteboardMime class converts between a MIME type and a - \l{http://developer.apple.com/macosx/uniformtypeidentifiers.html}{Uniform - Type Identifier (UTI)} format. - - Qt's drag and drop and clipboard facilities use the MIME - standard. On X11, this maps trivially to the Xdnd protocol. On - Mac, although some applications use MIME to describe clipboard - contents, it is more common to use Apple's UTI format. - - QMacPasteboardMime's role is to bridge the gap between MIME and UTI; - By subclasses this class, one can extend Qt's drag and drop - and clipboard handling to convert to and from unsupported, or proprietary, UTI formats. - - A subclass of QMacPasteboardMime will automatically be registered, and active, upon instantiation. - - Qt has predefined support for the following UTIs: - \table - \header \li UTI - \li Converts to - \row \li \c public.utf8-plain-text - \li \c text/plain - \row \li \c public.utf16-plain-text - \li \c text/plain - \row \li \c public.html - \li \c text/html - \row \li \c public.url - \li \c text/uri-list - \row \li \c public.file-url - \li \c text/uri-list - \row \li \c public.tiff - \li \c application/x-qt-image - \row \li \c public.vcard - \li \c text/plain - \row \li \c com.apple.traditional-mac-plain-text - \li \c text/plain - \row \li \c com.apple.pict - \li \c application/x-qt-image - \endtable - - When working with MIME data, Qt will interate through all instances of QMacPasteboardMime to - find an instance that can convert to, or from, a specific MIME type. It will do this by calling - canConvert() on each instance, starting with (and choosing) the last created instance first. - The actual conversions will be done by using convertToMime() and convertFromMime(). - - \note The API uses the term "flavor" in some cases. This is for backwards - compatibility reasons, and should now be understood as UTIs. -*/ - -/*! \enum QMacPasteboardMime::QMacPasteboardMimeType - \internal -*/ - -/*! - Constructs a new conversion object of type \a t, adding it to the - globally accessed list of available converters. -*/ -QMacPasteboardMime::QMacPasteboardMime(char t) : type(t) -{ - Q_UNUSED(type); - - QPlatformNativeInterface::NativeResourceForIntegrationFunction function = resolvePlatformFunction("addToMimeList"); - if (function) { - typedef void (*AddToGlobalMimeListFunction)(QMacPasteboardMime *); - reinterpret_cast<AddToGlobalMimeListFunction>(function)(this); - } -} - -/*! - Destroys a conversion object, removing it from the global - list of available converters. -*/ -QMacPasteboardMime::~QMacPasteboardMime() -{ - QPlatformNativeInterface::NativeResourceForIntegrationFunction function = resolvePlatformFunction("removeFromMimeList"); - if (function) { - typedef void (*RemoveFromGlobalMimeListFunction)(QMacPasteboardMime *); - reinterpret_cast<RemoveFromGlobalMimeListFunction>(function)(this); - } -} - -/*! - Returns the item count for the given \a mimeData -*/ -int QMacPasteboardMime::count(QMimeData *mimeData) -{ - Q_UNUSED(mimeData); - return 1; -} - -/*! - \fn QString QMacPasteboardMime::convertorName() - - Returns a name for the converter. - - All subclasses must reimplement this pure virtual function. -*/ - -/*! - \fn bool QMacPasteboardMime::canConvert(const QString &mime, QString flav) - - Returns true if the converter can convert (both ways) between - \a mime and \a flav; otherwise returns false. - - All subclasses must reimplement this pure virtual function. -*/ - -/*! - \fn QString QMacPasteboardMime::mimeFor(QString flav) - - Returns the MIME UTI used for Mac flavor \a flav, or 0 if this - converter does not support \a flav. - - All subclasses must reimplement this pure virtual function. -*/ - -/*! - \fn QString QMacPasteboardMime::flavorFor(const QString &mime) - - Returns the Mac UTI used for MIME type \a mime, or 0 if this - converter does not support \a mime. - - All subclasses must reimplement this pure virtual function. -*/ - -/*! - \fn QVariant QMacPasteboardMime::convertToMime(const QString &mime, QList<QByteArray> data, QString flav) - - Returns \a data converted from Mac UTI \a flav to MIME type \a - mime. - - Note that Mac flavors must all be self-terminating. The input \a - data may contain trailing data. - - All subclasses must reimplement this pure virtual function. -*/ - -/*! - \fn QList<QByteArray> QMacPasteboardMime::convertFromMime(const QString &mime, QVariant data, QString flav) - - Returns \a data converted from MIME type \a mime - to Mac UTI \a flav. - - Note that Mac flavors must all be self-terminating. The return - value may contain trailing data. - - All subclasses must reimplement this pure virtual function. -*/ - -QT_END_NAMESPACE diff --git a/src/macextras/qmactoolbar.h b/src/macextras/qmactoolbar.h deleted file mode 100644 index 2706089..0000000 --- a/src/macextras/qmactoolbar.h +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMACTOOLBAR_H -#define QMACTOOLBAR_H - -#include <QtMacExtras/qmacextrasglobal.h> -#include <QtMacExtras/qmactoolbaritem.h> - -#include <QtCore/QString> -#include <QtCore/QObject> -#include <QtCore/QVariant> -#include <QtGui/QIcon> - -Q_FORWARD_DECLARE_OBJC_CLASS(NSToolbar); - -QT_BEGIN_NAMESPACE - -class QWindow; -class QMacToolBarPrivate; - -class Q_MACEXTRAS_EXPORT QMacToolBar : public QObject -{ - Q_OBJECT -public: - explicit QMacToolBar(QObject *parent = nullptr); - explicit QMacToolBar(const QString &identifier, QObject *parent = nullptr); - ~QMacToolBar(); - - QMacToolBarItem *addItem(const QIcon &icon, const QString &text); - QMacToolBarItem *addAllowedItem(const QIcon &icon, const QString &text); - QMacToolBarItem *addStandardItem(QMacToolBarItem::StandardItem standardItem); - QMacToolBarItem *addAllowedStandardItem(QMacToolBarItem::StandardItem standardItem); - void addSeparator(); - - void setItems(QList<QMacToolBarItem *> &items); - QList<QMacToolBarItem *> items(); - void setAllowedItems(QList<QMacToolBarItem *> &allowedItems); - QList<QMacToolBarItem *> allowedItems(); - - void attachToWindow(QWindow *window); - void detachFromWindow(); - - NSToolbar* nativeToolbar() const; -private Q_SLOTS: - void showInWindow_impl(); -private: - Q_DECLARE_PRIVATE(QMacToolBar) -}; - -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(QMacToolBar*) - -#endif - diff --git a/src/macextras/qmactoolbar.mm b/src/macextras/qmactoolbar.mm deleted file mode 100644 index 1881c4f..0000000 --- a/src/macextras/qmactoolbar.mm +++ /dev/null @@ -1,331 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#import <AppKit/AppKit.h> -#include "qmactoolbar.h" -#include "qmactoolbar_p.h" - -#include <QtCore/QDebug> -#include <QtCore/QTimer> -#include <QtCore/QUuid> -#include <QtCore/QString> -#include <QtCore/qdebug.h> - -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -#include <QtGui/QGuiApplication> -#include <qpa/qplatformnativeinterface.h> -#else -#include <QtGui/QMainWindow> -#endif - -#include "qmacfunctions.h" -#include "qmacfunctions_p.h" -#include "qmactoolbaritem_p.h" -#include "qmactoolbardelegate_p.h" -#include "qnstoolbar_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QMacToolBar - \inmodule QtMacExtras - \since 5.3 - \brief The QMacToolBar class wraps the native NSToolbar class. - - QMacToolBar provides a Qt-based API for NSToolBar. The toolbar displays one or - more \e items. Each toolbar item has an icon and a text label. - - The toolbar must be attached to a QWindow using the - \l{QMacToolBar::attachToWindow()}{attachToWindow()} method in order to be visible. - The toolbar is attached to the native NSWindow and is displayed above the - QWindow. QMacToolBar visibility follows window visibility. - - Add items by calling addItem(). The toolbar has a customization menu which - is available to the user from the toolbar context menu. Use addAllowedItem() to - add items to the customization menu. - - Usage: (QtWidgets) - \code - QMacToolBar *toolBar = new QMacToolBar(this); - QMacToolBarItem *toolBarItem = toolBar->addItem(QIcon(), QStringLiteral("foo")); - connect(toolBarItem, SIGNAL(activated()), this, SLOT(fooClicked())); - - this->window()->winId(); // create window->windowhandle() - toolBar->attachToWindow(this->window()->windowHandle()); - \endcode - - \sa QMacToolBarItem -*/ - -/*! - Constructs a QMacToolBar with the given \a parent -*/ -QMacToolBar::QMacToolBar(QObject *parent) - : QObject(*new QMacToolBarPrivate(), parent) -{ -} - -/*! - Constructs a QMacToolBar with the given \a identifier and \a parent. The identifier is used - to uniquely identify the toolbar within the appliation, for example when autosaving the - toolbar configuration. -*/ -QMacToolBar::QMacToolBar(const QString &identifier, QObject *parent) - : QObject(*new QMacToolBarPrivate(identifier), parent) -{ -} - -/*! - Destroys the toolbar. -*/ -QMacToolBar::~QMacToolBar() -{ -} - -/*! - Add a toolbar item with \a icon and \a text. -*/ -QMacToolBarItem *QMacToolBar::addItem(const QIcon &icon, const QString &text) -{ - Q_D(QMacToolBar); - QMacToolBarItem *item = new QMacToolBarItem(this); - item->setText(text); - item->setIcon(icon); - d->items.append(item); - d->allowedItems.append(item); - return item; -} - -/*! - Add a toolbar separator item. -*/ -void QMacToolBar::addSeparator() -{ - addStandardItem(QMacToolBarItem::Space); // No Seprator on OS X. -} - -/*! - Add a toolbar standard item. - \omitvalue standardItem - \internal -*/ -QMacToolBarItem *QMacToolBar::addStandardItem(QMacToolBarItem::StandardItem standardItem) -{ - Q_D(QMacToolBar); - QMacToolBarItem *item = new QMacToolBarItem(this); - item->setStandardItem(standardItem); - d->items.append(item); - d->allowedItems.append(item); - return item; -} - -/*! - Add atoolbar item with \a icon and \a text to the toolbar customization menu. -*/ -QMacToolBarItem *QMacToolBar::addAllowedItem(const QIcon &icon, const QString &text) -{ - Q_D(QMacToolBar); - QMacToolBarItem *item = new QMacToolBarItem(this); - item->setText(text); - item->setIcon(icon); - d->allowedItems.append(item); - return item; -} - -/*! - Add a standard toolbar item to the toolbar customization menu. - \omitvalue standardItem - \internal -*/ -QMacToolBarItem *QMacToolBar::addAllowedStandardItem(QMacToolBarItem::StandardItem standardItem) -{ - Q_D(QMacToolBar); - QMacToolBarItem *item = new QMacToolBarItem(this); - item->setStandardItem(standardItem); - d->allowedItems.append(item); - return item; -} - -/*! - Sets the list of the default toolbar \a items. -*/ -void QMacToolBar::setItems(QList<QMacToolBarItem *> &items) -{ - Q_D(QMacToolBar); - d->items = items; -} - -/*! - Returns the list of the default toolbar items. -*/ -QList<QMacToolBarItem *> QMacToolBar::items() -{ - Q_D(QMacToolBar); - return d->items; -} - -/*! - Sets the list of toolbar items shown on the toolbar customization menu to \a allowedItems. -*/ -void QMacToolBar::setAllowedItems(QList<QMacToolBarItem *> &allowedItems) -{ - Q_D(QMacToolBar); - d->allowedItems = allowedItems; -} - -/*! - Returns the list oftoolbar items shown on the the toolbar customization menu. -*/ -QList<QMacToolBarItem *> QMacToolBar::allowedItems() -{ - Q_D(QMacToolBar); - return d->allowedItems; -} - -/*! - Attaches the toolbar to \a window. The toolbar will be displayed at the top of the - native window, under and attached to the title bar above the QWindow. The toolbar is displayed - outside the QWidnow area. - - Use QWidget::windowHandle() to get a QWindow pointer from a QWidget instance. At app startup - the QWindow might not have been created yet, call QWidget::winId() to make sure it is. -*/ -void QMacToolBar::attachToWindow(QWindow *window) -{ - Q_D(QMacToolBar); - if (!window) { - detachFromWindow(); - return; - } - - QPlatformNativeInterface::NativeResourceForIntegrationFunction function = resolvePlatformFunction("setNSToolbar"); - if (function) { - typedef void (*SetNSToolbarFunction)(QWindow *window, void *nsToolbar); - reinterpret_cast<SetNSToolbarFunction>(function)(window, d->toolbar); - } else { - d->targetWindow = window; - QTimer::singleShot(100, this, SLOT(showInWindow_impl())); // ### hackety hack - } -} - -/*! - \internal -*/ -void QMacToolBar::showInWindow_impl() -{ - Q_D(QMacToolBar); - if (!d->targetWindow) { - QTimer::singleShot(100, this, SLOT(showInWindow_impl())); - return; - } - - NSWindow *macWindow = static_cast<NSWindow*>( - QGuiApplication::platformNativeInterface()->nativeResourceForWindow("nswindow", d->targetWindow)); - - if (!macWindow) { - QTimer::singleShot(100, this, SLOT(showInWindow_impl())); - return; - } - - [macWindow setToolbar: d->toolbar]; - [macWindow setShowsToolbarButton:YES]; -} - -/*! - Detatches the toolbar from the current window. -*/ -void QMacToolBar::detachFromWindow() -{ - Q_D(QMacToolBar); - if (!d->targetWindow) - return; - - NSWindow *macWindow = static_cast<NSWindow*>( - QGuiApplication::platformNativeInterface()->nativeResourceForWindow("nswindow", d->targetWindow)); - [macWindow setToolbar:nil]; -} - -/*! - Returns the naitve NSTooolbar object. -*/ -NSToolbar *QMacToolBar::nativeToolbar() const -{ - Q_D(const QMacToolBar); - return d->toolbar; -} - -QMacToolBarPrivate::QMacToolBarPrivate(const QString &identifier) -{ - QString ident = identifier.isEmpty() ? QUuid::createUuid().toString() : identifier; - toolbar = [[NSToolbar alloc] initWithIdentifier:ident.toNSString()]; - [toolbar setAutosavesConfiguration:NO]; - [toolbar setAllowsUserCustomization:YES]; - - QMacToolbarDelegate *delegate = [[QMacToolbarDelegate alloc] init]; - delegate->toolbarPrivate = this; - [toolbar setDelegate:delegate]; - - targetWindow = 0; -} - -QMacToolBarPrivate::~QMacToolBarPrivate() -{ - [[toolbar delegate]release]; - [toolbar release]; -} - -NSMutableArray *QMacToolBarPrivate::getItemIdentifiers(const QList<QMacToolBarItem *> &items, bool cullUnselectable) -{ - NSMutableArray *array = [[NSMutableArray alloc] init]; - for (const QMacToolBarItem * item : items) { - if (cullUnselectable && item->selectable() == false) - continue; - [array addObject : item->d_func()->itemIdentifier()]; - } - return array; -} - -void QMacToolBarPrivate::itemClicked(NSToolbarItem *item) -{ - QString identifier = QString::fromNSString([item itemIdentifier]); - QMacToolBarItem *toolButton = reinterpret_cast<QMacToolBarItem *>(identifier.toULongLong()); - Q_EMIT toolButton->activated(); -} - - -QT_END_NAMESPACE diff --git a/src/macextras/qmactoolbar_p.h b/src/macextras/qmactoolbar_p.h deleted file mode 100644 index 68d3a5c..0000000 --- a/src/macextras/qmactoolbar_p.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMACTOOLBAR_P_H -#define QMACTOOLBAR_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// -#import <AppKit/AppKit.h> - -#include "qmactoolbar.h" - -#include "qmacextrasglobal.h" -#include "qmactoolbaritem.h" - -#include <QtCore/QString> -#include <QtCore/QObject> -#include <QtCore/private/qobject_p.h> - -Q_FORWARD_DECLARE_OBJC_CLASS(NSToolbar); - -QT_BEGIN_NAMESPACE - -class QMacToolBarPrivate : public QObjectPrivate -{ -public: - QMacToolBarPrivate(const QString &identifier = QString()); - ~QMacToolBarPrivate(); - - static NSString *getItemIdentifier(const QMacToolBarItem *item); - static NSMutableArray *getItemIdentifiers(const QList<QMacToolBarItem *> &items, bool cullUnselectable); - void itemClicked(NSToolbarItem *itemClicked); - - NSToolbar *toolbar; - QWindow *targetWindow; - QList<QMacToolBarItem *> items; - QList<QMacToolBarItem *> allowedItems; - - Q_DECLARE_PUBLIC(QMacToolBar) -}; - -QT_END_NAMESPACE - -#endif - diff --git a/src/macextras/qmactoolbardelegate.mm b/src/macextras/qmactoolbardelegate.mm deleted file mode 100644 index 23e5150..0000000 --- a/src/macextras/qmactoolbardelegate.mm +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmactoolbardelegate_p.h" - -#include <QtGui/QImage> -#include <QtGui/QPixmap> - -#include <QtCore/QString> - -#include "qmacfunctions.h" -#include "qmactoolbar.h" - -QT_USE_NAMESPACE - -NSArray *toNSArray(const QList<QString> &stringList) -{ - NSMutableArray *array = [[NSMutableArray alloc] init]; - for (const QString &string : stringList) { - [array addObject:string.toNSString()]; - } - return array; -} - -// from QMacToolButton.cpp -QString qt_strippedText(QString s) -{ - s.remove( QString::fromLatin1("...") ); - int i = 0; - while (i < s.size()) { - ++i; - if (s.at(i-1) != QLatin1Char('&')) - continue; - if (i < s.size() && s.at(i) == QLatin1Char('&')) - ++i; - s.remove(i-1,1); - } - return s.trimmed(); -} - -@implementation QMacToolbarDelegate - -- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar -{ - Q_UNUSED(toolbar); - return toolbarPrivate->getItemIdentifiers(toolbarPrivate->items, false); -} - -- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)toolbar -{ - Q_UNUSED(toolbar); - return toolbarPrivate->getItemIdentifiers(toolbarPrivate->allowedItems, false); -} - -- (NSArray *)toolbarSelectableItemIdentifiers: (NSToolbar *)toolbar -{ - Q_UNUSED(toolbar); - NSMutableArray *array = toolbarPrivate->getItemIdentifiers(toolbarPrivate->items, true); - [array addObjectsFromArray:toolbarPrivate->getItemIdentifiers(toolbarPrivate->allowedItems, true)]; - return array; -} - -- (IBAction)itemClicked:(id)sender -{ - NSToolbarItem *item = reinterpret_cast<NSToolbarItem *>(sender); - toolbarPrivate->itemClicked(item); -} - -- (NSToolbarItem *) toolbar: (NSToolbar *)toolbar itemForItemIdentifier: (NSString *) itemIdentifier willBeInsertedIntoToolbar:(BOOL) willBeInserted -{ - Q_UNUSED(toolbar); - Q_UNUSED(willBeInserted); - const QString identifier = QString::fromNSString(itemIdentifier); - QMacToolBarItem *toolButton = reinterpret_cast<QMacToolBarItem *>(identifier.toULongLong()); // string -> unisgned long long -> pointer - NSToolbarItem *toolbarItem = toolButton->nativeToolBarItem(); - - [toolbarItem setTarget:self]; - [toolbarItem setAction:@selector(itemClicked:)]; - - return toolbarItem; -} - -@end diff --git a/src/macextras/qmactoolbardelegate_p.h b/src/macextras/qmactoolbardelegate_p.h deleted file mode 100644 index 26ce14a..0000000 --- a/src/macextras/qmactoolbardelegate_p.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMACTOOLBARDELEGATE_H -#define QMACTOOLBARDELEGATE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#import <AppKit/AppKit.h> -#include "qmactoolbar.h" -#include "qmactoolbar_p.h" - -#include <QtCore/qglobal.h> -#include <private/qcore_mac_p.h> - -@interface QT_MANGLE_NAMESPACE(QMacToolbarDelegate) : NSObject <NSToolbarDelegate> -{ -@public - QMacToolBarPrivate *toolbarPrivate; -} - -- (NSToolbarItem *) toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *) itemIdent willBeInsertedIntoToolbar:(BOOL) willBeInserted; -- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar; -- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)toolbar; -- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar; -- (IBAction)itemClicked:(id)sender; -@end - -QT_NAMESPACE_ALIAS_OBJC_CLASS(QMacToolbarDelegate); - -#endif // QMACTOOLBARDELEGATE_H diff --git a/src/macextras/qmactoolbaritem.h b/src/macextras/qmactoolbaritem.h deleted file mode 100644 index eb0bd71..0000000 --- a/src/macextras/qmactoolbaritem.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMACTOOLBARITEM_H -#define QMACTOOLBARITEM_H - -#include <QtCore/QObject> -#include <QtCore/QString> -#include <QtGui/QIcon> - -#include <QtMacExtras/qmacextrasglobal.h> - -Q_FORWARD_DECLARE_OBJC_CLASS(NSToolbarItem); - -QT_BEGIN_NAMESPACE - -class QMacToolBarItemPrivate; -class Q_MACEXTRAS_EXPORT QMacToolBarItem : public QObject -{ - Q_OBJECT - Q_PROPERTY(bool selectable READ selectable WRITE setSelectable) - Q_PROPERTY(StandardItem standardItem READ standardItem WRITE setStandardItem) - Q_PROPERTY(QString text READ text WRITE setText) - Q_PROPERTY(QIcon icon READ icon WRITE setIcon) - Q_ENUMS(StandardItem) - -public: - enum StandardItem - { - NoStandardItem, - Space, - FlexibleSpace - }; - - explicit QMacToolBarItem(QObject *parent = nullptr); - virtual ~QMacToolBarItem(); - - bool selectable() const; - void setSelectable(bool selectable); - - StandardItem standardItem() const; - void setStandardItem(StandardItem standardItem); - - QString text() const; - void setText(const QString &text); - - QIcon icon() const; - void setIcon(const QIcon &icon); - - NSToolbarItem *nativeToolBarItem() const; - -Q_SIGNALS: - void activated(); -private: - friend class QMacToolBarPrivate; - Q_DECLARE_PRIVATE(QMacToolBarItem) -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/macextras/qmactoolbaritem.mm b/src/macextras/qmactoolbaritem.mm deleted file mode 100644 index 3bb3a5a..0000000 --- a/src/macextras/qmactoolbaritem.mm +++ /dev/null @@ -1,240 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmactoolbaritem.h" -#include "qmactoolbaritem_p.h" -#include "qmacfunctions.h" -#include "qmacfunctions_p.h" -#include "qmactoolbar_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QMacToolBarItem - \inmodule QtMacExtras - \since 5.3 - \brief The QMacToolBarItem class provides an item for QMacToolBar. - - All items should have the text and icon properites set, or have the - standardItem property set to something else than NoStandardItem. - - \sa QMacToolBar -*/ - -/*! - \enum QMacToolBarItem::StandardItem - \value NoStandardItem Don't use a standard item - \value Space A spacing item - \value FlexibleSpace A spacing item which grows to fill available space -*/ - - -/*! - Constructs a QMacToolBarItem with \a parent. -*/ -QMacToolBarItem::QMacToolBarItem(QObject *parent) - :QObject(*new QMacToolBarItemPrivate, parent) -{ - Q_D(QMacToolBarItem); - d->initNativeToolbarItem(); -} - -/*! - Destroys a QMacToolBarItem -*/ -QMacToolBarItem::~QMacToolBarItem() -{ - -} - -/*! - \property QMacToolBarItem::selectable - \brief Whether the item is selecatble - - This property's default is false. -*/ -bool QMacToolBarItem::selectable() const -{ - Q_D(const QMacToolBarItem); - return d->selectable; -} - -void QMacToolBarItem::setSelectable(bool selectable) -{ - Q_D(QMacToolBarItem); - d->selectable = selectable; -} - -/*! - \property QMacToolBarItem::standardItem - \brief Whether the item is a standard item. - - This property's default is NoStandardItem, in which case the icon and text - property determines the item contents. - - Setting this property to somthing else than NoStandardItem takes precendense - over icon and text. -*/ -QMacToolBarItem::StandardItem QMacToolBarItem::standardItem() const -{ - Q_D(const QMacToolBarItem); - return d->standardItem; -} - -void QMacToolBarItem::setStandardItem(StandardItem standardItem) -{ - Q_D(QMacToolBarItem); - - if (d->standardItem == standardItem) - return; - - d->standardItem = standardItem; - d->initNativeToolbarItem(); -} - -/*! - \property QMacToolBarItem::text - \brief The item's text. -*/ -QString QMacToolBarItem::text() const -{ - Q_D(const QMacToolBarItem); - return d->text; -} - -void QMacToolBarItem::setText(const QString &text) -{ - Q_D(QMacToolBarItem); - d->text = text; - - if (d->standardItem != QMacToolBarItem::NoStandardItem) - return; - - [d->toolbarItem setLabel:text.toNSString()]; -} - -/*! - \property QMacToolBarItem::icon - \brief The item's icon. -*/ -QIcon QMacToolBarItem::icon() const -{ - Q_D(const QMacToolBarItem); - return d->icon; -} - -void QMacToolBarItem::setIcon(const QIcon &icon) -{ - Q_D(QMacToolBarItem); - d->icon = icon; - QPixmap pixmap = icon.pixmap(64, 64); - - if (d->standardItem != QMacToolBarItem::NoStandardItem) - return; - - if (pixmap.isNull() == false) { - NSImage *image = [[NSImage alloc] initWithCGImage:pixmap.toImage().toCGImage() size:NSZeroSize]; - d->toolbarItem.image = [image autorelease]; - } -} - -/*! - Returns the native NSToolbarItem. -*/ -NSToolbarItem *QMacToolBarItem::nativeToolBarItem() const -{ - Q_D(const QMacToolBarItem); - return d->toolbarItem; -} - -/*! - \fn void QMacToolBarItem::activated(); - - This signal is emitted when the toolbar item is clicked or otherwise activated. -*/ - -QMacToolBarItemPrivate::QMacToolBarItemPrivate() -{ - standardItem = QMacToolBarItem::NoStandardItem; - selectable = false; - toolbarItem = 0; -} - -QMacToolBarItemPrivate::~QMacToolBarItemPrivate() -{ - [toolbarItem release]; -} - -NSString *QMacToolBarItemPrivate::toNSStandardItem(QMacToolBarItem::StandardItem standardItem) -{ - /* - ### not supported yet; Qt does not handle the action - messages these send. - - if (standardItem == QMacToolBarItem::ShowColors) - return NSToolbarShowColorsItemIdentifier; - else if (standardItem == QMacToolBarItem::ShowFonts) - return NSToolbarShowFontsItemIdentifier; - else if (standardItem == QMacToolBarItem::PrintItem) - return NSToolbarPrintItemIdentifier; - else -*/ - if (standardItem == QMacToolBarItem::Space) - return NSToolbarSpaceItemIdentifier; - else if (standardItem == QMacToolBarItem::FlexibleSpace) - return NSToolbarFlexibleSpaceItemIdentifier; - return @""; -} - -NSString *QMacToolBarItemPrivate::itemIdentifier() const -{ - if (standardItem == QMacToolBarItem::NoStandardItem) - return QString::number(qulonglong(q_func())).toNSString(); - - return toNSStandardItem(standardItem); -} - -// Initializes the NSToolBarItem based on QMacToolBarItem properties. -void QMacToolBarItemPrivate::initNativeToolbarItem() -{ - NSString *identifier = itemIdentifier(); - toolbarItem = [[NSToolbarItem alloc] initWithItemIdentifier:identifier]; -} - -QT_END_NAMESPACE diff --git a/src/macextras/qmactoolbaritem_p.h b/src/macextras/qmactoolbaritem_p.h deleted file mode 100644 index 1e3562d..0000000 --- a/src/macextras/qmactoolbaritem_p.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMACTOOLBARITEM_P_H -#define QMACTOOLBARITEM_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#undef slots -#import <AppKit/AppKit.h> - -#include <QtCore/private/qobject_p.h> - -QT_BEGIN_NAMESPACE - -class QMacToolBarItem; -class QMacToolBarItemPrivate : public QObjectPrivate -{ -public: - QMacToolBarItemPrivate(); - ~QMacToolBarItemPrivate(); - static NSString *toNSStandardItem(QMacToolBarItem::StandardItem standardItem); - NSString *itemIdentifier() const; - void initNativeToolbarItem(); - - bool selectable; - QMacToolBarItem::StandardItem standardItem; - QString text; - QIcon icon; - NSToolbarItem *toolbarItem; - Q_DECLARE_PUBLIC(QMacToolBarItem) -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/macextras/qnstoolbar.mm b/src/macextras/qnstoolbar.mm deleted file mode 100644 index 38b2ae2..0000000 --- a/src/macextras/qnstoolbar.mm +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#import "qnstoolbar_p.h" - -NSString *QtNSToolbarDisplayModeChangedNotification = @"QtNSToolbarDisplayModeChangedNotification"; -NSString *QtNSToolbarShowsBaselineSeparatorChangedNotification = @"QtNSToolbarShowsBaselineSeparatorChangedNotification"; -NSString *QtNSToolbarAllowsUserCustomizationChangedNotification = @"QtNSToolbarAllowsUserCustomizationChangedNotification"; -NSString *QtNSToolbarSizeModeChangedNotification = @"QtNSToolbarSizeModeChangedNotification"; -NSString *QtNSToolbarVisibilityChangedNotification = @"QtNSToolbarVisibilityChangedNotification"; - -QT_USE_NAMESPACE - -@implementation QtNSToolbar - -- (void)setDisplayMode:(NSToolbarDisplayMode)displayMode -{ - if ([self displayMode] != displayMode) - { - [super setDisplayMode:displayMode]; - [[NSNotificationCenter defaultCenter] postNotificationName:QtNSToolbarDisplayModeChangedNotification object:self]; - } -} - -- (void)setShowsBaselineSeparator:(BOOL)flag -{ - if ([self showsBaselineSeparator] != flag) - { - [super setShowsBaselineSeparator:flag]; - [[NSNotificationCenter defaultCenter] postNotificationName:QtNSToolbarShowsBaselineSeparatorChangedNotification object:self]; - } -} - -- (void)setAllowsUserCustomization:(BOOL)allowsCustomization -{ - if ([self allowsUserCustomization] != allowsCustomization) - { - [super setAllowsUserCustomization:allowsCustomization]; - [[NSNotificationCenter defaultCenter] postNotificationName:QtNSToolbarAllowsUserCustomizationChangedNotification object:self]; - } -} - -- (void)setSizeMode:(NSToolbarSizeMode)sizeMode -{ - if ([self sizeMode] != sizeMode) - { - [super setSizeMode:sizeMode]; - [[NSNotificationCenter defaultCenter] postNotificationName:QtNSToolbarSizeModeChangedNotification object:self]; - } -} - -- (void)setVisible:(BOOL)shown -{ - BOOL isVisible = [self isVisible]; - [super setVisible:shown]; - - // The super call might not always have effect - i.e. trying to hide the toolbar when the customization palette is running - if ([self isVisible] != isVisible) - [[NSNotificationCenter defaultCenter] postNotificationName:QtNSToolbarVisibilityChangedNotification object:self]; -} - -@end diff --git a/src/macextras/qnstoolbar_p.h b/src/macextras/qnstoolbar_p.h deleted file mode 100644 index 1733b58..0000000 --- a/src/macextras/qnstoolbar_p.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtMacExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNSTOOLBAR_H -#define QNSTOOLBAR_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <AppKit/NSToolbar.h> - -#include <qglobal.h> -#include <private/qcore_mac_p.h> - -extern NSString *QtNSToolbarDisplayModeChangedNotification; -extern NSString *QtNSToolbarShowsBaselineSeparatorChangedNotification; -extern NSString *QtNSToolbarAllowsUserCustomizationChangedNotification; -extern NSString *QtNSToolbarSizeModeChangedNotification; -extern NSString *QtNSToolbarVisibilityChangedNotification; - -@interface QT_MANGLE_NAMESPACE(QtNSToolbar) : NSToolbar - -@end - -QT_NAMESPACE_ALIAS_OBJC_CLASS(QtNSToolbar); - -#endif // QNSTOOLBAR_H diff --git a/src/src.pro b/src/src.pro deleted file mode 100644 index 1993687..0000000 --- a/src/src.pro +++ /dev/null @@ -1,10 +0,0 @@ -mac { - TEMPLATE = subdirs - SUBDIRS += macextras -} -else { - # fake project for creating the documentation - TEMPLATE = aux - CONFIG += force_qt - QMAKE_DOCS = $$PWD/macextras/doc/qtmacextras.qdocconf -} |