ginebra2/ContentViews/GContentViewTouchNavigation.h
changeset 5 0f2326c2a325
child 6 1c3b8676e58c
equal deleted inserted replaced
1:b0dd75e285d2 5:0f2326c2a325
       
     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 "ChromeWidget.h"
       
    29 
       
    30 namespace GVA
       
    31 {
       
    32     /*!
       
    33      * This class provides the virtual function overrides needed to make GWebTouchNavigation
       
    34      * work on a GWebContentViewWidget.
       
    35      */
       
    36     class GContentViewTouchNavigation : public GWebTouchNavigation
       
    37     {
       
    38         Q_OBJECT
       
    39     public:
       
    40         GContentViewTouchNavigation(QWebPage* webPage, GWebContentViewWidget* view);
       
    41         void setChromeWidget(ChromeWidget* chrome) { m_chrome = chrome;}
       
    42 
       
    43     protected:
       
    44         GWebContentViewWidget *contentViewWidget() { return static_cast<GWebContentViewWidget*>(m_view); }
       
    45 
       
    46         virtual qreal slideView(qreal delta) { return m_chrome->slideView(delta); }
       
    47         virtual qreal shrinkView(qreal delta) { return m_chrome->shrinkView(delta); }
       
    48         virtual qreal viewInitialScale() { return contentViewWidget()->initialScale(); }
       
    49         virtual void setViewBlockElement(const QWebElement &el) { contentViewWidget()->setBlockElement(el); }
       
    50         virtual void setViewZoomFactor(qreal zoom) { return contentViewWidget()->setZoomFactor(zoom); }
       
    51 
       
    52     protected:
       
    53         ChromeWidget* m_chrome;
       
    54     };
       
    55 
       
    56 }
       
    57 
       
    58 #endif