|
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 #ifndef nsAppShellWindowEnumerator_h |
|
7 #define nsAppShellWindowEnumerator_h |
|
8 |
|
9 #include "nsCOMPtr.h" |
|
10 #include "nsString.h" |
|
11 |
|
12 #include "nsISimpleEnumerator.h" |
|
13 #include "nsIXULWindow.h" |
|
14 |
|
15 class nsWindowMediator; |
|
16 |
|
17 // |
|
18 // nsWindowInfo |
|
19 // |
|
20 |
|
21 struct nsWindowInfo |
|
22 { |
|
23 nsWindowInfo(nsIXULWindow* inWindow, int32_t inTimeStamp); |
|
24 ~nsWindowInfo(); |
|
25 |
|
26 nsCOMPtr<nsIXULWindow> mWindow; |
|
27 int32_t mTimeStamp; |
|
28 uint32_t mZLevel; |
|
29 |
|
30 // each struct is in two, independent, circular, doubly-linked lists |
|
31 nsWindowInfo *mYounger, // next younger in sequence |
|
32 *mOlder; |
|
33 nsWindowInfo *mLower, // next lower in z-order |
|
34 *mHigher; |
|
35 |
|
36 bool TypeEquals(const nsAString &aType); |
|
37 void InsertAfter(nsWindowInfo *inOlder, nsWindowInfo *inHigher); |
|
38 void Unlink(bool inAge, bool inZ); |
|
39 void ReferenceSelf(bool inAge, bool inZ); |
|
40 }; |
|
41 |
|
42 // |
|
43 // virtual enumerators |
|
44 // |
|
45 |
|
46 class nsAppShellWindowEnumerator : public nsISimpleEnumerator { |
|
47 |
|
48 friend class nsWindowMediator; |
|
49 |
|
50 public: |
|
51 nsAppShellWindowEnumerator(const char16_t* aTypeString, |
|
52 nsWindowMediator& inMediator); |
|
53 virtual ~nsAppShellWindowEnumerator(); |
|
54 NS_IMETHOD GetNext(nsISupports **retval) = 0; |
|
55 NS_IMETHOD HasMoreElements(bool *retval); |
|
56 |
|
57 NS_DECL_ISUPPORTS |
|
58 |
|
59 protected: |
|
60 |
|
61 void AdjustInitialPosition(); |
|
62 virtual nsWindowInfo *FindNext() = 0; |
|
63 |
|
64 void WindowRemoved(nsWindowInfo *inInfo); |
|
65 |
|
66 nsWindowMediator *mWindowMediator; |
|
67 nsString mType; |
|
68 nsWindowInfo *mCurrentPosition; |
|
69 }; |
|
70 |
|
71 class nsASDOMWindowEnumerator : public nsAppShellWindowEnumerator { |
|
72 |
|
73 public: |
|
74 nsASDOMWindowEnumerator(const char16_t* aTypeString, |
|
75 nsWindowMediator& inMediator); |
|
76 virtual ~nsASDOMWindowEnumerator(); |
|
77 NS_IMETHOD GetNext(nsISupports **retval); |
|
78 }; |
|
79 |
|
80 class nsASXULWindowEnumerator : public nsAppShellWindowEnumerator { |
|
81 |
|
82 public: |
|
83 nsASXULWindowEnumerator(const char16_t* aTypeString, |
|
84 nsWindowMediator& inMediator); |
|
85 virtual ~nsASXULWindowEnumerator(); |
|
86 NS_IMETHOD GetNext(nsISupports **retval); |
|
87 }; |
|
88 |
|
89 // |
|
90 // concrete enumerators |
|
91 // |
|
92 |
|
93 class nsASDOMWindowEarlyToLateEnumerator : public nsASDOMWindowEnumerator { |
|
94 |
|
95 public: |
|
96 nsASDOMWindowEarlyToLateEnumerator(const char16_t* aTypeString, |
|
97 nsWindowMediator& inMediator); |
|
98 |
|
99 virtual ~nsASDOMWindowEarlyToLateEnumerator(); |
|
100 |
|
101 protected: |
|
102 virtual nsWindowInfo *FindNext(); |
|
103 }; |
|
104 |
|
105 class nsASXULWindowEarlyToLateEnumerator : public nsASXULWindowEnumerator { |
|
106 |
|
107 public: |
|
108 nsASXULWindowEarlyToLateEnumerator(const char16_t* aTypeString, |
|
109 nsWindowMediator& inMediator); |
|
110 |
|
111 virtual ~nsASXULWindowEarlyToLateEnumerator(); |
|
112 |
|
113 protected: |
|
114 virtual nsWindowInfo *FindNext(); |
|
115 }; |
|
116 |
|
117 class nsASDOMWindowFrontToBackEnumerator : public nsASDOMWindowEnumerator { |
|
118 |
|
119 public: |
|
120 nsASDOMWindowFrontToBackEnumerator(const char16_t* aTypeString, |
|
121 nsWindowMediator& inMediator); |
|
122 |
|
123 virtual ~nsASDOMWindowFrontToBackEnumerator(); |
|
124 |
|
125 protected: |
|
126 virtual nsWindowInfo *FindNext(); |
|
127 }; |
|
128 |
|
129 class nsASXULWindowFrontToBackEnumerator : public nsASXULWindowEnumerator { |
|
130 |
|
131 public: |
|
132 nsASXULWindowFrontToBackEnumerator(const char16_t* aTypeString, |
|
133 nsWindowMediator& inMediator); |
|
134 |
|
135 virtual ~nsASXULWindowFrontToBackEnumerator(); |
|
136 |
|
137 protected: |
|
138 virtual nsWindowInfo *FindNext(); |
|
139 }; |
|
140 |
|
141 class nsASDOMWindowBackToFrontEnumerator : public nsASDOMWindowEnumerator { |
|
142 |
|
143 public: |
|
144 nsASDOMWindowBackToFrontEnumerator(const char16_t* aTypeString, |
|
145 nsWindowMediator& inMediator); |
|
146 |
|
147 virtual ~nsASDOMWindowBackToFrontEnumerator(); |
|
148 |
|
149 protected: |
|
150 virtual nsWindowInfo *FindNext(); |
|
151 }; |
|
152 |
|
153 class nsASXULWindowBackToFrontEnumerator : public nsASXULWindowEnumerator { |
|
154 |
|
155 public: |
|
156 nsASXULWindowBackToFrontEnumerator(const char16_t* aTypeString, |
|
157 nsWindowMediator& inMediator); |
|
158 |
|
159 virtual ~nsASXULWindowBackToFrontEnumerator(); |
|
160 |
|
161 protected: |
|
162 virtual nsWindowInfo *FindNext(); |
|
163 }; |
|
164 |
|
165 #endif |