|
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 |
|
7 #ifndef nsTreeSelection_h__ |
|
8 #define nsTreeSelection_h__ |
|
9 |
|
10 #include "nsITreeSelection.h" |
|
11 #include "nsITreeColumns.h" |
|
12 #include "nsITimer.h" |
|
13 #include "nsCycleCollectionParticipant.h" |
|
14 #include "mozilla/Attributes.h" |
|
15 |
|
16 class nsITreeBoxObject; |
|
17 struct nsTreeRange; |
|
18 |
|
19 class nsTreeSelection MOZ_FINAL : public nsINativeTreeSelection |
|
20 { |
|
21 public: |
|
22 nsTreeSelection(nsITreeBoxObject* aTree); |
|
23 ~nsTreeSelection(); |
|
24 |
|
25 NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
|
26 NS_DECL_CYCLE_COLLECTION_CLASS(nsTreeSelection) |
|
27 NS_DECL_NSITREESELECTION |
|
28 |
|
29 // nsINativeTreeSelection: Untrusted code can use us |
|
30 NS_IMETHOD EnsureNative() MOZ_OVERRIDE { return NS_OK; } |
|
31 |
|
32 friend struct nsTreeRange; |
|
33 |
|
34 protected: |
|
35 nsresult FireOnSelectHandler(); |
|
36 static void SelectCallback(nsITimer *aTimer, void *aClosure); |
|
37 |
|
38 protected: |
|
39 // Members |
|
40 nsCOMPtr<nsITreeBoxObject> mTree; // The tree will hold on to us through the view and let go when it dies. |
|
41 |
|
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. |
|
46 |
|
47 nsTreeRange* mFirstRange; // Our list of ranges. |
|
48 |
|
49 nsCOMPtr<nsITimer> mSelectTimer; |
|
50 }; |
|
51 |
|
52 nsresult |
|
53 NS_NewTreeSelection(nsITreeBoxObject* aTree, nsITreeSelection** aResult); |
|
54 |
|
55 #endif |