Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing 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/. */
6 //
7 // nsScrollbarFrame
8 //
10 #ifndef nsScrollbarFrame_h__
11 #define nsScrollbarFrame_h__
13 #include "mozilla/Attributes.h"
14 #include "nsBoxFrame.h"
16 class nsIScrollbarMediator;
18 nsIFrame* NS_NewScrollbarFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
20 class nsScrollbarFrame : public nsBoxFrame
21 {
22 public:
23 nsScrollbarFrame(nsIPresShell* aShell, nsStyleContext* aContext):
24 nsBoxFrame(aShell, aContext), mScrollbarMediator(nullptr) {}
26 NS_DECL_QUERYFRAME_TARGET(nsScrollbarFrame)
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
34 // nsIFrame overrides
35 virtual nsresult AttributeChanged(int32_t aNameSpaceID,
36 nsIAtom* aAttribute,
37 int32_t aModType) MOZ_OVERRIDE;
39 NS_DECL_QUERYFRAME
40 NS_DECL_FRAMEARENA_HELPERS
42 NS_IMETHOD HandlePress(nsPresContext* aPresContext,
43 mozilla::WidgetGUIEvent* aEvent,
44 nsEventStatus* aEventStatus) MOZ_OVERRIDE;
46 NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext,
47 mozilla::WidgetGUIEvent* aEvent,
48 nsEventStatus* aEventStatus,
49 bool aControlHeld) MOZ_OVERRIDE;
51 NS_IMETHOD HandleDrag(nsPresContext* aPresContext,
52 mozilla::WidgetGUIEvent* aEvent,
53 nsEventStatus* aEventStatus) MOZ_OVERRIDE;
55 NS_IMETHOD HandleRelease(nsPresContext* aPresContext,
56 mozilla::WidgetGUIEvent* aEvent,
57 nsEventStatus* aEventStatus) MOZ_OVERRIDE;
59 virtual void Init(nsIContent* aContent,
60 nsIFrame* aParent,
61 nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
63 virtual nsresult Reflow(nsPresContext* aPresContext,
64 nsHTMLReflowMetrics& aDesiredSize,
65 const nsHTMLReflowState& aReflowState,
66 nsReflowStatus& aStatus) MOZ_OVERRIDE;
68 virtual nsIAtom* GetType() const MOZ_OVERRIDE;
70 void SetScrollbarMediatorContent(nsIContent* aMediator);
71 nsIScrollbarMediator* GetScrollbarMediator();
73 // nsBox methods
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; }
84 virtual nsresult GetMargin(nsMargin& aMargin) MOZ_OVERRIDE;
86 private:
87 nsCOMPtr<nsIContent> mScrollbarMediator;
88 }; // class nsScrollbarFrame
90 #endif