layout/xul/nsIScrollbarMediator.h
author Wes Kocher <wkocher@mozilla.com>
Wed, 25 Mar 2015 14:46:47 -0700
changeset 264609 a88e14943648e15ac2332f023cf18fb172a6598b
parent 264599 3ed9d5170d1386e5922df6ca06765922db08968c
child 264614 9711c8b664ea3fcb5ce9048caccfef885db41026
permissions -rw-r--r--
Backed out 2 changesets (bug 969250) on the other theory that it broke lots of tests, forcing a prolonged CLOSED TREE Backed out changeset 3c1005c81e52 (bug 969250) Backed out changeset 3ed9d5170d13 (bug 969250)

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */

#ifndef nsIScrollbarMediator_h___
#define nsIScrollbarMediator_h___

#include "nsQueryFrame.h"
#include "nsCoord.h"

class nsScrollbarFrame;
class nsIDOMEventTarget;
class nsIFrame;

class nsIScrollbarMediator : public nsQueryFrame
{
public:
  NS_DECL_QUERYFRAME_TARGET(nsIScrollbarMediator)

  /**
   * The aScrollbar argument denotes the scrollbar that's firing the notification.
   * aScrollbar is never null.
   * aDirection is either -1, 0, or 1.
   */

  /**
   * 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.
   */
  virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection) = 0;
  virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection) = 0;
  virtual void ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection) = 0;
  /**
   * 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.
   * 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.)
   * @note This method might destroy the frame, pres shell, and other objects.
   */
  virtual void ThumbMoved(nsScrollbarFrame* aScrollbar,
                          nscoord aOldPos,
                          nscoord aNewPos) = 0;
  virtual void VisibilityChanged(bool aVisible) = 0;

  /**
   * 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;
};

#endif