Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : /**
7 :
8 : Eric D Vaughan
9 : This class lays out its children either vertically or horizontally
10 :
11 : **/
12 :
13 : #ifndef nsScrollbarButtonFrame_h___
14 : #define nsScrollbarButtonFrame_h___
15 :
16 : #include "mozilla/Attributes.h"
17 : #include "nsButtonBoxFrame.h"
18 : #include "nsITimer.h"
19 : #include "nsRepeatService.h"
20 :
21 0 : class nsScrollbarButtonFrame final : public nsButtonBoxFrame
22 : {
23 : public:
24 0 : NS_DECL_FRAMEARENA_HELPERS(nsScrollbarButtonFrame)
25 :
26 0 : explicit nsScrollbarButtonFrame(nsStyleContext* aContext):
27 0 : nsButtonBoxFrame(aContext, kClassID), mCursorOnThis(false) {}
28 :
29 : // Overrides
30 : virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
31 :
32 : friend nsIFrame* NS_NewScrollbarButtonFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
33 :
34 : virtual nsresult HandleEvent(nsPresContext* aPresContext,
35 : mozilla::WidgetGUIEvent* aEvent,
36 : nsEventStatus* aEventStatus) override;
37 :
38 : static nsresult GetChildWithTag(nsIAtom* atom, nsIFrame* start, nsIFrame*& result);
39 : static nsresult GetParentWithTag(nsIAtom* atom, nsIFrame* start, nsIFrame*& result);
40 :
41 : bool HandleButtonPress(nsPresContext* aPresContext,
42 : mozilla::WidgetGUIEvent* aEvent,
43 : nsEventStatus* aEventStatus);
44 :
45 0 : NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext,
46 : mozilla::WidgetGUIEvent* aEvent,
47 : nsEventStatus* aEventStatus,
48 : bool aControlHeld) override
49 : {
50 0 : return NS_OK;
51 : }
52 :
53 0 : NS_IMETHOD HandleDrag(nsPresContext* aPresContext,
54 : mozilla::WidgetGUIEvent* aEvent,
55 : nsEventStatus* aEventStatus) override
56 : {
57 0 : return NS_OK;
58 : }
59 :
60 : NS_IMETHOD HandleRelease(nsPresContext* aPresContext,
61 : mozilla::WidgetGUIEvent* aEvent,
62 : nsEventStatus* aEventStatus) override;
63 :
64 : protected:
65 : virtual void MouseClicked(mozilla::WidgetGUIEvent* aEvent) override;
66 :
67 0 : void StartRepeat() {
68 0 : nsRepeatService::GetInstance()->Start(Notify, this,
69 0 : mContent->OwnerDoc(),
70 0 : NS_LITERAL_CSTRING("nsScrollbarButtonFrame"));
71 0 : }
72 0 : void StopRepeat() {
73 0 : nsRepeatService::GetInstance()->Stop(Notify, this);
74 0 : }
75 : void Notify();
76 0 : static void Notify(void* aData) {
77 0 : static_cast<nsScrollbarButtonFrame*>(aData)->Notify();
78 0 : }
79 :
80 : bool mCursorOnThis;
81 : };
82 :
83 : #endif
|