webengine/osswebengine/WebKit/s60/webview/WebCursor.h
changeset 0 dd21522fd290
child 5 10e98eab6f85
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2006 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 the License "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:   Implemetation of WebCursor
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __WEBKITCURSOR_H__
       
    19 #define __WEBKITCURSOR_H__
       
    20 
       
    21 #include <e32base.h>
       
    22 #include "WebCoreWidget.h"
       
    23 #include "WebCannedImages.h"
       
    24 #include <w32std.h>
       
    25 
       
    26 namespace WebCore {
       
    27     class IntRect;
       
    28     class IntPoint;
       
    29 }
       
    30 #define KInitialOffset 5
       
    31 
       
    32 class WebView;
       
    33 class WebFrame;
       
    34 class CWindowGc;
       
    35 class WebFrame;
       
    36 class CFbsBitmap;
       
    37 
       
    38 class WebCursor : public CBase
       
    39     {
       
    40     public: // constructors and destructors
       
    41 
       
    42         static WebCursor* NewL();
       
    43         virtual ~WebCursor();
       
    44 
       
    45     public:
       
    46 
       
    47         const TPoint& position() const { return m_pos; }
       
    48         const TRect& nodeRect() const { return m_nodeRect; }
       
    49         void setPosition(const TPoint& pt) { m_pos = pt; m_sprite.SetPosition(pt);}
       
    50         void updatePositionAndElemType(const TPoint& pt);
       
    51         void setCurrentView(WebView& view);
       
    52         void offsetCursor(const TPoint& offset);
       
    53         bool isVisible() const { return m_visible; }
       
    54         void setCursorVisible(bool visible) { m_visible = visible; }
       
    55         void setCursor(CursorTypes);
       
    56         void cursorUpdate(bool visible);
       
    57         void moveCursorAdjusted(int lr,int tb,int scrllrange);
       
    58         void reset();
       
    59         void setWaitCursor( bool waiton );
       
    60         bool waitCursor() { return m_waiton; }
       
    61         void setTransparent(bool transparent);
       
    62         bool transparent() const { return m_transparent; }
       
    63         void setOpaqueUntil(int microsecs);
       
    64         void increaseTransparencyMoveCount();
       
    65         void resetTransparency();
       
    66         void scrollAndMoveCursor(int dir, int scrollRange, bool auto);
       
    67         WebFrame* getFrameUnderCursor();
       
    68         bool navigableNodeUnderCursor(WebFrame& webFrame, TPoint& aPoint, TBrCtlDefs::TBrCtlElementType& aElType, TRect& aFocusRect) const;
       
    69         
       
    70 
       
    71   private:
       
    72         void moveCursor(int lr,int tb, int scrollRange);
       
    73         WebFrame* getFrameAtPoint(const TPoint& viewPos_);
       
    74         bool determineCursorPosition(WebFrame& webFrame, TBrCtlDefs::TBrCtlElementType& aElType, TRect& aFocusRect, TRect& aSearchRect, 
       
    75             TPoint& aCursorPosition, bool aInitialize);
       
    76         void increaseSearchRect(int lr,int tb,TRect& aRect);
       
    77         bool decideCursorPosition(WebFrame& webFrame, const WebCore::IntRect& searchRect, WebCore::IntPoint& cursorPosition);
       
    78         WebFrame* calculateScrollableFrameView(TPoint& pos, TPoint& aPoint, TRect& fRect, bool autoscroll);
       
    79         void innerRect(TRect& rect);
       
    80         bool frameHasContentToScroll(WebFrame* frame, TPoint& delta);
       
    81         WebFrame*  determineScrollingFrame(int border1, int border2, int pos, 
       
    82         		                           WebFrame* fr1, WebFrame* fr2, TPoint& delta);
       
    83     private:
       
    84 
       
    85         WebCursor();
       
    86         void ConstructL();
       
    87         TRect calcSearchRect(int lr, int tb, int scrollRange);
       
    88         void constructSprite();
       
    89         
       
    90 
       
    91         TPoint                          m_pos;
       
    92         int                             m_previousLr;
       
    93         int                             m_previousTb;
       
    94         TRect                           m_nodeRect;
       
    95         TCannedImageData                m_hand;
       
    96         TCannedImageData                m_arrow;
       
    97         TCannedImageData                m_ibeam;        
       
    98         TCannedImageData                m_wait;
       
    99         TCannedImageData                m_selectMulti;
       
   100 
       
   101         //TCannedImageData                iSmartLinkPhoneImage;
       
   102         //TCannedImageData                iSmartLinkEmailImage;
       
   103 
       
   104         WebView*                        m_view;
       
   105         bool                            m_visible;
       
   106         RWsSprite                       m_sprite;
       
   107         bool                            m_waiton;
       
   108         int                             m_flipcounter;
       
   109         bool                            m_transparent;
       
   110         CFbsBitmap*                     m_transarrowmask;
       
   111         CPeriodic*                      m_transtimer;
       
   112         int                             m_transcount;
       
   113         CursorTypes                     m_type;
       
   114         int                             m_flipCounter;
       
   115         TPoint                          m_incrLimit;
       
   116     };
       
   117 
       
   118 #endif