ginebra2/PageItem.h
changeset 3 0954f5dd2cd0
equal deleted inserted replaced
1:b0dd75e285d2 3:0954f5dd2cd0
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 *
       
     5 * This program is free software: you can redistribute it and/or modify
       
     6 * it under the terms of the GNU Lesser General Public License as published by
       
     7 * the Free Software Foundation, version 2.1 of the License.
       
     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 Lesser General Public License for more details.
       
    13 *
       
    14 * You should have received a copy of the GNU Lesser General Public License
       
    15 * along with this program.  If not,
       
    16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
       
    17 *
       
    18 * Description:
       
    19 *
       
    20 */
       
    21 
       
    22 #ifndef PAGEITEM_H_
       
    23 #define PAGEITEM_H_
       
    24 
       
    25 #include "NativeChromeItem.h"
       
    26 
       
    27 #include <QVariant>
       
    28 
       
    29 class QGraphicsWebView;
       
    30 
       
    31 namespace GVA {
       
    32 
       
    33 class GWebTouchNavigation;
       
    34 class ChromeWidget;
       
    35 class GSuperWebPage;
       
    36 class WebPageWrapper;
       
    37 
       
    38 /*!
       
    39  * This class provides a full QWebView in a single chrome item
       
    40  * \sa PageSnippet
       
    41  */
       
    42 class PageItem: public NativeChromeItem {
       
    43     Q_OBJECT
       
    44   public:
       
    45     PageItem(ChromeSnippet * snippet=0, ChromeWidget* chrome=0);
       
    46     virtual ~PageItem();
       
    47 
       
    48     QString url() const;
       
    49     void setUrl(const QString &url);
       
    50 
       
    51     void setHtml(const QString &value);
       
    52     QString html() const;
       
    53 
       
    54     QVariant evaluateJavaScript(const QString &expression);
       
    55     void instantiate();
       
    56     void setSize(const QSizeF &size);
       
    57 
       
    58     /// Puts a call to \ref cleanup on the end of the event queue.  Similar to QObject::deleteLater.
       
    59     /// Could be problematic if an event is subsequently placed on the queue that expects this object
       
    60     /// to be fully instantiated.
       
    61     void cleanUpOnTimer();
       
    62 
       
    63   public slots:
       
    64     void cleanUp();
       
    65 
       
    66   protected:
       
    67     virtual void resizeEvent(QGraphicsSceneResizeEvent *event);
       
    68     virtual void showEvent(QShowEvent *event);
       
    69     void setWebViewSize(const QSizeF &size);
       
    70 
       
    71   protected:
       
    72     QGraphicsWebView *m_webView;
       
    73     GWebTouchNavigation *m_touchNavigation;
       
    74     GSuperWebPage *m_superPage;
       
    75     WebPageWrapper *m_page;
       
    76     ChromeWidget* m_chrome;
       
    77     QTimer* m_cleanupTimer;
       
    78     QString m_url;
       
    79     bool m_isInstantiated;
       
    80     QString m_html;
       
    81 };
       
    82 
       
    83 }
       
    84 
       
    85 #endif /* PAGEITEM_H_ */