Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | /** |
michael@0 | 7 | |
michael@0 | 8 | Eric D Vaughan |
michael@0 | 9 | This class lays out its children either vertically or horizontally |
michael@0 | 10 | |
michael@0 | 11 | **/ |
michael@0 | 12 | |
michael@0 | 13 | #ifndef nsScrollbarButtonFrame_h___ |
michael@0 | 14 | #define nsScrollbarButtonFrame_h___ |
michael@0 | 15 | |
michael@0 | 16 | #include "mozilla/Attributes.h" |
michael@0 | 17 | #include "nsButtonBoxFrame.h" |
michael@0 | 18 | #include "nsITimer.h" |
michael@0 | 19 | #include "nsRepeatService.h" |
michael@0 | 20 | |
michael@0 | 21 | class nsSliderFrame; |
michael@0 | 22 | |
michael@0 | 23 | class nsScrollbarButtonFrame : public nsButtonBoxFrame |
michael@0 | 24 | { |
michael@0 | 25 | public: |
michael@0 | 26 | NS_DECL_FRAMEARENA_HELPERS |
michael@0 | 27 | |
michael@0 | 28 | nsScrollbarButtonFrame(nsIPresShell* aPresShell, nsStyleContext* aContext): |
michael@0 | 29 | nsButtonBoxFrame(aPresShell, aContext), mCursorOnThis(false) {} |
michael@0 | 30 | |
michael@0 | 31 | // Overrides |
michael@0 | 32 | virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE; |
michael@0 | 33 | |
michael@0 | 34 | friend nsIFrame* NS_NewScrollbarButtonFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
michael@0 | 35 | |
michael@0 | 36 | virtual nsresult HandleEvent(nsPresContext* aPresContext, |
michael@0 | 37 | mozilla::WidgetGUIEvent* aEvent, |
michael@0 | 38 | nsEventStatus* aEventStatus) MOZ_OVERRIDE; |
michael@0 | 39 | |
michael@0 | 40 | static nsresult GetChildWithTag(nsPresContext* aPresContext, |
michael@0 | 41 | nsIAtom* atom, nsIFrame* start, nsIFrame*& result); |
michael@0 | 42 | static nsresult GetParentWithTag(nsIAtom* atom, nsIFrame* start, nsIFrame*& result); |
michael@0 | 43 | |
michael@0 | 44 | bool HandleButtonPress(nsPresContext* aPresContext, |
michael@0 | 45 | mozilla::WidgetGUIEvent* aEvent, |
michael@0 | 46 | nsEventStatus* aEventStatus); |
michael@0 | 47 | |
michael@0 | 48 | NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext, |
michael@0 | 49 | mozilla::WidgetGUIEvent* aEvent, |
michael@0 | 50 | nsEventStatus* aEventStatus, |
michael@0 | 51 | bool aControlHeld) MOZ_OVERRIDE |
michael@0 | 52 | { |
michael@0 | 53 | return NS_OK; |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | NS_IMETHOD HandleDrag(nsPresContext* aPresContext, |
michael@0 | 57 | mozilla::WidgetGUIEvent* aEvent, |
michael@0 | 58 | nsEventStatus* aEventStatus) MOZ_OVERRIDE |
michael@0 | 59 | { |
michael@0 | 60 | return NS_OK; |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | NS_IMETHOD HandleRelease(nsPresContext* aPresContext, |
michael@0 | 64 | mozilla::WidgetGUIEvent* aEvent, |
michael@0 | 65 | nsEventStatus* aEventStatus) MOZ_OVERRIDE; |
michael@0 | 66 | |
michael@0 | 67 | protected: |
michael@0 | 68 | virtual void MouseClicked(nsPresContext* aPresContext, |
michael@0 | 69 | mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE; |
michael@0 | 70 | void DoButtonAction(bool aSmoothScroll); |
michael@0 | 71 | |
michael@0 | 72 | void StartRepeat() { |
michael@0 | 73 | nsRepeatService::GetInstance()->Start(Notify, this); |
michael@0 | 74 | } |
michael@0 | 75 | void StopRepeat() { |
michael@0 | 76 | nsRepeatService::GetInstance()->Stop(Notify, this); |
michael@0 | 77 | } |
michael@0 | 78 | void Notify(); |
michael@0 | 79 | static void Notify(void* aData) { |
michael@0 | 80 | static_cast<nsScrollbarButtonFrame*>(aData)->Notify(); |
michael@0 | 81 | } |
michael@0 | 82 | |
michael@0 | 83 | int32_t mIncrement; |
michael@0 | 84 | bool mCursorOnThis; |
michael@0 | 85 | }; |
michael@0 | 86 | |
michael@0 | 87 | #endif |