layout/xul/nsScrollbarButtonFrame.h

branch
TOR_BUG_9701
changeset 14
925c144e1f1f
equal deleted inserted replaced
-1:000000000000 0:1eceec0be7aa
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 class nsSliderFrame;
22
23 class nsScrollbarButtonFrame : public nsButtonBoxFrame
24 {
25 public:
26 NS_DECL_FRAMEARENA_HELPERS
27
28 nsScrollbarButtonFrame(nsIPresShell* aPresShell, nsStyleContext* aContext):
29 nsButtonBoxFrame(aPresShell, aContext), mCursorOnThis(false) {}
30
31 // Overrides
32 virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
33
34 friend nsIFrame* NS_NewScrollbarButtonFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
35
36 virtual nsresult HandleEvent(nsPresContext* aPresContext,
37 mozilla::WidgetGUIEvent* aEvent,
38 nsEventStatus* aEventStatus) MOZ_OVERRIDE;
39
40 static nsresult GetChildWithTag(nsPresContext* aPresContext,
41 nsIAtom* atom, nsIFrame* start, nsIFrame*& result);
42 static nsresult GetParentWithTag(nsIAtom* atom, nsIFrame* start, nsIFrame*& result);
43
44 bool HandleButtonPress(nsPresContext* aPresContext,
45 mozilla::WidgetGUIEvent* aEvent,
46 nsEventStatus* aEventStatus);
47
48 NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext,
49 mozilla::WidgetGUIEvent* aEvent,
50 nsEventStatus* aEventStatus,
51 bool aControlHeld) MOZ_OVERRIDE
52 {
53 return NS_OK;
54 }
55
56 NS_IMETHOD HandleDrag(nsPresContext* aPresContext,
57 mozilla::WidgetGUIEvent* aEvent,
58 nsEventStatus* aEventStatus) MOZ_OVERRIDE
59 {
60 return NS_OK;
61 }
62
63 NS_IMETHOD HandleRelease(nsPresContext* aPresContext,
64 mozilla::WidgetGUIEvent* aEvent,
65 nsEventStatus* aEventStatus) MOZ_OVERRIDE;
66
67 protected:
68 virtual void MouseClicked(nsPresContext* aPresContext,
69 mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE;
70 void DoButtonAction(bool aSmoothScroll);
71
72 void StartRepeat() {
73 nsRepeatService::GetInstance()->Start(Notify, this);
74 }
75 void StopRepeat() {
76 nsRepeatService::GetInstance()->Stop(Notify, this);
77 }
78 void Notify();
79 static void Notify(void* aData) {
80 static_cast<nsScrollbarButtonFrame*>(aData)->Notify();
81 }
82
83 int32_t mIncrement;
84 bool mCursorOnThis;
85 };
86
87 #endif

mercurial