2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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-21 01:39:52 +04:00
|
|
|
|
|
|
|
//
|
|
|
|
// nsScrollbarFrame
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef nsScrollbarFrame_h__
|
|
|
|
#define nsScrollbarFrame_h__
|
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
1999-06-15 08:02:43 +04:00
|
|
|
#include "nsBoxFrame.h"
|
1999-07-01 02:17:43 +04:00
|
|
|
|
2000-06-07 03:13:05 +04:00
|
|
|
class nsIScrollbarMediator;
|
1999-04-21 01:39:52 +04:00
|
|
|
|
2006-03-27 01:30:36 +04:00
|
|
|
nsIFrame* NS_NewScrollbarFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
1999-04-21 01:39:52 +04:00
|
|
|
|
2011-07-11 18:05:09 +04:00
|
|
|
class nsScrollbarFrame : public nsBoxFrame
|
1999-04-21 01:39:52 +04:00
|
|
|
{
|
|
|
|
public:
|
2015-01-06 12:27:56 +03:00
|
|
|
explicit nsScrollbarFrame(nsStyleContext* aContext):
|
|
|
|
nsBoxFrame(aContext), mScrollbarMediator(nullptr) {}
|
1999-04-21 01:39:52 +04:00
|
|
|
|
2011-07-11 18:05:09 +04:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsScrollbarFrame)
|
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override {
|
2001-11-14 04:33:42 +03:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("ScrollbarFrame"), aResult);
|
1999-04-21 01:39:52 +04:00
|
|
|
}
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1999-06-15 08:02:43 +04:00
|
|
|
|
1999-11-02 01:12:45 +03:00
|
|
|
// nsIFrame overrides
|
2014-02-18 11:47:48 +04:00
|
|
|
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
|
2014-02-18 12:36:33 +04:00
|
|
|
nsIAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
int32_t aModType) override;
|
1999-06-15 08:02:43 +04:00
|
|
|
|
2009-01-12 22:20:59 +03:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
1999-04-21 01:39:52 +04:00
|
|
|
|
2009-01-12 22:20:59 +03:00
|
|
|
NS_IMETHOD HandlePress(nsPresContext* aPresContext,
|
2013-10-02 07:46:03 +04:00
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsEventStatus* aEventStatus) override;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext,
|
2013-10-02 07:46:03 +04:00
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
|
|
|
nsEventStatus* aEventStatus,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aControlHeld) override;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2011-08-03 07:39:02 +04:00
|
|
|
NS_IMETHOD HandleDrag(nsPresContext* aPresContext,
|
2013-10-02 07:46:03 +04:00
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsEventStatus* aEventStatus) override;
|
2011-08-03 07:39:02 +04:00
|
|
|
|
|
|
|
NS_IMETHOD HandleRelease(nsPresContext* aPresContext,
|
2013-10-02 07:46:03 +04:00
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsEventStatus* aEventStatus) override;
|
2011-08-03 07:39:02 +04:00
|
|
|
|
2014-05-25 02:20:40 +04:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsContainerFrame* aParent,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIFrame* aPrevInFlow) override;
|
1999-08-20 02:16:23 +04:00
|
|
|
|
2014-05-13 04:47:52 +04:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsReflowStatus& aStatus) override;
|
2004-01-09 22:21:20 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIAtom* GetType() const override;
|
2007-04-11 04:25:11 +04:00
|
|
|
|
2011-07-11 18:05:09 +04:00
|
|
|
void SetScrollbarMediatorContent(nsIContent* aMediator);
|
|
|
|
nsIScrollbarMediator* GetScrollbarMediator();
|
2000-06-07 03:13:05 +04:00
|
|
|
|
2004-07-16 20:56:21 +04:00
|
|
|
// nsBox methods
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Treat scrollbars as clipping their children; overflowing children
|
2009-04-06 04:31:50 +04:00
|
|
|
* will not be allowed to set an overflow rect on this
|
2004-07-16 20:56:21 +04: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 19:28:04 +03:00
|
|
|
virtual bool DoesClipChildren() override { return true; }
|
2006-12-07 22:53:41 +03:00
|
|
|
|
2015-04-21 23:09:48 +03:00
|
|
|
virtual nsresult GetMargin(nsMargin& aMargin) override;
|
2013-06-27 08:00:41 +04:00
|
|
|
|
2014-02-05 05:30:34 +04: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 16:14:26 +04:00
|
|
|
* @returns The new position after clamping, in CSS Pixels
|
2014-02-05 05:30:34 +04: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-07 03:13:05 +04:00
|
|
|
private:
|
2006-12-07 22:53:41 +03:00
|
|
|
nsCOMPtr<nsIContent> mScrollbarMediator;
|
1999-04-21 01:39:52 +04:00
|
|
|
}; // class nsScrollbarFrame
|
|
|
|
|
|
|
|
#endif
|