no bug - Import translations from android-l10n r=release a=l10n CLOSED TREE
[gecko.git] / layout / xul / nsScrollbarButtonFrame.h
blob0f2d2ab56c6bf0a2497accfe79590a69078f1714
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/. */
7 /**
9 Eric D Vaughan
10 This class lays out its children either vertically or horizontally
12 **/
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"
22 namespace mozilla {
23 class PresShell;
24 } // namespace mozilla
26 class nsScrollbarButtonFrame final : public mozilla::SimpleXULLeafFrame {
27 public:
28 NS_DECL_FRAMEARENA_HELPERS(nsScrollbarButtonFrame)
30 explicit nsScrollbarButtonFrame(ComputedStyle* aStyle,
31 nsPresContext* aPresContext)
32 : mozilla::SimpleXULLeafFrame(aStyle, aPresContext, kClassID) {}
34 // Overrides
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,
45 nsIFrame*& result);
46 static nsresult GetParentWithTag(nsAtom* atom, nsIFrame* start,
47 nsIFrame*& result);
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 {
57 return NS_OK;
60 MOZ_CAN_RUN_SCRIPT
61 NS_IMETHOD HandleDrag(nsPresContext* aPresContext,
62 mozilla::WidgetGUIEvent* aEvent,
63 nsEventStatus* aEventStatus) override {
64 return NS_OK;
67 NS_IMETHOD HandleRelease(nsPresContext* aPresContext,
68 mozilla::WidgetGUIEvent* aEvent,
69 nsEventStatus* aEventStatus) override;
71 protected:
72 void StartRepeat() {
73 nsRepeatService::GetInstance()->Start(Notify, this, mContent->OwnerDoc(),
74 "nsScrollbarButtonFrame"_ns);
76 void StopRepeat() { nsRepeatService::GetInstance()->Stop(Notify, this); }
77 void Notify();
78 static void Notify(void* aData) {
79 static_cast<nsScrollbarButtonFrame*>(aData)->Notify();
82 bool mCursorOnThis = false;
85 #endif