ginebra2/ContentViews/GContentViewTouchNavigation.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 GWEBCONTENTVIEWTOUCHNAVIGATION_H
       
    23 #define GWEBCONTENTVIEWTOUCHNAVIGATION_H
       
    24 
       
    25 #include <QObject>
       
    26 #include "GWebTouchNavigation.h"
       
    27 #include "GWebContentViewWidget.h"
       
    28 #include "ChromeLayout.h"
       
    29 #include "ChromeWidget.h"
       
    30 
       
    31 namespace GVA
       
    32 {
       
    33     /*!
       
    34      * This class provides the virtual function overrides needed to make GWebTouchNavigation
       
    35      * work on a GWebContentViewWidget.
       
    36      */
       
    37     class GContentViewTouchNavigation : public GWebTouchNavigation
       
    38     {
       
    39         Q_OBJECT
       
    40     public:
       
    41         GContentViewTouchNavigation(QWebPage* webPage, GWebContentViewWidget* view);
       
    42         void setChromeWidget(ChromeWidget* chrome) { m_chrome = chrome;}
       
    43 
       
    44         Q_PROPERTY(qreal doubleClickEnabled READ getDoubleClickEnabled WRITE setDoubleClickEnabled)
       
    45         qreal getDoubleClickEnabled() const { return m_doubleClickEnabled; }
       
    46         void setDoubleClickEnabled(qreal value)  { m_doubleClickEnabled = value; }
       
    47     
       
    48     protected:
       
    49         GWebContentViewWidget *contentViewWidget() { return static_cast<GWebContentViewWidget*>(m_view); }
       
    50 
       
    51         virtual qreal slideView(qreal delta) { return m_chrome->layout()->slideView(delta); }
       
    52         virtual qreal shrinkView(qreal delta) { return m_chrome->layout()->shrinkView(delta); }
       
    53         virtual qreal viewInitialScale() { return contentViewWidget()->initialScale(); }
       
    54         virtual void setViewBlockElement(const QWebElement &el) { contentViewWidget()->setBlockElement(el); }
       
    55         virtual void setViewZoomFactor(qreal zoom) { return contentViewWidget()->setZoomFactor(zoom); }
       
    56 
       
    57     protected:
       
    58         ChromeWidget* m_chrome;
       
    59     
       
    60     };
       
    61 
       
    62 }
       
    63 
       
    64 #endif