2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 14:30:37 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-04-20 21:39:52 +00:00
|
|
|
*
|
2004-04-18 14:30:37 +00:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1999-04-20 21:39:52 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-04-20 21:39:52 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 14:30:37 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-28 20:14:13 +00:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 03:40:37 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 14:30:37 +00:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-28 20:14:13 +00:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-18 14:30:37 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-28 20:14:13 +00:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-18 14:30:37 +00:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-28 20:14:13 +00:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-04-20 21:39:52 +00:00
|
|
|
|
1999-04-20 21:43:09 +00:00
|
|
|
#ifndef nsSliderFrame_h__
|
|
|
|
#define nsSliderFrame_h__
|
1999-04-20 21:39:52 +00:00
|
|
|
|
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
#include "nsBoxFrame.h"
|
1999-04-20 21:39:52 +00:00
|
|
|
#include "prtypes.h"
|
|
|
|
#include "nsIAtom.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2002-09-07 05:38:16 +00:00
|
|
|
#include "nsITimer.h"
|
2000-04-26 04:00:29 +00:00
|
|
|
#include "nsIDOMMouseListener.h"
|
1999-04-20 21:39:52 +00:00
|
|
|
|
|
|
|
class nsString;
|
1999-06-23 17:00:17 +00:00
|
|
|
class nsIScrollbarListener;
|
2007-10-15 03:42:27 +00:00
|
|
|
class nsISupportsArray;
|
1999-08-19 22:16:23 +00:00
|
|
|
class nsITimer;
|
2000-04-26 04:00:29 +00:00
|
|
|
class nsSliderFrame;
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2006-03-26 21:30:36 +00:00
|
|
|
nsIFrame* NS_NewSliderFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
1999-04-20 21:39:52 +00:00
|
|
|
|
2000-04-26 04:00:29 +00:00
|
|
|
class nsSliderMediator : public nsIDOMMouseListener,
|
|
|
|
public nsITimerCallback
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
nsSliderFrame* mSlider;
|
|
|
|
|
2003-01-08 21:19:10 +00:00
|
|
|
nsSliderMediator(nsSliderFrame* aSlider) { mSlider = aSlider; }
|
2000-04-26 04:00:29 +00:00
|
|
|
virtual ~nsSliderMediator() {}
|
|
|
|
|
|
|
|
virtual void SetSlider(nsSliderFrame* aSlider) { mSlider = aSlider; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Processes a mouse down event
|
|
|
|
* @param aMouseEvent @see nsIDOMEvent.h
|
|
|
|
* @returns whether the event was consumed or ignored. @see nsresult
|
|
|
|
*/
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
NS_IMETHOD MouseDown(nsIDOMEvent* aMouseEvent);
|
2000-04-26 04:00:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Processes a mouse up event
|
|
|
|
* @param aMouseEvent @see nsIDOMEvent.h
|
|
|
|
* @returns whether the event was consumed or ignored. @see nsresult
|
|
|
|
*/
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
NS_IMETHOD MouseUp(nsIDOMEvent* aMouseEvent);
|
2000-04-26 04:00:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Processes a mouse click event
|
|
|
|
* @param aMouseEvent @see nsIDOMEvent.h
|
|
|
|
* @returns whether the event was consumed or ignored. @see nsresult
|
|
|
|
*
|
|
|
|
*/
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
NS_IMETHOD MouseClick(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
2000-04-26 04:00:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Processes a mouse click event
|
|
|
|
* @param aMouseEvent @see nsIDOMEvent.h
|
|
|
|
* @returns whether the event was consumed or ignored. @see nsresult
|
|
|
|
*
|
|
|
|
*/
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
NS_IMETHOD MouseDblClick(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
2000-04-26 04:00:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Processes a mouse enter event
|
|
|
|
* @param aMouseEvent @see nsIDOMEvent.h
|
|
|
|
* @returns whether the event was consumed or ignored. @see nsresult
|
|
|
|
*/
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
NS_IMETHOD MouseOver(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
2000-04-26 04:00:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Processes a mouse leave event
|
|
|
|
* @param aMouseEvent @see nsIDOMEvent.h
|
|
|
|
* @returns whether the event was consumed or ignored. @see nsresult
|
|
|
|
*/
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
NS_IMETHOD MouseOut(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
2000-04-26 04:00:29 +00:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
2000-04-26 04:00:29 +00:00
|
|
|
|
2002-09-07 05:38:16 +00:00
|
|
|
NS_DECL_NSITIMERCALLBACK
|
2000-04-26 04:00:29 +00:00
|
|
|
|
2001-01-11 01:56:27 +00:00
|
|
|
|
2000-04-26 04:00:29 +00:00
|
|
|
}; // class nsSliderFrame
|
|
|
|
|
|
|
|
class nsSliderFrame : public nsBoxFrame
|
1999-04-20 21:39:52 +00:00
|
|
|
{
|
|
|
|
public:
|
2003-09-14 01:25:04 +00:00
|
|
|
friend class nsSliderMediator;
|
|
|
|
|
2006-03-26 21:30:36 +00:00
|
|
|
nsSliderFrame(nsIPresShell* aShell, nsStyleContext* aContext);
|
1999-08-19 22:16:23 +00:00
|
|
|
virtual ~nsSliderFrame();
|
1999-04-20 21:39:52 +00:00
|
|
|
|
1999-11-01 22:12:45 +00:00
|
|
|
#ifdef DEBUG
|
2001-11-14 01:33:42 +00:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const {
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("SliderFrame"), 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
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
// nsIBox
|
2007-01-08 02:57:59 +00:00
|
|
|
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
|
|
|
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
|
|
|
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
2000-07-07 22:24:06 +00:00
|
|
|
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
|
2000-03-31 07:02:06 +00:00
|
|
|
|
1999-11-01 22:12:45 +00:00
|
|
|
// nsIFrame overrides
|
2005-02-07 01:58:25 +00:00
|
|
|
NS_IMETHOD AppendFrames(nsIAtom* aListName,
|
2001-01-11 01:56:27 +00:00
|
|
|
nsIFrame* aFrameList);
|
|
|
|
|
2005-02-07 01:58:25 +00:00
|
|
|
NS_IMETHOD InsertFrames(nsIAtom* aListName,
|
2001-01-11 01:56:27 +00:00
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList);
|
|
|
|
|
2005-02-07 01:58:25 +00:00
|
|
|
NS_IMETHOD RemoveFrame(nsIAtom* aListName,
|
2001-01-11 01:56:27 +00:00
|
|
|
nsIFrame* aOldFrame);
|
|
|
|
|
2006-04-10 00:16:29 +00:00
|
|
|
virtual void Destroy();
|
1999-08-29 10:51:15 +00:00
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
NS_IMETHOD BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
|
|
|
|
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2005-09-07 16:49:21 +00:00
|
|
|
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
|
1999-06-15 04:02:43 +00:00
|
|
|
nsIAtom* aAttribute,
|
2003-07-11 21:16:12 +00:00
|
|
|
PRInt32 aModType);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2006-03-09 18:55:21 +00:00
|
|
|
NS_IMETHOD Init(nsIContent* aContent,
|
1999-06-15 04:02:43 +00:00
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* asPrevInFlow);
|
|
|
|
|
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
|
1999-06-15 04:02:43 +00:00
|
|
|
nsGUIEvent* aEvent,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsEventStatus* aEventStatus);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2006-04-10 00:16:29 +00:00
|
|
|
NS_IMETHOD SetInitialChildList(nsIAtom* aListName,
|
1999-06-15 04:02:43 +00:00
|
|
|
nsIFrame* aChildList);
|
|
|
|
|
2007-05-25 10:09:29 +00:00
|
|
|
virtual nsIAtom* GetType() const;
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
NS_IMETHOD MouseDown(nsIDOMEvent* aMouseEvent);
|
|
|
|
NS_IMETHOD MouseUp(nsIDOMEvent* aMouseEvent);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 17:42:36 +00:00
|
|
|
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
static PRInt32 GetCurrentPosition(nsIContent* content);
|
2006-05-30 13:50:48 +00:00
|
|
|
static PRInt32 GetMinPosition(nsIContent* content);
|
1999-06-15 04:02:43 +00:00
|
|
|
static PRInt32 GetMaxPosition(nsIContent* content);
|
|
|
|
static PRInt32 GetIncrement(nsIContent* content);
|
|
|
|
static PRInt32 GetPageIncrement(nsIContent* content);
|
|
|
|
static PRInt32 GetIntegerAttribute(nsIContent* content, nsIAtom* atom, PRInt32 defaultValue);
|
2000-03-31 07:02:06 +00:00
|
|
|
void EnsureOrient();
|
1999-06-15 04:02:43 +00:00
|
|
|
|
1999-06-23 17:00:17 +00:00
|
|
|
void SetScrollbarListener(nsIScrollbarListener* aListener);
|
1999-06-15 04:02:43 +00:00
|
|
|
|
2004-07-20 00:02:43 +00:00
|
|
|
virtual nsIView* GetMouseCapturer() const { return GetView(); }
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD HandlePress(nsPresContext* aPresContext,
|
1999-08-19 22:16:23 +00:00
|
|
|
nsGUIEvent * aEvent,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsEventStatus* aEventStatus);
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext,
|
1999-08-19 22:16:23 +00:00
|
|
|
nsGUIEvent * aEvent,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsEventStatus* aEventStatus) { return NS_OK; }
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD HandleDrag(nsPresContext* aPresContext,
|
1999-08-19 22:16:23 +00:00
|
|
|
nsGUIEvent * aEvent,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsEventStatus* aEventStatus) { return NS_OK; }
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD HandleRelease(nsPresContext* aPresContext,
|
1999-08-19 22:16:23 +00:00
|
|
|
nsGUIEvent * aEvent,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsEventStatus* aEventStatus);
|
1999-08-19 22:16:23 +00:00
|
|
|
|
2000-01-21 21:56:09 +00:00
|
|
|
NS_IMETHOD_(void) Notify(nsITimer *timer);
|
1999-08-19 22:16:23 +00:00
|
|
|
|
1999-06-15 04:02:43 +00:00
|
|
|
private:
|
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
nsIBox* GetScrollbar();
|
|
|
|
|
2007-04-09 22:39:57 +00:00
|
|
|
void PageUpDown(nscoord change);
|
2007-05-25 10:09:29 +00:00
|
|
|
void SetCurrentPosition(nsIContent* scrollbar, nscoord pos, PRBool aIsSmooth,
|
|
|
|
PRBool aImmediateRedraw);
|
|
|
|
void SetCurrentPositionInternal(nsIContent* scrollbar, nscoord pos,
|
|
|
|
PRBool aIsSmooth, PRBool aImmediateRedraw);
|
|
|
|
nsresult CurrentPositionChanged(nsPresContext* aPresContext,
|
|
|
|
PRBool aImmediateRedraw);
|
2003-09-14 01:25:04 +00:00
|
|
|
void DragThumb(PRBool aGrabMouseEvents);
|
1999-06-15 04:02:43 +00:00
|
|
|
void AddListener();
|
|
|
|
void RemoveListener();
|
2003-09-14 01:25:04 +00:00
|
|
|
PRBool isDraggingThumb();
|
1999-06-15 04:02:43 +00:00
|
|
|
|
|
|
|
float mRatio;
|
|
|
|
|
2004-08-28 11:41:02 +00:00
|
|
|
nscoord mDragStart;
|
1999-06-15 04:02:43 +00:00
|
|
|
nscoord mThumbStart;
|
1999-04-20 21:39:52 +00:00
|
|
|
|
1999-06-23 17:00:17 +00:00
|
|
|
PRInt32 mCurPos;
|
|
|
|
|
|
|
|
nsIScrollbarListener* mScrollbarListener;
|
|
|
|
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-09 22:02:40 +00:00
|
|
|
nscoord mChange;
|
2004-01-27 05:19:57 +00:00
|
|
|
nsPoint mDestinationPoint;
|
2000-04-26 04:00:29 +00:00
|
|
|
nsSliderMediator* mMediator;
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-09 22:02:40 +00:00
|
|
|
|
2004-01-27 05:19:57 +00:00
|
|
|
static PRBool gMiddlePref;
|
|
|
|
static PRInt32 gSnapMultiplier;
|
1999-04-20 21:43:09 +00:00
|
|
|
}; // class nsSliderFrame
|
1999-04-20 21:39:52 +00:00
|
|
|
|
|
|
|
#endif
|