layout/xul/nsScrollbarButtonFrame.h

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 /**
     8   Eric D Vaughan
     9   This class lays out its children either vertically or horizontally
    11 **/
    13 #ifndef nsScrollbarButtonFrame_h___
    14 #define nsScrollbarButtonFrame_h___
    16 #include "mozilla/Attributes.h"
    17 #include "nsButtonBoxFrame.h"
    18 #include "nsITimer.h"
    19 #include "nsRepeatService.h"
    21 class nsSliderFrame;
    23 class nsScrollbarButtonFrame : public nsButtonBoxFrame
    24 {
    25 public:
    26   NS_DECL_FRAMEARENA_HELPERS
    28   nsScrollbarButtonFrame(nsIPresShell* aPresShell, nsStyleContext* aContext):
    29     nsButtonBoxFrame(aPresShell, aContext), mCursorOnThis(false) {}
    31   // Overrides
    32   virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
    34   friend nsIFrame* NS_NewScrollbarButtonFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
    36   virtual nsresult HandleEvent(nsPresContext* aPresContext,
    37                                mozilla::WidgetGUIEvent* aEvent,
    38                                nsEventStatus* aEventStatus) MOZ_OVERRIDE;
    40   static nsresult GetChildWithTag(nsPresContext* aPresContext,
    41                                   nsIAtom* atom, nsIFrame* start, nsIFrame*& result);
    42   static nsresult GetParentWithTag(nsIAtom* atom, nsIFrame* start, nsIFrame*& result);
    44   bool HandleButtonPress(nsPresContext* aPresContext,
    45                          mozilla::WidgetGUIEvent* aEvent,
    46                          nsEventStatus* aEventStatus);
    48   NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext,
    49                                  mozilla::WidgetGUIEvent* aEvent,
    50                                  nsEventStatus* aEventStatus,
    51                                  bool aControlHeld) MOZ_OVERRIDE
    52  {
    53    return NS_OK;
    54  }
    56   NS_IMETHOD HandleDrag(nsPresContext* aPresContext,
    57                         mozilla::WidgetGUIEvent* aEvent,
    58                         nsEventStatus* aEventStatus) MOZ_OVERRIDE
    59   {
    60     return NS_OK;
    61   }
    63   NS_IMETHOD HandleRelease(nsPresContext* aPresContext,
    64                            mozilla::WidgetGUIEvent* aEvent,
    65                            nsEventStatus* aEventStatus) MOZ_OVERRIDE;
    67 protected:
    68   virtual void MouseClicked(nsPresContext* aPresContext,
    69                             mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE;
    70   void DoButtonAction(bool aSmoothScroll);
    72   void StartRepeat() {
    73     nsRepeatService::GetInstance()->Start(Notify, this);
    74   }
    75   void StopRepeat() {
    76     nsRepeatService::GetInstance()->Stop(Notify, this);
    77   }
    78   void Notify();
    79   static void Notify(void* aData) {
    80     static_cast<nsScrollbarButtonFrame*>(aData)->Notify();
    81   }
    83   int32_t mIncrement;  
    84   bool mCursorOnThis;
    85 };
    87 #endif

mercurial