Plasma
frame.h
Go to the documentation of this file.
00001 /* 00002 * Copyright 2008 Marco Martin <notmart@gmail.com> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU Library General Public License as 00006 * published by the Free Software Foundation; either version 2, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details 00013 * 00014 * You should have received a copy of the GNU Library General Public 00015 * License along with this program; if not, write to the 00016 * Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef PLASMA_FRAME_H 00021 #define PLASMA_FRAME_H 00022 00023 #include <QtGui/QGraphicsWidget> 00024 00025 #include <plasma/plasma_export.h> 00026 #include <plasma/framesvg.h> 00027 00028 class QFrame; 00029 00030 namespace Plasma 00031 { 00032 00033 class FramePrivate; 00034 00043 class PLASMA_EXPORT Frame : public QGraphicsWidget 00044 { 00045 Q_OBJECT 00046 Q_PROPERTY(Shadow frameShadow READ frameShadow WRITE setFrameShadow) 00047 Q_PROPERTY(QString text READ text WRITE setText) 00048 Q_PROPERTY(QString image READ image WRITE setImage) 00049 Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet) 00050 Q_ENUMS(Shadow) 00051 00052 public: 00053 enum Shadow { 00054 Plain = 1, 00055 Raised = 2, 00056 Sunken = 3 00057 }; 00058 00064 explicit Frame(QGraphicsWidget *parent = 0); 00065 ~Frame(); 00066 00072 void setFrameShadow(Shadow shadow); 00073 00077 Shadow frameShadow() const; 00078 00083 void setEnabledBorders(const FrameSvg::EnabledBorders borders); 00084 00090 FrameSvg::EnabledBorders enabledBorders() const; 00091 00098 void setText(QString text); 00099 00103 QString text() const; 00104 00110 void setImage(const QString &path); 00111 00115 QString image() const; 00116 00122 void setStyleSheet(const QString &stylesheet); 00123 00127 QString styleSheet() const; 00128 00132 QWidget *nativeWidget() const; 00133 00134 protected: 00135 void paint(QPainter *painter, 00136 const QStyleOptionGraphicsItem *option, 00137 QWidget *widget = 0); 00138 00139 void resizeEvent(QGraphicsSceneResizeEvent *event); 00140 QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint) const; 00141 void changeEvent(QEvent *event); 00142 00143 private: 00144 FramePrivate * const d; 00145 00146 Q_PRIVATE_SLOT(d, void syncBorders()) 00147 Q_PRIVATE_SLOT(d, void setPalette()) 00148 }; 00149 00150 } // namespace Plasma 00151 00152 #endif // multiple inclusion guard
KDE 4.6 API Reference