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 nsAppShellWindowEnumerator_h michael@0: #define nsAppShellWindowEnumerator_h michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsString.h" michael@0: michael@0: #include "nsISimpleEnumerator.h" michael@0: #include "nsIXULWindow.h" michael@0: michael@0: class nsWindowMediator; michael@0: michael@0: // michael@0: // nsWindowInfo michael@0: // michael@0: michael@0: struct nsWindowInfo michael@0: { michael@0: nsWindowInfo(nsIXULWindow* inWindow, int32_t inTimeStamp); michael@0: ~nsWindowInfo(); michael@0: michael@0: nsCOMPtr mWindow; michael@0: int32_t mTimeStamp; michael@0: uint32_t mZLevel; michael@0: michael@0: // each struct is in two, independent, circular, doubly-linked lists michael@0: nsWindowInfo *mYounger, // next younger in sequence michael@0: *mOlder; michael@0: nsWindowInfo *mLower, // next lower in z-order michael@0: *mHigher; michael@0: michael@0: bool TypeEquals(const nsAString &aType); michael@0: void InsertAfter(nsWindowInfo *inOlder, nsWindowInfo *inHigher); michael@0: void Unlink(bool inAge, bool inZ); michael@0: void ReferenceSelf(bool inAge, bool inZ); michael@0: }; michael@0: michael@0: // michael@0: // virtual enumerators michael@0: // michael@0: michael@0: class nsAppShellWindowEnumerator : public nsISimpleEnumerator { michael@0: michael@0: friend class nsWindowMediator; michael@0: michael@0: public: michael@0: nsAppShellWindowEnumerator(const char16_t* aTypeString, michael@0: nsWindowMediator& inMediator); michael@0: virtual ~nsAppShellWindowEnumerator(); michael@0: NS_IMETHOD GetNext(nsISupports **retval) = 0; michael@0: NS_IMETHOD HasMoreElements(bool *retval); michael@0: michael@0: NS_DECL_ISUPPORTS michael@0: michael@0: protected: michael@0: michael@0: void AdjustInitialPosition(); michael@0: virtual nsWindowInfo *FindNext() = 0; michael@0: michael@0: void WindowRemoved(nsWindowInfo *inInfo); michael@0: michael@0: nsWindowMediator *mWindowMediator; michael@0: nsString mType; michael@0: nsWindowInfo *mCurrentPosition; michael@0: }; michael@0: michael@0: class nsASDOMWindowEnumerator : public nsAppShellWindowEnumerator { michael@0: michael@0: public: michael@0: nsASDOMWindowEnumerator(const char16_t* aTypeString, michael@0: nsWindowMediator& inMediator); michael@0: virtual ~nsASDOMWindowEnumerator(); michael@0: NS_IMETHOD GetNext(nsISupports **retval); michael@0: }; michael@0: michael@0: class nsASXULWindowEnumerator : public nsAppShellWindowEnumerator { michael@0: michael@0: public: michael@0: nsASXULWindowEnumerator(const char16_t* aTypeString, michael@0: nsWindowMediator& inMediator); michael@0: virtual ~nsASXULWindowEnumerator(); michael@0: NS_IMETHOD GetNext(nsISupports **retval); michael@0: }; michael@0: michael@0: // michael@0: // concrete enumerators michael@0: // michael@0: michael@0: class nsASDOMWindowEarlyToLateEnumerator : public nsASDOMWindowEnumerator { michael@0: michael@0: public: michael@0: nsASDOMWindowEarlyToLateEnumerator(const char16_t* aTypeString, michael@0: nsWindowMediator& inMediator); michael@0: michael@0: virtual ~nsASDOMWindowEarlyToLateEnumerator(); michael@0: michael@0: protected: michael@0: virtual nsWindowInfo *FindNext(); michael@0: }; michael@0: michael@0: class nsASXULWindowEarlyToLateEnumerator : public nsASXULWindowEnumerator { michael@0: michael@0: public: michael@0: nsASXULWindowEarlyToLateEnumerator(const char16_t* aTypeString, michael@0: nsWindowMediator& inMediator); michael@0: michael@0: virtual ~nsASXULWindowEarlyToLateEnumerator(); michael@0: michael@0: protected: michael@0: virtual nsWindowInfo *FindNext(); michael@0: }; michael@0: michael@0: class nsASDOMWindowFrontToBackEnumerator : public nsASDOMWindowEnumerator { michael@0: michael@0: public: michael@0: nsASDOMWindowFrontToBackEnumerator(const char16_t* aTypeString, michael@0: nsWindowMediator& inMediator); michael@0: michael@0: virtual ~nsASDOMWindowFrontToBackEnumerator(); michael@0: michael@0: protected: michael@0: virtual nsWindowInfo *FindNext(); michael@0: }; michael@0: michael@0: class nsASXULWindowFrontToBackEnumerator : public nsASXULWindowEnumerator { michael@0: michael@0: public: michael@0: nsASXULWindowFrontToBackEnumerator(const char16_t* aTypeString, michael@0: nsWindowMediator& inMediator); michael@0: michael@0: virtual ~nsASXULWindowFrontToBackEnumerator(); michael@0: michael@0: protected: michael@0: virtual nsWindowInfo *FindNext(); michael@0: }; michael@0: michael@0: class nsASDOMWindowBackToFrontEnumerator : public nsASDOMWindowEnumerator { michael@0: michael@0: public: michael@0: nsASDOMWindowBackToFrontEnumerator(const char16_t* aTypeString, michael@0: nsWindowMediator& inMediator); michael@0: michael@0: virtual ~nsASDOMWindowBackToFrontEnumerator(); michael@0: michael@0: protected: michael@0: virtual nsWindowInfo *FindNext(); michael@0: }; michael@0: michael@0: class nsASXULWindowBackToFrontEnumerator : public nsASXULWindowEnumerator { michael@0: michael@0: public: michael@0: nsASXULWindowBackToFrontEnumerator(const char16_t* aTypeString, michael@0: nsWindowMediator& inMediator); michael@0: michael@0: virtual ~nsASXULWindowBackToFrontEnumerator(); michael@0: michael@0: protected: michael@0: virtual nsWindowInfo *FindNext(); michael@0: }; michael@0: michael@0: #endif