/src/mozilla-central/xpfe/appshell/nsAppShellWindowEnumerator.h
Line | Count | Source (jump to first uncovered line) |
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 "nsSimpleEnumerator.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 nsSimpleEnumerator { |
47 | | |
48 | | friend class nsWindowMediator; |
49 | | |
50 | | public: |
51 | | nsAppShellWindowEnumerator(const char16_t* aTypeString, |
52 | | nsWindowMediator& inMediator); |
53 | | NS_IMETHOD GetNext(nsISupports **retval) override = 0; |
54 | | NS_IMETHOD HasMoreElements(bool *retval) override; |
55 | | |
56 | | protected: |
57 | | |
58 | | ~nsAppShellWindowEnumerator() override; |
59 | | |
60 | | void AdjustInitialPosition(); |
61 | | virtual nsWindowInfo *FindNext() = 0; |
62 | | |
63 | | void WindowRemoved(nsWindowInfo *inInfo); |
64 | | |
65 | | nsWindowMediator *mWindowMediator; |
66 | | nsString mType; |
67 | | nsWindowInfo *mCurrentPosition; |
68 | | }; |
69 | | |
70 | | class nsASDOMWindowEnumerator : public nsAppShellWindowEnumerator { |
71 | | |
72 | | public: |
73 | | nsASDOMWindowEnumerator(const char16_t* aTypeString, |
74 | | nsWindowMediator& inMediator); |
75 | | virtual ~nsASDOMWindowEnumerator(); |
76 | | NS_IMETHOD GetNext(nsISupports **retval) override; |
77 | | }; |
78 | | |
79 | | class nsASXULWindowEnumerator : public nsAppShellWindowEnumerator { |
80 | | |
81 | | public: |
82 | | nsASXULWindowEnumerator(const char16_t* aTypeString, |
83 | | nsWindowMediator& inMediator); |
84 | | virtual ~nsASXULWindowEnumerator(); |
85 | | NS_IMETHOD GetNext(nsISupports **retval) override; |
86 | | |
87 | 0 | const nsID& DefaultInterface() override { return NS_GET_IID(nsIXULWindow); } |
88 | | }; |
89 | | |
90 | | // |
91 | | // concrete enumerators |
92 | | // |
93 | | |
94 | | class nsASDOMWindowEarlyToLateEnumerator : public nsASDOMWindowEnumerator { |
95 | | |
96 | | public: |
97 | | nsASDOMWindowEarlyToLateEnumerator(const char16_t* aTypeString, |
98 | | nsWindowMediator& inMediator); |
99 | | |
100 | | virtual ~nsASDOMWindowEarlyToLateEnumerator(); |
101 | | |
102 | | protected: |
103 | | virtual nsWindowInfo *FindNext() override; |
104 | | }; |
105 | | |
106 | | class nsASXULWindowEarlyToLateEnumerator : public nsASXULWindowEnumerator { |
107 | | |
108 | | public: |
109 | | nsASXULWindowEarlyToLateEnumerator(const char16_t* aTypeString, |
110 | | nsWindowMediator& inMediator); |
111 | | |
112 | | virtual ~nsASXULWindowEarlyToLateEnumerator(); |
113 | | |
114 | | protected: |
115 | | virtual nsWindowInfo *FindNext() override; |
116 | | }; |
117 | | |
118 | | class nsASDOMWindowFrontToBackEnumerator : public nsASDOMWindowEnumerator { |
119 | | |
120 | | public: |
121 | | nsASDOMWindowFrontToBackEnumerator(const char16_t* aTypeString, |
122 | | nsWindowMediator& inMediator); |
123 | | |
124 | | virtual ~nsASDOMWindowFrontToBackEnumerator(); |
125 | | |
126 | | protected: |
127 | | virtual nsWindowInfo *FindNext() override; |
128 | | }; |
129 | | |
130 | | class nsASXULWindowFrontToBackEnumerator : public nsASXULWindowEnumerator { |
131 | | |
132 | | public: |
133 | | nsASXULWindowFrontToBackEnumerator(const char16_t* aTypeString, |
134 | | nsWindowMediator& inMediator); |
135 | | |
136 | | virtual ~nsASXULWindowFrontToBackEnumerator(); |
137 | | |
138 | | protected: |
139 | | virtual nsWindowInfo *FindNext() override; |
140 | | }; |
141 | | |
142 | | class nsASDOMWindowBackToFrontEnumerator : public nsASDOMWindowEnumerator { |
143 | | |
144 | | public: |
145 | | nsASDOMWindowBackToFrontEnumerator(const char16_t* aTypeString, |
146 | | nsWindowMediator& inMediator); |
147 | | |
148 | | virtual ~nsASDOMWindowBackToFrontEnumerator(); |
149 | | |
150 | | protected: |
151 | | virtual nsWindowInfo *FindNext() override; |
152 | | }; |
153 | | |
154 | | class nsASXULWindowBackToFrontEnumerator : public nsASXULWindowEnumerator { |
155 | | |
156 | | public: |
157 | | nsASXULWindowBackToFrontEnumerator(const char16_t* aTypeString, |
158 | | nsWindowMediator& inMediator); |
159 | | |
160 | | virtual ~nsASXULWindowBackToFrontEnumerator(); |
161 | | |
162 | | protected: |
163 | | virtual nsWindowInfo *FindNext() override; |
164 | | }; |
165 | | |
166 | | #endif |