Line data Source code
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 final : public imgINotificationObserver
17 : {
18 : public:
19 : explicit nsTreeImageListener(nsTreeBodyFrame *aTreeFrame);
20 :
21 : NS_DECL_ISUPPORTS
22 : NS_DECL_IMGINOTIFICATIONOBSERVER
23 :
24 : NS_IMETHOD ClearFrame();
25 :
26 : friend class nsTreeBodyFrame;
27 :
28 : protected:
29 : ~nsTreeImageListener();
30 :
31 0 : void UnsuppressInvalidation() { mInvalidationSuppressed = false; }
32 : void Invalidate();
33 : void AddCell(int32_t aIndex, nsITreeColumn* aCol);
34 :
35 : private:
36 : nsTreeBodyFrame* mTreeFrame;
37 :
38 : // A guard that prevents us from recursive painting.
39 : bool mInvalidationSuppressed;
40 :
41 : class InvalidationArea {
42 : public:
43 : explicit InvalidationArea(nsITreeColumn* aCol);
44 0 : ~InvalidationArea() { delete mNext; }
45 :
46 : friend class nsTreeImageListener;
47 :
48 : protected:
49 : void AddRow(int32_t aIndex);
50 0 : nsITreeColumn* GetCol() { return mCol.get(); }
51 0 : int32_t GetMin() { return mMin; }
52 0 : int32_t GetMax() { return mMax; }
53 0 : InvalidationArea* GetNext() { return mNext; }
54 0 : void SetNext(InvalidationArea* aNext) { mNext = aNext; }
55 :
56 : private:
57 : nsCOMPtr<nsITreeColumn> mCol;
58 : int32_t mMin;
59 : int32_t mMax;
60 : InvalidationArea* mNext;
61 : };
62 :
63 : InvalidationArea* mInvalidationArea;
64 : };
65 :
66 : #endif // nsTreeImageListener_h__
|