From 7bc57326e69b9c3f0eaeda63e4a49b67ba611426 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sat, 8 Jun 2024 15:05:55 +0900 Subject: Rename style nt* related files to equivalent tq* Signed-off-by: Michele Calgaro --- src/styles/ntqcommonstyle.h | 2 +- src/styles/ntqstylefactory.h | 62 ---------- src/styles/ntqstyleplugin.h | 72 ----------- src/styles/qstylefactory.cpp | 268 ---------------------------------------- src/styles/qstyleinterface_p.h | 76 ------------ src/styles/qstyleplugin.cpp | 185 --------------------------- src/styles/qt_styles.pri | 10 +- src/styles/tqstylefactory.cpp | 268 ++++++++++++++++++++++++++++++++++++++++ src/styles/tqstylefactory.h | 62 ++++++++++ src/styles/tqstyleinterface_p.h | 76 ++++++++++++ src/styles/tqstyleplugin.cpp | 185 +++++++++++++++++++++++++++ src/styles/tqstyleplugin.h | 72 +++++++++++ 12 files changed, 669 insertions(+), 669 deletions(-) delete mode 100644 src/styles/ntqstylefactory.h delete mode 100644 src/styles/ntqstyleplugin.h delete mode 100644 src/styles/qstylefactory.cpp delete mode 100644 src/styles/qstyleinterface_p.h delete mode 100644 src/styles/qstyleplugin.cpp create mode 100644 src/styles/tqstylefactory.cpp create mode 100644 src/styles/tqstylefactory.h create mode 100644 src/styles/tqstyleinterface_p.h create mode 100644 src/styles/tqstyleplugin.cpp create mode 100644 src/styles/tqstyleplugin.h (limited to 'src/styles') diff --git a/src/styles/ntqcommonstyle.h b/src/styles/ntqcommonstyle.h index 47edfe2cb..705177d71 100644 --- a/src/styles/ntqcommonstyle.h +++ b/src/styles/ntqcommonstyle.h @@ -42,7 +42,7 @@ #define TQCOMMONSTYLE_H #ifndef QT_H -#include "ntqstyle.h" +#include "tqstyle.h" #endif // QT_H #ifndef TQT_NO_STYLE diff --git a/src/styles/ntqstylefactory.h b/src/styles/ntqstylefactory.h deleted file mode 100644 index bfab3153c..000000000 --- a/src/styles/ntqstylefactory.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** ... -** -** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQSTYLEFACTORY_H -#define TQSTYLEFACTORY_H - -#ifndef QT_H -#include "tqstringlist.h" -#endif // QT_H - -#ifndef TQT_NO_STYLE - -class TQString; -class TQStyle; - -class TQ_EXPORT TQStyleFactory -{ -public: -#ifndef TQT_NO_STRINGLIST - static TQStringList keys(); -#endif - static TQStyle *create( const TQString& ); -}; - -#endif //TQT_NO_STYLE - -#endif //TQSTYLEFACTORY_H diff --git a/src/styles/ntqstyleplugin.h b/src/styles/ntqstyleplugin.h deleted file mode 100644 index 13d83c453..000000000 --- a/src/styles/ntqstyleplugin.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Definition of TQStylePlugin class -** -** Created : 010920 -** -** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQSTYLEPLUGIN_H -#define TQSTYLEPLUGIN_H - -#ifndef QT_H -#include "ntqgplugin.h" -#include "tqstringlist.h" -#endif // QT_H - -#ifndef TQT_NO_STYLE -#ifndef TQT_NO_COMPONENT - -class TQStyle; -class TQStylePluginPrivate; - -class TQ_EXPORT TQStylePlugin : public TQGPlugin -{ - TQ_OBJECT -public: - TQStylePlugin(); - ~TQStylePlugin(); - - virtual TQStringList keys() const = 0; - virtual TQStyle *create( const TQString &key ) = 0; - -private: - TQStylePluginPrivate *d; -}; - -#endif // TQT_NO_COMPONENT -#endif // TQT_NO_STYLE - -#endif // TQSTYLEPLUGIN_H diff --git a/src/styles/qstylefactory.cpp b/src/styles/qstylefactory.cpp deleted file mode 100644 index cf494018a..000000000 --- a/src/styles/qstylefactory.cpp +++ /dev/null @@ -1,268 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQStyleFactory class -** -** Created : 001103 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "qstyleinterface_p.h" // up here for GCC 2.7.* compatibility -#include "ntqstylefactory.h" - -#ifndef TQT_NO_STYLE - -#include "ntqapplication.h" -#include "ntqwindowsstyle.h" -#include "ntqmotifstyle.h" -#include "ntqcdestyle.h" -#include "ntqmotifplusstyle.h" -#include "ntqplatinumstyle.h" -#include "ntqsgistyle.h" -#include "ntqcompactstyle.h" -#ifndef TQT_NO_STYLE_WINDOWSXP -#include "qwindowsxpstyle.h" -#endif -#ifndef TQT_NO_STYLE_AQUA -#include "qaquastyle.h" -#endif -#ifndef TQT_NO_STYLE_POCKETPC -#include "qpocketpcstyle_wce.h" -#endif - -#if !defined( TQT_NO_STYLE_MAC ) && defined( TQ_WS_MAC ) -TQString p2qstring(const unsigned char *c); //qglobal.cpp -#include "qt_mac.h" -#include "qmacstyle_mac.h" -#endif -#include - -#include -#ifndef TQT_NO_COMPONENT -class TQStyleFactoryPrivate : public TQObject -{ -public: - TQStyleFactoryPrivate(); - ~TQStyleFactoryPrivate(); - - static TQPluginManager *manager; -}; - -static TQStyleFactoryPrivate *instance = 0; -TQPluginManager *TQStyleFactoryPrivate::manager = 0; - -TQStyleFactoryPrivate::TQStyleFactoryPrivate() -: TQObject( tqApp ) -{ - manager = new TQPluginManager( IID_QStyleFactory, TQApplication::libraryPaths(), "/styles", FALSE ); -} - -TQStyleFactoryPrivate::~TQStyleFactoryPrivate() -{ - delete manager; - manager = 0; - - instance = 0; -} - -#endif //TQT_NO_COMPONENT - -/*! - \class TQStyleFactory ntqstylefactory.h - \brief The TQStyleFactory class creates TQStyle objects. - - The style factory creates a TQStyle object for a given key with - TQStyleFactory::create(key). - - The styles are either built-in or dynamically loaded from a style - plugin (see \l TQStylePlugin). - - TQStyleFactory::keys() returns a list of valid keys, typically - including "Windows", "Motif", "CDE", "MotifPlus", "Platinum", - "SGI" and "Compact". Depending on the platform, "WindowsXP", - "Aqua" or "Macintosh" may be available. -*/ - -/*! - Creates a TQStyle object that matches \a key case-insensitively. - This is either a built-in style, or a style from a style plugin. - - \sa keys() -*/ -TQStyle *TQStyleFactory::create( const TQString& key ) -{ - TQStyle *ret = 0; - TQString style = key.lower(); -#ifndef TQT_NO_STYLE_WINDOWS - if ( style == "windows" ) - ret = new TQWindowsStyle; - else -#endif -#ifndef TQT_NO_STYLE_WINDOWSXP - if ( style == "windowsxp" ) - ret = new TQWindowsXPStyle; - else -#endif -#ifndef TQT_NO_STYLE_MOTIF - if ( style == "motif" ) - ret = new TQMotifStyle; - else -#endif -#ifndef TQT_NO_STYLE_CDE - if ( style == "cde" ) - ret = new TQCDEStyle; - else -#endif -#ifndef TQT_NO_STYLE_MOTIFPLUS - if ( style == "motifplus" ) - ret = new TQMotifPlusStyle; - else -#endif -#ifndef TQT_NO_STYLE_PLATINUM - if ( style == "platinum" ) - ret = new TQPlatinumStyle; - else -#endif -#ifndef TQT_NO_STYLE_SGI - if ( style == "sgi") - ret = new TQSGIStyle; - else -#endif -#ifndef TQT_NO_STYLE_COMPACT - if ( style == "compact" ) - ret = new TQCompactStyle; - else -#endif -#ifndef TQT_NO_STYLE_AQUA - if ( style == "aqua" ) - ret = new TQAquaStyle; -#endif -#ifndef TQT_NO_STYLE_POCKETPC - if ( style == "pocketpc" ) - ret = new TQPocketPCStyle; -#endif -#if !defined( TQT_NO_STYLE_MAC ) && defined( TQ_WS_MAC ) - if( style.left(9) == "macintosh" ) - ret = new TQMacStyle; -#endif - { } // Keep these here - they make the #ifdefery above work - -#ifndef TQT_NO_COMPONENT - if(!ret) { - if ( !instance ) - instance = new TQStyleFactoryPrivate; - - TQInterfacePtr iface; - TQStyleFactoryPrivate::manager->queryInterface( style, &iface ); - - if ( iface ) - ret = iface->create( style ); - } - if(ret) - ret->setName(key); -#endif - return ret; -} - -#ifndef TQT_NO_STRINGLIST -/*! - Returns the list of keys this factory can create styles for. - - \sa create() -*/ -TQStringList TQStyleFactory::keys() -{ - TQStringList list; -#ifndef TQT_NO_COMPONENT - if ( !instance ) - instance = new TQStyleFactoryPrivate; - - list = TQStyleFactoryPrivate::manager->featureList(); -#endif //TQT_NO_COMPONENT - -#ifndef TQT_NO_STYLE_WINDOWS - if ( !list.contains( "Windows" ) ) - list << "Windows"; -#endif -#ifndef TQT_NO_STYLE_WINDOWSXP - if ( !list.contains( "WindowsXP" ) && TQWindowsXPStyle::resolveSymbols() ) - list << "WindowsXP"; -#endif -#ifndef TQT_NO_STYLE_MOTIF - if ( !list.contains( "Motif" ) ) - list << "Motif"; -#endif -#ifndef TQT_NO_STYLE_CDE - if ( !list.contains( "CDE" ) ) - list << "CDE"; -#endif -#ifndef TQT_NO_STYLE_MOTIFPLUS - if ( !list.contains( "MotifPlus" ) ) - list << "MotifPlus"; -#endif -#ifndef TQT_NO_STYLE_PLATINUM - if ( !list.contains( "Platinum" ) ) - list << "Platinum"; -#endif -#ifndef TQT_NO_STYLE_SGI - if ( !list.contains( "SGI" ) ) - list << "SGI"; -#endif -#ifndef TQT_NO_STYLE_COMPACT - if ( !list.contains( "Compact" ) ) - list << "Compact"; -#endif -#ifndef TQT_NO_STYLE_AQUA - if ( !list.contains( "Aqua" ) ) - list << "Aqua"; -#endif -#if !defined( TQT_NO_STYLE_MAC ) && defined( TQ_WS_MAC ) - TQString mstyle = "Macintosh"; - Collection c = NewCollection(); - if (c) { - GetTheme(c); - Str255 str; - long int s = 256; - if(!GetCollectionItem(c, kThemeNameTag, 0, &s, &str)) - mstyle += " (" + p2qstring(str) + ")"; - } - if (!list.contains(mstyle)) - list << mstyle; - DisposeCollection(c); -#endif - - return list; -} -#endif -#endif // TQT_NO_STYLE diff --git a/src/styles/qstyleinterface_p.h b/src/styles/qstyleinterface_p.h deleted file mode 100644 index 500dcfef3..000000000 --- a/src/styles/qstyleinterface_p.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** ... -** -** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQSTYLEINTERFACE_P_H -#define TQSTYLEINTERFACE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the TQt API. This header file may -// change from version to version without notice, or even be -// removed. -// -// We mean it. -// -// - -#ifndef QT_H -#include -#endif // QT_H - -#ifndef TQT_NO_STYLE -#ifndef TQT_NO_COMPONENT - -class TQStyle; - -// {FC1B6EBE-053C-49c1-A483-C377739AB9A5} -#ifndef IID_QStyleFactory -#define IID_QStyleFactory TQUuid(0xfc1b6ebe, 0x53c, 0x49c1, 0xa4, 0x83, 0xc3, 0x77, 0x73, 0x9a, 0xb9, 0xa5) -#endif - -struct TQ_EXPORT TQStyleFactoryInterface : public TQFeatureListInterface -{ - virtual TQStyle* create( const TQString& style ) = 0; -}; - -#endif //TQT_NO_COMPONENT -#endif //TQT_NO_STYLE - -#endif //TQSTYLEINTERFACE_P_H diff --git a/src/styles/qstyleplugin.cpp b/src/styles/qstyleplugin.cpp deleted file mode 100644 index 2650708c1..000000000 --- a/src/styles/qstyleplugin.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQSqlDriverPlugin class -** -** Created : 010920 -** -** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqstyleplugin.h" - -#ifndef TQT_NO_STYLE -#ifndef TQT_NO_COMPONENT - -#include "qstyleinterface_p.h" -#include "tqobjectcleanuphandler.h" -#include "ntqstyle.h" - -/*! - \class TQStylePlugin ntqstyleplugin.h - \brief The TQStylePlugin class provides an abstract base for custom TQStyle plugins. - - \ingroup plugins - - The style plugin is a simple plugin interface that makes it easy - to create custom styles that can be loaded dynamically into - applications with a TQStyleFactory. - - Writing a style plugin is achieved by subclassing this base class, - reimplementing the pure virtual functions keys() and create(), and - exporting the class with the \c TQ_EXPORT_PLUGIN macro. See the - \link plugins-howto.html plugins documentation\endlink for an - example. -*/ - -/*! - \fn TQStringList TQStylePlugin::keys() const - - Returns the list of style keys this plugin supports. - - These keys are usually the class names of the custom styles that - are implemented in the plugin. - - \sa create() -*/ - -/*! - \fn TQStyle* TQStylePlugin::create( const TQString& key ) - - Creates and returns a TQStyle object for the style key \a key. The - style key is usually the class name of the required style. - - \sa keys() -*/ - -class TQStylePluginPrivate : public TQStyleFactoryInterface, public TQLibraryInterface -{ -public: - TQStylePluginPrivate( TQStylePlugin *p ) - : plugin( p ) - { - } - - virtual ~TQStylePluginPrivate(); - - TQRESULT queryInterface( const TQUuid &iid, TQUnknownInterface **iface ); - TQ_REFCOUNT; - - TQStringList featureList() const; - TQStyle *create( const TQString &key ); - - bool init(); - void cleanup(); - bool canUnload() const; - -private: - TQStylePlugin *plugin; - TQObjectCleanupHandler styles; -}; - -TQRESULT TQStylePluginPrivate::queryInterface( const TQUuid &iid, TQUnknownInterface **iface ) -{ - *iface = 0; - - if ( iid == IID_QUnknown ) - *iface = (TQStyleFactoryInterface*)this; - else if ( iid == IID_QFeatureList ) - *iface = (TQFeatureListInterface*)this; - else if ( iid == IID_QStyleFactory ) - *iface = (TQStyleFactoryInterface*)this; - else if ( iid == IID_QLibrary ) - *iface = (TQLibraryInterface*) this; - else - return TQE_NOINTERFACE; - - (*iface)->addRef(); - return TQS_OK; -} - -TQStylePluginPrivate::~TQStylePluginPrivate() -{ - delete plugin; -} - -TQStringList TQStylePluginPrivate::featureList() const -{ - return plugin->keys(); -} - -TQStyle *TQStylePluginPrivate::create( const TQString &key ) -{ - TQStyle *st = plugin->create( key ); - styles.add( st ); - return st; -} - -bool TQStylePluginPrivate::init() -{ - return TRUE; -} - -void TQStylePluginPrivate::cleanup() -{ - styles.clear(); -} - -bool TQStylePluginPrivate::canUnload() const -{ - return styles.isEmpty(); -} - - -/*! - Constructs a style plugin. This is invoked automatically by the - \c TQ_EXPORT_PLUGIN macro. -*/ -TQStylePlugin::TQStylePlugin() - : TQGPlugin( (TQStyleFactoryInterface*)(d = new TQStylePluginPrivate( this )) ) -{ -} - -/*! - Destroys the style plugin. - - You never have to call this explicitly. TQt destroys a plugin - automatically when it is no longer used. -*/ -TQStylePlugin::~TQStylePlugin() -{ - // don't delete d, as this is deleted by d -} - -#endif // TQT_NO_COMPONENT -#endif // TQT_NO_STYLE diff --git a/src/styles/qt_styles.pri b/src/styles/qt_styles.pri index 7eb9e5bcf..812690724 100644 --- a/src/styles/qt_styles.pri +++ b/src/styles/qt_styles.pri @@ -2,12 +2,12 @@ styles { STYLES_P = styles - HEADERS +=$$STYLES_H/ntqstylefactory.h \ - $$STYLES_P/qstyleinterface_p.h \ - $$STYLES_H/ntqstyleplugin.h \ + HEADERS +=$$STYLES_H/tqstylefactory.h \ + $$STYLES_P/tqstyleinterface_p.h \ + $$STYLES_H/tqstyleplugin.h \ $$STYLES_H/ntqcommonstyle.h - SOURCES +=$$STYLES_CPP/qstylefactory.cpp \ - $$STYLES_CPP/qstyleplugin.cpp \ + SOURCES +=$$STYLES_CPP/tqstylefactory.cpp \ + $$STYLES_CPP/tqstyleplugin.cpp \ $$STYLES_CPP/qcommonstyle.cpp contains( styles, all ) { diff --git a/src/styles/tqstylefactory.cpp b/src/styles/tqstylefactory.cpp new file mode 100644 index 000000000..d87794f9a --- /dev/null +++ b/src/styles/tqstylefactory.cpp @@ -0,0 +1,268 @@ +/**************************************************************************** +** +** Implementation of TQStyleFactory class +** +** Created : 001103 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqstyleinterface_p.h" // up here for GCC 2.7.* compatibility +#include "tqstylefactory.h" + +#ifndef TQT_NO_STYLE + +#include "ntqapplication.h" +#include "ntqwindowsstyle.h" +#include "ntqmotifstyle.h" +#include "ntqcdestyle.h" +#include "ntqmotifplusstyle.h" +#include "ntqplatinumstyle.h" +#include "ntqsgistyle.h" +#include "ntqcompactstyle.h" +#ifndef TQT_NO_STYLE_WINDOWSXP +#include "qwindowsxpstyle.h" +#endif +#ifndef TQT_NO_STYLE_AQUA +#include "qaquastyle.h" +#endif +#ifndef TQT_NO_STYLE_POCKETPC +#include "qpocketpcstyle_wce.h" +#endif + +#if !defined( TQT_NO_STYLE_MAC ) && defined( TQ_WS_MAC ) +TQString p2qstring(const unsigned char *c); //qglobal.cpp +#include "qt_mac.h" +#include "qmacstyle_mac.h" +#endif +#include + +#include +#ifndef TQT_NO_COMPONENT +class TQStyleFactoryPrivate : public TQObject +{ +public: + TQStyleFactoryPrivate(); + ~TQStyleFactoryPrivate(); + + static TQPluginManager *manager; +}; + +static TQStyleFactoryPrivate *instance = 0; +TQPluginManager *TQStyleFactoryPrivate::manager = 0; + +TQStyleFactoryPrivate::TQStyleFactoryPrivate() +: TQObject( tqApp ) +{ + manager = new TQPluginManager( IID_QStyleFactory, TQApplication::libraryPaths(), "/styles", FALSE ); +} + +TQStyleFactoryPrivate::~TQStyleFactoryPrivate() +{ + delete manager; + manager = 0; + + instance = 0; +} + +#endif //TQT_NO_COMPONENT + +/*! + \class TQStyleFactory tqstylefactory.h + \brief The TQStyleFactory class creates TQStyle objects. + + The style factory creates a TQStyle object for a given key with + TQStyleFactory::create(key). + + The styles are either built-in or dynamically loaded from a style + plugin (see \l TQStylePlugin). + + TQStyleFactory::keys() returns a list of valid keys, typically + including "Windows", "Motif", "CDE", "MotifPlus", "Platinum", + "SGI" and "Compact". Depending on the platform, "WindowsXP", + "Aqua" or "Macintosh" may be available. +*/ + +/*! + Creates a TQStyle object that matches \a key case-insensitively. + This is either a built-in style, or a style from a style plugin. + + \sa keys() +*/ +TQStyle *TQStyleFactory::create( const TQString& key ) +{ + TQStyle *ret = 0; + TQString style = key.lower(); +#ifndef TQT_NO_STYLE_WINDOWS + if ( style == "windows" ) + ret = new TQWindowsStyle; + else +#endif +#ifndef TQT_NO_STYLE_WINDOWSXP + if ( style == "windowsxp" ) + ret = new TQWindowsXPStyle; + else +#endif +#ifndef TQT_NO_STYLE_MOTIF + if ( style == "motif" ) + ret = new TQMotifStyle; + else +#endif +#ifndef TQT_NO_STYLE_CDE + if ( style == "cde" ) + ret = new TQCDEStyle; + else +#endif +#ifndef TQT_NO_STYLE_MOTIFPLUS + if ( style == "motifplus" ) + ret = new TQMotifPlusStyle; + else +#endif +#ifndef TQT_NO_STYLE_PLATINUM + if ( style == "platinum" ) + ret = new TQPlatinumStyle; + else +#endif +#ifndef TQT_NO_STYLE_SGI + if ( style == "sgi") + ret = new TQSGIStyle; + else +#endif +#ifndef TQT_NO_STYLE_COMPACT + if ( style == "compact" ) + ret = new TQCompactStyle; + else +#endif +#ifndef TQT_NO_STYLE_AQUA + if ( style == "aqua" ) + ret = new TQAquaStyle; +#endif +#ifndef TQT_NO_STYLE_POCKETPC + if ( style == "pocketpc" ) + ret = new TQPocketPCStyle; +#endif +#if !defined( TQT_NO_STYLE_MAC ) && defined( TQ_WS_MAC ) + if( style.left(9) == "macintosh" ) + ret = new TQMacStyle; +#endif + { } // Keep these here - they make the #ifdefery above work + +#ifndef TQT_NO_COMPONENT + if(!ret) { + if ( !instance ) + instance = new TQStyleFactoryPrivate; + + TQInterfacePtr iface; + TQStyleFactoryPrivate::manager->queryInterface( style, &iface ); + + if ( iface ) + ret = iface->create( style ); + } + if(ret) + ret->setName(key); +#endif + return ret; +} + +#ifndef TQT_NO_STRINGLIST +/*! + Returns the list of keys this factory can create styles for. + + \sa create() +*/ +TQStringList TQStyleFactory::keys() +{ + TQStringList list; +#ifndef TQT_NO_COMPONENT + if ( !instance ) + instance = new TQStyleFactoryPrivate; + + list = TQStyleFactoryPrivate::manager->featureList(); +#endif //TQT_NO_COMPONENT + +#ifndef TQT_NO_STYLE_WINDOWS + if ( !list.contains( "Windows" ) ) + list << "Windows"; +#endif +#ifndef TQT_NO_STYLE_WINDOWSXP + if ( !list.contains( "WindowsXP" ) && TQWindowsXPStyle::resolveSymbols() ) + list << "WindowsXP"; +#endif +#ifndef TQT_NO_STYLE_MOTIF + if ( !list.contains( "Motif" ) ) + list << "Motif"; +#endif +#ifndef TQT_NO_STYLE_CDE + if ( !list.contains( "CDE" ) ) + list << "CDE"; +#endif +#ifndef TQT_NO_STYLE_MOTIFPLUS + if ( !list.contains( "MotifPlus" ) ) + list << "MotifPlus"; +#endif +#ifndef TQT_NO_STYLE_PLATINUM + if ( !list.contains( "Platinum" ) ) + list << "Platinum"; +#endif +#ifndef TQT_NO_STYLE_SGI + if ( !list.contains( "SGI" ) ) + list << "SGI"; +#endif +#ifndef TQT_NO_STYLE_COMPACT + if ( !list.contains( "Compact" ) ) + list << "Compact"; +#endif +#ifndef TQT_NO_STYLE_AQUA + if ( !list.contains( "Aqua" ) ) + list << "Aqua"; +#endif +#if !defined( TQT_NO_STYLE_MAC ) && defined( TQ_WS_MAC ) + TQString mstyle = "Macintosh"; + Collection c = NewCollection(); + if (c) { + GetTheme(c); + Str255 str; + long int s = 256; + if(!GetCollectionItem(c, kThemeNameTag, 0, &s, &str)) + mstyle += " (" + p2qstring(str) + ")"; + } + if (!list.contains(mstyle)) + list << mstyle; + DisposeCollection(c); +#endif + + return list; +} +#endif +#endif // TQT_NO_STYLE diff --git a/src/styles/tqstylefactory.h b/src/styles/tqstylefactory.h new file mode 100644 index 000000000..bfab3153c --- /dev/null +++ b/src/styles/tqstylefactory.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** ... +** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQSTYLEFACTORY_H +#define TQSTYLEFACTORY_H + +#ifndef QT_H +#include "tqstringlist.h" +#endif // QT_H + +#ifndef TQT_NO_STYLE + +class TQString; +class TQStyle; + +class TQ_EXPORT TQStyleFactory +{ +public: +#ifndef TQT_NO_STRINGLIST + static TQStringList keys(); +#endif + static TQStyle *create( const TQString& ); +}; + +#endif //TQT_NO_STYLE + +#endif //TQSTYLEFACTORY_H diff --git a/src/styles/tqstyleinterface_p.h b/src/styles/tqstyleinterface_p.h new file mode 100644 index 000000000..500dcfef3 --- /dev/null +++ b/src/styles/tqstyleinterface_p.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** ... +** +** Copyright (C) 2000-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQSTYLEINTERFACE_P_H +#define TQSTYLEINTERFACE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the TQt API. This header file may +// change from version to version without notice, or even be +// removed. +// +// We mean it. +// +// + +#ifndef QT_H +#include +#endif // QT_H + +#ifndef TQT_NO_STYLE +#ifndef TQT_NO_COMPONENT + +class TQStyle; + +// {FC1B6EBE-053C-49c1-A483-C377739AB9A5} +#ifndef IID_QStyleFactory +#define IID_QStyleFactory TQUuid(0xfc1b6ebe, 0x53c, 0x49c1, 0xa4, 0x83, 0xc3, 0x77, 0x73, 0x9a, 0xb9, 0xa5) +#endif + +struct TQ_EXPORT TQStyleFactoryInterface : public TQFeatureListInterface +{ + virtual TQStyle* create( const TQString& style ) = 0; +}; + +#endif //TQT_NO_COMPONENT +#endif //TQT_NO_STYLE + +#endif //TQSTYLEINTERFACE_P_H diff --git a/src/styles/tqstyleplugin.cpp b/src/styles/tqstyleplugin.cpp new file mode 100644 index 000000000..50e0e684d --- /dev/null +++ b/src/styles/tqstyleplugin.cpp @@ -0,0 +1,185 @@ +/**************************************************************************** +** +** Implementation of TQSqlDriverPlugin class +** +** Created : 010920 +** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqstyleplugin.h" + +#ifndef TQT_NO_STYLE +#ifndef TQT_NO_COMPONENT + +#include "tqstyleinterface_p.h" +#include "tqobjectcleanuphandler.h" +#include "tqstyle.h" + +/*! + \class TQStylePlugin tqstyleplugin.h + \brief The TQStylePlugin class provides an abstract base for custom TQStyle plugins. + + \ingroup plugins + + The style plugin is a simple plugin interface that makes it easy + to create custom styles that can be loaded dynamically into + applications with a TQStyleFactory. + + Writing a style plugin is achieved by subclassing this base class, + reimplementing the pure virtual functions keys() and create(), and + exporting the class with the \c TQ_EXPORT_PLUGIN macro. See the + \link plugins-howto.html plugins documentation\endlink for an + example. +*/ + +/*! + \fn TQStringList TQStylePlugin::keys() const + + Returns the list of style keys this plugin supports. + + These keys are usually the class names of the custom styles that + are implemented in the plugin. + + \sa create() +*/ + +/*! + \fn TQStyle* TQStylePlugin::create( const TQString& key ) + + Creates and returns a TQStyle object for the style key \a key. The + style key is usually the class name of the required style. + + \sa keys() +*/ + +class TQStylePluginPrivate : public TQStyleFactoryInterface, public TQLibraryInterface +{ +public: + TQStylePluginPrivate( TQStylePlugin *p ) + : plugin( p ) + { + } + + virtual ~TQStylePluginPrivate(); + + TQRESULT queryInterface( const TQUuid &iid, TQUnknownInterface **iface ); + TQ_REFCOUNT; + + TQStringList featureList() const; + TQStyle *create( const TQString &key ); + + bool init(); + void cleanup(); + bool canUnload() const; + +private: + TQStylePlugin *plugin; + TQObjectCleanupHandler styles; +}; + +TQRESULT TQStylePluginPrivate::queryInterface( const TQUuid &iid, TQUnknownInterface **iface ) +{ + *iface = 0; + + if ( iid == IID_QUnknown ) + *iface = (TQStyleFactoryInterface*)this; + else if ( iid == IID_QFeatureList ) + *iface = (TQFeatureListInterface*)this; + else if ( iid == IID_QStyleFactory ) + *iface = (TQStyleFactoryInterface*)this; + else if ( iid == IID_QLibrary ) + *iface = (TQLibraryInterface*) this; + else + return TQE_NOINTERFACE; + + (*iface)->addRef(); + return TQS_OK; +} + +TQStylePluginPrivate::~TQStylePluginPrivate() +{ + delete plugin; +} + +TQStringList TQStylePluginPrivate::featureList() const +{ + return plugin->keys(); +} + +TQStyle *TQStylePluginPrivate::create( const TQString &key ) +{ + TQStyle *st = plugin->create( key ); + styles.add( st ); + return st; +} + +bool TQStylePluginPrivate::init() +{ + return TRUE; +} + +void TQStylePluginPrivate::cleanup() +{ + styles.clear(); +} + +bool TQStylePluginPrivate::canUnload() const +{ + return styles.isEmpty(); +} + + +/*! + Constructs a style plugin. This is invoked automatically by the + \c TQ_EXPORT_PLUGIN macro. +*/ +TQStylePlugin::TQStylePlugin() + : TQGPlugin( (TQStyleFactoryInterface*)(d = new TQStylePluginPrivate( this )) ) +{ +} + +/*! + Destroys the style plugin. + + You never have to call this explicitly. TQt destroys a plugin + automatically when it is no longer used. +*/ +TQStylePlugin::~TQStylePlugin() +{ + // don't delete d, as this is deleted by d +} + +#endif // TQT_NO_COMPONENT +#endif // TQT_NO_STYLE diff --git a/src/styles/tqstyleplugin.h b/src/styles/tqstyleplugin.h new file mode 100644 index 000000000..13d83c453 --- /dev/null +++ b/src/styles/tqstyleplugin.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Definition of TQStylePlugin class +** +** Created : 010920 +** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQSTYLEPLUGIN_H +#define TQSTYLEPLUGIN_H + +#ifndef QT_H +#include "ntqgplugin.h" +#include "tqstringlist.h" +#endif // QT_H + +#ifndef TQT_NO_STYLE +#ifndef TQT_NO_COMPONENT + +class TQStyle; +class TQStylePluginPrivate; + +class TQ_EXPORT TQStylePlugin : public TQGPlugin +{ + TQ_OBJECT +public: + TQStylePlugin(); + ~TQStylePlugin(); + + virtual TQStringList keys() const = 0; + virtual TQStyle *create( const TQString &key ) = 0; + +private: + TQStylePluginPrivate *d; +}; + +#endif // TQT_NO_COMPONENT +#endif // TQT_NO_STYLE + +#endif // TQSTYLEPLUGIN_H -- cgit v1.2.1