layout/base/nsPresState.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:5147d5773a00
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 /*
7 * a piece of state that is stored in session history when the document
8 * is not
9 */
10
11 #ifndef nsPresState_h_
12 #define nsPresState_h_
13
14 #include "nsPoint.h"
15 #include "gfxPoint.h"
16 #include "nsAutoPtr.h"
17
18 class nsPresState
19 {
20 public:
21 nsPresState()
22 : mContentData(nullptr)
23 , mScrollState(0, 0)
24 , mResolution(1.0, 1.0)
25 , mDisabledSet(false)
26 , mDisabled(false)
27 {}
28
29 void SetScrollState(const nsPoint& aState)
30 {
31 mScrollState = aState;
32 }
33
34 nsPoint GetScrollState() const
35 {
36 return mScrollState;
37 }
38
39 void SetResolution(const gfxSize& aSize)
40 {
41 mResolution = aSize;
42 }
43
44 gfxSize GetResolution() const
45 {
46 return mResolution;
47 }
48
49 void ClearNonScrollState()
50 {
51 mContentData = nullptr;
52 mDisabledSet = false;
53 }
54
55 bool GetDisabled() const
56 {
57 return mDisabled;
58 }
59
60 void SetDisabled(bool aDisabled)
61 {
62 mDisabled = aDisabled;
63 mDisabledSet = true;
64 }
65
66 bool IsDisabledSet() const
67 {
68 return mDisabledSet;
69 }
70
71 nsISupports* GetStateProperty() const
72 {
73 return mContentData;
74 }
75
76 void SetStateProperty(nsISupports *aProperty)
77 {
78 mContentData = aProperty;
79 }
80
81 // MEMBER VARIABLES
82 protected:
83 nsCOMPtr<nsISupports> mContentData;
84 nsPoint mScrollState;
85 gfxSize mResolution;
86 bool mDisabledSet;
87 bool mDisabled;
88 };
89
90 #endif /* nsPresState_h_ */

mercurial