File indexing completed on 2024-05-19 04:59:11

0001 /* ============================================================
0002 * Falkon - Qt web browser
0003 * Copyright (C) 2015-2016 David Rosca <nowrep@gmail.com>
0004 *
0005 * This program is free software: you can redistribute it and/or modify
0006 * it under the terms of the GNU General Public License as published by
0007 * the Free Software Foundation, either version 3 of the License, or
0008 * (at your option) any later version.
0009 *
0010 * This program is distributed in the hope that it will be useful,
0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013 * GNU General Public License for more details.
0014 *
0015 * You should have received a copy of the GNU General Public License
0016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017 * ============================================================ */
0018 #ifndef WEBHITTESTRESULT_H
0019 #define WEBHITTESTRESULT_H
0020 
0021 #include <QUrl>
0022 #include <QRect>
0023 #include <QString>
0024 #include <QVariantMap>
0025 
0026 #include "qzcommon.h"
0027 
0028 class QWebEngineContextMenuRequest;
0029 
0030 class WebPage;
0031 
0032 class FALKON_EXPORT WebHitTestResult
0033 {
0034 public:
0035     explicit WebHitTestResult(const WebPage *page, const QPoint &pos);
0036 
0037     void updateWithContextMenuData(const QWebEngineContextMenuRequest &data);
0038 
0039     QUrl baseUrl() const;
0040     QString alternateText() const;
0041     QRect boundingRect() const;
0042     QUrl imageUrl() const;
0043     bool isContentEditable() const;
0044     bool isContentSelected() const;
0045     bool isNull() const;
0046     QString linkTitle() const;
0047     QUrl linkUrl() const;
0048     QUrl mediaUrl() const;
0049     bool mediaPaused() const;
0050     bool mediaMuted() const;
0051     QPoint pos() const;
0052     QPointF viewportPos() const;
0053     QString tagName() const;
0054 
0055 private:
0056     void init(const QUrl &url, const QVariantMap &map);
0057 
0058     bool m_isNull;
0059     QUrl m_baseUrl;
0060     QString m_alternateText;
0061     QRect m_boundingRect;
0062     QUrl m_imageUrl;
0063     bool m_isContentEditable;
0064     bool m_isContentSelected;
0065     QString m_linkTitle;
0066     QUrl m_linkUrl;
0067     QUrl m_mediaUrl;
0068     bool m_mediaPaused;
0069     bool m_mediaMuted;
0070     QPoint m_pos;
0071     QPointF m_viewportPos;
0072     QString m_tagName;
0073 };
0074 
0075 #endif // WEBHITTESTRESULT_H