KDEUI
kmessagewidget.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 * 00003 * Copyright (c) 2011 Aurélien Gâteau <agateau@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 as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00018 * 02110-1301 USA 00019 */ 00020 #ifndef KMESSAGEWIDGET_H 00021 #define KMESSAGEWIDGET_H 00022 00023 #include <kdeui_export.h> 00024 00025 #include <QFrame> 00026 00027 class KMessageWidgetPrivate; 00028 00092 class KDEUI_EXPORT KMessageWidget : public QFrame 00093 { 00094 Q_OBJECT 00095 Q_ENUMS(MessageType) 00096 00097 Q_PROPERTY(QString text READ text WRITE setText) 00098 Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap) 00099 Q_PROPERTY(bool closeButtonVisible READ isCloseButtonVisible WRITE setCloseButtonVisible) 00100 Q_PROPERTY(MessageType messageType READ messageType WRITE setMessageType) 00101 public: 00102 enum MessageType { 00103 Positive, 00104 Information, 00105 Warning, 00106 Error 00107 }; 00108 00112 explicit KMessageWidget(QWidget *parent = 0); 00113 00114 explicit KMessageWidget(const QString &text, QWidget *parent = 0); 00115 00116 ~KMessageWidget(); 00117 00118 QString text() const; 00119 00120 bool wordWrap() const; 00121 00122 bool isCloseButtonVisible() const; 00123 00124 MessageType messageType() const; 00125 00126 void addAction(QAction *action); 00127 00128 void removeAction(QAction *action); 00129 00130 QSize sizeHint() const; 00131 00132 QSize minimumSizeHint() const; 00133 00134 public Q_SLOTS: 00135 void setText(const QString &text); 00136 00137 void setWordWrap(bool wordWrap); 00138 00139 void setCloseButtonVisible(bool visible); 00140 00141 void setMessageType(KMessageWidget::MessageType type); 00142 00147 void animatedShow(); 00148 00153 void animatedHide(); 00154 00155 protected: 00156 void paintEvent(QPaintEvent *event); 00157 00158 bool event(QEvent *event); 00159 00160 void resizeEvent(QResizeEvent *event); 00161 00162 void showEvent(QShowEvent *event); 00163 00164 private: 00165 KMessageWidgetPrivate *const d; 00166 friend class KMessageWidgetPrivate; 00167 00168 Q_PRIVATE_SLOT(d, void slotTimeLineChanged(qreal)) 00169 Q_PRIVATE_SLOT(d, void slotTimeLineFinished()) 00170 }; 00171 00172 #endif /* KMESSAGEWIDGET_H */
KDE 4.7 API Reference