michael@0: /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsTreeSelection_h__ michael@0: #define nsTreeSelection_h__ michael@0: michael@0: #include "nsITreeSelection.h" michael@0: #include "nsITreeColumns.h" michael@0: #include "nsITimer.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: class nsITreeBoxObject; michael@0: struct nsTreeRange; michael@0: michael@0: class nsTreeSelection MOZ_FINAL : public nsINativeTreeSelection michael@0: { michael@0: public: michael@0: nsTreeSelection(nsITreeBoxObject* aTree); michael@0: ~nsTreeSelection(); michael@0: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_CYCLE_COLLECTION_CLASS(nsTreeSelection) michael@0: NS_DECL_NSITREESELECTION michael@0: michael@0: // nsINativeTreeSelection: Untrusted code can use us michael@0: NS_IMETHOD EnsureNative() MOZ_OVERRIDE { return NS_OK; } michael@0: michael@0: friend struct nsTreeRange; michael@0: michael@0: protected: michael@0: nsresult FireOnSelectHandler(); michael@0: static void SelectCallback(nsITimer *aTimer, void *aClosure); michael@0: michael@0: protected: michael@0: // Members michael@0: nsCOMPtr mTree; // The tree will hold on to us through the view and let go when it dies. michael@0: michael@0: bool mSuppressed; // Whether or not we should be firing onselect events. michael@0: int32_t mCurrentIndex; // The item to draw the rect around. The last one clicked, etc. michael@0: nsCOMPtr mCurrentColumn; michael@0: int32_t mShiftSelectPivot; // Used when multiple SHIFT+selects are performed to pivot on. michael@0: michael@0: nsTreeRange* mFirstRange; // Our list of ranges. michael@0: michael@0: nsCOMPtr mSelectTimer; michael@0: }; michael@0: michael@0: nsresult michael@0: NS_NewTreeSelection(nsITreeBoxObject* aTree, nsITreeSelection** aResult); michael@0: michael@0: #endif