Line data Source code
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 0 : class nsPresState
19 : {
20 : public:
21 0 : nsPresState()
22 0 : : mContentData(nullptr)
23 : , mScrollState(0, 0)
24 : , mAllowScrollOriginDowngrade(true)
25 : , mResolution(1.0)
26 : , mScaleToResolution(false)
27 : , mDisabledSet(false)
28 : , mDisabled(false)
29 0 : , mDroppedDown(false)
30 0 : {}
31 :
32 0 : void SetScrollState(const nsPoint& aState)
33 : {
34 0 : mScrollState = aState;
35 0 : }
36 :
37 0 : nsPoint GetScrollPosition() const
38 : {
39 0 : return mScrollState;
40 : }
41 :
42 0 : void SetAllowScrollOriginDowngrade(bool aAllowScrollOriginDowngrade)
43 : {
44 0 : mAllowScrollOriginDowngrade = aAllowScrollOriginDowngrade;
45 0 : }
46 :
47 0 : bool GetAllowScrollOriginDowngrade()
48 : {
49 0 : return mAllowScrollOriginDowngrade;
50 : }
51 :
52 0 : void SetResolution(float aSize)
53 : {
54 0 : mResolution = aSize;
55 0 : }
56 :
57 0 : float GetResolution() const
58 : {
59 0 : return mResolution;
60 : }
61 :
62 0 : void SetScaleToResolution(bool aScaleToResolution)
63 : {
64 0 : mScaleToResolution = aScaleToResolution;
65 0 : }
66 :
67 0 : bool GetScaleToResolution() const
68 : {
69 0 : return mScaleToResolution;
70 : }
71 :
72 0 : void ClearNonScrollState()
73 : {
74 0 : mContentData = nullptr;
75 0 : mDisabledSet = false;
76 0 : }
77 :
78 0 : bool GetDisabled() const
79 : {
80 0 : return mDisabled;
81 : }
82 :
83 0 : void SetDisabled(bool aDisabled)
84 : {
85 0 : mDisabled = aDisabled;
86 0 : mDisabledSet = true;
87 0 : }
88 :
89 0 : bool IsDisabledSet() const
90 : {
91 0 : return mDisabledSet;
92 : }
93 :
94 0 : nsISupports* GetStateProperty() const
95 : {
96 0 : return mContentData;
97 : }
98 :
99 0 : void SetStateProperty(nsISupports *aProperty)
100 : {
101 0 : mContentData = aProperty;
102 0 : }
103 :
104 0 : void SetDroppedDown(bool aDroppedDown)
105 : {
106 0 : mDroppedDown = aDroppedDown;
107 0 : }
108 :
109 0 : bool GetDroppedDown() const
110 : {
111 0 : return mDroppedDown;
112 : }
113 :
114 : // MEMBER VARIABLES
115 : protected:
116 : nsCOMPtr<nsISupports> mContentData;
117 : nsPoint mScrollState;
118 : bool mAllowScrollOriginDowngrade;
119 : float mResolution;
120 : bool mScaleToResolution;
121 : bool mDisabledSet;
122 : bool mDisabled;
123 : bool mDroppedDown;
124 : };
125 :
126 : #endif /* nsPresState_h_ */
|