1 /*****************************************************************************
2 * resizablepopup.h - QStarDict, a StarDict clone written with using Qt *
3 * Copyright (C) 2007 Alexander Rodin *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License along *
16 * with this program; if not, write to the Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
18 *****************************************************************************/
20 #ifndef RESIZABLEPOPUP_H
21 #define RESIZABLEPOPUP_H
33 * The ResizablePopup widget is a resizable top-level window
34 * without decorations.
36 class ResizablePopup: public QFrame
42 * Construct a ResizablePopup widget.
44 ResizablePopup(QWidget *parent = 0);
47 * Return timeout before hiding after mouse leaving.
49 int timeoutBeforeHide() const
50 { return m_timeoutBeforeHide; }
52 * Return a default size of new-shown popup.
54 const QSize& defaultSize() const
55 { return m_defaultSize; }
59 * Set timeout before hiding after mouse leaving.
61 void setTimeoutBeforeHide(int timeoutBeforeHide)
62 { m_timeoutBeforeHide = timeoutBeforeHide; }
64 * Set default size of new-shown popup.
66 void setDefaultSize(const QSize &defaultSize)
67 { m_defaultSize = defaultSize; }
69 * Show popup under mouse cursor.
74 void enterEvent(QEvent*);
75 void leaveEvent(QEvent*);
76 void mouseMoveEvent(QMouseEvent*);
77 void mousePressEvent(QMouseEvent*);
78 void mouseReleaseEvent(QMouseEvent*);
79 void mouseDoubleClickEvent(QMouseEvent*);
80 void timerEvent(QTimerEvent*);
81 bool event(QEvent *event);
99 QPoint m_oldCursorPos;
102 ResizeDirection m_resizeDirection;
103 int m_timeoutBeforeHide;
111 #endif // RESIZABLEPOPUP_H
113 // vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab cindent textwidth=120 formatoptions=tc