layout/xul/tree/nsTreeImageListener.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:9aedffd31dcd
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 nsTreeImageListener_h__
7 #define nsTreeImageListener_h__
8
9 #include "nsString.h"
10 #include "nsCOMPtr.h"
11 #include "nsITreeColumns.h"
12 #include "nsTreeBodyFrame.h"
13 #include "mozilla/Attributes.h"
14
15 // This class handles image load observation.
16 class nsTreeImageListener MOZ_FINAL : public imgINotificationObserver
17 {
18 public:
19 nsTreeImageListener(nsTreeBodyFrame *aTreeFrame);
20 ~nsTreeImageListener();
21
22 NS_DECL_ISUPPORTS
23 NS_DECL_IMGINOTIFICATIONOBSERVER
24
25 NS_IMETHOD ClearFrame();
26
27 friend class nsTreeBodyFrame;
28
29 protected:
30 void UnsuppressInvalidation() { mInvalidationSuppressed = false; }
31 void Invalidate();
32 void AddCell(int32_t aIndex, nsITreeColumn* aCol);
33
34 private:
35 nsTreeBodyFrame* mTreeFrame;
36
37 // A guard that prevents us from recursive painting.
38 bool mInvalidationSuppressed;
39
40 class InvalidationArea {
41 public:
42 InvalidationArea(nsITreeColumn* aCol);
43 ~InvalidationArea() { delete mNext; }
44
45 friend class nsTreeImageListener;
46
47 protected:
48 void AddRow(int32_t aIndex);
49 nsITreeColumn* GetCol() { return mCol.get(); }
50 int32_t GetMin() { return mMin; }
51 int32_t GetMax() { return mMax; }
52 InvalidationArea* GetNext() { return mNext; }
53 void SetNext(InvalidationArea* aNext) { mNext = aNext; }
54
55 private:
56 nsCOMPtr<nsITreeColumn> mCol;
57 int32_t mMin;
58 int32_t mMax;
59 InvalidationArea* mNext;
60 };
61
62 InvalidationArea* mInvalidationArea;
63 };
64
65 #endif // nsTreeImageListener_h__

mercurial