ginebra2/ScrollZoomWidget.h
changeset 0 1450b09d0cfd
equal deleted inserted replaced
-1:000000000000 0:1450b09d0cfd
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __gva_scrollzoomwidget_h__
       
    20 #define __gva_scrollzoomwidget_h__
       
    21 
       
    22 #include "NativeChromeItem.h"
       
    23 
       
    24 class QTimeLine;
       
    25 
       
    26 namespace GVA {
       
    27 
       
    28   class GWebContentView;
       
    29 
       
    30   class ScrollZoomWidget : public NativeChromeItem
       
    31   {
       
    32     Q_OBJECT
       
    33   public:
       
    34     ScrollZoomWidget(ChromeSnippet* snippet, QGraphicsItem* parent = 0);
       
    35     virtual ~ScrollZoomWidget();
       
    36     void paint(QPainter* painter, const QStyleOptionGraphicsItem* opt, QWidget* widget);
       
    37     void mousePressEvent(QGraphicsSceneMouseEvent * ev);
       
    38     void mouseReleaseEvent(QGraphicsSceneMouseEvent * ev);
       
    39   public slots:
       
    40     void updateZoom(qreal delta);
       
    41     void updateScroll(qreal delta);
       
    42     void onLoadFinished(bool ok);
       
    43   protected:
       
    44     QVariant itemChange(GraphicsItemChange change, const QVariant & value);
       
    45   private:
       
    46     void zoom();
       
    47     void scroll();
       
    48     bool m_zoomIn;
       
    49     bool m_scrolling;
       
    50     qreal m_xScale;
       
    51     qreal m_yScale;
       
    52     qreal m_deltaX;
       
    53     qreal m_deltaY;
       
    54     qreal m_centerX;
       
    55     qreal m_centerY;
       
    56     QTimeLine * m_timeLine;
       
    57     GWebContentView * m_webView;
       
    58     QGraphicsEffect * m_effect;
       
    59     QImage m_buttonImage;
       
    60   };
       
    61 
       
    62 } // end of namespace GVA
       
    63 
       
    64 #endif // __GINEBRA_REDCHROMESNIPPET_H__