/src/mozilla-central/layout/xul/nsScrollbarButtonFrame.h
Line | Count | Source (jump to first uncovered line) |
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 "mozilla/Attributes.h" |
18 | | #include "nsButtonBoxFrame.h" |
19 | | #include "nsITimer.h" |
20 | | #include "nsRepeatService.h" |
21 | | |
22 | | class nsScrollbarButtonFrame final : public nsButtonBoxFrame |
23 | | { |
24 | | public: |
25 | | NS_DECL_FRAMEARENA_HELPERS(nsScrollbarButtonFrame) |
26 | | |
27 | | explicit nsScrollbarButtonFrame(ComputedStyle* aStyle): |
28 | 0 | nsButtonBoxFrame(aStyle, kClassID), mCursorOnThis(false) {} |
29 | | |
30 | | // Overrides |
31 | | virtual void DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) override; |
32 | | |
33 | | friend nsIFrame* NS_NewScrollbarButtonFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle); |
34 | | |
35 | | virtual nsresult HandleEvent(nsPresContext* aPresContext, |
36 | | mozilla::WidgetGUIEvent* aEvent, |
37 | | nsEventStatus* aEventStatus) override; |
38 | | |
39 | | static nsresult GetChildWithTag(nsAtom* atom, nsIFrame* start, nsIFrame*& result); |
40 | | static nsresult GetParentWithTag(nsAtom* atom, nsIFrame* start, nsIFrame*& result); |
41 | | |
42 | | bool HandleButtonPress(nsPresContext* aPresContext, |
43 | | mozilla::WidgetGUIEvent* aEvent, |
44 | | nsEventStatus* aEventStatus); |
45 | | |
46 | | NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext, |
47 | | mozilla::WidgetGUIEvent* aEvent, |
48 | | nsEventStatus* aEventStatus, |
49 | | bool aControlHeld) override |
50 | 0 | { |
51 | 0 | return NS_OK; |
52 | 0 | } |
53 | | |
54 | | NS_IMETHOD HandleDrag(nsPresContext* aPresContext, |
55 | | mozilla::WidgetGUIEvent* aEvent, |
56 | | nsEventStatus* aEventStatus) override |
57 | 0 | { |
58 | 0 | return NS_OK; |
59 | 0 | } |
60 | | |
61 | | NS_IMETHOD HandleRelease(nsPresContext* aPresContext, |
62 | | mozilla::WidgetGUIEvent* aEvent, |
63 | | nsEventStatus* aEventStatus) override; |
64 | | |
65 | | protected: |
66 | 0 | void StartRepeat() { |
67 | 0 | nsRepeatService::GetInstance()->Start(Notify, this, |
68 | 0 | mContent->OwnerDoc(), |
69 | 0 | NS_LITERAL_CSTRING("nsScrollbarButtonFrame")); |
70 | 0 | } |
71 | 0 | void StopRepeat() { |
72 | 0 | nsRepeatService::GetInstance()->Stop(Notify, this); |
73 | 0 | } |
74 | | void Notify(); |
75 | 0 | static void Notify(void* aData) { |
76 | 0 | static_cast<nsScrollbarButtonFrame*>(aData)->Notify(); |
77 | 0 | } |
78 | | |
79 | | bool mCursorOnThis; |
80 | | }; |
81 | | |
82 | | #endif |