michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /** michael@0: michael@0: Eric D Vaughan michael@0: This class lays out its children either vertically or horizontally michael@0: michael@0: **/ michael@0: michael@0: #ifndef nsScrollbarButtonFrame_h___ michael@0: #define nsScrollbarButtonFrame_h___ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsButtonBoxFrame.h" michael@0: #include "nsITimer.h" michael@0: #include "nsRepeatService.h" michael@0: michael@0: class nsSliderFrame; michael@0: michael@0: class nsScrollbarButtonFrame : public nsButtonBoxFrame michael@0: { michael@0: public: michael@0: NS_DECL_FRAMEARENA_HELPERS michael@0: michael@0: nsScrollbarButtonFrame(nsIPresShell* aPresShell, nsStyleContext* aContext): michael@0: nsButtonBoxFrame(aPresShell, aContext), mCursorOnThis(false) {} michael@0: michael@0: // Overrides michael@0: virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE; michael@0: michael@0: friend nsIFrame* NS_NewScrollbarButtonFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); michael@0: michael@0: virtual nsresult HandleEvent(nsPresContext* aPresContext, michael@0: mozilla::WidgetGUIEvent* aEvent, michael@0: nsEventStatus* aEventStatus) MOZ_OVERRIDE; michael@0: michael@0: static nsresult GetChildWithTag(nsPresContext* aPresContext, michael@0: nsIAtom* atom, nsIFrame* start, nsIFrame*& result); michael@0: static nsresult GetParentWithTag(nsIAtom* atom, nsIFrame* start, nsIFrame*& result); michael@0: michael@0: bool HandleButtonPress(nsPresContext* aPresContext, michael@0: mozilla::WidgetGUIEvent* aEvent, michael@0: nsEventStatus* aEventStatus); michael@0: michael@0: NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext, michael@0: mozilla::WidgetGUIEvent* aEvent, michael@0: nsEventStatus* aEventStatus, michael@0: bool aControlHeld) MOZ_OVERRIDE michael@0: { michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHOD HandleDrag(nsPresContext* aPresContext, michael@0: mozilla::WidgetGUIEvent* aEvent, michael@0: nsEventStatus* aEventStatus) MOZ_OVERRIDE michael@0: { michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_IMETHOD HandleRelease(nsPresContext* aPresContext, michael@0: mozilla::WidgetGUIEvent* aEvent, michael@0: nsEventStatus* aEventStatus) MOZ_OVERRIDE; michael@0: michael@0: protected: michael@0: virtual void MouseClicked(nsPresContext* aPresContext, michael@0: mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE; michael@0: void DoButtonAction(bool aSmoothScroll); michael@0: michael@0: void StartRepeat() { michael@0: nsRepeatService::GetInstance()->Start(Notify, this); michael@0: } michael@0: void StopRepeat() { michael@0: nsRepeatService::GetInstance()->Stop(Notify, this); michael@0: } michael@0: void Notify(); michael@0: static void Notify(void* aData) { michael@0: static_cast(aData)->Notify(); michael@0: } michael@0: michael@0: int32_t mIncrement; michael@0: bool mCursorOnThis; michael@0: }; michael@0: michael@0: #endif