TreeBoxObject.h 3.9 KB

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