Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/layout/xul/tree/nsTreeSelection.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 "nsITimer.h"
12
#include "nsCycleCollectionParticipant.h"
13
#include "mozilla/Attributes.h"
14
15
class nsITreeBoxObject;
16
class nsTreeColumn;
17
struct nsTreeRange;
18
19
class nsTreeSelection final : public nsINativeTreeSelection
20
{
21
public:
22
  explicit nsTreeSelection(nsITreeBoxObject* aTree);
23
24
  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
25
  NS_DECL_CYCLE_COLLECTION_CLASS(nsTreeSelection)
26
  NS_DECL_NSITREESELECTION
27
28
  // nsINativeTreeSelection: Untrusted code can use us
29
0
  NS_IMETHOD EnsureNative() override { return NS_OK; }
30
31
  friend struct nsTreeRange;
32
33
protected:
34
  ~nsTreeSelection();
35
36
  nsresult FireOnSelectHandler();
37
  static void SelectCallback(nsITimer *aTimer, void *aClosure);
38
39
protected:
40
  // Helper function to get the content node associated with mTree.
41
  already_AddRefed<nsIContent> GetContent();
42
43
  // Members
44
  nsCOMPtr<nsITreeBoxObject> mTree; // The tree will hold on to us through the view and let go when it dies.
45
46
  bool mSuppressed; // Whether or not we should be firing onselect events.
47
  int32_t mCurrentIndex; // The item to draw the rect around. The last one clicked, etc.
48
  RefPtr<nsTreeColumn> mCurrentColumn;
49
  int32_t mShiftSelectPivot; // Used when multiple SHIFT+selects are performed to pivot on.
50
51
  nsTreeRange* mFirstRange; // Our list of ranges.
52
53
  nsCOMPtr<nsITimer> mSelectTimer;
54
};
55
56
nsresult
57
NS_NewTreeSelection(nsITreeBoxObject* aTree, nsITreeSelection** aResult);
58
59
#endif