2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
Eric D Vaughan
|
|
|
|
This class lays out its children either vertically or horizontally
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef nsScrollbarButtonFrame_h___
|
|
|
|
#define nsScrollbarButtonFrame_h___
|
|
|
|
|
|
|
|
#include "nsButtonBoxFrame.h"
|
|
|
|
#include "nsITimer.h"
|
2008-02-14 18:04:34 -08:00
|
|
|
#include "nsRepeatService.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsSliderFrame;
|
|
|
|
|
2008-02-14 18:04:34 -08:00
|
|
|
class nsScrollbarButtonFrame : public nsButtonBoxFrame
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsScrollbarButtonFrame(nsIPresShell* aPresShell, nsStyleContext* aContext):
|
2011-11-17 15:41:35 -08:00
|
|
|
nsButtonBoxFrame(aPresShell, aContext), mCursorOnThis(false) {}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Overrides
|
2009-12-23 21:21:15 -08:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
friend nsIFrame* NS_NewScrollbarButtonFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
|
|
|
|
|
|
|
NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
|
|
|
|
nsGUIEvent* aEvent,
|
|
|
|
nsEventStatus* aEventStatus);
|
|
|
|
|
|
|
|
static nsresult GetChildWithTag(nsPresContext* aPresContext,
|
|
|
|
nsIAtom* atom, nsIFrame* start, nsIFrame*& result);
|
|
|
|
static nsresult GetParentWithTag(nsIAtom* atom, nsIFrame* start, nsIFrame*& result);
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool HandleButtonPress(nsPresContext* aPresContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsGUIEvent * aEvent,
|
|
|
|
nsEventStatus* aEventStatus);
|
|
|
|
|
|
|
|
NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext,
|
2009-07-28 05:53:20 -07:00
|
|
|
nsGUIEvent * aEvent,
|
|
|
|
nsEventStatus* aEventStatus,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aControlHeld) { return NS_OK; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-08-02 20:39:02 -07:00
|
|
|
NS_IMETHOD HandleDrag(nsPresContext* aPresContext,
|
|
|
|
nsGUIEvent * aEvent,
|
|
|
|
nsEventStatus* aEventStatus) { return NS_OK; }
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD HandleRelease(nsPresContext* aPresContext,
|
|
|
|
nsGUIEvent * aEvent,
|
|
|
|
nsEventStatus* aEventStatus);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void MouseClicked(nsPresContext* aPresContext, nsGUIEvent* aEvent);
|
2011-09-28 23:19:26 -07:00
|
|
|
void DoButtonAction(bool aSmoothScroll);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-02-14 18:04:34 -08:00
|
|
|
void StartRepeat() {
|
|
|
|
nsRepeatService::GetInstance()->Start(Notify, this);
|
|
|
|
}
|
|
|
|
void StopRepeat() {
|
|
|
|
nsRepeatService::GetInstance()->Stop(Notify, this);
|
|
|
|
}
|
|
|
|
void Notify();
|
|
|
|
static void Notify(void* aData) {
|
|
|
|
static_cast<nsScrollbarButtonFrame*>(aData)->Notify();
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-02-14 18:04:34 -08:00
|
|
|
PRInt32 mIncrement;
|
2011-11-17 15:41:35 -08:00
|
|
|
bool mCursorOnThis;
|
2008-02-14 18:04:34 -08:00
|
|
|
};
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#endif
|