ginebra2/ContentViews/GWebContentViewWidget.h
changeset 3 0954f5dd2cd0
parent 0 1450b09d0cfd
child 16 3c88a81ff781
--- a/ginebra2/ContentViews/GWebContentViewWidget.h	Fri May 14 15:40:36 2010 +0300
+++ b/ginebra2/ContentViews/GWebContentViewWidget.h	Tue Jun 29 00:46:29 2010 -0400
@@ -1,22 +1,24 @@
 /*
 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, version 2.1 of the License.
 *
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
+* 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 Lesser General Public License for more details.
 *
-* Description: 
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program.  If not,
+* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
 *
+* Description:
 */
 
 
-
 #ifndef GWebContentViewWidget_H_
 #define GWebContentViewWidget_H_
 
@@ -86,9 +88,7 @@
     QWebPage* wrtPage() { return m_wrtPage; }
     void showNormalPage();
 
-    void createPagePixmap();
     void setBitmapZoom(qreal zoom);
-    void deletePagePixmap();
     void setPageCenterZoomFactor(qreal zoom);
 
     void initializeViewportParams();
@@ -98,7 +98,7 @@
     qreal maximumScale();
     qreal initialScale();
     void updateViewport();
-    void setBlockElement(QWebElement pt);
+    void setBlockElement(const QWebElement &pt);
     QPointF mapToGlobal(const QPointF& p);
     QPointF mapFromGlobal(const QPointF& p);
 
@@ -109,10 +109,38 @@
     void setPageZoomMetaData(ZoomMetaData params);
     ZoomMetaData defaultZoomData();
     void setCheckeredPixmap();
+
+    void onLoadStarted();
+    void onLoadFinished();
+
+    /*!
+     * \brief Freeze the on-screen state of the window.
+     * Takes a snapshot of the window in its current state.  The paint() method will then use
+     * this snapshot for all further paints, until unfreeze() is called.  Freeze() increments
+     * a counter and unfreeze() decrements the counter so that nested calls to them are handled
+     * correctly.
+     * \sa unfreeze
+     */
+    void freeze();
+
+    /*!
+     * \brief Unfreeze the on-screen state of the window.
+     * \sa freeze
+     */
+    void unfreeze();
+
+    /*!
+     * \brief Returns true if the window is currently frozen.
+     * \sa freeze
+     * \sa unfreeze
+     */
+    bool frozen() const { return m_frozenCount > 0; }
+
 public slots:
     void setViewportSize();
 
     void onInitLayout();
+    void onLongPressEvent(QPoint pos);
 
 signals:
     void contextEvent(::WebViewEventContext *context);
@@ -120,23 +148,24 @@
 
     void pageZoomMetaDataChange(QWebFrame* frame, ZoomMetaData data);protected:
     void paintEvent(QPaintEvent *event);
-
-    virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
+    void longPressEvent(::WebViewEventContext *context);
 
-public:
-    void onLoadStarted();
-    void onLoadFinished();
+private slots:
+    /*!
+     * \brief Update the "frozen" image of this window.
+     */
+    void updateFrozenImage();
 
 private:
     void updateViewportSize(QGraphicsSceneResizeEvent *e);
+    virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
 
     GVA::GWebContentView* m_webContentView;
     qreal       m_dirtyZoomFactor;
-    QPixmap    *m_frozenPixmap;
-    int         m_freezeCount;
+    QPixmap     *m_frozenPixmap;
+    int         m_frozenCount;
     QWebPage   *m_wrtPage;
     bool        m_bitmapZoom;
-    QPixmap    *m_pagePixmap;
     qreal       m_aspectRation;
     qreal       m_viewportWidth;
     qreal       m_viewportHeight;
@@ -152,12 +181,12 @@
     int         m_previousViewPortwidth;
     qreal       m_Ratiox;
     qreal       m_Ratioy;
-    
-    
+
+
     QImage*     m_bitmapImage;
     qreal       m_bitmapZoomFactor;
     QPixmap*    m_checkeredBoxPixmap;
-    
+
     bool        m_inLoading;
     QTime       m_loadingTime;
 #ifndef NO_QSTM_GESTURE