michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef NS_SMILINTERVAL_H_ michael@0: #define NS_SMILINTERVAL_H_ michael@0: michael@0: #include "nsSMILInstanceTime.h" michael@0: #include "nsTArray.h" michael@0: michael@0: //---------------------------------------------------------------------- michael@0: // nsSMILInterval class michael@0: // michael@0: // A structure consisting of a begin and end time. The begin time must be michael@0: // resolved (i.e. not indefinite or unresolved). michael@0: // michael@0: // For an overview of how this class is related to other SMIL time classes see michael@0: // the documentation in nsSMILTimeValue.h michael@0: michael@0: class nsSMILInterval michael@0: { michael@0: public: michael@0: nsSMILInterval(); michael@0: nsSMILInterval(const nsSMILInterval& aOther); michael@0: ~nsSMILInterval(); michael@0: void Unlink(bool aFiltered = false); michael@0: michael@0: const nsSMILInstanceTime* Begin() const michael@0: { michael@0: NS_ABORT_IF_FALSE(mBegin && mEnd, michael@0: "Requesting Begin() on un-initialized instance time"); michael@0: return mBegin; michael@0: } michael@0: nsSMILInstanceTime* Begin(); michael@0: michael@0: const nsSMILInstanceTime* End() const michael@0: { michael@0: NS_ABORT_IF_FALSE(mBegin && mEnd, michael@0: "Requesting End() on un-initialized instance time"); michael@0: return mEnd; michael@0: } michael@0: nsSMILInstanceTime* End(); michael@0: michael@0: void SetBegin(nsSMILInstanceTime& aBegin); michael@0: void SetEnd(nsSMILInstanceTime& aEnd); michael@0: void Set(nsSMILInstanceTime& aBegin, nsSMILInstanceTime& aEnd) michael@0: { michael@0: SetBegin(aBegin); michael@0: SetEnd(aEnd); michael@0: } michael@0: michael@0: void FixBegin(); michael@0: void FixEnd(); michael@0: michael@0: typedef nsTArray > InstanceTimeList; michael@0: michael@0: void AddDependentTime(nsSMILInstanceTime& aTime); michael@0: void RemoveDependentTime(const nsSMILInstanceTime& aTime); michael@0: void GetDependentTimes(InstanceTimeList& aTimes); michael@0: michael@0: // Cue for assessing if this interval can be filtered michael@0: bool IsDependencyChainLink() const; michael@0: michael@0: private: michael@0: nsRefPtr mBegin; michael@0: nsRefPtr mEnd; michael@0: michael@0: // nsSMILInstanceTimes to notify when this interval is changed or deleted. michael@0: InstanceTimeList mDependentTimes; michael@0: michael@0: // Indicates if the end points of the interval are fixed or not. michael@0: // michael@0: // Note that this is not the same as having an end point whose TIME is fixed michael@0: // (i.e. nsSMILInstanceTime::IsFixed() returns true). This is because it is michael@0: // possible to have an end point with a fixed TIME and yet still update the michael@0: // end point to refer to a different nsSMILInstanceTime object. michael@0: // michael@0: // However, if mBegin/EndFixed is true, then BOTH the nsSMILInstanceTime michael@0: // OBJECT returned for that end point and its TIME value will not change. michael@0: bool mBeginFixed; michael@0: bool mEndFixed; michael@0: }; michael@0: michael@0: #endif // NS_SMILINTERVAL_H_