File indexing completed on 2022-11-29 18:38:24

0001 /*
0002  * Copyright 1999 by Martin R. Jones <mjones@kde.org>
0003  *
0004  * This program is free software; you can redistribute it and/or modify
0005  * it under the terms of the GNU General Public License as published by
0006  * the Free Software Foundation; either version 2 of the License, or
0007  * (at your option) any later version.
0008  *
0009  * This program is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  * GNU General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU General Public License
0015  * along with this program; if not, write to the Free Software
0016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0017  */
0018 #ifndef AMORBUBBLE_H
0019 #define AMORBUBBLE_H
0020 
0021 #include <QLabel>
0022 #include <QPoint>
0023 
0024 class QLabel;
0025 
0026 
0027 class AmorBubble : public QLabel
0028 {
0029     Q_OBJECT
0030 
0031     public:
0032         AmorBubble();
0033 
0034         void setOrigin(int x, int y) { move( x + 10, y - 10 ); }
0035         void setMessage(const QString &message) { setText( message ); show(); }
0036 
0037         bool mouseWithin() { return m_mouseWithin; }
0038 
0039     protected:
0040         void enterEvent(QEvent *event) override { Q_UNUSED( event ); m_mouseWithin = true; }
0041         void leaveEvent(QEvent *event) override { Q_UNUSED( event ); m_mouseWithin = false; }
0042         void mouseReleaseEvent(QMouseEvent *event) override { Q_UNUSED( event ); hide(); }
0043 
0044     protected:        
0045         QLabel *m_label;        // displays the message
0046         //QPoint m_position;
0047         bool m_mouseWithin;      // the mouse pointer is inside the bubble
0048         
0049         //QRect mBound;           // bounds of the text
0050         //QBitmap mMask;          // shape mask
0051         //VertPos mArrowVert;     // vertical position of the arrow
0052         //HorzPos mArrowHorz;     // horizontal position of the arrow
0053 };
0054 
0055 
0056 #endif
0057 
0058 // kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; replace-tabs on; space-indent on;
0059 // vim:set spell et sw=4 ts=4 nowrap cino=l1,cs,U1: