[163] | 1 | /* smplayer, GUI front-end for mplayer.
|
---|
[188] | 2 | Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
[163] | 3 |
|
---|
| 4 | This program is free software; you can redistribute it and/or modify
|
---|
| 5 | it under the terms of the GNU General Public License as published by
|
---|
| 6 | the Free Software Foundation; either version 2 of the License, or
|
---|
| 7 | (at your option) any later version.
|
---|
| 8 |
|
---|
| 9 | This program is distributed in the hope that it will be useful,
|
---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 12 | GNU General Public License for more details.
|
---|
| 13 |
|
---|
| 14 | You should have received a copy of the GNU General Public License
|
---|
| 15 | along with this program; if not, write to the Free Software
|
---|
| 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
| 17 | */
|
---|
| 18 |
|
---|
| 19 | #ifndef AUTOHIDEWIDGET_H
|
---|
| 20 | #define AUTOHIDEWIDGET_H
|
---|
| 21 |
|
---|
| 22 | #include <QWidget>
|
---|
| 23 |
|
---|
| 24 | class QTimer;
|
---|
| 25 | class QPropertyAnimation;
|
---|
| 26 |
|
---|
| 27 | class AutohideWidget : public QWidget
|
---|
| 28 | {
|
---|
| 29 | Q_OBJECT
|
---|
| 30 |
|
---|
| 31 | public:
|
---|
| 32 | enum Activation { Anywhere = 1, Bottom = 2 };
|
---|
| 33 |
|
---|
| 34 | AutohideWidget(QWidget * parent = 0);
|
---|
| 35 | ~AutohideWidget();
|
---|
| 36 |
|
---|
| 37 | void setInternalWidget(QWidget * w);
|
---|
| 38 | QWidget * internalWidget() { return internal_widget; };
|
---|
| 39 |
|
---|
| 40 | public slots:
|
---|
| 41 | void show();
|
---|
| 42 | void activate();
|
---|
| 43 | void deactivate();
|
---|
| 44 | void setAutoHide(bool b);
|
---|
| 45 | void setAnimated(bool b) { use_animation = b; };
|
---|
| 46 | void setMargin(int margin) { spacing = margin; };
|
---|
| 47 | void setPercWidth(int s) { perc_width = s;}
|
---|
| 48 | void setActivationArea(Activation m) { activation_area = m; }
|
---|
| 49 | void setHideDelay(int ms);
|
---|
| 50 |
|
---|
| 51 | public:
|
---|
| 52 | bool isActive() { return turned_on; };
|
---|
| 53 | bool autoHide() { return auto_hide; };
|
---|
| 54 | bool isAnimated() { return use_animation; };
|
---|
| 55 | int margin() { return spacing; };
|
---|
| 56 | int percWidth() { return perc_width; };
|
---|
| 57 | Activation activationArea() { return activation_area; }
|
---|
| 58 | int hideDelay();
|
---|
| 59 |
|
---|
| 60 | protected:
|
---|
| 61 | bool eventFilter(QObject * obj, QEvent * event);
|
---|
| 62 |
|
---|
| 63 | private slots:
|
---|
| 64 | void checkUnderMouse();
|
---|
| 65 | void showAnimated();
|
---|
| 66 |
|
---|
| 67 | private:
|
---|
| 68 | void installFilter(QObject *o);
|
---|
| 69 | void resizeAndMove();
|
---|
[181] | 70 | bool visiblePopups();
|
---|
[163] | 71 |
|
---|
| 72 | private:
|
---|
| 73 | bool turned_on;
|
---|
| 74 | bool auto_hide;
|
---|
| 75 | bool use_animation;
|
---|
| 76 | int spacing;
|
---|
| 77 | int perc_width;
|
---|
| 78 | Activation activation_area;
|
---|
| 79 | QWidget * internal_widget;
|
---|
| 80 | QTimer * timer;
|
---|
| 81 | #if QT_VERSION >= 0x040600
|
---|
| 82 | QPropertyAnimation * animation;
|
---|
| 83 | #endif
|
---|
| 84 | };
|
---|
| 85 |
|
---|
| 86 | #endif
|
---|
| 87 |
|
---|