tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsTreeSelection.h (1760B)


      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 "XULTreeElement.h"
     11 #include "nsCycleCollectionParticipant.h"
     12 #include "nsITimer.h"
     13 #include "nsITreeSelection.h"
     14 
     15 class nsTreeColumn;
     16 struct nsTreeRange;
     17 
     18 class nsTreeSelection final : public nsINativeTreeSelection {
     19 public:
     20  explicit nsTreeSelection(mozilla::dom::XULTreeElement* aTree);
     21 
     22  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     23  NS_DECL_CYCLE_COLLECTION_CLASS(nsTreeSelection)
     24  NS_DECL_NSITREESELECTION
     25 
     26  // nsINativeTreeSelection: Untrusted code can use us
     27  NS_IMETHOD EnsureNative() override { return NS_OK; }
     28 
     29  friend struct nsTreeRange;
     30 
     31 protected:
     32  ~nsTreeSelection();
     33 
     34  nsresult FireOnSelectHandler();
     35  static void SelectCallback(nsITimer* aTimer, void* aClosure);
     36 
     37 protected:
     38  // The tree will hold on to us through the view and let go when it dies.
     39  RefPtr<mozilla::dom::XULTreeElement> mTree;
     40 
     41  bool mSuppressed;       // Whether or not we should be firing onselect events.
     42  int32_t mCurrentIndex;  // The item to draw the rect around. The last one
     43                          // clicked, etc.
     44  int32_t mShiftSelectPivot;  // Used when multiple SHIFT+selects are performed
     45                              // to pivot on.
     46 
     47  nsTreeRange* mFirstRange;  // Our list of ranges.
     48 
     49  nsCOMPtr<nsITimer> mSelectTimer;
     50 };
     51 
     52 nsresult NS_NewTreeSelection(mozilla::dom::XULTreeElement* aTree,
     53                             nsITreeSelection** aResult);
     54 
     55 #endif