File indexing completed on 2024-05-12 16:39:57
0001 /* This file is part of the KDE libraries 0002 * 0003 * Copyright (c) 2011 Aurélien Gâteau <agateau@kde.org> 0004 * Copyright (C) 2011 Jarosław Staniek <staniek@kde.org> 0005 * 0006 * This library is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU Lesser General Public 0008 * License as published by the Free Software Foundation; either 0009 * version 2.1 of the License, or (at your option) any later version. 0010 * 0011 * This library is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 * Lesser General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU Lesser General Public 0017 * License along with this library; if not, write to the Free Software 0018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 0019 * 02110-1301 USA 0020 */ 0021 #ifndef KMESSAGEWIDGET_P_H 0022 #define KMESSAGEWIDGET_P_H 0023 0024 #include "kmessagewidget.h" 0025 0026 #include <QLabel> 0027 0028 class KMessageWidgetFrame : public QFrame 0029 { 0030 Q_OBJECT 0031 public: 0032 explicit KMessageWidgetFrame(QWidget* parent = 0); 0033 0034 virtual void paintEvent(QPaintEvent* event) override; 0035 0036 KMessageWidget::CalloutPointerDirection calloutPointerDirection() const; 0037 0038 void setCalloutPointerDirection(KMessageWidget::CalloutPointerDirection direction); 0039 0040 QPoint calloutPointerPosition() const; 0041 0042 QPoint pointerPosition() const; 0043 0044 void setCalloutPointerPosition(const QPoint& globalPos); 0045 0046 void updateCalloutPointerPosition() const; 0047 0048 const int radius; 0049 QBrush bgBrush; 0050 QBrush borderBrush; 0051 0052 private: 0053 void paintCalloutPointer(); 0054 void updateCalloutPointerTransformation() const; 0055 0056 KMessageWidget::CalloutPointerDirection m_calloutPointerDirection; 0057 mutable QTransform m_calloutPointerTransformation; 0058 mutable QSize m_sizeForRecentTransformation; 0059 QPoint m_calloutPointerGlobalPosition; 0060 QPolygonF m_polyline; 0061 QPolygonF m_polygon; 0062 }; 0063 0064 class ClickableLabel : public QLabel 0065 { 0066 Q_OBJECT 0067 public: 0068 explicit ClickableLabel(QWidget *parent = 0); 0069 virtual ~ClickableLabel(); 0070 virtual void mousePressEvent(QMouseEvent *ev) override; 0071 0072 Q_SIGNALS: 0073 void clicked(); 0074 }; 0075 0076 #endif /* KMESSAGEWIDGET_P_H */