WebKit/qt/Api/qwebpage_p.h
changeset 0 4f2f89ce4247
child 2 303757a437d3
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     1 /*
       
     2     Copyright (C) 2008, 2009 Nokia Corporation and/or its subsidiary(-ies)
       
     3     Copyright (C) 2008 Holger Hans Peter Freyther
       
     4 
       
     5     This library is free software; you can redistribute it and/or
       
     6     modify it under the terms of the GNU Library General Public
       
     7     License as published by the Free Software Foundation; either
       
     8     version 2 of the License, or (at your option) any later version.
       
     9 
       
    10     This library 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 GNU
       
    13     Library General Public License for more details.
       
    14 
       
    15     You should have received a copy of the GNU Library General Public License
       
    16     along with this library; see the file COPYING.LIB.  If not, write to
       
    17     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
       
    18     Boston, MA 02110-1301, USA.
       
    19 */
       
    20 
       
    21 #ifndef QWEBPAGE_P_H
       
    22 #define QWEBPAGE_P_H
       
    23 
       
    24 #include <qbasictimer.h>
       
    25 #include <qnetworkproxy.h>
       
    26 #include <qpointer.h>
       
    27 #include <qevent.h>
       
    28 #include <qgraphicssceneevent.h>
       
    29 
       
    30 #include "qwebpage.h"
       
    31 #include "qwebhistory.h"
       
    32 #include "qwebframe.h"
       
    33 
       
    34 #include "KURL.h"
       
    35 #include "PlatformString.h"
       
    36 
       
    37 #include <wtf/RefPtr.h>
       
    38 
       
    39 namespace WebCore {
       
    40     class ChromeClientQt;
       
    41     class ContextMenuClientQt;
       
    42     class ContextMenuItem;
       
    43     class ContextMenu;
       
    44     class EditorClientQt;
       
    45     class Element;
       
    46     class InspectorController;
       
    47     class Node;
       
    48     class Page;
       
    49     class Frame;
       
    50 }
       
    51 
       
    52 QT_BEGIN_NAMESPACE
       
    53 class QUndoStack;
       
    54 class QMenu;
       
    55 class QBitArray;
       
    56 QT_END_NAMESPACE
       
    57 
       
    58 class QWebInspector;
       
    59 class QWebPageClient;
       
    60 
       
    61 class QtViewportHintsPrivate : public QSharedData {
       
    62 public:
       
    63     QtViewportHintsPrivate(QWebPage::ViewportHints* qq)
       
    64         : q(qq)
       
    65     { }
       
    66 
       
    67     QWebPage::ViewportHints* q;
       
    68 };
       
    69 
       
    70 class QWebPagePrivate {
       
    71 public:
       
    72     QWebPagePrivate(QWebPage*);
       
    73     ~QWebPagePrivate();
       
    74 
       
    75     static WebCore::Page* core(QWebPage*);
       
    76     static QWebPagePrivate* priv(QWebPage*);
       
    77 
       
    78     void createMainFrame();
       
    79 #ifndef QT_NO_CONTEXTMENU
       
    80     QMenu* createContextMenu(const WebCore::ContextMenu* webcoreMenu, const QList<WebCore::ContextMenuItem>* items, QBitArray* visitedWebActions);
       
    81 #endif
       
    82     void _q_onLoadProgressChanged(int);
       
    83     void _q_webActionTriggered(bool checked);
       
    84     void _q_cleanupLeakMessages();
       
    85     void updateAction(QWebPage::WebAction action);
       
    86     void updateNavigationActions();
       
    87     void updateEditorActions();
       
    88 
       
    89     void timerEvent(QTimerEvent*);
       
    90 
       
    91     void mouseMoveEvent(QMouseEvent*);
       
    92     void mouseMoveEvent(QGraphicsSceneMouseEvent*);
       
    93     void mousePressEvent(QMouseEvent*);
       
    94     void mousePressEvent(QGraphicsSceneMouseEvent*);
       
    95     void mouseDoubleClickEvent(QMouseEvent*);
       
    96     void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*);
       
    97     void mouseTripleClickEvent(QMouseEvent*);
       
    98     void mouseTripleClickEvent(QGraphicsSceneMouseEvent*);
       
    99     void mouseReleaseEvent(QMouseEvent*);
       
   100     void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
       
   101 #ifndef QT_NO_CONTEXTMENU
       
   102     void contextMenuEvent(const QPoint& globalPos);
       
   103 #endif
       
   104 #ifndef QT_NO_WHEELEVENT
       
   105     void wheelEvent(QWheelEvent*);
       
   106     void wheelEvent(QGraphicsSceneWheelEvent*);
       
   107 #endif
       
   108     void keyPressEvent(QKeyEvent*);
       
   109     void keyReleaseEvent(QKeyEvent*);
       
   110     void focusInEvent(QFocusEvent*);
       
   111     void focusOutEvent(QFocusEvent*);
       
   112 
       
   113     void dragEnterEvent(QDragEnterEvent*);
       
   114     void dragEnterEvent(QGraphicsSceneDragDropEvent*);
       
   115     void dragLeaveEvent(QDragLeaveEvent*);
       
   116     void dragLeaveEvent(QGraphicsSceneDragDropEvent*);
       
   117     void dragMoveEvent(QDragMoveEvent*);
       
   118     void dragMoveEvent(QGraphicsSceneDragDropEvent*);
       
   119     void dropEvent(QDropEvent*);
       
   120     void dropEvent(QGraphicsSceneDragDropEvent*);
       
   121 
       
   122     void inputMethodEvent(QInputMethodEvent*);
       
   123 
       
   124 #ifndef QT_NO_PROPERTIES
       
   125     void dynamicPropertyChangeEvent(QDynamicPropertyChangeEvent*);
       
   126 #endif
       
   127 
       
   128     void shortcutOverrideEvent(QKeyEvent*);
       
   129     void leaveEvent(QEvent*);
       
   130     void handleClipboard(QEvent*, Qt::MouseButton);
       
   131     void handleSoftwareInputPanel(Qt::MouseButton);
       
   132     bool handleScrolling(QKeyEvent*, WebCore::Frame*);
       
   133 
       
   134 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
       
   135     // Returns whether the default action was cancelled in the JS event handler
       
   136     bool touchEvent(QTouchEvent*);
       
   137 #endif
       
   138 
       
   139     void setInspector(QWebInspector*);
       
   140     QWebInspector* getOrCreateInspector();
       
   141     WebCore::InspectorController* inspectorController();
       
   142 
       
   143 #ifndef QT_NO_SHORTCUT
       
   144     static QWebPage::WebAction editorActionForKeyEvent(QKeyEvent* event);
       
   145 #endif
       
   146     static const char* editorCommandForWebActions(QWebPage::WebAction action);
       
   147 
       
   148     WebCore::ChromeClientQt *chromeClient;
       
   149     WebCore::ContextMenuClientQt *contextMenuClient;
       
   150     WebCore::EditorClientQt *editorClient;
       
   151     WebCore::Page *page;
       
   152 
       
   153     QPointer<QWebFrame> mainFrame;
       
   154 
       
   155     QWebPage *q;
       
   156     QWebPageClient* client;
       
   157 #ifndef QT_NO_UNDOSTACK
       
   158     QUndoStack *undoStack;
       
   159 #endif
       
   160 
       
   161 #if QT_VERSION >= 0x040600
       
   162     QWeakPointer<QWidget> view;
       
   163 #else
       
   164     QWidget* view;
       
   165 #endif
       
   166 
       
   167     bool insideOpenCall;
       
   168     quint64 m_totalBytes;
       
   169     quint64 m_bytesReceived;
       
   170 
       
   171     QPoint tripleClick;
       
   172     QBasicTimer tripleClickTimer;
       
   173 
       
   174     bool clickCausedFocus;
       
   175 
       
   176     bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type);
       
   177     QNetworkAccessManager *networkManager;
       
   178 
       
   179     bool forwardUnsupportedContent;
       
   180     bool smartInsertDeleteEnabled;
       
   181     bool selectTrailingWhitespaceEnabled;
       
   182     QWebPage::LinkDelegationPolicy linkPolicy;
       
   183 
       
   184     QSize viewportSize;
       
   185     QSize fixedLayoutSize;
       
   186     QWebHistory history;
       
   187     QWebHitTestResult hitTestResult;
       
   188 #ifndef QT_NO_CONTEXTMENU
       
   189     QPointer<QMenu> currentContextMenu;
       
   190 #endif
       
   191     QWebSettings *settings;
       
   192     QPalette palette;
       
   193     bool editable;
       
   194     bool useFixedLayout;
       
   195 
       
   196     QAction *actions[QWebPage::WebActionCount];
       
   197 
       
   198     QWebPluginFactory *pluginFactory;
       
   199 
       
   200     QWidget* inspectorFrontend;
       
   201     QWebInspector* inspector;
       
   202     bool inspectorIsInternalOnly; // True if created through the Inspect context menu action
       
   203     Qt::DropAction m_lastDropAction;
       
   204     
       
   205     QString viewMode;
       
   206 
       
   207     static bool drtRun;
       
   208 };
       
   209 
       
   210 #endif