Bug 460926 A11y hierachy is broken on Ubuntu 8.10 (GNOME 2.24), r=Evan.Yan sr=roc
[wine-gecko.git] / view / public / nsIScrollableView.h
blob64c1ed4dd273df7612bffaa7c3cb3d33533507e8
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #ifndef nsIScrollableView_h___
39 #define nsIScrollableView_h___
41 #include "nsCoord.h"
43 class nsIView;
44 class nsIScrollPositionListener;
45 struct nsSize;
47 // IID for the nsIScrollableView interface
48 #define NS_ISCROLLABLEVIEW_IID \
49 { 0x00bba69f, 0xbbef, 0x4725, \
50 { 0x8b, 0xee, 0xec, 0xfe, 0x82, 0xf7, 0xbd, 0xb0 } }
52 /**
53 * A scrolling view allows an arbitrary view that you supply to be scrolled
54 * vertically or horizontally (or both). The scrolling view creates and
55 * manages the scrollbars.
57 * You must use SetScrolledView() to specify the view that is to be scrolled,
58 * because the scrolled view is made a child of the clip view (an internal
59 * child view created by the scrolling view).
62 class nsIScrollableView {
63 public:
64 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCROLLABLEVIEW_IID)
66 /**
67 * Create the controls used to allow scrolling. Call this method
68 * before anything else is done with the scrollable view.
69 * @param aNative native widget to use as parent for control widgets
70 * @return error status
72 NS_IMETHOD CreateScrollControls(nsNativeWidget aNative = nsnull) = 0;
74 /**
75 * Get the dimensions of the container
76 * @param aWidth return value for width of container
77 * @param aHeight return value for height of container
79 NS_IMETHOD GetContainerSize(nscoord *aWidth, nscoord *aHeight) const = 0;
81 /**
82 * Set the view that we are scrolling within the scrolling view.
84 NS_IMETHOD SetScrolledView(nsIView *aScrolledView) = 0;
86 /**
87 * Get the view that we are scrolling within the scrolling view.
88 * @result child view
90 NS_IMETHOD GetScrolledView(nsIView *&aScrolledView) const = 0;
92 /**
93 * Get the position of the scrolled view.
95 NS_IMETHOD GetScrollPosition(nscoord &aX, nscoord& aY) const = 0;
97 /**
98 * Scroll the view to the given x,y, update's the scrollbar's thumb
99 * positions and the view's offset. Clamps the values to be
100 * legal. Updates the display based on aUpdateFlags.
101 * @param aX left edge to scroll to
102 * @param aY top edge to scroll to
103 * @param aUpdateFlags indicate smooth or async scrolling
104 * @return error status
106 NS_IMETHOD ScrollTo(nscoord aX, nscoord aY, PRUint32 aUpdateFlags) = 0;
109 * Set the properties describing how scrolling can be performed
110 * in this scrollable.
111 * @param aProperties new properties
112 * @return error status
114 NS_IMETHOD SetScrollProperties(PRUint32 aProperties) = 0;
117 * Get the properties describing how scrolling can be performed
118 * in this scrollable.
119 * @param aProperties out parameter for current properties
120 * @return error status
122 NS_IMETHOD GetScrollProperties(PRUint32 *aProperties) = 0;
125 * Set the height of a line used for line scrolling.
126 * @param aHeight new line height in app units. the default
127 * height is 12 points.
128 * @return error status
130 NS_IMETHOD SetLineHeight(nscoord aHeight) = 0;
133 * Get the height of a line used for line scrolling.
134 * @param aHeight out parameter for line height
135 * @return error status
137 NS_IMETHOD GetLineHeight(nscoord *aHeight) = 0;
140 * Scroll the view left or right by aNumLinesX columns. Positive values move right.
141 * Scroll the view up or down by aNumLinesY lines. Positive values move down.
142 * Prevents scrolling off the end of the view.
143 * @param aNumLinesX number of lines to scroll the view horizontally
144 * @param aNumLinesY number of lines to scroll the view vertically
145 * @param aUpdateFlags indicate smooth or async scrolling
146 * @return error status
148 NS_IMETHOD ScrollByLines(PRInt32 aNumLinesX, PRInt32 aNumLinexY,
149 PRUint32 aUpdateFlags = 0) = 0;
152 * Get the desired size of a page scroll in each dimension.
153 * ScrollByPages will scroll by independent multiples of these amounts
154 * unless it hits the edge of the view.
156 NS_IMETHOD GetPageScrollDistances(nsSize *aDistances) = 0;
159 * Scroll the view left or right by aNumPagesX pages. Positive values move right.
160 * Scroll the view up or down by aNumPagesY pages. Positive values move down.
161 * A page is considered to be the amount displayed by the clip view.
162 * Prevents scrolling off the end of the view.
163 * @param aNumPagesX number of pages to scroll the view horizontally
164 * @param aNumPagesY number of pages to scroll the view vertically
165 * @param aUpdateFlags indicate smooth or async scrolling
166 * @return error status
168 NS_IMETHOD ScrollByPages(PRInt32 aNumPagesX, PRInt32 aNumPagesY,
169 PRUint32 aUpdateFlags = 0) = 0;
172 * Scroll the view to the top or bottom of the document depending
173 * on the value of aTop.
174 * @param aForward indicates whether to scroll to top or bottom
175 * @param aUpdateFlags indicate smooth or async scrolling
176 * @return error status
178 NS_IMETHOD ScrollByWhole(PRBool aTop, PRUint32 aUpdateFlags = 0) = 0;
181 * Scroll the view left or right by aNumLinesX pixels. Positive values move
182 * right. Scroll the view up or down by aNumLinesY pixels. Positive values
183 * move down. Prevents scrolling off the end of the view.
184 * @param aNumLinesX number of lines to scroll the view horizontally
185 * @param aNumLinesY number of lines to scroll the view vertically
186 * @param aUpdateFlags indicate smooth or async scrolling
187 * @return error status
189 NS_IMETHOD ScrollByPixels(PRInt32 aNumPixelsX, PRInt32 aNumPixelsY,
190 PRUint32 aUpdateFlags = 0) = 0;
193 * Check the view can scroll from current offset.
194 * @param aHorizontal If checking to Left or to Right, true. Otherwise, false.
195 * @param aForward If checking to Right or Bottom, true. Otherwise, false.
196 * @param aResult If the view can scroll, true. Otherwise, false.
197 * @return error status
199 NS_IMETHOD CanScroll(PRBool aHorizontal, PRBool aForward, PRBool &aResult) = 0;
202 * Returns the view as an nsIView*
204 NS_IMETHOD_(nsIView*) View() = 0;
207 * Adds a scroll position listener.
209 NS_IMETHOD AddScrollPositionListener(nsIScrollPositionListener* aListener) = 0;
212 * Removes a scroll position listener.
214 NS_IMETHOD RemoveScrollPositionListener(nsIScrollPositionListener* aListener) = 0;
217 NS_DEFINE_STATIC_IID_ACCESSOR(nsIScrollableView, NS_ISCROLLABLEVIEW_IID)
219 //regardless of the transparency or opacity settings
220 //for this view, it can always be scrolled via a blit
221 #define NS_SCROLL_PROPERTY_ALWAYS_BLIT 0x0001
223 #endif