the-libs/lib/tpopover.h

64 lines
2 KiB
C
Raw Normal View History

2019-01-07 23:21:06 -05:00
/****************************************
*
* INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE
* Copyright (C) 2019 Victor Tran
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* *************************************/
#ifndef TPOPOVER_H
#define TPOPOVER_H
#include <QObject>
2019-01-15 23:00:10 -05:00
#include <the-libs_global.h>
2019-01-07 23:21:06 -05:00
struct tPopoverPrivate;
2020-05-28 10:33:51 -04:00
class THELIBSSHARED_EXPORT tPopover : public QObject {
2019-01-07 23:21:06 -05:00
Q_OBJECT
public:
2020-05-28 10:33:51 -04:00
explicit tPopover(QWidget* popoverWidget, QObject* parent = nullptr);
2019-01-07 23:21:06 -05:00
~tPopover();
2019-01-29 03:43:56 -05:00
enum PopoverSide {
Leading,
2019-07-26 04:00:40 -04:00
Trailing,
Bottom
2019-01-29 03:43:56 -05:00
};
2019-01-07 23:21:06 -05:00
void setPopoverWidth(int width);
2019-01-29 03:43:56 -05:00
void setPopoverSide(PopoverSide side);
2019-01-29 10:27:16 -05:00
void setPerformBlanking(bool performBlanking);
2019-03-06 05:02:59 -05:00
void setDismissable(bool dismissable);
2021-04-28 01:16:09 -04:00
Q_DECL_DEPRECATED void setPerformBlur(bool performBlur); //Use tScrim::setBlurEnabled(bool) instead
2019-01-29 03:43:56 -05:00
static tPopover* popoverForWidget(QWidget* popoverWidget);
2020-05-28 10:33:51 -04:00
static tPopover* popoverForPopoverWidget(QWidget* popoverWidget);
2019-01-07 23:21:06 -05:00
signals:
void dismissed();
public slots:
void show(QWidget* parent);
void dismiss();
private:
tPopoverPrivate* d;
bool eventFilter(QObject* watched, QEvent* event);
2019-01-29 03:43:56 -05:00
bool isOpeningOnRight();
2020-05-28 10:33:51 -04:00
void updateGeometry();
2019-01-07 23:21:06 -05:00
};
#endif // TPOPOVER_H