2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1999-06-30 22:17:43 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* The contents of this file are subject to the Netscape 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/NPL/
|
1999-06-30 22:17:43 +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-06-30 22:17:43 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* 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):
|
2000-11-16 22:25:45 +00:00
|
|
|
* Blake Ross <blakeross@telocity.com>
|
2001-09-28 20:14:13 +00:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either 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"),
|
|
|
|
* 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
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* 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
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-06-30 22:17:43 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Eric Vaughan
|
|
|
|
// Netscape Communications
|
|
|
|
//
|
|
|
|
// See documentation in associated header file
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "nsSplitterFrame.h"
|
|
|
|
#include "nsXULAtoms.h"
|
|
|
|
#include "nsHTMLAtoms.h"
|
|
|
|
#include "nsISupportsArray.h"
|
|
|
|
#include "nsIDOMElement.h"
|
|
|
|
#include "nsIDOMDocument.h"
|
|
|
|
#include "nsIXMLContent.h"
|
2000-03-11 10:34:29 +00:00
|
|
|
#include "nsIPresContext.h"
|
2000-12-30 19:22:22 +00:00
|
|
|
#include "nsIDocument.h"
|
1999-06-30 22:17:43 +00:00
|
|
|
#include "nsINameSpaceManager.h"
|
|
|
|
#include "nsScrollbarButtonFrame.h"
|
1999-09-05 20:46:59 +00:00
|
|
|
#include "nsIDOMMouseListener.h"
|
|
|
|
#include "nsIDOMMouseMotionListener.h"
|
2000-12-30 19:22:22 +00:00
|
|
|
#include "nsIDOMEventReceiver.h"
|
1999-09-05 20:46:59 +00:00
|
|
|
#include "nsIView.h"
|
|
|
|
#include "nsIViewManager.h"
|
|
|
|
#include "nsIScrollableView.h"
|
1999-11-03 07:11:45 +00:00
|
|
|
#include "nsIDOMMouseEvent.h"
|
1999-09-05 20:46:59 +00:00
|
|
|
#include "nsIPresShell.h"
|
|
|
|
#include "nsFrameNavigator.h"
|
|
|
|
#include "nsHTMLParts.h"
|
2000-11-16 22:25:45 +00:00
|
|
|
#include "nsILookAndFeel.h"
|
1999-09-05 20:46:59 +00:00
|
|
|
#include "nsIPresShell.h"
|
1999-09-14 22:17:19 +00:00
|
|
|
#include "nsIStyleContext.h"
|
|
|
|
#include "nsWidgetsCID.h"
|
2000-03-31 07:02:06 +00:00
|
|
|
#include "nsBoxLayoutState.h"
|
2000-05-09 21:42:40 +00:00
|
|
|
#include "nsIXBLService.h"
|
|
|
|
#include "nsIServiceManager.h"
|
2000-09-01 00:59:09 +00:00
|
|
|
#include "nsHTMLContainerFrame.h"
|
2001-02-19 21:50:04 +00:00
|
|
|
#include "nsINodeInfo.h"
|
2001-07-16 02:40:48 +00:00
|
|
|
#include "nsGUIEvent.h"
|
2001-02-19 21:50:04 +00:00
|
|
|
|
|
|
|
#include "nsContentCID.h"
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
const PRInt32 kMaxZ = 0x7fffffff; //XXX: Shouldn't there be a define somewhere for MaxInt for PRInt32
|
2002-01-09 15:46:39 +00:00
|
|
|
// was used in nsSplitterFrame::Init but now commented out
|
|
|
|
//static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
|
2000-11-16 22:25:45 +00:00
|
|
|
PRInt32 realTimeDrag;
|
1999-06-30 22:17:43 +00:00
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
class nsSplitterInfo {
|
|
|
|
public:
|
|
|
|
nscoord min;
|
|
|
|
nscoord max;
|
|
|
|
nscoord current;
|
|
|
|
nscoord changed;
|
2000-03-31 07:02:06 +00:00
|
|
|
nsIBox* child;
|
2000-01-18 23:14:25 +00:00
|
|
|
PRInt32 flex;
|
1999-09-05 20:46:59 +00:00
|
|
|
PRInt32 index;
|
|
|
|
};
|
|
|
|
|
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
|
|
|
class nsSplitterFrameInner : public nsIDOMMouseListener, public nsIDOMMouseMotionListener {
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
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
|
|
|
nsSplitterFrameInner(nsSplitterFrame* aSplitter)
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
2002-09-07 17:13:19 +00:00
|
|
|
NS_INIT_ISUPPORTS();
|
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
|
|
|
mOuter = aSplitter;
|
1999-09-05 20:46:59 +00:00
|
|
|
mPressed = PR_FALSE;
|
|
|
|
}
|
2000-04-03 03:55:38 +00:00
|
|
|
virtual ~nsSplitterFrameInner();
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
// mouse listener
|
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);
|
|
|
|
NS_IMETHOD MouseClick(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
|
|
|
NS_IMETHOD MouseDblClick(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
|
|
|
NS_IMETHOD MouseOver(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
|
|
|
NS_IMETHOD MouseOut(nsIDOMEvent* aMouseEvent) { return MouseMove(aMouseEvent); }
|
|
|
|
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
// mouse motion listener
|
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 MouseMove(nsIDOMEvent* aMouseEvent);
|
|
|
|
NS_IMETHOD DragMove(nsIDOMEvent* aMouseEvent) { return NS_OK; }
|
1999-09-05 20:46:59 +00:00
|
|
|
|
1999-11-24 06:03:41 +00:00
|
|
|
void MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent);
|
|
|
|
void MouseUp(nsIPresContext* aPresContext, nsGUIEvent* aEvent);
|
1999-09-05 20:46:59 +00:00
|
|
|
|
1999-11-24 06:03:41 +00:00
|
|
|
void AdjustChildren(nsIPresContext* aPresContext);
|
|
|
|
void AdjustChildren(nsIPresContext* aPresContext, nsSplitterInfo* aChildInfos, PRInt32 aCount, PRBool aIsHorizontal);
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
void AddRemoveSpace(nscoord aDiff,
|
|
|
|
nsSplitterInfo* aChildInfos,
|
|
|
|
PRInt32 aCount,
|
|
|
|
PRInt32& aSpaceLeft);
|
|
|
|
|
1999-10-26 04:44:41 +00:00
|
|
|
void ResizeChildTo(nsIPresContext* aPresContext,
|
|
|
|
nscoord& aDiff,
|
1999-09-05 20:46:59 +00:00
|
|
|
nsSplitterInfo* aChildrenBeforeInfos,
|
|
|
|
nsSplitterInfo* aChildrenAfterInfos,
|
|
|
|
PRInt32 aChildrenBeforeCount,
|
|
|
|
PRInt32 aChildrenAfterCount,
|
|
|
|
PRBool aBounded);
|
|
|
|
|
|
|
|
void UpdateState();
|
|
|
|
|
2000-01-22 01:16:50 +00:00
|
|
|
void AddListener(nsIPresContext* aPresContext);
|
1999-09-05 20:46:59 +00:00
|
|
|
void RemoveListener();
|
|
|
|
|
1999-09-08 23:51:02 +00:00
|
|
|
enum ResizeType { Closest, Farthest, Grow };
|
1999-09-05 20:46:59 +00:00
|
|
|
enum State { Open, Collapsed, Dragging };
|
1999-09-14 22:17:19 +00:00
|
|
|
enum CollapseDirection { Before, After, None };
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
ResizeType GetResizeBefore();
|
|
|
|
ResizeType GetResizeAfter();
|
|
|
|
State GetState();
|
|
|
|
|
2000-05-26 06:42:29 +00:00
|
|
|
//nsresult CaptureMouse(nsIPresContext* aPresContext, PRBool aGrabMouseEvents);
|
|
|
|
//PRBool IsMouseCaptured(nsIPresContext* aPresContext);
|
1999-09-05 20:46:59 +00:00
|
|
|
void Reverse(nsSplitterInfo*& aIndexes, PRInt32 aCount);
|
1999-09-14 22:17:19 +00:00
|
|
|
CollapseDirection GetCollapseDirection();
|
1999-09-05 20:46:59 +00:00
|
|
|
|
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
|
|
|
void MoveSplitterBy(nsIPresContext* aPresContext, nscoord aDiff);
|
2000-03-31 07:02:06 +00:00
|
|
|
void EnsureOrient();
|
2000-04-11 23:55:15 +00:00
|
|
|
void SetPreferredSize(nsBoxLayoutState& aState, nsIBox* aChildBox, nscoord aOnePixel, PRBool aIsHorizontal, nscoord* aSize);
|
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
|
|
|
|
|
|
|
nsSplitterFrame* mOuter;
|
1999-09-05 20:46:59 +00:00
|
|
|
PRBool mDidDrag;
|
|
|
|
nscoord mDragStartPx;
|
|
|
|
nscoord mCurrentPos;
|
2000-03-31 07:02:06 +00:00
|
|
|
nsIBox* mParentBox;
|
1999-09-05 20:46:59 +00:00
|
|
|
PRBool mPressed;
|
|
|
|
nsSplitterInfo* mChildInfosBefore;
|
|
|
|
nsSplitterInfo* mChildInfosAfter;
|
|
|
|
PRInt32 mChildInfosBeforeCount;
|
|
|
|
PRInt32 mChildInfosAfterCount;
|
|
|
|
State mState;
|
|
|
|
nscoord mSplitterPos;
|
1999-09-08 23:51:02 +00:00
|
|
|
nscoord mSplitterViewPos;
|
2000-08-30 21:51:02 +00:00
|
|
|
PRBool mDragging;
|
2000-03-31 07:02:06 +00:00
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
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
|
|
|
NS_IMPL_ISUPPORTS2(nsSplitterFrameInner, nsIDOMMouseListener, nsIDOMMouseMotionListener)
|
1999-09-05 20:46:59 +00:00
|
|
|
|
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
|
|
|
nsSplitterFrameInner::ResizeType
|
|
|
|
nsSplitterFrameInner::GetResizeBefore()
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIContent> content;
|
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
|
|
|
mOuter->GetContent(getter_AddRefs(content));
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
nsString value;
|
2001-08-17 08:14:14 +00:00
|
|
|
content->GetAttr(kNameSpaceID_None, nsXULAtoms::resizebefore, value);
|
1999-09-08 23:51:02 +00:00
|
|
|
if (value.EqualsIgnoreCase("farthest"))
|
|
|
|
return Farthest;
|
1999-09-05 20:46:59 +00:00
|
|
|
else
|
|
|
|
return Closest;
|
|
|
|
}
|
|
|
|
|
2000-04-03 03:55:38 +00:00
|
|
|
nsSplitterFrameInner::~nsSplitterFrameInner()
|
|
|
|
{
|
|
|
|
delete[] mChildInfosBefore;
|
|
|
|
delete[] mChildInfosAfter;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
nsSplitterFrameInner::ResizeType
|
|
|
|
nsSplitterFrameInner::GetResizeAfter()
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIContent> content;
|
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
|
|
|
mOuter->GetContent(getter_AddRefs(content));
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
nsString value;
|
2001-08-17 08:14:14 +00:00
|
|
|
content->GetAttr(kNameSpaceID_None, nsXULAtoms::resizeafter, value);
|
1999-09-08 23:51:02 +00:00
|
|
|
if (value.EqualsIgnoreCase("farthest"))
|
|
|
|
return Farthest;
|
1999-09-05 20:46:59 +00:00
|
|
|
else if (value.EqualsIgnoreCase("grow"))
|
|
|
|
return Grow;
|
|
|
|
else
|
|
|
|
return Closest;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
nsSplitterFrameInner::State
|
|
|
|
nsSplitterFrameInner::GetState()
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIContent> content;
|
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
|
|
|
mOuter->GetContent(getter_AddRefs(content));
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
nsString value;
|
2001-08-17 08:14:14 +00:00
|
|
|
content->GetAttr(kNameSpaceID_None, nsXULAtoms::state, value);
|
1999-09-05 20:46:59 +00:00
|
|
|
if (value.EqualsIgnoreCase("dragging"))
|
|
|
|
return Dragging;
|
|
|
|
else if (value.EqualsIgnoreCase("collapsed"))
|
|
|
|
return Collapsed;
|
|
|
|
else
|
|
|
|
return Open;
|
|
|
|
|
|
|
|
}
|
1999-06-30 22:17:43 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// NS_NewSplitterFrame
|
|
|
|
//
|
|
|
|
// Creates a new Toolbar frame and returns it in |aNewFrame|
|
|
|
|
//
|
|
|
|
nsresult
|
1999-12-04 23:49:50 +00:00
|
|
|
NS_NewSplitterFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame )
|
1999-06-30 22:17:43 +00:00
|
|
|
{
|
|
|
|
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
|
|
|
if (nsnull == aNewFrame) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
2000-03-02 03:01:30 +00:00
|
|
|
nsSplitterFrame* it = new (aPresShell) nsSplitterFrame(aPresShell);
|
1999-06-30 22:17:43 +00:00
|
|
|
if (nsnull == it)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
*aNewFrame = it;
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
} // NS_NewSplitterFrame
|
|
|
|
|
2000-03-02 03:01:30 +00:00
|
|
|
nsSplitterFrame::nsSplitterFrame(nsIPresShell* aPresShell):nsBoxFrame(aPresShell)
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
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
|
|
|
mInner = new nsSplitterFrameInner(this);
|
|
|
|
mInner->AddRef();
|
|
|
|
mInner->mChildInfosAfter = nsnull;
|
|
|
|
mInner->mChildInfosBefore = nsnull;
|
|
|
|
mInner->mState = nsSplitterFrameInner::Open;
|
2000-08-30 21:51:02 +00:00
|
|
|
mInner->mDragging = PR_FALSE;
|
1999-09-05 20:46:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsSplitterFrame::~nsSplitterFrame()
|
|
|
|
{
|
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
|
|
|
mInner->RemoveListener();
|
|
|
|
mInner->Release();
|
1999-09-05 20:46:59 +00:00
|
|
|
}
|
|
|
|
|
2000-05-26 06:42:29 +00:00
|
|
|
|
1999-12-22 01:57:29 +00:00
|
|
|
//
|
|
|
|
// QueryInterface
|
|
|
|
//
|
1999-12-21 19:28:15 +00:00
|
|
|
NS_INTERFACE_MAP_BEGIN(nsSplitterFrame)
|
2000-01-26 22:35:53 +00:00
|
|
|
NS_INTERFACE_MAP_END_INHERITING(nsBoxFrame)
|
1999-12-22 01:57:29 +00:00
|
|
|
|
1999-12-21 19:28:15 +00:00
|
|
|
|
1999-09-14 22:17:19 +00:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsSplitterFrame::GetCursor(nsIPresContext* aPresContext,
|
1999-09-14 22:17:19 +00:00
|
|
|
nsPoint& aPoint,
|
|
|
|
PRInt32& aCursor)
|
|
|
|
{
|
2000-01-18 23:14:25 +00:00
|
|
|
return nsBoxFrame::GetCursor(aPresContext, aPoint, aCursor);
|
|
|
|
|
|
|
|
/*
|
1999-09-14 22:17:19 +00:00
|
|
|
if (IsHorizontal())
|
|
|
|
aCursor = NS_STYLE_CURSOR_N_RESIZE;
|
|
|
|
else
|
|
|
|
aCursor = NS_STYLE_CURSOR_W_RESIZE;
|
2000-01-18 23:14:25 +00:00
|
|
|
|
1999-09-14 22:17:19 +00:00
|
|
|
return NS_OK;
|
2000-01-18 23:14:25 +00:00
|
|
|
*/
|
1999-09-14 22:17:19 +00:00
|
|
|
}
|
|
|
|
|
1999-06-30 22:17:43 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSplitterFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aChild,
|
1999-10-15 23:16:45 +00:00
|
|
|
PRInt32 aNameSpaceID,
|
1999-06-30 22:17:43 +00:00
|
|
|
nsIAtom* aAttribute,
|
2001-08-25 02:01:08 +00:00
|
|
|
PRInt32 aModType,
|
1999-06-30 22:17:43 +00:00
|
|
|
PRInt32 aHint)
|
|
|
|
{
|
|
|
|
nsresult rv = nsBoxFrame::AttributeChanged(aPresContext, aChild,
|
2001-08-25 02:01:08 +00:00
|
|
|
aNameSpaceID, aAttribute, aModType, aHint);
|
1999-06-30 22:17:43 +00:00
|
|
|
// if the alignment changed. Let the grippy know
|
|
|
|
if (aAttribute == nsHTMLAtoms::align) {
|
|
|
|
// tell the slider its attribute changed so it can
|
|
|
|
// update itself
|
|
|
|
nsIFrame* grippy = nsnull;
|
2000-01-22 01:16:50 +00:00
|
|
|
nsScrollbarButtonFrame::GetChildWithTag(aPresContext, nsXULAtoms::grippy, this, grippy);
|
1999-06-30 22:17:43 +00:00
|
|
|
if (grippy)
|
2001-08-25 02:01:08 +00:00
|
|
|
grippy->AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType, aHint);
|
1999-09-05 20:46:59 +00:00
|
|
|
} else if (aAttribute == nsXULAtoms::state) {
|
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
|
|
|
mInner->UpdateState();
|
1999-06-30 22:17:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize us. If we are in a box get our alignment so we know what direction we are
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsSplitterFrame::Init(nsIPresContext* aPresContext,
|
1999-06-30 22:17:43 +00:00
|
|
|
nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIStyleContext* aContext,
|
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
2001-08-14 01:55:29 +00:00
|
|
|
/* make it real time drag for now due to problems
|
2000-11-16 22:25:45 +00:00
|
|
|
nsILookAndFeel* lookAndFeel;
|
|
|
|
if (NS_SUCCEEDED(nsComponentManager::CreateInstance(kLookAndFeelCID, nsnull, NS_GET_IID(nsILookAndFeel), (void**)&lookAndFeel))) {
|
|
|
|
lookAndFeel->GetMetric(nsILookAndFeel::eMetric_DragFullWindow, realTimeDrag);
|
|
|
|
NS_RELEASE(lookAndFeel);
|
|
|
|
}
|
2001-08-14 01:55:29 +00:00
|
|
|
else */
|
2000-11-16 22:25:45 +00:00
|
|
|
realTimeDrag = 1;
|
|
|
|
|
2001-10-26 00:09:12 +00:00
|
|
|
// determine orientation of parent, and if vertical, set orient to vertical
|
|
|
|
// on splitter content, then re-resolve style
|
|
|
|
nsIBox* boxParent;
|
|
|
|
if (aParent)
|
|
|
|
CallQueryInterface(aParent, &boxParent);
|
2001-11-22 21:41:47 +00:00
|
|
|
// |newContext| to Release the reference after the call to nsBoxFrame::Init
|
|
|
|
nsCOMPtr<nsIStyleContext> newContext;
|
2001-10-26 00:09:12 +00:00
|
|
|
if (boxParent) {
|
|
|
|
PRBool isHorizontal;
|
|
|
|
boxParent->GetOrientation(isHorizontal);
|
|
|
|
if (!isHorizontal) {
|
|
|
|
nsAutoString str;
|
|
|
|
aContent->GetAttr(kNameSpaceID_None, nsXULAtoms::orient, str);
|
|
|
|
if (str.IsEmpty()) {
|
|
|
|
aContent->SetAttr(kNameSpaceID_None, nsXULAtoms::orient,
|
|
|
|
NS_LITERAL_STRING("vertical"), PR_FALSE);
|
2002-10-09 01:46:15 +00:00
|
|
|
nsCOMPtr<nsIStyleContext> parent = aContext->GetParent();
|
2002-03-31 16:59:00 +00:00
|
|
|
aPresContext->ResolveStyleContextFor(aContent, parent,
|
2001-11-22 21:41:47 +00:00
|
|
|
getter_AddRefs(newContext));
|
|
|
|
aContext = newContext;
|
2001-10-26 00:09:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-06-30 22:17:43 +00:00
|
|
|
nsresult rv = nsBoxFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
|
|
|
|
1999-10-26 04:44:41 +00:00
|
|
|
// XXX Hack because we need the pres context in some of the event handling functions...
|
1999-11-24 06:03:41 +00:00
|
|
|
mPresContext = aPresContext;
|
1999-09-05 20:46:59 +00:00
|
|
|
|
2000-08-12 19:44:11 +00:00
|
|
|
nsHTMLContainerFrame::CreateViewForFrame(aPresContext,this,aContext,nsnull,PR_TRUE);
|
1999-09-05 20:46:59 +00:00
|
|
|
nsIView* view;
|
1999-11-24 06:03:41 +00:00
|
|
|
GetView(aPresContext, &view);
|
2000-02-14 01:42:09 +00:00
|
|
|
|
2001-12-01 14:31:45 +00:00
|
|
|
nsCOMPtr<nsIViewManager> viewManager;
|
|
|
|
view->GetViewManager(*getter_AddRefs(viewManager));
|
|
|
|
viewManager->SetViewContentTransparency(view, PR_TRUE);
|
|
|
|
viewManager->SetViewZIndex(view, PR_FALSE, kMaxZ);
|
|
|
|
|
|
|
|
if (!realTimeDrag) {
|
2000-03-31 07:02:06 +00:00
|
|
|
// currently this only works on win32 and mac
|
|
|
|
static NS_DEFINE_CID(kCChildCID, NS_CHILD_CID);
|
|
|
|
|
|
|
|
// Need to have a widget to appear on top of other widgets.
|
|
|
|
view->CreateWidget(kCChildCID);
|
2000-11-16 22:25:45 +00:00
|
|
|
}
|
1999-09-05 20:46:59 +00:00
|
|
|
|
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
|
|
|
mInner->mState = nsSplitterFrameInner::Open;
|
|
|
|
mInner->AddListener(aPresContext);
|
2000-03-31 07:02:06 +00:00
|
|
|
mInner->mParentBox = nsnull;
|
1999-06-30 22:17:43 +00:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
NS_IMETHODIMP
|
2000-07-07 22:24:06 +00:00
|
|
|
nsSplitterFrame::DoLayout(nsBoxLayoutState& aState)
|
2000-03-31 07:02:06 +00:00
|
|
|
{
|
2000-05-26 06:42:29 +00:00
|
|
|
nsIFrame* frame;
|
|
|
|
GetFrame(&frame);
|
|
|
|
|
|
|
|
nsFrameState childState;
|
|
|
|
frame->GetFrameState(&childState);
|
|
|
|
|
|
|
|
if (childState & NS_FRAME_FIRST_REFLOW)
|
|
|
|
{
|
2000-03-31 07:02:06 +00:00
|
|
|
GetParentBox(&mInner->mParentBox);
|
|
|
|
mInner->UpdateState();
|
|
|
|
}
|
2000-05-26 06:42:29 +00:00
|
|
|
|
2000-07-07 22:24:06 +00:00
|
|
|
return nsBoxFrame::DoLayout(aState);
|
2000-03-31 07:02:06 +00:00
|
|
|
}
|
|
|
|
|
2001-03-08 00:47:22 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
nsSplitterFrame::GetInitialOrientation(PRBool& aIsHorizontal)
|
|
|
|
{
|
|
|
|
nsIBox* box;
|
|
|
|
GetParentBox(&box);
|
|
|
|
if (box) {
|
|
|
|
PRBool horizontal;
|
|
|
|
box->GetOrientation(horizontal);
|
|
|
|
aIsHorizontal = !horizontal;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
nsBoxFrame::GetInitialOrientation(aIsHorizontal);
|
|
|
|
}
|
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsSplitterFrame::HandlePress(nsIPresContext* aPresContext,
|
1999-09-05 20:46:59 +00:00
|
|
|
nsGUIEvent * aEvent,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsEventStatus* aEventStatus)
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsSplitterFrame::HandleMultiplePress(nsIPresContext* aPresContext,
|
1999-09-05 20:46:59 +00:00
|
|
|
nsGUIEvent * aEvent,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsEventStatus* aEventStatus)
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsSplitterFrame::HandleDrag(nsIPresContext* aPresContext,
|
1999-09-05 20:46:59 +00:00
|
|
|
nsGUIEvent * aEvent,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsEventStatus* aEventStatus)
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsSplitterFrame::HandleRelease(nsIPresContext* aPresContext,
|
1999-09-05 20:46:59 +00:00
|
|
|
nsGUIEvent * aEvent,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsEventStatus* aEventStatus)
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-10-26 04:44:41 +00:00
|
|
|
NS_IMETHODIMP nsSplitterFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|
|
|
const nsPoint& aPoint,
|
2000-03-31 07:02:06 +00:00
|
|
|
nsFramePaintLayer aWhichLayer,
|
1999-09-05 20:46:59 +00:00
|
|
|
nsIFrame** aFrame)
|
|
|
|
{
|
2000-05-15 04:12:31 +00:00
|
|
|
if ((aWhichLayer != NS_FRAME_PAINT_LAYER_FOREGROUND))
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
// if the mouse is captured always return us as the frame.
|
2000-08-30 21:51:02 +00:00
|
|
|
if (mInner->mDragging)
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
2000-03-22 02:43:08 +00:00
|
|
|
// XXX It's probably better not to check visibility here, right?
|
1999-09-05 20:46:59 +00:00
|
|
|
*aFrame = this;
|
|
|
|
return NS_OK;
|
2000-03-31 07:02:06 +00:00
|
|
|
} else {
|
|
|
|
|
|
|
|
if (!mRect.Contains(aPoint))
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
nsresult rv = nsBoxFrame::GetFrameForPoint(aPresContext, aPoint, aWhichLayer, aFrame);
|
|
|
|
if (rv == NS_ERROR_FAILURE) {
|
|
|
|
*aFrame = this;
|
|
|
|
rv = NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
1999-09-05 20:46:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsSplitterFrame::HandleEvent(nsIPresContext* aPresContext,
|
1999-09-05 20:46:59 +00:00
|
|
|
nsGUIEvent* aEvent,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsEventStatus* aEventStatus)
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
2000-08-30 21:51:02 +00:00
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
switch (aEvent->message) {
|
|
|
|
case NS_MOUSE_MOVE:
|
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
|
|
|
mInner->MouseDrag(aPresContext, aEvent);
|
1999-09-05 20:46:59 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NS_MOUSE_LEFT_BUTTON_UP:
|
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
|
|
|
mInner->MouseUp(aPresContext, aEvent);
|
1999-09-05 20:46:59 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2000-08-30 21:51:02 +00:00
|
|
|
return nsBoxFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
1999-09-05 20:46:59 +00:00
|
|
|
}
|
|
|
|
|
1999-09-08 23:51:02 +00:00
|
|
|
void
|
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
|
|
|
nsSplitterFrameInner::MouseUp(nsIPresContext* aPresContext, nsGUIEvent* aEvent)
|
1999-09-08 23:51:02 +00:00
|
|
|
{
|
2000-08-30 21:51:02 +00:00
|
|
|
if (mDragging) {
|
1999-09-08 23:51:02 +00:00
|
|
|
AdjustChildren(aPresContext);
|
2000-01-22 01:16:50 +00:00
|
|
|
AddListener(aPresContext);
|
2000-05-26 06:42:29 +00:00
|
|
|
mOuter->CaptureMouse(aPresContext, PR_FALSE);
|
2000-08-30 21:51:02 +00:00
|
|
|
mDragging = PR_FALSE;
|
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
|
|
|
State newState = GetState();
|
|
|
|
// if the state is dragging then make it Open.
|
|
|
|
if (newState == Dragging)
|
2001-08-17 08:14:14 +00:00
|
|
|
mOuter->mContent->SetAttr(kNameSpaceID_None, nsXULAtoms::state, nsAutoString(), PR_TRUE);
|
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
|
|
|
|
1999-09-08 23:51:02 +00:00
|
|
|
mPressed = PR_FALSE;
|
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
|
|
|
|
2000-10-28 22:17:53 +00:00
|
|
|
//printf("MouseUp\n");
|
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
|
|
|
|
1999-09-08 23:51:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
void
|
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
|
|
|
nsSplitterFrameInner::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent)
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
2000-08-30 21:51:02 +00:00
|
|
|
if (mDragging) {
|
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
|
|
|
|
2000-10-28 22:17:53 +00:00
|
|
|
//printf("Dragging\n");
|
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
|
|
|
|
|
|
|
PRBool isHorizontal = !mOuter->IsHorizontal();
|
1999-09-05 20:46:59 +00:00
|
|
|
// convert coord to pixels
|
|
|
|
nscoord pos = isHorizontal ? aEvent->point.x : aEvent->point.y;
|
|
|
|
|
|
|
|
// mDragStartPx is in pixels and is in our client areas coordinate system.
|
|
|
|
// so we need to first convert it so twips and then get it into our coordinate system.
|
|
|
|
|
|
|
|
// convert start to twips
|
|
|
|
nscoord startpx = mDragStartPx;
|
|
|
|
|
|
|
|
float p2t;
|
1999-11-24 06:03:41 +00:00
|
|
|
aPresContext->GetScaledPixelsToTwips(&p2t);
|
1999-09-05 20:46:59 +00:00
|
|
|
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
|
|
|
nscoord start = startpx*onePixel;
|
|
|
|
|
|
|
|
// get it into our coordintate system by subtracting our parents offsets.
|
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
|
|
|
nsIFrame* parent = mOuter;
|
1999-09-05 20:46:59 +00:00
|
|
|
while(parent != nsnull)
|
|
|
|
{
|
|
|
|
// if we hit a scrollable view make sure we take into account
|
|
|
|
// how much we are scrolled.
|
|
|
|
nsIScrollableView* scrollingView;
|
|
|
|
nsIView* view;
|
1999-11-24 06:03:41 +00:00
|
|
|
parent->GetView(aPresContext, &view);
|
1999-09-05 20:46:59 +00:00
|
|
|
if (view) {
|
1999-12-21 19:28:15 +00:00
|
|
|
nsresult result = view->QueryInterface(NS_GET_IID(nsIScrollableView), (void**)&scrollingView);
|
1999-09-05 20:46:59 +00:00
|
|
|
if (NS_SUCCEEDED(result)) {
|
|
|
|
nscoord xoff = 0;
|
|
|
|
nscoord yoff = 0;
|
|
|
|
scrollingView->GetScrollPosition(xoff, yoff);
|
|
|
|
isHorizontal ? start += xoff : start += yoff;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nsRect r;
|
|
|
|
parent->GetRect(r);
|
|
|
|
isHorizontal ? start -= r.x : start -= r.y;
|
|
|
|
parent->GetParent(&parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
// take our current position and substract the start location
|
|
|
|
pos -= start;
|
|
|
|
|
2000-10-28 22:17:53 +00:00
|
|
|
//printf("Diff=%d\n", pos);
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
ResizeType resizeAfter = GetResizeAfter();
|
|
|
|
|
|
|
|
PRBool bounded;
|
|
|
|
|
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
|
|
|
if (resizeAfter == nsSplitterFrameInner::Grow)
|
1999-09-05 20:46:59 +00:00
|
|
|
bounded = PR_FALSE;
|
|
|
|
else
|
|
|
|
bounded = PR_TRUE;
|
|
|
|
|
1999-09-14 22:17:19 +00:00
|
|
|
int i;
|
1999-09-05 20:46:59 +00:00
|
|
|
for (i=0; i < mChildInfosBeforeCount; i++)
|
|
|
|
mChildInfosBefore[i].changed = mChildInfosBefore[i].current;
|
|
|
|
|
|
|
|
for (i=0; i < mChildInfosAfterCount; i++)
|
|
|
|
mChildInfosAfter[i].changed = mChildInfosAfter[i].current;
|
|
|
|
|
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 oldPos = pos;
|
1999-09-14 22:17:19 +00:00
|
|
|
|
1999-11-24 06:03:41 +00:00
|
|
|
ResizeChildTo(aPresContext, pos, mChildInfosBefore, mChildInfosAfter, mChildInfosBeforeCount, mChildInfosAfterCount, bounded);
|
1999-09-05 20:46:59 +00:00
|
|
|
|
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
|
|
|
State currentState = GetState();
|
|
|
|
CollapseDirection dir = GetCollapseDirection();
|
|
|
|
|
|
|
|
// if we are in a collapsed position
|
2000-11-16 22:25:45 +00:00
|
|
|
if (realTimeDrag && ((oldPos > 0 && oldPos > pos && dir == After) || (oldPos < 0 && oldPos < pos && dir == Before)))
|
1999-09-14 22:17:19 +00:00
|
|
|
{
|
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
|
|
|
// and we are not collapsed then collapse
|
|
|
|
if (currentState == Dragging) {
|
|
|
|
if (oldPos > 0 && oldPos > pos)
|
|
|
|
{
|
2000-10-28 22:17:53 +00:00
|
|
|
//printf("Collapse right\n");
|
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
|
|
|
if (GetCollapseDirection() == After)
|
|
|
|
{
|
2001-11-14 01:33:42 +00:00
|
|
|
mOuter->mContent->SetAttr(kNameSpaceID_None, nsXULAtoms::state, NS_LITERAL_STRING("collapsed"), PR_TRUE);
|
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
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (oldPos < 0 && oldPos < pos)
|
|
|
|
{
|
2000-10-28 22:17:53 +00:00
|
|
|
//printf("Collapse left\n");
|
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
|
|
|
if (GetCollapseDirection() == Before)
|
|
|
|
{
|
2001-11-14 01:33:42 +00:00
|
|
|
mOuter->mContent->SetAttr(kNameSpaceID_None, nsXULAtoms::state, NS_LITERAL_STRING("collapsed"), PR_TRUE);
|
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
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2000-11-16 22:25:45 +00:00
|
|
|
|
1999-09-14 22:17:19 +00:00
|
|
|
}
|
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
|
|
|
} else {
|
|
|
|
// if we are not in a collapsed position and we are not dragging make sure
|
|
|
|
// we are dragging.
|
|
|
|
if (currentState != Dragging)
|
2001-11-14 01:33:42 +00:00
|
|
|
mOuter->mContent->SetAttr(kNameSpaceID_None, nsXULAtoms::state, NS_LITERAL_STRING("dragging"), PR_TRUE);
|
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
|
|
|
|
2000-11-16 22:25:45 +00:00
|
|
|
if (realTimeDrag)
|
|
|
|
AdjustChildren(aPresContext);
|
|
|
|
else
|
|
|
|
MoveSplitterBy(aPresContext, pos);
|
1999-09-14 22:17:19 +00:00
|
|
|
|
|
|
|
}
|
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
|
|
|
|
|
|
|
|
1999-09-14 22:17:19 +00:00
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
|
2000-10-28 22:17:53 +00:00
|
|
|
// printf("----- resize ----- ");
|
1999-09-08 23:51:02 +00:00
|
|
|
/*
|
1999-09-05 20:46:59 +00:00
|
|
|
for (i=0; i < mChildInfosBeforeCount; i++)
|
2000-10-28 22:17:53 +00:00
|
|
|
printf("before, index=%d, current=%d, changed=%d\n", mChildInfosBefore[i].index, mChildInfosBefore[i].current, mChildInfosBefore[i].changed);
|
1999-09-05 20:46:59 +00:00
|
|
|
for (i=0; i < mChildInfosAfterCount; i++)
|
2000-10-28 22:17:53 +00:00
|
|
|
printf("after, index=%d, current=%d, changed=%d\n", mChildInfosAfter[i].index, mChildInfosAfter[i].current, mChildInfosAfter[i].changed);
|
1999-09-08 23:51:02 +00:00
|
|
|
*/
|
1999-09-05 20:46:59 +00:00
|
|
|
|
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
|
|
|
/*
|
1999-09-05 20:46:59 +00:00
|
|
|
nsCOMPtr<nsIPresShell> shell;
|
1999-11-24 06:03:41 +00:00
|
|
|
aPresContext->GetShell(getter_AddRefs(shell));
|
1999-09-05 20:46:59 +00:00
|
|
|
|
2001-12-17 22:39:59 +00:00
|
|
|
nsCOMPtr<nsHTMLReflowCommand> reflowCmd;
|
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
|
|
|
nsresult rv = NS_NewHTMLReflowCommand(getter_AddRefs(reflowCmd), mOuter->mParent,
|
2001-12-17 22:39:59 +00:00
|
|
|
eReflowType_StyleChanged);
|
1999-09-05 20:46:59 +00:00
|
|
|
if (NS_SUCCEEDED(rv))
|
|
|
|
shell->AppendReflowCommand(reflowCmd);
|
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
|
|
|
|
|
|
|
nsCOMPtr<nsIPresShell> shell;
|
|
|
|
aPresContext->GetShell(getter_AddRefs(shell));
|
1999-09-05 20:46:59 +00:00
|
|
|
|
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
|
|
|
mOuter->mState |= NS_FRAME_IS_DIRTY;
|
|
|
|
mOuter->mParent->ReflowDirtyChild(shell, mOuter);
|
|
|
|
*/
|
1999-09-05 20:46:59 +00:00
|
|
|
mDidDrag = PR_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
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
|
|
|
nsSplitterFrameInner::AddListener(nsIPresContext* aPresContext)
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
|
|
|
nsIFrame* thumbFrame = nsnull;
|
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
|
|
|
mOuter->FirstChild(aPresContext, nsnull,&thumbFrame);
|
1999-09-05 20:46:59 +00:00
|
|
|
nsCOMPtr<nsIContent> content;
|
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
|
|
|
mOuter->GetContent(getter_AddRefs(content));
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMEventReceiver> reciever(do_QueryInterface(content));
|
|
|
|
|
1999-12-21 19:28:15 +00:00
|
|
|
reciever->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*,this), NS_GET_IID(nsIDOMMouseListener));
|
|
|
|
reciever->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseMotionListener*,this), NS_GET_IID(nsIDOMMouseMotionListener));
|
1999-09-05 20:46:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
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
|
|
|
nsSplitterFrameInner::RemoveListener()
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIContent> content;
|
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
|
|
|
mOuter->GetContent(getter_AddRefs(content));
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMEventReceiver> reciever(do_QueryInterface(content));
|
|
|
|
|
1999-12-21 19:28:15 +00:00
|
|
|
reciever->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*,this),NS_GET_IID(nsIDOMMouseListener));
|
|
|
|
reciever->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseMotionListener*,this),NS_GET_IID(nsIDOMMouseMotionListener));
|
1999-09-05 20:46:59 +00:00
|
|
|
}
|
|
|
|
|
2000-05-26 06:42:29 +00:00
|
|
|
/*
|
1999-09-05 20:46:59 +00:00
|
|
|
nsresult
|
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
|
|
|
nsSplitterFrameInner :: CaptureMouse(nsIPresContext* aPresContext, PRBool aGrabMouseEvents)
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
|
|
|
// get its view
|
|
|
|
nsIView* view = nsnull;
|
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
|
|
|
mOuter->GetView(aPresContext, &view);
|
1999-09-05 20:46:59 +00:00
|
|
|
nsCOMPtr<nsIViewManager> viewMan;
|
|
|
|
PRBool result;
|
1999-09-22 03:11:47 +00:00
|
|
|
//nsCOMPtr<nsIWidget> widget;
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
if (view) {
|
|
|
|
view->GetViewManager(*getter_AddRefs(viewMan));
|
1999-09-22 03:11:47 +00:00
|
|
|
//view->GetWidget(*getter_AddRefs(widget));
|
1999-09-05 20:46:59 +00:00
|
|
|
if (viewMan) {
|
|
|
|
if (aGrabMouseEvents) {
|
|
|
|
viewMan->GrabMouseEvents(view,result);
|
1999-09-22 03:11:47 +00:00
|
|
|
// if (widget)
|
|
|
|
// widget->CaptureMouse(PR_TRUE);
|
1999-09-05 20:46:59 +00:00
|
|
|
} else {
|
|
|
|
viewMan->GrabMouseEvents(nsnull,result);
|
1999-09-22 03:11:47 +00:00
|
|
|
// if (widget)
|
|
|
|
// widget->CaptureMouse(PR_FALSE);
|
1999-09-05 20:46:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-05-26 06:42:29 +00:00
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
PRBool
|
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
|
|
|
nsSplitterFrameInner :: IsMouseCaptured(nsIPresContext* aPresContext)
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
|
|
|
// get its view
|
|
|
|
nsIView* view = nsnull;
|
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
|
|
|
mOuter->GetView(aPresContext, &view);
|
1999-09-05 20:46:59 +00:00
|
|
|
nsCOMPtr<nsIViewManager> viewMan;
|
|
|
|
|
|
|
|
if (view) {
|
|
|
|
view->GetViewManager(*getter_AddRefs(viewMan));
|
|
|
|
|
|
|
|
if (viewMan) {
|
|
|
|
nsIView* grabbingView;
|
|
|
|
viewMan->GetMouseEventGrabber(grabbingView);
|
|
|
|
if (grabbingView == view)
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
2000-05-26 06:42:29 +00:00
|
|
|
*/
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
nsresult
|
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
|
|
|
nsSplitterFrameInner::MouseUp(nsIDOMEvent* aMouseEvent)
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
|
|
|
mPressed = PR_FALSE;
|
2002-04-10 04:58:02 +00:00
|
|
|
|
|
|
|
mOuter->CaptureMouse(mOuter->mPresContext, PR_FALSE);
|
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
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
|
|
|
nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
2000-05-15 22:43:47 +00:00
|
|
|
nsCOMPtr<nsIDOMMouseEvent> mouseEvent(do_QueryInterface(aMouseEvent));
|
|
|
|
|
|
|
|
PRUint16 button = 0;
|
|
|
|
mouseEvent->GetButton(&button);
|
|
|
|
|
|
|
|
// only if left button
|
2001-03-02 03:07:53 +00:00
|
|
|
if (button != 0)
|
2000-05-15 22:43:47 +00:00
|
|
|
return NS_OK;
|
|
|
|
|
2000-09-08 06:55:10 +00:00
|
|
|
nsCOMPtr<nsIContent> content;
|
|
|
|
mOuter->GetContent(getter_AddRefs(content));
|
|
|
|
|
|
|
|
nsAutoString disabled;
|
2001-08-17 08:14:14 +00:00
|
|
|
content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled);
|
2000-09-08 06:55:10 +00:00
|
|
|
if (disabled.Equals(NS_LITERAL_STRING("true")))
|
|
|
|
return NS_OK;
|
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
nsBoxLayoutState state(mOuter->mPresContext);
|
1999-09-05 20:46:59 +00:00
|
|
|
mCurrentPos = 0;
|
|
|
|
mPressed = PR_TRUE;
|
|
|
|
|
|
|
|
mDidDrag = PR_FALSE;
|
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
mOuter->GetParentBox(&mParentBox);
|
2001-08-15 04:09:41 +00:00
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
// get our index
|
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 childIndex = nsFrameNavigator::IndexOf(mOuter->mPresContext, mParentBox, mOuter);
|
|
|
|
PRInt32 childCount = nsFrameNavigator::CountFrames(mOuter->mPresContext, mParentBox);
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
// if its 0 or the last index then stop right here.
|
|
|
|
if (childIndex == 0 || childIndex == childCount-1) {
|
|
|
|
mPressed = PR_FALSE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
EnsureOrient();
|
|
|
|
PRBool isHorizontal = !mOuter->IsHorizontal();
|
2001-08-15 04:09:41 +00:00
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
ResizeType resizeBefore = GetResizeBefore();
|
|
|
|
ResizeType resizeAfter = GetResizeAfter();
|
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
delete[] mChildInfosBefore;
|
|
|
|
delete[] mChildInfosAfter;
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
mChildInfosBefore = new nsSplitterInfo[childCount];
|
|
|
|
mChildInfosAfter = new nsSplitterInfo[childCount];
|
|
|
|
|
|
|
|
// create info 2 lists. One of the children before us and one after.
|
|
|
|
PRInt32 count = 0;
|
|
|
|
mChildInfosBeforeCount = 0;
|
|
|
|
mChildInfosAfterCount = 0;
|
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
nsIBox* childBox = nsnull;
|
|
|
|
mParentBox->GetChildBox(&childBox);
|
1999-09-05 20:46:59 +00:00
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
while (nsnull != childBox)
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
2000-03-31 07:02:06 +00:00
|
|
|
nsIFrame* childFrame = nsnull;
|
|
|
|
childBox->GetFrame(&childFrame);
|
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
childFrame->GetContent(getter_AddRefs(content));
|
2000-04-03 03:55:38 +00:00
|
|
|
nsCOMPtr<nsIAtom> atom;
|
2000-05-09 21:42:40 +00:00
|
|
|
nsresult rv;
|
2001-07-25 07:54:28 +00:00
|
|
|
nsCOMPtr<nsIXBLService> xblService =
|
|
|
|
do_GetService("@mozilla.org/xbl;1", &rv);
|
2000-05-09 21:42:40 +00:00
|
|
|
|
2000-05-24 08:19:10 +00:00
|
|
|
if (NS_SUCCEEDED(rv) && xblService) {
|
|
|
|
PRInt32 dummy;
|
|
|
|
xblService->ResolveTag(content, &dummy, getter_AddRefs(atom));
|
|
|
|
} else
|
2000-04-21 08:11:39 +00:00
|
|
|
content->GetTag(*getter_AddRefs(atom));
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
// skip over any splitters
|
2000-04-03 04:17:47 +00:00
|
|
|
if (atom.get() != nsXULAtoms::splitter) {
|
2000-03-31 07:02:06 +00:00
|
|
|
nsSize prefSize(0,0);
|
|
|
|
nsSize minSize(0,0);
|
|
|
|
nsSize maxSize(0,0);
|
|
|
|
nscoord flex = 0;
|
1999-09-05 20:46:59 +00:00
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
childBox->GetPrefSize(state, prefSize);
|
|
|
|
childBox->GetMinSize(state, minSize);
|
|
|
|
childBox->GetMaxSize(state, maxSize);
|
|
|
|
nsBox::BoundsCheck(minSize, prefSize, maxSize);
|
1999-09-05 20:46:59 +00:00
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
mOuter->AddMargin(childBox, minSize);
|
|
|
|
mOuter->AddMargin(childBox, prefSize);
|
|
|
|
mOuter->AddMargin(childBox, maxSize);
|
|
|
|
|
|
|
|
childBox->GetFlex(state, flex);
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
nsMargin margin(0,0,0,0);
|
2000-03-31 07:02:06 +00:00
|
|
|
childBox->GetMargin(margin);
|
1999-09-05 20:46:59 +00:00
|
|
|
nsRect r(0,0,0,0);
|
2000-03-31 07:02:06 +00:00
|
|
|
childBox->GetBounds(r);
|
1999-09-05 20:46:59 +00:00
|
|
|
r.Inflate(margin);
|
|
|
|
|
2002-07-16 01:23:43 +00:00
|
|
|
nsAutoString fixed, hidden;
|
2001-08-17 08:14:14 +00:00
|
|
|
content->GetAttr(kNameSpaceID_None, nsXULAtoms::fixed, fixed);
|
2002-07-16 01:45:38 +00:00
|
|
|
// We need to check for hidden attribute too, since treecols with
|
|
|
|
// the hidden="true" attribute are not really hidden, just collapsed
|
2002-07-16 01:23:43 +00:00
|
|
|
content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::hidden, hidden);
|
2000-09-08 06:55:10 +00:00
|
|
|
|
2002-07-16 01:45:38 +00:00
|
|
|
NS_NAMED_LITERAL_STRING(attrTrue, "true");
|
|
|
|
if (!attrTrue.Equals(fixed) && !attrTrue.Equals(hidden)) {
|
|
|
|
if (count < childIndex) {
|
2000-09-08 06:55:10 +00:00
|
|
|
mChildInfosBefore[mChildInfosBeforeCount].child = childBox;
|
|
|
|
mChildInfosBefore[mChildInfosBeforeCount].min = isHorizontal ? minSize.width : minSize.height;
|
|
|
|
mChildInfosBefore[mChildInfosBeforeCount].max = isHorizontal ? maxSize.width : maxSize.height;
|
|
|
|
mChildInfosBefore[mChildInfosBeforeCount].current = isHorizontal ? r.width : r.height;
|
|
|
|
mChildInfosBefore[mChildInfosBeforeCount].flex = flex;
|
|
|
|
mChildInfosBefore[mChildInfosBeforeCount].index = count;
|
|
|
|
mChildInfosBefore[mChildInfosBeforeCount].changed = mChildInfosBefore[mChildInfosBeforeCount].current;
|
|
|
|
mChildInfosBeforeCount++;
|
2002-07-16 01:45:38 +00:00
|
|
|
} else if (count > childIndex) {
|
2000-09-08 06:55:10 +00:00
|
|
|
mChildInfosAfter[mChildInfosAfterCount].child = childBox;
|
|
|
|
mChildInfosAfter[mChildInfosAfterCount].min = isHorizontal ? minSize.width : minSize.height;
|
|
|
|
mChildInfosAfter[mChildInfosAfterCount].max = isHorizontal ? maxSize.width : maxSize.height;
|
|
|
|
mChildInfosAfter[mChildInfosAfterCount].current = isHorizontal ? r.width : r.height;
|
|
|
|
mChildInfosAfter[mChildInfosAfterCount].flex = flex;
|
|
|
|
mChildInfosAfter[mChildInfosAfterCount].index = count;
|
2002-07-16 01:45:38 +00:00
|
|
|
mChildInfosAfter[mChildInfosAfterCount].changed = mChildInfosAfter[mChildInfosAfterCount].current;
|
2000-09-08 06:55:10 +00:00
|
|
|
mChildInfosAfterCount++;
|
|
|
|
}
|
1999-09-05 20:46:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-05-09 21:42:40 +00:00
|
|
|
rv = childBox->GetNextBox(&childBox);
|
1999-09-05 20:46:59 +00:00
|
|
|
NS_ASSERTION(rv == NS_OK,"failed to get next child");
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
2001-08-15 04:09:41 +00:00
|
|
|
PRBool isNormalDirection = PR_TRUE;
|
|
|
|
mParentBox->GetDirection(isNormalDirection);
|
|
|
|
if (!isNormalDirection) {
|
|
|
|
// The before array is really the after array, and the order needs to be reversed.
|
|
|
|
// First reverse both arrays.
|
|
|
|
Reverse(mChildInfosBefore, mChildInfosBeforeCount);
|
|
|
|
Reverse(mChildInfosAfter, mChildInfosAfterCount);
|
|
|
|
|
|
|
|
// Now swap the two arrays.
|
|
|
|
nscoord newAfterCount = mChildInfosBeforeCount;
|
|
|
|
mChildInfosBeforeCount = mChildInfosAfterCount;
|
|
|
|
mChildInfosAfterCount = newAfterCount;
|
|
|
|
nsSplitterInfo* temp = mChildInfosAfter;
|
|
|
|
mChildInfosAfter = mChildInfosBefore;
|
|
|
|
mChildInfosBefore = temp;
|
|
|
|
}
|
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
// if the resizebefore is closest we must reverse the list because the first child in the list
|
1999-09-08 23:51:02 +00:00
|
|
|
// is the Farthest we want the first child to be the closest.
|
1999-09-05 20:46:59 +00:00
|
|
|
if (resizeBefore == Closest)
|
|
|
|
Reverse(mChildInfosBefore, mChildInfosBeforeCount);
|
|
|
|
|
1999-09-08 23:51:02 +00:00
|
|
|
// if the resizeafter is the Farthest we must reverse the list because the first child in the list
|
|
|
|
// is the closest we want the first child to be the Farthest.
|
|
|
|
if (resizeAfter == Farthest)
|
1999-09-05 20:46:59 +00:00
|
|
|
Reverse(mChildInfosAfter, mChildInfosAfterCount);
|
|
|
|
|
|
|
|
// grow only applys to the children after. If grow is set then no space should be taken out of any children after
|
|
|
|
// us. To do this we just set the size of that list to be 0.
|
|
|
|
if (resizeAfter == Grow)
|
|
|
|
mChildInfosAfterCount = 0;
|
|
|
|
|
1999-09-08 23:51:02 +00:00
|
|
|
nsRect vr(0,0,0,0);
|
|
|
|
nsIView *v;
|
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
|
|
|
mOuter->GetView(mOuter->mPresContext, &v);
|
1999-09-08 23:51:02 +00:00
|
|
|
v->GetBounds(vr);
|
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
PRInt32 c = 0;
|
|
|
|
if (isHorizontal) {
|
1999-11-03 07:11:45 +00:00
|
|
|
mouseEvent->GetClientX(&c);
|
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
|
|
|
mSplitterPos = mOuter->mRect.x;
|
1999-09-08 23:51:02 +00:00
|
|
|
mSplitterViewPos = vr.x;
|
1999-09-05 20:46:59 +00:00
|
|
|
} else {
|
1999-11-03 07:11:45 +00:00
|
|
|
mouseEvent->GetClientY(&c);
|
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
|
|
|
mSplitterPos = mOuter->mRect.y;
|
1999-09-08 23:51:02 +00:00
|
|
|
mSplitterViewPos = vr.y;
|
1999-09-05 20:46:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mDragStartPx = c;
|
|
|
|
|
2000-10-28 22:17:53 +00:00
|
|
|
//printf("Pressed mDragStartPx=%d\n",mDragStartPx);
|
1999-09-05 20:46:59 +00:00
|
|
|
|
2002-03-27 05:49:56 +00:00
|
|
|
mOuter->CaptureMouse(mOuter->mPresContext, PR_TRUE);
|
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
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
|
|
|
nsSplitterFrameInner::MouseMove(nsIDOMEvent* aMouseEvent)
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
2000-10-28 22:17:53 +00:00
|
|
|
//printf("Mouse move\n");
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
if (!mPressed)
|
|
|
|
return NS_OK;
|
|
|
|
|
2000-08-30 21:51:02 +00:00
|
|
|
if (mDragging)
|
1999-09-05 20:46:59 +00:00
|
|
|
return NS_OK;
|
|
|
|
|
2001-11-14 01:33:42 +00:00
|
|
|
mOuter->mContent->SetAttr(kNameSpaceID_None, nsXULAtoms::state, NS_LITERAL_STRING("dragging"), PR_TRUE);
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
RemoveListener();
|
2000-08-30 21:51:02 +00:00
|
|
|
mDragging = PR_TRUE;
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
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
|
|
|
nsSplitterFrameInner::Reverse(nsSplitterInfo*& aChildInfos, PRInt32 aCount)
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
|
|
|
nsSplitterInfo* infos = new nsSplitterInfo[aCount];
|
|
|
|
|
|
|
|
for (int i=0; i < aCount; i++)
|
|
|
|
infos[i] = aChildInfos[aCount - 1 - i];
|
|
|
|
|
2000-04-03 03:55:38 +00:00
|
|
|
delete[] aChildInfos;
|
1999-09-05 20:46:59 +00:00
|
|
|
aChildInfos = infos;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
nsSplitterFrameInner::CollapseDirection
|
|
|
|
nsSplitterFrameInner::GetCollapseDirection()
|
1999-09-14 22:17:19 +00:00
|
|
|
{
|
|
|
|
nsString value;
|
2001-08-17 08:14:14 +00:00
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == mOuter->mContent->GetAttr(kNameSpaceID_None, nsXULAtoms::collapse, value))
|
1999-09-14 22:17:19 +00:00
|
|
|
{
|
|
|
|
if (value.EqualsIgnoreCase("before"))
|
|
|
|
return Before;
|
|
|
|
else if (value.EqualsIgnoreCase("after"))
|
|
|
|
return After;
|
|
|
|
else
|
|
|
|
return None;
|
|
|
|
} else {
|
|
|
|
return None;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
void
|
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
|
|
|
nsSplitterFrameInner::UpdateState()
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
2000-03-08 00:14:53 +00:00
|
|
|
// State Transitions:
|
|
|
|
// Open -> Dragging
|
|
|
|
// Open -> Collapsed
|
|
|
|
// Collapsed -> Open
|
|
|
|
// Collapsed -> Dragging
|
|
|
|
// Dragging -> Open
|
|
|
|
// Dragging -> Collapsed (auto collapse)
|
1999-09-14 22:17:19 +00:00
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
State newState = GetState();
|
|
|
|
|
2000-03-08 00:14:53 +00:00
|
|
|
if (newState == mState) {
|
|
|
|
// No change.
|
1999-09-05 20:46:59 +00:00
|
|
|
return;
|
2000-03-08 00:14:53 +00:00
|
|
|
}
|
1999-09-05 20:46:59 +00:00
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
CollapseDirection direction = GetCollapseDirection();
|
|
|
|
if (direction != None) {
|
|
|
|
nsIBox* splitter = mOuter;
|
|
|
|
// Find the splitter's immediate sibling.
|
|
|
|
nsIBox* splitterSibling =
|
|
|
|
nsFrameNavigator::GetChildBeforeAfter(mOuter->mPresContext, splitter,
|
|
|
|
(direction == Before));
|
|
|
|
if (splitterSibling) {
|
|
|
|
nsIFrame* splitterSiblingFrame = nsnull;
|
|
|
|
splitterSibling->GetFrame(&splitterSiblingFrame);
|
|
|
|
nsCOMPtr<nsIContent> sibling;
|
|
|
|
if (NS_SUCCEEDED(splitterSiblingFrame->GetContent(getter_AddRefs(sibling)))
|
|
|
|
&& sibling) {
|
|
|
|
if (mState == Collapsed) {
|
|
|
|
// Collapsed -> Open
|
|
|
|
// Collapsed -> Dragging
|
2001-08-17 08:14:14 +00:00
|
|
|
sibling->UnsetAttr(kNameSpaceID_None, nsXULAtoms::collapsed,
|
|
|
|
PR_TRUE);
|
2000-03-31 07:02:06 +00:00
|
|
|
} else if ((mState == Open || mState == Dragging)
|
|
|
|
&& newState == Collapsed) {
|
|
|
|
// Open -> Collapsed
|
|
|
|
// Dragging -> Collapsed
|
2001-08-17 08:14:14 +00:00
|
|
|
sibling->SetAttr(kNameSpaceID_None, nsXULAtoms::collapsed,
|
2001-11-14 01:33:42 +00:00
|
|
|
NS_LITERAL_STRING("true"), PR_TRUE);
|
2000-03-31 07:02:06 +00:00
|
|
|
}
|
2000-03-08 02:33:52 +00:00
|
|
|
}
|
2000-03-08 00:14:53 +00:00
|
|
|
}
|
1999-09-05 20:46:59 +00:00
|
|
|
}
|
2000-03-31 07:02:06 +00:00
|
|
|
mState = newState;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsSplitterFrameInner::EnsureOrient()
|
|
|
|
{
|
|
|
|
nsIFrame* frame = nsnull;
|
|
|
|
mParentBox->GetFrame(&frame);
|
|
|
|
nsFrameState state;
|
|
|
|
frame->GetFrameState(&state);
|
|
|
|
|
|
|
|
PRBool isHorizontal = !(state & NS_STATE_IS_HORIZONTAL);
|
|
|
|
if (isHorizontal)
|
|
|
|
mOuter->mState |= NS_STATE_IS_HORIZONTAL;
|
|
|
|
else
|
|
|
|
mOuter->mState &= ~NS_STATE_IS_HORIZONTAL;
|
1999-09-05 20:46:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
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
|
|
|
nsSplitterFrameInner::AdjustChildren(nsIPresContext* aPresContext)
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
2000-03-31 07:02:06 +00:00
|
|
|
EnsureOrient();
|
|
|
|
PRBool isHorizontal = !mOuter->IsHorizontal();
|
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
AdjustChildren(aPresContext, mChildInfosBefore, mChildInfosBeforeCount, isHorizontal);
|
|
|
|
AdjustChildren(aPresContext, mChildInfosAfter, mChildInfosAfterCount, isHorizontal);
|
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
|
2000-10-28 22:17:53 +00:00
|
|
|
// printf("----- Posting Dirty -----\n");
|
2000-03-31 07:02:06 +00:00
|
|
|
|
|
|
|
|
2000-11-16 22:25:45 +00:00
|
|
|
if (realTimeDrag) {
|
|
|
|
// nsBoxLayoutState state(aPresContext);
|
|
|
|
// state.SetLayoutReason(nsBoxLayoutState::Resize);
|
2000-03-31 07:02:06 +00:00
|
|
|
//mParentBox->Layout(state);
|
2000-11-16 22:25:45 +00:00
|
|
|
/*
|
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
|
|
|
nsCOMPtr<nsIPresShell> shell;
|
|
|
|
aPresContext->GetShell(getter_AddRefs(shell));
|
2000-03-31 07:02:06 +00:00
|
|
|
|
|
|
|
shell->EnterReflowLock();
|
|
|
|
shell->ProcessReflowCommands(PR_TRUE);
|
|
|
|
shell->ExitReflowLock(PR_FALSE);
|
2000-11-16 22:25:45 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPresShell> shell;
|
|
|
|
aPresContext->GetShell(getter_AddRefs(shell));
|
|
|
|
nsIFrame* frame = nsnull;
|
|
|
|
mParentBox->GetFrame(&frame);
|
2000-03-31 07:02:06 +00:00
|
|
|
|
2000-11-16 22:25:45 +00:00
|
|
|
/*
|
|
|
|
shell->EnterReflowLock();
|
|
|
|
nsRect bounds;
|
|
|
|
mParentBox->GetBounds(bounds);
|
|
|
|
nsSize maxSize(bounds.width, bounds.height);
|
|
|
|
nsIRenderingContext* rcx = nsnull;
|
|
|
|
nsresult rv = shell->CreateRenderingContext(frame, &rcx);
|
|
|
|
nsHTMLReflowState reflowState(aPresContext, frame,
|
2000-03-31 07:02:06 +00:00
|
|
|
eReflowReason_Resize, rcx, maxSize);
|
2000-11-16 22:25:45 +00:00
|
|
|
nsBoxLayoutState state(aPresContext, reflowState);
|
|
|
|
mParentBox->Layout(state);
|
|
|
|
shell->ExitReflowLock(PR_TRUE);
|
|
|
|
*/
|
2000-10-07 00:49:08 +00:00
|
|
|
|
2000-11-16 22:25:45 +00:00
|
|
|
nsCOMPtr<nsIViewManager> viewManager;
|
|
|
|
nsIView* view = nsnull;
|
|
|
|
frame->GetView(aPresContext, &view);
|
2000-03-31 07:02:06 +00:00
|
|
|
|
2000-11-16 22:25:45 +00:00
|
|
|
nsRect damageRect(0,0,0,0);
|
|
|
|
mParentBox->GetContentRect(damageRect);
|
2000-03-31 07:02:06 +00:00
|
|
|
|
2000-11-16 22:25:45 +00:00
|
|
|
if (view) {
|
|
|
|
view->GetViewManager(*getter_AddRefs(viewManager));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
nsPoint offset;
|
|
|
|
frame->GetOffsetFromView(aPresContext, offset, &view);
|
|
|
|
NS_ASSERTION(nsnull != view, "no view");
|
|
|
|
damageRect += offset;
|
|
|
|
view->GetViewManager(*getter_AddRefs(viewManager));
|
|
|
|
}
|
2000-03-31 07:02:06 +00:00
|
|
|
|
2000-11-16 22:25:45 +00:00
|
|
|
viewManager->DisableRefresh();
|
2001-08-31 04:28:26 +00:00
|
|
|
shell->FlushPendingNotifications(PR_FALSE);
|
2000-11-16 22:25:45 +00:00
|
|
|
viewManager->EnableRefresh(NS_VMREFRESH_NO_SYNC);
|
2000-10-07 00:49:08 +00:00
|
|
|
|
2000-11-16 22:25:45 +00:00
|
|
|
viewManager->UpdateView(view, damageRect, NS_VMREFRESH_IMMEDIATE);
|
2000-10-07 00:49:08 +00:00
|
|
|
|
|
|
|
|
2000-11-16 22:25:45 +00:00
|
|
|
}
|
|
|
|
else {
|
2000-03-31 07:02:06 +00:00
|
|
|
//mOuter->mState |= NS_FRAME_IS_DIRTY;
|
|
|
|
//mOuter->mParent->ReflowDirtyChild(shell, mOuter->mParent);
|
|
|
|
nsBoxLayoutState state(aPresContext);
|
|
|
|
mOuter->MarkDirty(state);
|
2000-11-16 22:25:45 +00:00
|
|
|
}
|
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
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
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
|
|
|
nsSplitterFrameInner::AdjustChildren(nsIPresContext* aPresContext, nsSplitterInfo* aChildInfos, PRInt32 aCount, PRBool aIsHorizontal)
|
1999-09-05 20:46:59 +00:00
|
|
|
{
|
2000-10-28 22:17:53 +00:00
|
|
|
///printf("------- AdjustChildren------\n");
|
2000-03-31 07:02:06 +00:00
|
|
|
|
|
|
|
nsBoxLayoutState state(aPresContext);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPresShell> shell;
|
|
|
|
state.GetPresShell(getter_AddRefs(shell));
|
|
|
|
|
|
|
|
float p2t;
|
|
|
|
aPresContext->GetScaledPixelsToTwips(&p2t);
|
|
|
|
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
1999-09-05 20:46:59 +00:00
|
|
|
|
2000-04-11 23:55:15 +00:00
|
|
|
// first set all the widths.
|
|
|
|
nsIBox* child = nsnull;
|
|
|
|
mOuter->GetChildBox(&child);
|
|
|
|
while(child)
|
|
|
|
{
|
|
|
|
SetPreferredSize(state, child, onePixel, aIsHorizontal, nsnull);
|
|
|
|
child->GetNextBox(&child);
|
|
|
|
}
|
|
|
|
|
|
|
|
// now set our changed widths.
|
1999-09-05 20:46:59 +00:00
|
|
|
for (int i=0; i < aCount; i++)
|
|
|
|
{
|
|
|
|
nscoord pref = aChildInfos[i].changed;
|
2000-03-31 07:02:06 +00:00
|
|
|
nsIBox* childBox = aChildInfos[i].child;
|
1999-09-05 20:46:59 +00:00
|
|
|
|
2000-04-11 23:55:15 +00:00
|
|
|
SetPreferredSize(state, childBox, onePixel, aIsHorizontal, &pref);
|
|
|
|
}
|
|
|
|
}
|
1999-09-05 20:46:59 +00:00
|
|
|
|
2000-04-11 23:55:15 +00:00
|
|
|
void
|
|
|
|
nsSplitterFrameInner::SetPreferredSize(nsBoxLayoutState& aState, nsIBox* aChildBox, nscoord aOnePixel, PRBool aIsHorizontal, nscoord* aSize)
|
|
|
|
{
|
2000-10-28 22:17:53 +00:00
|
|
|
//printf("current=%d, pref=%d", current/onePixel, pref/onePixel);
|
2000-04-11 23:55:15 +00:00
|
|
|
|
|
|
|
nscoord current = 0;
|
|
|
|
|
|
|
|
nsRect rect(0,0,0,0);
|
|
|
|
aChildBox->GetBounds(rect);
|
|
|
|
if (aIsHorizontal)
|
|
|
|
current = rect.width;
|
|
|
|
else
|
|
|
|
current = rect.height;
|
1999-09-05 20:46:59 +00:00
|
|
|
|
2000-04-11 23:55:15 +00:00
|
|
|
nscoord pref = 0;
|
|
|
|
|
|
|
|
if (!aSize)
|
|
|
|
{
|
|
|
|
if (aIsHorizontal)
|
|
|
|
pref = rect.width;
|
|
|
|
else
|
|
|
|
pref = rect.height;
|
|
|
|
} else {
|
|
|
|
pref = *aSize;
|
|
|
|
}
|
1999-09-05 20:46:59 +00:00
|
|
|
|
2000-04-11 23:55:15 +00:00
|
|
|
nsMargin margin(0,0,0,0);
|
|
|
|
aChildBox->GetMargin(margin);
|
1999-09-05 20:46:59 +00:00
|
|
|
|
2000-04-11 23:55:15 +00:00
|
|
|
nsCOMPtr<nsIAtom> attribute;
|
1999-09-05 20:46:59 +00:00
|
|
|
|
2000-04-11 23:55:15 +00:00
|
|
|
if (aIsHorizontal) {
|
|
|
|
pref -= (margin.left + margin.right);
|
|
|
|
attribute = nsHTMLAtoms::width;
|
|
|
|
} else {
|
|
|
|
pref -= (margin.top + margin.bottom);
|
|
|
|
attribute = nsHTMLAtoms::height;
|
|
|
|
}
|
1999-09-05 20:46:59 +00:00
|
|
|
|
2000-04-11 23:55:15 +00:00
|
|
|
nsIFrame* childFrame = nsnull;
|
|
|
|
aChildBox->GetFrame(&childFrame);
|
1999-09-05 20:46:59 +00:00
|
|
|
|
2000-04-11 23:55:15 +00:00
|
|
|
nsCOMPtr<nsIContent> content;
|
|
|
|
childFrame->GetContent(getter_AddRefs(content));
|
|
|
|
|
|
|
|
// set its preferred size.
|
|
|
|
char ch[50];
|
|
|
|
sprintf(ch,"%d",pref/aOnePixel);
|
|
|
|
nsAutoString oldValue;
|
2001-08-17 08:14:14 +00:00
|
|
|
content->GetAttr(kNameSpaceID_None, attribute, oldValue);
|
2000-04-16 11:19:26 +00:00
|
|
|
if (oldValue.EqualsWithConversion(ch))
|
2000-04-11 23:55:15 +00:00
|
|
|
return;
|
|
|
|
|
2001-08-17 08:14:14 +00:00
|
|
|
content->SetAttr(kNameSpaceID_None, attribute, NS_ConvertASCIItoUCS2(ch), PR_TRUE);
|
2000-04-11 23:55:15 +00:00
|
|
|
aChildBox->MarkDirty(aState);
|
1999-09-05 20:46:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
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
|
|
|
nsSplitterFrameInner::AddRemoveSpace(nscoord aDiff,
|
1999-09-05 20:46:59 +00:00
|
|
|
nsSplitterInfo* aChildInfos,
|
|
|
|
PRInt32 aCount,
|
|
|
|
PRInt32& aSpaceLeft)
|
|
|
|
{
|
|
|
|
aSpaceLeft = 0;
|
|
|
|
|
|
|
|
for (int i=0; i < aCount; i++) {
|
|
|
|
nscoord min = aChildInfos[i].min;
|
|
|
|
nscoord max = aChildInfos[i].max;
|
|
|
|
nscoord& c = aChildInfos[i].changed;
|
|
|
|
|
|
|
|
// figure our how much space to add or remove
|
|
|
|
if (c + aDiff < min) {
|
|
|
|
aDiff += (c - min);
|
|
|
|
c = min;
|
|
|
|
} else if (c + aDiff > max) {
|
|
|
|
aDiff -= (max - c);
|
|
|
|
c = max;
|
|
|
|
} else {
|
|
|
|
c += aDiff;
|
|
|
|
aDiff = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// there is not space left? We are done
|
|
|
|
if (aDiff == 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
aSpaceLeft = aDiff;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ok if we want to resize a child we will know the actual size in pixels we want it to be.
|
|
|
|
* This is not the preferred size. But they only way we can change a child is my manipulating its
|
|
|
|
* preferred size. So give the actual pixel size this return method will return figure out the preferred
|
|
|
|
* size and set it.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
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
|
|
|
nsSplitterFrameInner::ResizeChildTo(nsIPresContext* aPresContext,
|
1999-10-26 04:44:41 +00:00
|
|
|
nscoord& aDiff,
|
1999-09-05 20:46:59 +00:00
|
|
|
nsSplitterInfo* aChildrenBeforeInfos,
|
|
|
|
nsSplitterInfo* aChildrenAfterInfos,
|
|
|
|
PRInt32 aChildrenBeforeCount,
|
|
|
|
PRInt32 aChildrenAfterCount,
|
|
|
|
PRBool aBounded)
|
|
|
|
{
|
|
|
|
nscoord spaceLeft;
|
|
|
|
AddRemoveSpace(aDiff, aChildrenBeforeInfos,aChildrenBeforeCount,spaceLeft);
|
|
|
|
|
|
|
|
// if there is any space left over remove it from the dif we were originally given
|
|
|
|
aDiff -= spaceLeft;
|
|
|
|
AddRemoveSpace(-aDiff, aChildrenAfterInfos,aChildrenAfterCount,spaceLeft);
|
|
|
|
|
|
|
|
if (spaceLeft != 0) {
|
|
|
|
if (aBounded) {
|
|
|
|
aDiff += spaceLeft;
|
|
|
|
AddRemoveSpace(spaceLeft, aChildrenBeforeInfos,aChildrenBeforeCount,spaceLeft);
|
|
|
|
} else {
|
|
|
|
spaceLeft = 0;
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
|
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
|
|
|
void
|
|
|
|
nsSplitterFrameInner::MoveSplitterBy(nsIPresContext* aPresContext, nscoord aDiff)
|
|
|
|
{
|
2001-09-18 21:47:32 +00:00
|
|
|
const nsRect& r = mOuter->mRect;
|
1999-09-08 23:51:02 +00:00
|
|
|
nsRect vr;
|
|
|
|
nsCOMPtr<nsIViewManager> vm;
|
|
|
|
nsIView *v;
|
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
|
|
|
mOuter->GetView(aPresContext, &v);
|
1999-09-08 23:51:02 +00:00
|
|
|
v->GetViewManager(*getter_AddRefs(vm));
|
|
|
|
v->GetBounds(vr);
|
1999-09-14 22:17:19 +00:00
|
|
|
nsRect invalid;
|
2000-03-31 07:02:06 +00:00
|
|
|
EnsureOrient();
|
|
|
|
PRBool isHorizontal = !mOuter->IsHorizontal();
|
|
|
|
if (isHorizontal) {
|
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
|
|
|
mOuter->MoveTo(aPresContext, mSplitterPos + aDiff, r.y);
|
1999-09-08 23:51:02 +00:00
|
|
|
vm->MoveViewTo(v, mSplitterViewPos + aDiff, vr.y);
|
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
|
|
|
invalid.UnionRect(r,mOuter->mRect);
|
1999-09-05 20:46:59 +00:00
|
|
|
} else {
|
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
|
|
|
mOuter->MoveTo(aPresContext, r.x, mSplitterPos + aDiff);
|
1999-09-08 23:51:02 +00:00
|
|
|
vm->MoveViewTo(v, vr.x, mSplitterViewPos + aDiff);
|
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
|
|
|
invalid.UnionRect(r,mOuter->mRect);
|
1999-09-05 20:46:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// redraw immediately only what changed. This is animation so
|
|
|
|
// it must be immediate.
|
2000-03-31 07:02:06 +00:00
|
|
|
nsBoxLayoutState state(aPresContext);
|
|
|
|
mParentBox->Redraw(state, &invalid, PR_TRUE);
|
1999-09-05 20:46:59 +00:00
|
|
|
}
|