2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* a piece of state that is stored in session history when the document
|
|
|
|
* is not
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsPresState_h_
|
|
|
|
#define nsPresState_h_
|
|
|
|
|
|
|
|
#include "nsPoint.h"
|
2014-04-07 04:43:58 -07:00
|
|
|
#include "gfxPoint.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
|
|
|
|
class nsPresState
|
|
|
|
{
|
|
|
|
public:
|
2008-12-12 11:25:22 -08:00
|
|
|
nsPresState()
|
2012-07-30 07:20:58 -07:00
|
|
|
: mContentData(nullptr)
|
2010-01-11 13:45:18 -08:00
|
|
|
, mScrollState(0, 0)
|
2015-03-06 15:07:59 -08:00
|
|
|
, mResolution(1.0)
|
2015-01-02 17:06:14 -08:00
|
|
|
, mScaleToResolution(false)
|
2011-10-17 07:59:28 -07:00
|
|
|
, mDisabledSet(false)
|
|
|
|
, mDisabled(false)
|
2008-12-12 11:25:22 -08:00
|
|
|
{}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-01-11 13:45:18 -08:00
|
|
|
void SetScrollState(const nsPoint& aState)
|
|
|
|
{
|
|
|
|
mScrollState = aState;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-04-07 04:43:58 -07:00
|
|
|
nsPoint GetScrollState() const
|
2010-01-11 13:45:18 -08:00
|
|
|
{
|
|
|
|
return mScrollState;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-06 15:07:59 -08:00
|
|
|
void SetResolution(float aSize)
|
2014-04-07 04:43:58 -07:00
|
|
|
{
|
|
|
|
mResolution = aSize;
|
|
|
|
}
|
|
|
|
|
2015-03-06 15:07:59 -08:00
|
|
|
float GetResolution() const
|
2014-04-07 04:43:58 -07:00
|
|
|
{
|
|
|
|
return mResolution;
|
|
|
|
}
|
|
|
|
|
2015-01-02 17:06:14 -08:00
|
|
|
void SetScaleToResolution(bool aScaleToResolution)
|
|
|
|
{
|
|
|
|
mScaleToResolution = aScaleToResolution;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetScaleToResolution() const
|
|
|
|
{
|
|
|
|
return mScaleToResolution;
|
|
|
|
}
|
|
|
|
|
2010-01-11 13:45:18 -08:00
|
|
|
void ClearNonScrollState()
|
|
|
|
{
|
2012-07-30 07:20:58 -07:00
|
|
|
mContentData = nullptr;
|
2011-10-17 07:59:28 -07:00
|
|
|
mDisabledSet = false;
|
2010-01-11 13:45:18 -08:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-04-07 04:43:58 -07:00
|
|
|
bool GetDisabled() const
|
2008-12-12 11:25:22 -08:00
|
|
|
{
|
|
|
|
return mDisabled;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetDisabled(bool aDisabled)
|
2008-12-12 11:25:22 -08:00
|
|
|
{
|
|
|
|
mDisabled = aDisabled;
|
2011-10-17 07:59:28 -07:00
|
|
|
mDisabledSet = true;
|
2008-12-12 11:25:22 -08:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-04-07 04:43:58 -07:00
|
|
|
bool IsDisabledSet() const
|
2008-12-12 11:25:22 -08:00
|
|
|
{
|
|
|
|
return mDisabledSet;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-04-07 04:43:58 -07:00
|
|
|
nsISupports* GetStateProperty() const
|
2008-12-12 11:25:22 -08:00
|
|
|
{
|
|
|
|
return mContentData;
|
|
|
|
}
|
2008-12-03 09:55:14 -08:00
|
|
|
|
2008-12-12 11:25:22 -08:00
|
|
|
void SetStateProperty(nsISupports *aProperty)
|
|
|
|
{
|
|
|
|
mContentData = aProperty;
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// MEMBER VARIABLES
|
|
|
|
protected:
|
2008-12-12 11:25:22 -08:00
|
|
|
nsCOMPtr<nsISupports> mContentData;
|
2010-01-11 13:45:18 -08:00
|
|
|
nsPoint mScrollState;
|
2015-03-06 15:07:59 -08:00
|
|
|
float mResolution;
|
2015-01-02 17:06:14 -08:00
|
|
|
bool mScaleToResolution;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mDisabledSet;
|
|
|
|
bool mDisabled;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsPresState_h_ */
|