1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
5
* The contents of this file are subject to the Netscape Public License
6
* Version 1.1 (the "License"); you may not use this file except in
7
* compliance with the License. You may obtain a copy of the License at
8
* http://www.mozilla.org/NPL/
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
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.
24
* Alternatively, the contents of this file may be used under the terms of
25
* either the GNU General Public License Version 2 or later (the "GPL"), or
26
* 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 NPL, 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 NPL, the GPL or the LGPL.
36
* ***** END LICENSE BLOCK ***** */
38
#ifndef nsScrollPortView_h___
39
#define nsScrollPortView_h___
42
#include "nsIScrollableView.h"
46
class nsISupportsArray;
49
//this is a class that acts as a container for other views and provides
50
//automatic management of scrolling of the views it contains.
52
class nsScrollPortView : public nsView, public nsIScrollableView
57
NS_IMETHOD QueryInterface(REFNSIID aIID,
60
NS_IMETHOD SetWidget(nsIWidget *aWidget);
62
//nsIScrollableView interface
63
NS_IMETHOD CreateScrollControls(nsNativeWidget aNative = nsnull);
64
NS_IMETHOD ComputeScrollOffsets(PRBool aAdjustWidgets = PR_TRUE);
65
NS_IMETHOD GetContainerSize(nscoord *aWidth, nscoord *aHeight) const;
66
NS_IMETHOD SetScrolledView(nsIView *aScrolledView);
67
NS_IMETHOD GetScrolledView(nsIView *&aScrolledView) const;
69
NS_IMETHOD SetScrollPreference(nsScrollPreference aPref);
70
NS_IMETHOD GetScrollPreference(nsScrollPreference &aScrollPreference) const;
71
NS_IMETHOD GetScrollPosition(nscoord &aX, nscoord &aY) const;
72
NS_IMETHOD ScrollTo(nscoord aX, nscoord aY, PRUint32 aUpdateFlags);
73
NS_IMETHOD SetControlInsets(const nsMargin &aInsets);
74
NS_IMETHOD GetControlInsets(nsMargin &aInsets) const;
75
NS_IMETHOD GetScrollbarVisibility(PRBool *aVerticalVisible,
76
PRBool *aHorizontalVisible) const;
77
NS_IMETHOD SetScrollProperties(PRUint32 aProperties);
78
NS_IMETHOD GetScrollProperties(PRUint32 *aProperties);
79
NS_IMETHOD SetLineHeight(nscoord aHeight);
80
NS_IMETHOD GetLineHeight(nscoord *aHeight);
81
NS_IMETHOD ScrollByLines(PRInt32 aNumLinesX, PRInt32 aNumLinesY);
82
NS_IMETHOD ScrollByPages(PRInt32 aNumPagesX, PRInt32 aNumPagesY);
83
NS_IMETHOD ScrollByWhole(PRBool aTop);
85
NS_IMETHOD GetClipView(const nsIView** aClipView) const;
87
NS_IMETHOD AddScrollPositionListener(nsIScrollPositionListener* aListener);
88
NS_IMETHOD RemoveScrollPositionListener(nsIScrollPositionListener* aListener);
90
// local to the view module
92
NS_IMETHOD Paint(nsIRenderingContext& rc, const nsRect& rect,
93
PRUint32 aPaintFlags, PRBool &Result);
94
NS_IMETHOD Paint(nsIRenderingContext& aRC, const nsIRegion& aRegion,
95
PRUint32 aPaintFlags, PRBool &Result);
96
nsView* GetScrolledView() const { return GetFirstChild(); }
99
NS_IMETHOD_(nsrefcnt) AddRef(void);
100
NS_IMETHOD_(nsrefcnt) Release(void);
101
NS_IMETHOD ScrollToImpl(nscoord aX, nscoord aY, PRUint32 aUpdateFlags);
104
SmoothScroll* mSmoothScroll;
107
void IncrementalScroll();
108
PRBool IsSmoothScrollingEnabled();
109
static void SmoothScrollAnimationCallback(nsITimer *aTimer, void* aESM);
112
virtual ~nsScrollPortView();
115
void Scroll(nsView *aScrolledView, PRInt32 aDx, PRInt32 aDy, float scale, PRUint32 aUpdateFlags);
116
PRBool CannotBitBlt(nsView* aScrolledView);
118
nscoord mOffsetX, mOffsetY;
119
nscoord mOffsetXpx, mOffsetYpx;
120
PRUint32 mScrollProperties;
122
nsISupportsArray *mListeners;