Making splitters support persistence.

This commit is contained in:
hyatt%netscape.com 2000-09-08 06:55:10 +00:00
Родитель a465d37a02
Коммит 366dca089a
3 изменённых файлов: 37 добавлений и 17 удалений

Просмотреть файл

@ -141,6 +141,8 @@ XUL_ATOM(resizeafter, "resizeafter")
XUL_ATOM(state, "state") XUL_ATOM(state, "state")
XUL_ATOM(debug, "debug") XUL_ATOM(debug, "debug")
XUL_ATOM(fixed, "fixed")
// grid // grid
XUL_ATOM(grid, "grid") XUL_ATOM(grid, "grid")
XUL_ATOM(rows, "rows") XUL_ATOM(rows, "rows")

Просмотреть файл

@ -770,6 +770,14 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
if (button != 1) if (button != 1)
return NS_OK; return NS_OK;
nsCOMPtr<nsIContent> content;
mOuter->GetContent(getter_AddRefs(content));
nsAutoString disabled;
content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled);
if (disabled.Equals(NS_LITERAL_STRING("true")))
return NS_OK;
nsBoxLayoutState state(mOuter->mPresContext); nsBoxLayoutState state(mOuter->mPresContext);
mCurrentPos = 0; mCurrentPos = 0;
mPressed = PR_TRUE; mPressed = PR_TRUE;
@ -808,6 +816,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
nsIBox* childBox = nsnull; nsIBox* childBox = nsnull;
mParentBox->GetChildBox(&childBox); mParentBox->GetChildBox(&childBox);
PRBool skip = PR_FALSE;
while (nsnull != childBox) while (nsnull != childBox)
{ {
nsIFrame* childFrame = nsnull; nsIFrame* childFrame = nsnull;
@ -849,7 +858,11 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
childBox->GetBounds(r); childBox->GetBounds(r);
r.Inflate(margin); r.Inflate(margin);
nsAutoString fixed;
content->GetAttribute(kNameSpaceID_None, nsXULAtoms::fixed, fixed);
if (count < childIndex) { if (count < childIndex) {
if (!fixed.Equals(NS_LITERAL_STRING("true"))) {
mChildInfosBefore[mChildInfosBeforeCount].child = childBox; mChildInfosBefore[mChildInfosBeforeCount].child = childBox;
mChildInfosBefore[mChildInfosBeforeCount].min = isHorizontal ? minSize.width : minSize.height; mChildInfosBefore[mChildInfosBeforeCount].min = isHorizontal ? minSize.width : minSize.height;
mChildInfosBefore[mChildInfosBeforeCount].max = isHorizontal ? maxSize.width : maxSize.height; mChildInfosBefore[mChildInfosBeforeCount].max = isHorizontal ? maxSize.width : maxSize.height;
@ -858,7 +871,9 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
mChildInfosBefore[mChildInfosBeforeCount].index = count; mChildInfosBefore[mChildInfosBeforeCount].index = count;
mChildInfosBefore[mChildInfosBeforeCount].changed = mChildInfosBefore[mChildInfosBeforeCount].current; mChildInfosBefore[mChildInfosBeforeCount].changed = mChildInfosBefore[mChildInfosBeforeCount].current;
mChildInfosBeforeCount++; mChildInfosBeforeCount++;
}
} else if (count > childIndex) { } else if (count > childIndex) {
if (!fixed.Equals(NS_LITERAL_STRING("true"))) {
mChildInfosAfter[mChildInfosAfterCount].child = childBox; mChildInfosAfter[mChildInfosAfterCount].child = childBox;
mChildInfosAfter[mChildInfosAfterCount].min = isHorizontal ? minSize.width : minSize.height; mChildInfosAfter[mChildInfosAfterCount].min = isHorizontal ? minSize.width : minSize.height;
mChildInfosAfter[mChildInfosAfterCount].max = isHorizontal ? maxSize.width : maxSize.height; mChildInfosAfter[mChildInfosAfterCount].max = isHorizontal ? maxSize.width : maxSize.height;
@ -869,6 +884,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
mChildInfosAfterCount++; mChildInfosAfterCount++;
} }
} }
}
rv = childBox->GetNextBox(&childBox); rv = childBox->GetNextBox(&childBox);
NS_ASSERTION(rv == NS_OK,"failed to get next child"); NS_ASSERTION(rv == NS_OK,"failed to get next child");
@ -1191,7 +1207,7 @@ nsSplitterFrameInner::SetPreferredSize(nsBoxLayoutState& aState, nsIBox* aChildB
if (oldValue.EqualsWithConversion(ch)) if (oldValue.EqualsWithConversion(ch))
return; return;
content->SetAttribute(kNameSpaceID_None, attribute, NS_ConvertASCIItoUCS2(ch), PR_FALSE); content->SetAttribute(kNameSpaceID_None, attribute, NS_ConvertASCIItoUCS2(ch), PR_TRUE);
#ifndef REAL_TIME_DRAG #ifndef REAL_TIME_DRAG
aChildBox->MarkDirty(aState); aChildBox->MarkDirty(aState);
#else #else

Просмотреть файл

@ -141,6 +141,8 @@ XUL_ATOM(resizeafter, "resizeafter")
XUL_ATOM(state, "state") XUL_ATOM(state, "state")
XUL_ATOM(debug, "debug") XUL_ATOM(debug, "debug")
XUL_ATOM(fixed, "fixed")
// grid // grid
XUL_ATOM(grid, "grid") XUL_ATOM(grid, "grid")
XUL_ATOM(rows, "rows") XUL_ATOM(rows, "rows")