2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
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/. */
|
2002-03-31 23:26:43 +04:00
|
|
|
|
|
|
|
#ifndef nsIScrollbarMediator_h___
|
|
|
|
#define nsIScrollbarMediator_h___
|
|
|
|
|
2021-09-15 19:15:02 +03:00
|
|
|
#include "mozilla/ScrollTypes.h"
|
2009-01-12 22:20:59 +03:00
|
|
|
#include "nsQueryFrame.h"
|
2014-02-05 05:30:34 +04:00
|
|
|
#include "nsCoord.h"
|
2002-03-31 23:26:43 +04:00
|
|
|
|
2011-07-11 18:05:09 +04:00
|
|
|
class nsScrollbarFrame;
|
2014-02-14 10:40:53 +04:00
|
|
|
class nsIFrame;
|
2002-03-31 23:26:43 +04:00
|
|
|
|
2014-02-14 10:40:53 +04:00
|
|
|
class nsIScrollbarMediator : public nsQueryFrame {
|
2002-03-31 23:26:43 +04:00
|
|
|
public:
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsIScrollbarMediator)
|
2002-03-31 23:26:43 +04:00
|
|
|
|
2014-02-05 05:30:34 +04:00
|
|
|
/**
|
|
|
|
* The aScrollbar argument denotes the scrollbar that's firing the
|
|
|
|
* notification. aScrollbar is never null. aDirection is either -1, 0, or 1.
|
|
|
|
*/
|
|
|
|
|
2015-03-25 21:40:31 +03:00
|
|
|
/**
|
|
|
|
* When set to ENABLE_SNAP, additional scrolling will be performed after the
|
|
|
|
* scroll operation to maintain the constraints set by CSS Scroll snapping.
|
|
|
|
* The additional scrolling may include asynchronous smooth scrolls that
|
|
|
|
* continue to animate after the initial scroll position has been set.
|
2019-04-11 09:20:04 +03:00
|
|
|
* In case of DEFAULT, it means ENABLE_SNAP for CSS scroll snap v1,
|
|
|
|
* DISABLE_SNAP for the old scroll snap.
|
2015-03-25 21:40:31 +03:00
|
|
|
*/
|
2019-04-11 09:20:04 +03:00
|
|
|
enum ScrollSnapMode { DEFAULT, DISABLE_SNAP, ENABLE_SNAP };
|
2015-03-25 21:40:31 +03:00
|
|
|
|
2014-02-05 05:30:34 +04:00
|
|
|
/**
|
|
|
|
* One of the following three methods is called when the scrollbar's button is
|
|
|
|
* clicked.
|
|
|
|
* @note These methods might destroy the frame, pres shell, and other objects.
|
|
|
|
*/
|
2015-03-25 21:40:31 +03:00
|
|
|
virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
|
|
|
ScrollSnapMode aSnap = DISABLE_SNAP) = 0;
|
|
|
|
virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
|
|
|
ScrollSnapMode aSnap = DISABLE_SNAP) = 0;
|
|
|
|
virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
|
|
|
ScrollSnapMode aSnap = DISABLE_SNAP) = 0;
|
2021-02-26 14:47:18 +03:00
|
|
|
|
|
|
|
// Only implemented for nsGfxScrollFrame, not nsTreeBodyFrame.
|
|
|
|
virtual void ScrollByUnit(nsScrollbarFrame* aScrollbar,
|
|
|
|
mozilla::ScrollMode aMode, int32_t aDirection,
|
|
|
|
mozilla::ScrollUnit aUnit,
|
|
|
|
ScrollSnapMode aSnap = DISABLE_SNAP) = 0;
|
|
|
|
|
2014-02-05 05:30:34 +04:00
|
|
|
/**
|
|
|
|
* RepeatButtonScroll is called when the scrollbar's button is held down. When
|
|
|
|
* the button is first clicked the increment is set; RepeatButtonScroll adds
|
|
|
|
* this increment to the current position.
|
|
|
|
* @note This method might destroy the frame, pres shell, and other objects.
|
|
|
|
*/
|
|
|
|
virtual void RepeatButtonScroll(nsScrollbarFrame* aScrollbar) = 0;
|
|
|
|
/**
|
|
|
|
* aOldPos and aNewPos are scroll positions.
|
2014-11-06 12:06:22 +03:00
|
|
|
* The scroll positions start with zero at the left edge; implementors that
|
|
|
|
* want zero at the right edge for RTL content will need to adjust
|
|
|
|
* accordingly. (See ScrollFrameHelper::ThumbMoved in nsGfxScrollFrame.cpp.)
|
2014-02-05 05:30:34 +04:00
|
|
|
* @note This method might destroy the frame, pres shell, and other objects.
|
|
|
|
*/
|
|
|
|
virtual void ThumbMoved(nsScrollbarFrame* aScrollbar, nscoord aOldPos,
|
|
|
|
nscoord aNewPos) = 0;
|
2015-03-25 21:40:31 +03:00
|
|
|
/**
|
|
|
|
* Called when the scroll bar thumb, slider, or any other component is
|
|
|
|
* released.
|
|
|
|
*/
|
|
|
|
virtual void ScrollbarReleased(nsScrollbarFrame* aScrollbar) = 0;
|
2014-02-05 05:30:34 +04:00
|
|
|
virtual void VisibilityChanged(bool aVisible) = 0;
|
2014-02-14 10:40:53 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the frame for the horizontal or vertical scrollbar, or null
|
|
|
|
* if there is no such box.
|
|
|
|
*/
|
|
|
|
virtual nsIFrame* GetScrollbarBox(bool aVertical) = 0;
|
|
|
|
/**
|
|
|
|
* Show or hide scrollbars on 2 fingers touch.
|
|
|
|
* Subclasses should call their ScrollbarActivity's corresponding methods.
|
|
|
|
*/
|
|
|
|
virtual void ScrollbarActivityStarted() const = 0;
|
|
|
|
virtual void ScrollbarActivityStopped() const = 0;
|
2015-05-12 11:49:25 +03:00
|
|
|
|
|
|
|
virtual bool IsScrollbarOnRight() const = 0;
|
2016-03-10 06:57:15 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the mediator is asking the scrollbar to suppress
|
|
|
|
* repainting itself on changes.
|
|
|
|
*/
|
|
|
|
virtual bool ShouldSuppressScrollbarRepaints() const = 0;
|
2002-03-31 23:26:43 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|