|
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 // nsScrollbarFrame |
|
8 // |
|
9 |
|
10 #ifndef nsScrollbarFrame_h__ |
|
11 #define nsScrollbarFrame_h__ |
|
12 |
|
13 #include "mozilla/Attributes.h" |
|
14 #include "nsBoxFrame.h" |
|
15 |
|
16 class nsIScrollbarMediator; |
|
17 |
|
18 nsIFrame* NS_NewScrollbarFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
19 |
|
20 class nsScrollbarFrame : public nsBoxFrame |
|
21 { |
|
22 public: |
|
23 nsScrollbarFrame(nsIPresShell* aShell, nsStyleContext* aContext): |
|
24 nsBoxFrame(aShell, aContext), mScrollbarMediator(nullptr) {} |
|
25 |
|
26 NS_DECL_QUERYFRAME_TARGET(nsScrollbarFrame) |
|
27 |
|
28 #ifdef DEBUG_FRAME_DUMP |
|
29 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { |
|
30 return MakeFrameName(NS_LITERAL_STRING("ScrollbarFrame"), aResult); |
|
31 } |
|
32 #endif |
|
33 |
|
34 // nsIFrame overrides |
|
35 virtual nsresult AttributeChanged(int32_t aNameSpaceID, |
|
36 nsIAtom* aAttribute, |
|
37 int32_t aModType) MOZ_OVERRIDE; |
|
38 |
|
39 NS_DECL_QUERYFRAME |
|
40 NS_DECL_FRAMEARENA_HELPERS |
|
41 |
|
42 NS_IMETHOD HandlePress(nsPresContext* aPresContext, |
|
43 mozilla::WidgetGUIEvent* aEvent, |
|
44 nsEventStatus* aEventStatus) MOZ_OVERRIDE; |
|
45 |
|
46 NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext, |
|
47 mozilla::WidgetGUIEvent* aEvent, |
|
48 nsEventStatus* aEventStatus, |
|
49 bool aControlHeld) MOZ_OVERRIDE; |
|
50 |
|
51 NS_IMETHOD HandleDrag(nsPresContext* aPresContext, |
|
52 mozilla::WidgetGUIEvent* aEvent, |
|
53 nsEventStatus* aEventStatus) MOZ_OVERRIDE; |
|
54 |
|
55 NS_IMETHOD HandleRelease(nsPresContext* aPresContext, |
|
56 mozilla::WidgetGUIEvent* aEvent, |
|
57 nsEventStatus* aEventStatus) MOZ_OVERRIDE; |
|
58 |
|
59 virtual void Init(nsIContent* aContent, |
|
60 nsIFrame* aParent, |
|
61 nsIFrame* aPrevInFlow) MOZ_OVERRIDE; |
|
62 |
|
63 virtual nsresult Reflow(nsPresContext* aPresContext, |
|
64 nsHTMLReflowMetrics& aDesiredSize, |
|
65 const nsHTMLReflowState& aReflowState, |
|
66 nsReflowStatus& aStatus) MOZ_OVERRIDE; |
|
67 |
|
68 virtual nsIAtom* GetType() const MOZ_OVERRIDE; |
|
69 |
|
70 void SetScrollbarMediatorContent(nsIContent* aMediator); |
|
71 nsIScrollbarMediator* GetScrollbarMediator(); |
|
72 |
|
73 // nsBox methods |
|
74 |
|
75 /** |
|
76 * Treat scrollbars as clipping their children; overflowing children |
|
77 * will not be allowed to set an overflow rect on this |
|
78 * frame. This means that when the scroll code decides to hide a |
|
79 * scrollframe by setting its height or width to zero, that will |
|
80 * hide the children too. |
|
81 */ |
|
82 virtual bool DoesClipChildren() MOZ_OVERRIDE { return true; } |
|
83 |
|
84 virtual nsresult GetMargin(nsMargin& aMargin) MOZ_OVERRIDE; |
|
85 |
|
86 private: |
|
87 nsCOMPtr<nsIContent> mScrollbarMediator; |
|
88 }; // class nsScrollbarFrame |
|
89 |
|
90 #endif |