nsScrollbarButtonFrame.h (2739B)
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 /** 8 9 Eric D Vaughan 10 This class lays out its children either vertically or horizontally 11 12 **/ 13 14 #ifndef nsScrollbarButtonFrame_h___ 15 #define nsScrollbarButtonFrame_h___ 16 17 #include "SimpleXULLeafFrame.h" 18 #include "mozilla/Attributes.h" 19 #include "nsLeafFrame.h" 20 #include "nsRepeatService.h" 21 22 class nsScrollbarFrame; 23 class nsIScrollbarMediator; 24 25 namespace mozilla { 26 class PresShell; 27 } // namespace mozilla 28 29 class nsScrollbarButtonFrame final : public mozilla::SimpleXULLeafFrame { 30 public: 31 NS_DECL_FRAMEARENA_HELPERS(nsScrollbarButtonFrame) 32 33 nsScrollbarButtonFrame(ComputedStyle* aStyle, nsPresContext* aPresContext) 34 : mozilla::SimpleXULLeafFrame(aStyle, aPresContext, kClassID) {} 35 36 // Overrides 37 void Destroy(DestroyContext&) override; 38 39 friend nsIFrame* NS_NewScrollbarButtonFrame(mozilla::PresShell* aPresShell, 40 ComputedStyle* aStyle); 41 42 nsresult HandleEvent(nsPresContext* aPresContext, 43 mozilla::WidgetGUIEvent* aEvent, 44 nsEventStatus* aEventStatus) override; 45 46 nsScrollbarFrame* GetScrollbar(); 47 nsIScrollbarMediator* GetMediator(); 48 49 bool HandleButtonPress(nsPresContext* aPresContext, 50 mozilla::WidgetGUIEvent* aEvent, 51 nsEventStatus* aEventStatus); 52 53 NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext, 54 mozilla::WidgetGUIEvent* aEvent, 55 nsEventStatus* aEventStatus, 56 bool aControlHeld) override { 57 return NS_OK; 58 } 59 60 MOZ_CAN_RUN_SCRIPT 61 NS_IMETHOD HandleDrag(nsPresContext* aPresContext, 62 mozilla::WidgetGUIEvent* aEvent, 63 nsEventStatus* aEventStatus) override { 64 return NS_OK; 65 } 66 67 NS_IMETHOD HandleRelease(nsPresContext* aPresContext, 68 mozilla::WidgetGUIEvent* aEvent, 69 nsEventStatus* aEventStatus) override; 70 71 protected: 72 void StartRepeat() { 73 nsRepeatService::GetInstance()->Start(Notify, this, mContent->OwnerDoc(), 74 "nsScrollbarButtonFrame"_ns); 75 } 76 void StopRepeat() { nsRepeatService::GetInstance()->Stop(Notify, this); } 77 void Notify(); 78 static void Notify(void* aData) { 79 static_cast<nsScrollbarButtonFrame*>(aData)->Notify(); 80 } 81 82 bool mCursorOnThis = false; 83 }; 84 85 #endif