~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/view/src/nsScrollPortView.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
4
 *
 
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/
 
9
 *
 
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.
 
14
 *
 
15
 * The Original Code is mozilla.org code.
 
16
 *
 
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.
 
21
 *
 
22
 * Contributor(s):
 
23
 *
 
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.
 
35
 *
 
36
 * ***** END LICENSE BLOCK ***** */
 
37
 
 
38
#ifndef nsScrollPortView_h___
 
39
#define nsScrollPortView_h___
 
40
 
 
41
#include "nsView.h"
 
42
#include "nsIScrollableView.h"
 
43
#include "nsCOMPtr.h"
 
44
#include "nsITimer.h"
 
45
 
 
46
class nsISupportsArray;
 
47
class SmoothScroll;
 
48
 
 
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.
 
51
 
 
52
class nsScrollPortView : public nsView, public nsIScrollableView
 
53
{
 
54
public:
 
55
  nsScrollPortView();
 
56
 
 
57
  NS_IMETHOD QueryInterface(REFNSIID aIID,
 
58
                            void** aInstancePtr);
 
59
 
 
60
  NS_IMETHOD  SetWidget(nsIWidget *aWidget);
 
61
 
 
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;
 
68
 
 
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);
 
84
  
 
85
  NS_IMETHOD  GetClipView(const nsIView** aClipView) const;
 
86
 
 
87
  NS_IMETHOD  AddScrollPositionListener(nsIScrollPositionListener* aListener);
 
88
  NS_IMETHOD  RemoveScrollPositionListener(nsIScrollPositionListener* aListener);
 
89
 
 
90
  // local to the view module
 
91
 
 
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(); }
 
97
 
 
98
private:
 
99
  NS_IMETHOD_(nsrefcnt) AddRef(void);
 
100
  NS_IMETHOD_(nsrefcnt) Release(void);
 
101
  NS_IMETHOD  ScrollToImpl(nscoord aX, nscoord aY, PRUint32 aUpdateFlags);
 
102
 
 
103
  // data members
 
104
  SmoothScroll* mSmoothScroll;
 
105
 
 
106
  // methods
 
107
  void        IncrementalScroll();
 
108
  PRBool      IsSmoothScrollingEnabled();
 
109
  static void SmoothScrollAnimationCallback(nsITimer *aTimer, void* aESM);
 
110
 
 
111
protected:
 
112
  virtual ~nsScrollPortView();
 
113
 
 
114
  //private
 
115
  void Scroll(nsView *aScrolledView, PRInt32 aDx, PRInt32 aDy, float scale, PRUint32 aUpdateFlags);
 
116
  PRBool CannotBitBlt(nsView* aScrolledView);
 
117
 
 
118
  nscoord             mOffsetX, mOffsetY;
 
119
  nscoord             mOffsetXpx, mOffsetYpx;
 
120
  PRUint32            mScrollProperties;
 
121
  nscoord             mLineHeight;
 
122
  nsISupportsArray   *mListeners;
 
123
};
 
124
 
 
125
#endif