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/. */
10 This class lays out its children either vertically or horizontally
14 #ifndef nsScrollbarButtonFrame_h___
15 #define nsScrollbarButtonFrame_h___
17 #include "SimpleXULLeafFrame.h"
18 #include "mozilla/Attributes.h"
19 #include "nsLeafFrame.h"
20 #include "nsRepeatService.h"
24 } // namespace mozilla
26 class nsScrollbarButtonFrame final
: public mozilla::SimpleXULLeafFrame
{
28 NS_DECL_FRAMEARENA_HELPERS(nsScrollbarButtonFrame
)
30 explicit nsScrollbarButtonFrame(ComputedStyle
* aStyle
,
31 nsPresContext
* aPresContext
)
32 : mozilla::SimpleXULLeafFrame(aStyle
, aPresContext
, kClassID
) {}
35 void Destroy(DestroyContext
&) override
;
37 friend nsIFrame
* NS_NewScrollbarButtonFrame(mozilla::PresShell
* aPresShell
,
38 ComputedStyle
* aStyle
);
40 nsresult
HandleEvent(nsPresContext
* aPresContext
,
41 mozilla::WidgetGUIEvent
* aEvent
,
42 nsEventStatus
* aEventStatus
) override
;
44 static nsresult
GetChildWithTag(nsAtom
* atom
, nsIFrame
* start
,
46 static nsresult
GetParentWithTag(nsAtom
* atom
, nsIFrame
* start
,
49 bool HandleButtonPress(nsPresContext
* aPresContext
,
50 mozilla::WidgetGUIEvent
* aEvent
,
51 nsEventStatus
* aEventStatus
);
53 NS_IMETHOD
HandleMultiplePress(nsPresContext
* aPresContext
,
54 mozilla::WidgetGUIEvent
* aEvent
,
55 nsEventStatus
* aEventStatus
,
56 bool aControlHeld
) override
{
61 NS_IMETHOD
HandleDrag(nsPresContext
* aPresContext
,
62 mozilla::WidgetGUIEvent
* aEvent
,
63 nsEventStatus
* aEventStatus
) override
{
67 NS_IMETHOD
HandleRelease(nsPresContext
* aPresContext
,
68 mozilla::WidgetGUIEvent
* aEvent
,
69 nsEventStatus
* aEventStatus
) override
;
73 nsRepeatService::GetInstance()->Start(Notify
, this, mContent
->OwnerDoc(),
74 "nsScrollbarButtonFrame"_ns
);
76 void StopRepeat() { nsRepeatService::GetInstance()->Stop(Notify
, this); }
78 static void Notify(void* aData
) {
79 static_cast<nsScrollbarButtonFrame
*>(aData
)->Notify();
82 bool mCursorOnThis
= false;