2005-01-28 23:01:46 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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/. */
|
2005-01-28 23:01:46 +03:00
|
|
|
|
2006-03-30 09:56:38 +04:00
|
|
|
/*
|
|
|
|
* a piece of state that is stored in session history when the document
|
|
|
|
* is not
|
|
|
|
*/
|
|
|
|
|
2005-01-28 23:01:46 +03:00
|
|
|
#ifndef nsPresState_h_
|
|
|
|
#define nsPresState_h_
|
|
|
|
|
2006-11-06 19:08:20 +03:00
|
|
|
#include "nsPoint.h"
|
2014-04-07 15:43:58 +04:00
|
|
|
#include "gfxPoint.h"
|
2006-11-06 19:08:20 +03:00
|
|
|
#include "nsAutoPtr.h"
|
2005-01-28 23:01:46 +03:00
|
|
|
|
|
|
|
class nsPresState
|
|
|
|
{
|
|
|
|
public:
|
2008-12-12 22:25:22 +03:00
|
|
|
nsPresState()
|
2012-07-30 18:20:58 +04:00
|
|
|
: mContentData(nullptr)
|
2010-01-12 00:45:18 +03:00
|
|
|
, mScrollState(0, 0)
|
2015-03-07 02:07:59 +03:00
|
|
|
, mResolution(1.0)
|
2015-01-03 04:06:14 +03:00
|
|
|
, mScaleToResolution(false)
|
2011-10-17 18:59:28 +04:00
|
|
|
, mDisabledSet(false)
|
|
|
|
, mDisabled(false)
|
2016-03-10 22:02:13 +03:00
|
|
|
, mDroppedDown(false)
|
2008-12-12 22:25:22 +03:00
|
|
|
{}
|
2005-01-28 23:01:46 +03:00
|
|
|
|
2010-01-12 00:45:18 +03:00
|
|
|
void SetScrollState(const nsPoint& aState)
|
|
|
|
{
|
|
|
|
mScrollState = aState;
|
|
|
|
}
|
2005-01-28 23:01:46 +03:00
|
|
|
|
2014-04-07 15:43:58 +04:00
|
|
|
nsPoint GetScrollState() const
|
2010-01-12 00:45:18 +03:00
|
|
|
{
|
|
|
|
return mScrollState;
|
|
|
|
}
|
2005-01-28 23:01:46 +03:00
|
|
|
|
2015-03-07 02:07:59 +03:00
|
|
|
void SetResolution(float aSize)
|
2014-04-07 15:43:58 +04:00
|
|
|
{
|
|
|
|
mResolution = aSize;
|
|
|
|
}
|
|
|
|
|
2015-03-07 02:07:59 +03:00
|
|
|
float GetResolution() const
|
2014-04-07 15:43:58 +04:00
|
|
|
{
|
|
|
|
return mResolution;
|
|
|
|
}
|
|
|
|
|
2015-01-03 04:06:14 +03:00
|
|
|
void SetScaleToResolution(bool aScaleToResolution)
|
|
|
|
{
|
|
|
|
mScaleToResolution = aScaleToResolution;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetScaleToResolution() const
|
|
|
|
{
|
|
|
|
return mScaleToResolution;
|
|
|
|
}
|
|
|
|
|
2010-01-12 00:45:18 +03:00
|
|
|
void ClearNonScrollState()
|
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
mContentData = nullptr;
|
2011-10-17 18:59:28 +04:00
|
|
|
mDisabledSet = false;
|
2010-01-12 00:45:18 +03:00
|
|
|
}
|
2005-01-28 23:01:46 +03:00
|
|
|
|
2014-04-07 15:43:58 +04:00
|
|
|
bool GetDisabled() const
|
2008-12-12 22:25:22 +03:00
|
|
|
{
|
|
|
|
return mDisabled;
|
|
|
|
}
|
2005-01-28 23:01:46 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetDisabled(bool aDisabled)
|
2008-12-12 22:25:22 +03:00
|
|
|
{
|
|
|
|
mDisabled = aDisabled;
|
2011-10-17 18:59:28 +04:00
|
|
|
mDisabledSet = true;
|
2008-12-12 22:25:22 +03:00
|
|
|
}
|
2005-01-28 23:01:46 +03:00
|
|
|
|
2014-04-07 15:43:58 +04:00
|
|
|
bool IsDisabledSet() const
|
2008-12-12 22:25:22 +03:00
|
|
|
{
|
|
|
|
return mDisabledSet;
|
|
|
|
}
|
2006-11-06 19:08:20 +03:00
|
|
|
|
2014-04-07 15:43:58 +04:00
|
|
|
nsISupports* GetStateProperty() const
|
2008-12-12 22:25:22 +03:00
|
|
|
{
|
|
|
|
return mContentData;
|
|
|
|
}
|
2008-12-03 20:55:14 +03:00
|
|
|
|
2008-12-12 22:25:22 +03:00
|
|
|
void SetStateProperty(nsISupports *aProperty)
|
|
|
|
{
|
|
|
|
mContentData = aProperty;
|
|
|
|
}
|
2006-11-06 19:08:20 +03:00
|
|
|
|
2016-03-10 22:02:13 +03:00
|
|
|
void SetDroppedDown(bool aDroppedDown)
|
|
|
|
{
|
|
|
|
mDroppedDown = aDroppedDown;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetDroppedDown() const
|
|
|
|
{
|
|
|
|
return mDroppedDown;
|
|
|
|
}
|
|
|
|
|
2005-01-28 23:01:46 +03:00
|
|
|
// MEMBER VARIABLES
|
|
|
|
protected:
|
2008-12-12 22:25:22 +03:00
|
|
|
nsCOMPtr<nsISupports> mContentData;
|
2010-01-12 00:45:18 +03:00
|
|
|
nsPoint mScrollState;
|
2015-03-07 02:07:59 +03:00
|
|
|
float mResolution;
|
2015-01-03 04:06:14 +03:00
|
|
|
bool mScaleToResolution;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mDisabledSet;
|
|
|
|
bool mDisabled;
|
2016-03-10 22:02:13 +03:00
|
|
|
bool mDroppedDown;
|
2005-01-28 23:01:46 +03:00
|
|
|
};
|
|
|
|
|
2006-11-06 19:08:20 +03:00
|
|
|
#endif /* nsPresState_h_ */
|