2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-04-20 21:39:52 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// nsScrollbarFrame
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef nsScrollbarFrame_h__
|
|
|
|
#define nsScrollbarFrame_h__
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
1999-06-15 04:02:43 +00:00
|
|
|
#include "nsBoxFrame.h"
|
1999-06-30 22:17:43 +00:00
|
|
|
|
2000-06-06 23:13:05 +00:00
|
|
|
class nsIScrollbarMediator;
|
1999-04-20 21:39:52 +00:00
|
|
|
|
2006-03-26 21:30:36 +00:00
|
|
|
nsIFrame* NS_NewScrollbarFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
1999-04-20 21:39:52 +00:00
|
|
|
|
2011-07-11 14:05:09 +00:00
|
|
|
class nsScrollbarFrame : public nsBoxFrame
|
1999-04-20 21:39:52 +00:00
|
|
|
{
|
|
|
|
public:
|
2015-01-06 09:27:56 +00:00
|
|
|
explicit nsScrollbarFrame(nsStyleContext* aContext):
|
|
|
|
nsBoxFrame(aContext), mScrollbarMediator(nullptr) {}
|
1999-04-20 21:39:52 +00:00
|
|
|
|
2011-07-11 14:05:09 +00:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsScrollbarFrame)
|
|
|
|
|
2014-01-05 23:31:14 +00:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override {
|
2001-11-14 01:33:42 +00:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("ScrollbarFrame"), aResult);
|
1999-04-20 21:39:52 +00:00
|
|
|
}
|
1999-11-01 22:12:45 +00:00
|
|
|
#endif
|
1999-06-15 04:02:43 +00:00
|
|
|
|
1999-11-01 22:12:45 +00:00
|
|
|
// nsIFrame overrides
|
2014-02-18 07:47:48 +00:00
|
|
|
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
|
2014-02-18 08:36:33 +00:00
|
|
|
nsIAtom* aAttribute,
|
2015-03-21 16:28:04 +00:00
|
|
|
int32_t aModType) override;
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2009-01-12 19:20:59 +00:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
1999-04-20 21:39:52 +00:00
|
|
|
|
2009-01-12 19:20:59 +00:00
|
|
|
NS_IMETHOD HandlePress(nsPresContext* aPresContext,
|
2013-10-02 03:46:03 +00:00
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsEventStatus* aEventStatus) override;
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext,
|
2013-10-02 03:46:03 +00:00
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
|
|
|
nsEventStatus* aEventStatus,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aControlHeld) override;
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2011-08-03 03:39:02 +00:00
|
|
|
NS_IMETHOD HandleDrag(nsPresContext* aPresContext,
|
2013-10-02 03:46:03 +00:00
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsEventStatus* aEventStatus) override;
|
2011-08-03 03:39:02 +00:00
|
|
|
|
|
|
|
NS_IMETHOD HandleRelease(nsPresContext* aPresContext,
|
2013-10-02 03:46:03 +00:00
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsEventStatus* aEventStatus) override;
|
2011-08-03 03:39:02 +00:00
|
|
|
|
2014-05-24 22:20:40 +00:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsContainerFrame* aParent,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsIFrame* aPrevInFlow) override;
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2014-05-13 00:47:52 +00:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsReflowStatus& aStatus) override;
|
2004-01-09 19:21:20 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsIAtom* GetType() const override;
|
2007-04-11 00:25:11 +00:00
|
|
|
|
2011-07-11 14:05:09 +00:00
|
|
|
void SetScrollbarMediatorContent(nsIContent* aMediator);
|
|
|
|
nsIScrollbarMediator* GetScrollbarMediator();
|
2000-06-06 23:13:05 +00:00
|
|
|
|
2004-07-16 16:56:21 +00:00
|
|
|
// nsBox methods
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Treat scrollbars as clipping their children; overflowing children
|
2009-04-06 00:31:50 +00:00
|
|
|
* will not be allowed to set an overflow rect on this
|
2004-07-16 16:56:21 +00:00
|
|
|
* frame. This means that when the scroll code decides to hide a
|
|
|
|
* scrollframe by setting its height or width to zero, that will
|
|
|
|
* hide the children too.
|
|
|
|
*/
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool DoesClipChildren() override { return true; }
|
2006-12-07 19:53:41 +00:00
|
|
|
|
2015-04-21 20:09:48 +00:00
|
|
|
virtual nsresult GetMargin(nsMargin& aMargin) override;
|
2013-06-27 04:00:41 +00:00
|
|
|
|
2014-02-05 01:30:34 +00:00
|
|
|
/**
|
|
|
|
* The following three methods set the value of mIncrement when a
|
|
|
|
* scrollbar button is pressed.
|
|
|
|
*/
|
|
|
|
void SetIncrementToLine(int32_t aDirection);
|
|
|
|
void SetIncrementToPage(int32_t aDirection);
|
|
|
|
void SetIncrementToWhole(int32_t aDirection);
|
|
|
|
/**
|
|
|
|
* MoveToNewPosition() adds mIncrement to the current position and
|
|
|
|
* updates the curpos attribute.
|
2014-10-09 12:14:26 +00:00
|
|
|
* @returns The new position after clamping, in CSS Pixels
|
2014-02-05 01:30:34 +00:00
|
|
|
* @note This method might destroy the frame, pres shell, and other objects.
|
|
|
|
*/
|
|
|
|
int32_t MoveToNewPosition();
|
|
|
|
int32_t GetIncrement() { return mIncrement; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int32_t mIncrement; // Amount to scroll, in CSSPixels
|
|
|
|
bool mSmoothScroll;
|
|
|
|
|
2000-06-06 23:13:05 +00:00
|
|
|
private:
|
2006-12-07 19:53:41 +00:00
|
|
|
nsCOMPtr<nsIContent> mScrollbarMediator;
|
1999-04-20 21:39:52 +00:00
|
|
|
}; // class nsScrollbarFrame
|
|
|
|
|
|
|
|
#endif
|