KDEUI
kdeuiwidgetsproxystyle.cpp
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 00003 Copyright (C) 2007 Fredrik Höglund <fredrik@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License (LGPL) as published by the Free Software Foundation; 00008 either version 2 of the License, or (at your option) any later 00009 version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #include "kdeuiwidgetsproxystyle_p.h" 00023 00024 #include <QtGui/QApplication> 00025 #include <QtGui/QWidget> 00026 #include <QtGui/QWindowsStyle> 00027 00028 KdeUiProxyStyle::KdeUiProxyStyle(QWidget *referenceWidget) 00029 : QStyle(), m_referenceWidget(referenceWidget) 00030 { 00031 } 00032 00033 KdeUiProxyStyle::~KdeUiProxyStyle() 00034 { 00035 } 00036 00037 QStyle *KdeUiProxyStyle::style() const 00038 { 00039 QStyle* baseStyle; 00040 if (m_referenceWidget && m_referenceWidget->parentWidget()) { 00041 baseStyle = m_referenceWidget->parentWidget()->style(); 00042 } else { 00043 baseStyle = QApplication::style(); 00044 } 00045 return baseStyle; 00046 } 00047 00048 void KdeUiProxyStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, 00049 QPainter *painter, const QWidget *widget) const 00050 { 00051 style()->drawComplexControl(control, option, painter, widget); 00052 } 00053 00054 void KdeUiProxyStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, 00055 const QWidget *widget) const 00056 { 00057 style()->drawControl(element, option, painter, widget); 00058 } 00059 00060 void KdeUiProxyStyle::drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, 00061 const QPixmap &pixmap) const 00062 { 00063 style()->drawItemPixmap(painter, rectangle, alignment, pixmap); 00064 } 00065 00066 void KdeUiProxyStyle::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, 00067 bool enabled, const QString &text, QPalette::ColorRole textRole) const 00068 { 00069 style()->drawItemText(painter, rectangle, alignment, palette, enabled, text, textRole); 00070 } 00071 00072 void KdeUiProxyStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, 00073 const QWidget *widget) const 00074 { 00075 style()->drawPrimitive(element, option, painter, widget); 00076 } 00077 00078 QPixmap KdeUiProxyStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, 00079 const QStyleOption *option) const 00080 { 00081 return style()->generatedIconPixmap(iconMode, pixmap, option); 00082 } 00083 00084 QStyle::SubControl KdeUiProxyStyle::hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, 00085 const QPoint &position, const QWidget *widget) const 00086 { 00087 return style()->hitTestComplexControl(control, option, position, widget); 00088 } 00089 00090 QRect KdeUiProxyStyle::itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const 00091 { 00092 return style()->itemPixmapRect(rectangle, alignment, pixmap); 00093 } 00094 00095 QRect KdeUiProxyStyle::itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, 00096 bool enabled, const QString &text) const 00097 { 00098 return style()->itemTextRect(metrics, rectangle, alignment, enabled, text); 00099 } 00100 00101 int KdeUiProxyStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const 00102 { 00103 return style()->pixelMetric(metric, option, widget); 00104 } 00105 00106 void KdeUiProxyStyle::polish(QWidget *widget) 00107 { 00108 style()->polish(widget); 00109 } 00110 00111 void KdeUiProxyStyle::polish(QApplication *application) 00112 { 00113 style()->polish(application); 00114 } 00115 00116 void KdeUiProxyStyle::polish(QPalette &palette) 00117 { 00118 style()->polish(palette); 00119 } 00120 00121 QSize KdeUiProxyStyle::sizeFromContents(ContentsType type, const QStyleOption *option, 00122 const QSize &contentsSize, const QWidget *widget) const 00123 { 00124 return style()->sizeFromContents(type, option, contentsSize, widget); 00125 } 00126 00127 QIcon KdeUiProxyStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option, 00128 const QWidget *widget) const 00129 { 00130 return style()->standardIcon(standardIcon, option, widget); 00131 } 00132 00133 QPixmap KdeUiProxyStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *option, 00134 const QWidget *widget) const 00135 { 00136 return style()->standardPixmap(standardPixmap, option, widget); 00137 } 00138 00139 QPalette KdeUiProxyStyle::standardPalette() const 00140 { 00141 return style()->standardPalette(); 00142 } 00143 00144 int KdeUiProxyStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, 00145 QStyleHintReturn *returnData) const 00146 { 00147 return style()->styleHint(hint, option, widget, returnData); 00148 } 00149 00150 QRect KdeUiProxyStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option, 00151 SubControl subControl, const QWidget *widget) const 00152 { 00153 return style()->subControlRect(control, option, subControl, widget); 00154 } 00155 00156 QRect KdeUiProxyStyle::subElementRect(SubElement element, const QStyleOption *option, 00157 const QWidget *widget) const 00158 { 00159 return style()->subElementRect(element, option, widget); 00160 } 00161 00162 void KdeUiProxyStyle::unpolish(QWidget *widget) 00163 { 00164 style()->unpolish(widget); 00165 } 00166 00167 void KdeUiProxyStyle::unpolish(QApplication *application) 00168 { 00169 style()->unpolish(application); 00170 } 00171
KDE 4.6 API Reference