|
1 /* |
|
2 * Copyright (c) 2007 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __WEBFRAMEVIEW_H__ |
|
19 #define __WEBFRAMEVIEW_H__ |
|
20 |
|
21 #include "Shared.h" |
|
22 #include "WebCoreWidget.h" |
|
23 #include "ScrollTypes.h" |
|
24 #include "ScrollBar.h" |
|
25 #include <wtf/RefPtr.h> |
|
26 |
|
27 namespace WebCore { |
|
28 class String; |
|
29 class PlatformScrollbar; |
|
30 class IntRect; |
|
31 } |
|
32 |
|
33 class WebFrame; |
|
34 class WebView; |
|
35 class TRect; |
|
36 |
|
37 class WebFrameView : public MScrollView, public WebCore::Shared<WebFrameView>, public WebCore::ScrollbarClient |
|
38 { |
|
39 public: |
|
40 |
|
41 // from MScrollView |
|
42 void draw(WebCoreGraphicsContext&, const TRect&); |
|
43 void invalidateRect(const TRect&, TBool); |
|
44 void scrollTo(const TPoint&); |
|
45 TRect visibleRect() const; |
|
46 TSize contentSize() const; |
|
47 void resizeContent(const TSize& /*aSize*/); |
|
48 void setMayUseCopyScroll(TBool /*aCopy*/); |
|
49 TPoint convertContentToView(const TPoint& /*aPoint*/); |
|
50 TPoint convertViewToContent(const TPoint& /*aPoint*/); |
|
51 TBool hasHorizontalScrollbar() const; |
|
52 TBool hasVerticalScrollbar() const; |
|
53 void setHorizontalScrollingMode(WebCore::ScrollbarMode /*aScrollMode*/); |
|
54 void setVerticalScrollingMode(WebCore::ScrollbarMode /*aScrollMode*/); |
|
55 void setScrollingMode(WebCore::ScrollbarMode /*aScrollMode*/); |
|
56 WebCore::ScrollbarMode horizontalScrollingMode(); |
|
57 WebCore::ScrollbarMode verticalScrollingMode(); |
|
58 WebCore::PlatformScrollbar* vScrollbar() {return m_vScrollbar;} |
|
59 WebCore::PlatformScrollbar* hScrollbar() {return m_hScrollbar;} |
|
60 void setScrollbarsSuppressed(TBool /*aSuppressed*/, TBool /*aRepaintOnUnsuppress*/); |
|
61 void addChild(MWebCoreWidget* /*aChild*/ ); |
|
62 TInt scalingFactor() const; |
|
63 TBool isVisible() const; |
|
64 TRect rect() const; |
|
65 TBool isFocused() const; |
|
66 void makeVisible(TBool /*aVisible*/); |
|
67 void setFocus(TBool aFocus); |
|
68 void activate(); |
|
69 void setParent(MScrollView* aParent); |
|
70 void setNeedsDisplay(TBool); |
|
71 void setCursor(CursorTypes); |
|
72 void setRect(const TRect& aRect); |
|
73 void ref() { ++m_refCount; } |
|
74 void deref() { if( --m_refCount == 0 ) delete this; } |
|
75 |
|
76 // accessors |
|
77 WebFrame* frame() const { return m_frame.get(); } |
|
78 WebView* topView() const { return m_topView.get(); } |
|
79 void setWebFrame(WebFrame*); |
|
80 void setTopView(WebView*); |
|
81 TPoint contentPos() { return m_contentPos; } |
|
82 WebFrameView* initWithFrame(TRect frame); |
|
83 void setAllowsScrolling(bool allowsScrolling); |
|
84 void setMarginWidth(int marginWidth); |
|
85 void setMarginHeight(int marginHeight); |
|
86 int marginWidth() const; |
|
87 int marginHeight() const; |
|
88 void setContentPos(TPoint pt); |
|
89 |
|
90 WebFrameView(); |
|
91 virtual ~WebFrameView(); |
|
92 static WebFrameView* viewClassForMIMEType(const WebCore::String& MIMEType); |
|
93 |
|
94 void valueChanged(WebCore::Scrollbar*); |
|
95 WebCore::IntRect windowClipRect() const; |
|
96 |
|
97 TPoint nearestPointInFrame(const TPoint &aPoint); |
|
98 TPoint frameCoordsInViewCoords(const TPoint& aPoint); |
|
99 TPoint viewCoordsInFrameCoords(const TPoint& aPoint); |
|
100 TRect rectInGlobalCoords() const; |
|
101 |
|
102 void checkScrollbarVisibility(); |
|
103 int getBidiWidth(); |
|
104 bool needScroll(const TPoint& aPoint); |
|
105 private: |
|
106 WebFrameView(const WebFrameView&); // not implemented |
|
107 WebFrameView& operator=(const WebFrameView&); // not implemented |
|
108 |
|
109 RefPtr<WebFrame> m_frame; // the frame associated with this view |
|
110 RefPtr<WebView> m_topView; // the top drawable view |
|
111 WebFrameView* m_parent; // the parent view |
|
112 |
|
113 TRect m_frameRect; // the location and size of this frame in its parent frame |
|
114 TPoint m_contentPos; |
|
115 TSize m_contentSize; |
|
116 |
|
117 WebCore::PlatformScrollbar* m_vScrollbar; // scrollbars |
|
118 WebCore::PlatformScrollbar* m_hScrollbar; |
|
119 WebCore::ScrollbarMode m_verticalScrollBarMode; |
|
120 WebCore::ScrollbarMode m_horizontalScrollBarMode; |
|
121 |
|
122 bool m_hasBorder; |
|
123 bool m_allowsScrolling; |
|
124 bool m_mayUseCopyScroll; |
|
125 |
|
126 bool m_resizeByEngine; |
|
127 int m_refCount; |
|
128 }; |
|
129 |
|
130 #endif // END OF FILE |