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 mozilla_dom_TreeBoxObject_h
7 : #define mozilla_dom_TreeBoxObject_h
8 :
9 : #include "mozilla/dom/BoxObject.h"
10 : #include "nsITreeView.h"
11 : #include "nsITreeBoxObject.h"
12 :
13 : class nsTreeBodyFrame;
14 : class nsTreeColumn;
15 : class nsTreeColumns;
16 :
17 : namespace mozilla {
18 : namespace dom {
19 :
20 : struct TreeCellInfo;
21 : class DOMRect;
22 :
23 : class TreeBoxObject final : public BoxObject,
24 : public nsITreeBoxObject
25 : {
26 : public:
27 : NS_DECL_ISUPPORTS_INHERITED
28 0 : NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TreeBoxObject, BoxObject)
29 : NS_DECL_NSITREEBOXOBJECT
30 :
31 : TreeBoxObject();
32 :
33 : nsTreeBodyFrame* GetTreeBodyFrame(bool aFlushLayout = false);
34 0 : nsTreeBodyFrame* GetCachedTreeBodyFrame() { return mTreeBody; }
35 :
36 : //NS_PIBOXOBJECT interfaces
37 : virtual void Clear() override;
38 : virtual void ClearCachedValues() override;
39 :
40 : // WebIDL
41 : virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
42 :
43 : already_AddRefed<nsTreeColumns> GetColumns();
44 :
45 : already_AddRefed<nsITreeView> GetView();
46 :
47 : void SetView(nsITreeView* arg, ErrorResult& aRv);
48 :
49 : bool Focused();
50 :
51 : already_AddRefed<Element> GetTreeBody();
52 :
53 : int32_t RowHeight();
54 :
55 : int32_t RowWidth();
56 :
57 : int32_t HorizontalPosition();
58 :
59 : already_AddRefed<nsIScriptableRegion> SelectionRegion();
60 :
61 : int32_t GetFirstVisibleRow();
62 :
63 : int32_t GetLastVisibleRow();
64 :
65 : int32_t GetPageLength();
66 :
67 : int32_t GetRowAt(int32_t x, int32_t y);
68 :
69 : void GetCellAt(int32_t x, int32_t y, TreeCellInfo& aRetVal, ErrorResult& aRv);
70 :
71 : already_AddRefed<DOMRect> GetCoordsForCellItem(int32_t row,
72 : nsTreeColumn& col,
73 : const nsAString& element,
74 : ErrorResult& aRv);
75 :
76 : bool IsCellCropped(int32_t row, nsITreeColumn* col, ErrorResult& aRv);
77 :
78 : void RemoveImageCacheEntry(int32_t row, nsITreeColumn& col, ErrorResult& aRv);
79 :
80 : // Deprecated APIs from old IDL
81 : void GetCellAt(JSContext* cx,
82 : int32_t x, int32_t y,
83 : JS::Handle<JSObject*> rowOut,
84 : JS::Handle<JSObject*> colOut,
85 : JS::Handle<JSObject*> childEltOut,
86 : ErrorResult& aRv);
87 :
88 : void GetCoordsForCellItem(JSContext* cx,
89 : int32_t row,
90 : nsTreeColumn& col,
91 : const nsAString& element,
92 : JS::Handle<JSObject*> xOut,
93 : JS::Handle<JSObject*> yOut,
94 : JS::Handle<JSObject*> widthOut,
95 : JS::Handle<JSObject*> heightOut,
96 : ErrorResult& aRv);
97 :
98 : // Same signature (except for nsresult return type) as the XPIDL impls
99 : // void Invalidate();
100 : // void BeginUpdateBatch();
101 : // void EndUpdateBatch();
102 : // void ClearStyleAndImageCaches();
103 : // void SetFocused(bool arg);
104 : // void EnsureRowIsVisible(int32_t index);
105 : // void EnsureCellIsVisible(int32_t row, nsITreeColumn* col);
106 : // void ScrollToRow(int32_t index);
107 : // void ScrollByLines(int32_t numLines);
108 : // void ScrollByPages(int32_t numPages);
109 : // void ScrollToCell(int32_t row, nsITreeColumn* col);
110 : // void ScrollToColumn(nsITreeColumn* col);
111 : // void ScrollToHorizontalPosition(int32_t horizontalPosition);
112 : // void InvalidateColumn(nsITreeColumn* col);
113 : // void InvalidateRow(int32_t index);
114 : // void InvalidateCell(int32_t row, nsITreeColumn* col);
115 : // void InvalidateRange(int32_t startIndex, int32_t endIndex);
116 : // void InvalidateColumnRange(int32_t startIndex, int32_t endIndex, nsITreeColumn* col);
117 : // void RowCountChanged(int32_t index, int32_t count);
118 :
119 : protected:
120 : nsTreeBodyFrame* mTreeBody;
121 : nsCOMPtr<nsITreeView> mView;
122 :
123 : private:
124 : ~TreeBoxObject();
125 : };
126 :
127 : } // namespace dom
128 : } // namespace mozilla
129 :
130 : #endif
|