nsTreeSelection.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2. *
  3. * This Source Code Form is subject to the terms of the Mozilla Public
  4. * License, v. 2.0. If a copy of the MPL was not distributed with this
  5. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  6. #ifndef nsTreeSelection_h__
  7. #define nsTreeSelection_h__
  8. #include "nsITreeSelection.h"
  9. #include "nsITreeColumns.h"
  10. #include "nsITimer.h"
  11. #include "nsCycleCollectionParticipant.h"
  12. #include "mozilla/Attributes.h"
  13. class nsITreeBoxObject;
  14. struct nsTreeRange;
  15. class nsTreeSelection final : public nsINativeTreeSelection
  16. {
  17. public:
  18. explicit nsTreeSelection(nsITreeBoxObject* aTree);
  19. NS_DECL_CYCLE_COLLECTING_ISUPPORTS
  20. NS_DECL_CYCLE_COLLECTION_CLASS(nsTreeSelection)
  21. NS_DECL_NSITREESELECTION
  22. // nsINativeTreeSelection: Untrusted code can use us
  23. NS_IMETHOD EnsureNative() override { return NS_OK; }
  24. friend struct nsTreeRange;
  25. protected:
  26. ~nsTreeSelection();
  27. nsresult FireOnSelectHandler();
  28. static void SelectCallback(nsITimer *aTimer, void *aClosure);
  29. protected:
  30. // Members
  31. nsCOMPtr<nsITreeBoxObject> mTree; // The tree will hold on to us through the view and let go when it dies.
  32. bool mSuppressed; // Whether or not we should be firing onselect events.
  33. int32_t mCurrentIndex; // The item to draw the rect around. The last one clicked, etc.
  34. nsCOMPtr<nsITreeColumn> mCurrentColumn;
  35. int32_t mShiftSelectPivot; // Used when multiple SHIFT+selects are performed to pivot on.
  36. nsTreeRange* mFirstRange; // Our list of ranges.
  37. nsCOMPtr<nsITimer> mSelectTimer;
  38. };
  39. nsresult
  40. NS_NewTreeSelection(nsITreeBoxObject* aTree, nsITreeSelection** aResult);
  41. #endif