49
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2004 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: Definition of the Browser On-screen scrollbar frame
|
|
15 |
* and browser scrollbar corner window
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
#ifndef SCROLLBARFRAME_H
|
|
20 |
#define SCROLLBARFRAME_H
|
|
21 |
|
|
22 |
//----------------------------------------------------------------------
|
|
23 |
// INCLUDES
|
|
24 |
//----------------------------------------------------------------------
|
|
25 |
#include "ScrollBar.h"
|
|
26 |
#include <e32std.h>
|
|
27 |
#include <coecntrl.h>
|
|
28 |
|
|
29 |
// Browser as a Plugin includes
|
|
30 |
#include <brctlinterface.h>
|
|
31 |
|
|
32 |
//----------------------------------------------------------------------
|
|
33 |
// CONSTANTS
|
|
34 |
//----------------------------------------------------------------------
|
|
35 |
const TInt KBrowserVScrollBarWidth = 6; // V Scrollbar Width
|
|
36 |
const TInt KBrowserHScrollBarHeight = 6; // H Scrollbar Height
|
|
37 |
|
|
38 |
const TInt KBrowserVScrollBarMaxLen = 204; // The maximum height of the vertical scrollbar
|
|
39 |
|
|
40 |
const TInt KBrowserMaxDisplayWidth = 176; // Display Width
|
|
41 |
const TInt KConvertToNegativeValue = -1; // used to convert numbers to negative
|
|
42 |
|
|
43 |
//----------------------------------------------------------------------
|
|
44 |
// FORWARD DECLARATIONS
|
|
45 |
//----------------------------------------------------------------------
|
|
46 |
class CScrollBar;
|
|
47 |
|
|
48 |
//----------------------------------------------------------------------
|
|
49 |
// CLASS DEFINITION - only used in CScrollBarFrame
|
|
50 |
//----------------------------------------------------------------------
|
|
51 |
/**
|
|
52 |
* Browser scrollbar corner window
|
|
53 |
*
|
|
54 |
* @since Series60_version 2.5
|
|
55 |
*/
|
|
56 |
class CScrollBarCornerWindow : public CCoeControl
|
|
57 |
{
|
|
58 |
//------------------------------------------------------------------
|
|
59 |
// Constructors and Destructors
|
|
60 |
//------------------------------------------------------------------
|
|
61 |
public:
|
|
62 |
static CScrollBarCornerWindow* NewL(const CCoeControl& aParent);
|
|
63 |
virtual ~CScrollBarCornerWindow();
|
|
64 |
|
|
65 |
// Inherited Functions
|
|
66 |
void Draw(const TRect& aRect) const;
|
|
67 |
private:
|
|
68 |
void ConstructL(const CCoeControl& aParent);
|
|
69 |
|
|
70 |
};
|
|
71 |
|
|
72 |
|
|
73 |
//----------------------------------------------------------------------
|
|
74 |
// CLASS DEFINITION
|
|
75 |
//----------------------------------------------------------------------
|
|
76 |
/**
|
|
77 |
* Browser scrollbar frame
|
|
78 |
* @since Series60_version 2.5
|
|
79 |
*/
|
|
80 |
class CScrollBarFrame : public CBase
|
|
81 |
{
|
|
82 |
//------------------------------------------------------------------
|
|
83 |
// Constructors and Destructors - Public
|
|
84 |
//------------------------------------------------------------------
|
|
85 |
public:
|
|
86 |
|
|
87 |
/**
|
|
88 |
* Two-phased constructor.
|
|
89 |
*/
|
|
90 |
static CScrollBarFrame* NewL(const CCoeControl& aParent);
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Destructor.
|
|
94 |
*/
|
|
95 |
virtual ~CScrollBarFrame();
|
|
96 |
|
|
97 |
//------------------------------------------------------------------
|
|
98 |
// Member Functions - Get/Set Funtions - Public
|
|
99 |
//------------------------------------------------------------------
|
|
100 |
public:
|
|
101 |
|
|
102 |
/**
|
|
103 |
* Sets the layout indicator
|
|
104 |
* @since Series60_version 2.5
|
|
105 |
* @param aLayout - webpage layout
|
|
106 |
* @return none
|
|
107 |
*/
|
|
108 |
inline void SetLayout(const TBrCtlLayout aLayout) { iLayout = aLayout; }
|
|
109 |
/**
|
|
110 |
* Returns the layout indicator value
|
|
111 |
* @since Series60_version 2.5
|
|
112 |
* @return MBrCtlLayoutObserver::TBrCtlLayout - layout of the webpage
|
|
113 |
*/
|
|
114 |
inline const TBrCtlLayout Layout() { return iLayout; }
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Returns the vertical scrollbar
|
|
118 |
* @since Series60_version 2.8
|
|
119 |
* @return MBrCtlLayoutObserver::TBrCtlLayout - layout of the webpage
|
|
120 |
*/
|
|
121 |
inline const CScrollBar* VScrollBar() {return iVScrollBar;}
|
|
122 |
|
|
123 |
/**
|
|
124 |
* Returns the horizontal scrollbar
|
|
125 |
* @since Series60_version 2.8
|
|
126 |
* @return MBrCtlLayoutObserver::TBrCtlLayout - layout of the webpage
|
|
127 |
*/
|
|
128 |
inline const CScrollBar* HScrollBar() {return iHScrollBar;}
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Sets the display height
|
|
132 |
* @since Series60_version 2.5
|
|
133 |
* @param aHeight - display height
|
|
134 |
* @return none
|
|
135 |
*/
|
|
136 |
void SetDisplayHeight(const TInt aHeight);
|
|
137 |
|
|
138 |
/**
|
|
139 |
* Sets the display width
|
|
140 |
* @since Series60_version 2.5
|
|
141 |
* @param aWidth - display width
|
|
142 |
* @return none
|
|
143 |
*/
|
|
144 |
void SetDisplayWidth(const TInt aWidth);
|
|
145 |
|
|
146 |
/**
|
|
147 |
* Gets the display rect
|
|
148 |
* @since Series60_version 2.5
|
|
149 |
* @return TRect& - the display rectangle
|
|
150 |
*/
|
|
151 |
const TRect& Display() const { return iDisplay; }
|
|
152 |
|
|
153 |
//------------------------------------------------------------------
|
|
154 |
// Member Functions - Public
|
|
155 |
//------------------------------------------------------------------
|
|
156 |
public:
|
|
157 |
|
|
158 |
/**
|
|
159 |
* Updates the vertical scrollbar
|
|
160 |
* @since Series60_version 2.5
|
|
161 |
* @return none
|
|
162 |
*/
|
|
163 |
void UpdateVScrollBarL();
|
|
164 |
|
|
165 |
/**
|
|
166 |
* Updates the Horizontal scrollbar
|
|
167 |
* @since Series60_version 2.5
|
|
168 |
* @return none
|
|
169 |
*/
|
|
170 |
void UpdateHScrollBarL();
|
|
171 |
|
|
172 |
/**
|
|
173 |
* Sets indicator relating to the webpage layout
|
|
174 |
* @since Series60_version 2.5
|
|
175 |
* @param aLayout - the layout of the webpage
|
|
176 |
* @return none
|
|
177 |
*/
|
|
178 |
void NotifyLayoutChange(TBrCtlLayout aLayout);
|
|
179 |
|
|
180 |
/**
|
|
181 |
* Determines whether a vertical scroll bar will be required
|
|
182 |
* and the space required for the scrollbar
|
|
183 |
* @since Series60_version 2.5
|
|
184 |
* @param aDocument - height of the webpage
|
|
185 |
* @param aDisplay - height of the display
|
|
186 |
* @param aDisplayPos - vertical position of display in webpage
|
|
187 |
* @return none
|
|
188 |
*/
|
|
189 |
TInt VScrollBarNeeded(TInt aDocument, TInt aDisplay, TInt aDisplayPos);
|
|
190 |
|
|
191 |
/**
|
|
192 |
* Determines whether a horizontal scroll bar will be required
|
|
193 |
* and the space required for the scrollbar
|
|
194 |
* @since Series60_version 2.5
|
|
195 |
* @param aDocument - width of the webpage
|
|
196 |
* @param aDisplay - width of the display
|
|
197 |
* @param aDisplayPos - horizontal position of display in webpage
|
|
198 |
* @param aDisplayHeight - vertical position of display in webpage
|
|
199 |
* @return none
|
|
200 |
*/
|
|
201 |
TInt HScrollBarNeeded(TInt aDocument, TInt aDisplay, TInt aDisplayPos,
|
|
202 |
TInt aDisplayHeight);
|
|
203 |
|
|
204 |
inline TInt VScrollBarWidth() { return KBrowserVScrollBarWidth; }
|
|
205 |
|
|
206 |
//------------------------------------------------------------------
|
|
207 |
// Constructors and Destructors - Private
|
|
208 |
//------------------------------------------------------------------
|
|
209 |
private:
|
|
210 |
|
|
211 |
/**
|
|
212 |
* C++ default constructor.
|
|
213 |
*/
|
|
214 |
CScrollBarFrame();
|
|
215 |
|
|
216 |
/**
|
|
217 |
* Symbian 2nd phase constructor
|
|
218 |
*/
|
|
219 |
void ConstructL( const CCoeControl& aParent );
|
|
220 |
|
|
221 |
//------------------------------------------------------------------
|
|
222 |
// Member Functions - Private
|
|
223 |
//------------------------------------------------------------------
|
|
224 |
private:
|
|
225 |
|
|
226 |
/**
|
|
227 |
* Calculates dimensions of the scroll bar and forwards to scrollbar
|
|
228 |
* @since Series60_version 2.5
|
|
229 |
* @param aOrientation - scrollbar orientation
|
|
230 |
* @return none
|
|
231 |
*/
|
|
232 |
void SetScrollBar(const CScrollBar::TOrientation aOrientation);
|
|
233 |
|
|
234 |
/**
|
|
235 |
* Calculates dimensions of the thumb and forwards to scrollbar thumb
|
|
236 |
* @since Series60_version 2.5
|
|
237 |
* @param aOrientation - scrollbar orientation
|
|
238 |
* @return none
|
|
239 |
*/
|
|
240 |
void SetThumb(CScrollBar::TOrientation aOrientation);
|
|
241 |
|
|
242 |
//------------------------------------------------------------------
|
|
243 |
// Member Data - Public
|
|
244 |
//------------------------------------------------------------------
|
|
245 |
public:
|
|
246 |
|
|
247 |
// Scrollbars
|
|
248 |
CScrollBar* iVScrollBar; // owned
|
|
249 |
CScrollBar* iHScrollBar; // owned
|
|
250 |
|
|
251 |
// Corner Window - only used with a scrollbar pair
|
|
252 |
CScrollBarCornerWindow* iCornerWindow; // owned
|
|
253 |
|
|
254 |
//------------------------------------------------------------------
|
|
255 |
// Member Data - Private
|
|
256 |
//------------------------------------------------------------------
|
|
257 |
private:
|
|
258 |
|
|
259 |
TRect iDocument; // web page
|
|
260 |
TRect iDisplay; // display
|
|
261 |
TPoint iDisplayPos; // position of display within web page
|
|
262 |
|
|
263 |
TRect iScrollBarRect; // TRect outside iDisplay where scrollbars are drawn
|
|
264 |
TBrCtlLayout iLayout; // is scrolling left to right OR right to left
|
|
265 |
};
|
|
266 |
|
|
267 |
#endif // SCROLLBARFRAME_H
|