Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
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/. */
7 #ifndef nsTreeSelection_h__
8 #define nsTreeSelection_h__
10 #include "nsITreeSelection.h"
11 #include "nsITreeColumns.h"
12 #include "nsITimer.h"
13 #include "nsCycleCollectionParticipant.h"
14 #include "mozilla/Attributes.h"
16 class nsITreeBoxObject;
17 struct nsTreeRange;
19 class nsTreeSelection MOZ_FINAL : public nsINativeTreeSelection
20 {
21 public:
22 nsTreeSelection(nsITreeBoxObject* aTree);
23 ~nsTreeSelection();
25 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
26 NS_DECL_CYCLE_COLLECTION_CLASS(nsTreeSelection)
27 NS_DECL_NSITREESELECTION
29 // nsINativeTreeSelection: Untrusted code can use us
30 NS_IMETHOD EnsureNative() MOZ_OVERRIDE { return NS_OK; }
32 friend struct nsTreeRange;
34 protected:
35 nsresult FireOnSelectHandler();
36 static void SelectCallback(nsITimer *aTimer, void *aClosure);
38 protected:
39 // Members
40 nsCOMPtr<nsITreeBoxObject> mTree; // The tree will hold on to us through the view and let go when it dies.
42 bool mSuppressed; // Whether or not we should be firing onselect events.
43 int32_t mCurrentIndex; // The item to draw the rect around. The last one clicked, etc.
44 nsCOMPtr<nsITreeColumn> mCurrentColumn;
45 int32_t mShiftSelectPivot; // Used when multiple SHIFT+selects are performed to pivot on.
47 nsTreeRange* mFirstRange; // Our list of ranges.
49 nsCOMPtr<nsITimer> mSelectTimer;
50 };
52 nsresult
53 NS_NewTreeSelection(nsITreeBoxObject* aTree, nsITreeSelection** aResult);
55 #endif