X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcontrib%2Flibqxt-2007-10-24%2Fsrc%2Fgui%2Fqxtproxystyle.cpp;fp=src%2Fcontrib%2Flibqxt-2007-10-24%2Fsrc%2Fgui%2Fqxtproxystyle.cpp;h=0000000000000000000000000000000000000000;hp=2278787cdb2ad17b4c203511758d1d13046fe600;hb=140d8a132103d2fa9baf55036e09b165624de167;hpb=97d674034551438238c568e8b42efb08e1ba7354 diff --git a/src/contrib/libqxt-2007-10-24/src/gui/qxtproxystyle.cpp b/src/contrib/libqxt-2007-10-24/src/gui/qxtproxystyle.cpp deleted file mode 100644 index 2278787c..00000000 --- a/src/contrib/libqxt-2007-10-24/src/gui/qxtproxystyle.cpp +++ /dev/null @@ -1,209 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) Qxt Foundation. Some rights reserved. -** -** This file is part of the QxtGui module of the Qt eXTension library -** -** This library is free software; you can redistribute it and/or modify it -** under the terms of th Common Public License, version 1.0, as published by -** IBM. -** -** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY -** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY -** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR -** FITNESS FOR A PARTICULAR PURPOSE. -** -** You should have received a copy of the CPL along with this file. -** See the LICENSE file and the cpl1.0.txt file included with the source -** distribution for more information. If you did not receive a copy of the -** license, contact the Qxt Foundation. -** -** -** -****************************************************************************/ -#include -#include "qxtproxystyle.h" - -/*! - \class QxtProxyStyle QxtProxyStyle - \ingroup QxtGui - \brief A proxy style. - - A technique called "proxy style" is a common way for creating - cross-platform custom styles. Developers often want to do slight - adjustments in some specific values returned by QStyle. A proxy - style is the solution to avoid subclassing any platform specific - style (eg. QPlastiqueStyle, QWindowsXPStyle, or QMacStyle) and - to retain the native look on all supported platforms. - - The subject has been discussed in Qt Quarterly 9: - http://doc.trolltech.com/qq/qq09-q-and-a.html#style (just notice - that there are a few noteworthy spelling mistakes in the article). - - Proxy styles are becoming obsolete thanks to style sheets - introduced in Qt 4.2. However, style sheets still is a new - concept and only a portion of features are supported yet. Both - - style sheets and proxy styles - have their pros and cons. - - \section usage Usage - - Implement the custom behaviour in a subclass of QxtProxyStyle: - \code - class MyCustomStyle : public QxtProxyStyle - { - public: - MyCustomStyle(const QString& baseStyle) : QxtProxyStyle(baseStyle) - { - } - - int pixelMetric(PixelMetric metric, const QStyleOption* option = 0, const QWidget* widget = 0) const - { - if (metric == QStyle::PM_ButtonMargin) - return 6; - return QxtProxyStyle::pixelMetric(metric, option, widget); - } - }; - \endcode - - Using the custom style for the whole application: - \code - QString defaultStyle = QApplication::style()->objectName(); - QApplication::setStyle(new MyCustomStyle(defaultStyle)); - \endcode - - Using the custom style for a single widget: - \code - QString defaultStyle = widget->style()->objectName(); - widget->setStyle(new MyCustomStyle(defaultStyle)); - \endcode - */ - -/*! - Constructs a new QxtProxyStyle for \a style. - See QStyleFactory::keys() for supported styles. - - \sa QStyleFactory::keys() - */ -QxtProxyStyle::QxtProxyStyle(const QString& baseStyle) - : QStyle(), style(QStyleFactory::create(baseStyle)) -{ - setObjectName(QLatin1String("proxy")); -} - -/*! - Destructs the proxy style. - */ -QxtProxyStyle::~QxtProxyStyle() -{ - delete style; -} - -void QxtProxyStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget) const -{ - style->drawComplexControl(control, option, painter, widget); -} - -void QxtProxyStyle::drawControl(ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget) const -{ - style->drawControl(element, option, painter, widget); -} - -void QxtProxyStyle::drawItemPixmap(QPainter* painter, const QRect& rect, int alignment, const QPixmap& pixmap) const -{ - style->drawItemPixmap(painter, rect, alignment, pixmap); -} - -void QxtProxyStyle::drawItemText(QPainter* painter, const QRect& rect, int alignment, const QPalette& pal, bool enabled, const QString& text, QPalette::ColorRole textRole) const -{ - style->drawItemText(painter, rect, alignment, pal, enabled, text, textRole); -} - -void QxtProxyStyle::drawPrimitive(PrimitiveElement elem, const QStyleOption* option, QPainter* painter, const QWidget* widget) const -{ - style->drawPrimitive(elem, option, painter, widget); -} - -QPixmap QxtProxyStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap& pixmap, const QStyleOption* option) const -{ - return style->generatedIconPixmap(iconMode, pixmap, option); -} - -QStyle::SubControl QxtProxyStyle::hitTestComplexControl(ComplexControl control, const QStyleOptionComplex* option, const QPoint& pos, const QWidget* widget) const -{ - return style->hitTestComplexControl(control, option, pos, widget); -} - -QRect QxtProxyStyle::itemPixmapRect(const QRect& rect, int alignment, const QPixmap& pixmap) const -{ - return style->itemPixmapRect(rect, alignment, pixmap); -} - -QRect QxtProxyStyle::itemTextRect(const QFontMetrics& metrics, const QRect& rect, int alignment, bool enabled, const QString& text) const -{ - return style->itemTextRect(metrics, rect, alignment, enabled, text); -} - -int QxtProxyStyle::pixelMetric(PixelMetric metric, const QStyleOption* option, const QWidget* widget) const -{ - return style->pixelMetric(metric, option, widget); -} - -void QxtProxyStyle::polish(QWidget* widget) -{ - style->polish(widget); -} - -void QxtProxyStyle::polish(QApplication* app) -{ - style->polish(app); -} - -void QxtProxyStyle::polish(QPalette& pal) -{ - style->polish(pal); -} - -QSize QxtProxyStyle::sizeFromContents(ContentsType type, const QStyleOption* option, const QSize& contentsSize, const QWidget* widget) const -{ - return style->sizeFromContents(type, option, contentsSize, widget); -} - -QIcon QxtProxyStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption* option, const QWidget* widget) const -{ - return style->standardIcon(standardIcon, option, widget); -} - -QPalette QxtProxyStyle::standardPalette() const -{ - return style->standardPalette(); -} - -QPixmap QxtProxyStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption* option, const QWidget* widget) const -{ - return style->standardPixmap(standardPixmap, option, widget); -} - -int QxtProxyStyle::styleHint(StyleHint hint, const QStyleOption* option, const QWidget* widget, QStyleHintReturn* returnData) const -{ - return style->styleHint(hint, option, widget, returnData); -} - -QRect QxtProxyStyle::subControlRect(ComplexControl control, const QStyleOptionComplex* option, SubControl subControl, const QWidget* widget) const -{ - return style->subControlRect(control, option, subControl, widget); -} - -QRect QxtProxyStyle::subElementRect(SubElement element, const QStyleOption* option, const QWidget* widget) const -{ - return style->subElementRect(element, option, widget); -} - -void QxtProxyStyle::unpolish(QWidget* widget) -{ - style->unpolish(widget); -} - -void QxtProxyStyle::unpolish(QApplication* app) -{ - style->unpolish(app); -}