layout/xul/tree/nsTreeSelection.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/xul/tree/nsTreeSelection.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + *
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef nsTreeSelection_h__
    1.11 +#define nsTreeSelection_h__
    1.12 +
    1.13 +#include "nsITreeSelection.h"
    1.14 +#include "nsITreeColumns.h"
    1.15 +#include "nsITimer.h"
    1.16 +#include "nsCycleCollectionParticipant.h"
    1.17 +#include "mozilla/Attributes.h"
    1.18 +
    1.19 +class nsITreeBoxObject;
    1.20 +struct nsTreeRange;
    1.21 +
    1.22 +class nsTreeSelection MOZ_FINAL : public nsINativeTreeSelection
    1.23 +{
    1.24 +public:
    1.25 +  nsTreeSelection(nsITreeBoxObject* aTree);
    1.26 +  ~nsTreeSelection();
    1.27 +   
    1.28 +  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
    1.29 +  NS_DECL_CYCLE_COLLECTION_CLASS(nsTreeSelection)
    1.30 +  NS_DECL_NSITREESELECTION
    1.31 +
    1.32 +  // nsINativeTreeSelection: Untrusted code can use us
    1.33 +  NS_IMETHOD EnsureNative() MOZ_OVERRIDE { return NS_OK; }
    1.34 +
    1.35 +  friend struct nsTreeRange;
    1.36 +
    1.37 +protected:
    1.38 +  nsresult FireOnSelectHandler();
    1.39 +  static void SelectCallback(nsITimer *aTimer, void *aClosure);
    1.40 +
    1.41 +protected:
    1.42 +  // Members
    1.43 +  nsCOMPtr<nsITreeBoxObject> mTree; // The tree will hold on to us through the view and let go when it dies.
    1.44 +
    1.45 +  bool mSuppressed; // Whether or not we should be firing onselect events.
    1.46 +  int32_t mCurrentIndex; // The item to draw the rect around. The last one clicked, etc.
    1.47 +  nsCOMPtr<nsITreeColumn> mCurrentColumn;
    1.48 +  int32_t mShiftSelectPivot; // Used when multiple SHIFT+selects are performed to pivot on.
    1.49 +
    1.50 +  nsTreeRange* mFirstRange; // Our list of ranges.
    1.51 +
    1.52 +  nsCOMPtr<nsITimer> mSelectTimer;
    1.53 +};
    1.54 +
    1.55 +nsresult
    1.56 +NS_NewTreeSelection(nsITreeBoxObject* aTree, nsITreeSelection** aResult);
    1.57 +
    1.58 +#endif

mercurial