Fixing tree widget updating problem.

git-svn-id: svn://10.0.0.236/trunk@49171 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
hyatt%netscape.com
1999-09-28 00:57:46 +00:00
parent 47b05de572
commit e30aa0ecb3
3 changed files with 29 additions and 5 deletions

View File

@@ -80,7 +80,7 @@ NS_NewTreeCellFrame (nsIFrame** aNewFrame)
// Constructor
nsTreeCellFrame::nsTreeCellFrame()
:nsTableCellFrame() { mAllowEvents = PR_FALSE; mIsHeader = PR_FALSE; }
:nsTableCellFrame() { mAllowEvents = PR_FALSE; mIsHeader = PR_FALSE; mAnonymousContent = nsnull; }
// Destructor
nsTreeCellFrame::~nsTreeCellFrame()
@@ -136,6 +136,24 @@ nsTreeCellFrame::Init(nsIPresContext& aPresContext,
return rv;
}
NS_IMETHODIMP nsTreeCellFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute,
PRInt32 aHint)
{
nsresult rv = nsTableCellFrame::AttributeChanged(aPresContext, aChild, aAttribute, aHint);
if (mAnonymousContent && (aAttribute == nsHTMLAtoms::align || aAttribute == nsXULAtoms::crop
|| aAttribute == nsHTMLAtoms::value))
{
nsAutoString value;
// XXX should check if attribute has been removed
mContent->GetAttribute(kNameSpaceID_None, aAttribute, value);
mAnonymousContent->SetAttribute(kNameSpaceID_None, aAttribute, value, PR_TRUE);
}
return rv;
}
nsTableFrame* nsTreeCellFrame::GetTreeFrame()
{
return mTreeFrame;

View File

@@ -27,6 +27,10 @@ class nsTreeCellFrame : public nsTableCellFrame
public:
friend nsresult NS_NewTreeCellFrame(nsIFrame** aNewFrame);
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsIAtom* aAttribute,
PRInt32 aHint);
NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, // Overridden to capture events
nsIFrame** aFrame);
@@ -56,11 +60,11 @@ public:
nsTableFrame* GetTreeFrame();
void SetAllowEvents(PRBool allowEvents) { mAllowEvents = allowEvents; };
void SetAnonymousContent(nsIContent* aAnonymousContent) { mAnonymousContent = aAnonymousContent; };
void ToggleOpenClose();
void Open();
void Close();
protected:
nsTreeCellFrame();
virtual ~nsTreeCellFrame();
@@ -90,4 +94,5 @@ protected:
PRBool mIsHeader; // Whether or not we're a column header
nsTreeFrame* mTreeFrame; // Our parent tree frame.
PRBool mAllowEvents; // Whether we let events go through.
nsIContent* mAnonymousContent; // Our anonymous titledbutton [WEAK ref]
}; // class nsTableCellFrame

View File

@@ -289,7 +289,8 @@ nsTreeRowGroupFrame::FindRowContentAtIndex(PRInt32& aIndex, nsIContent* aParent,
void
nsTreeRowGroupFrame::FindPreviousRowContent(PRInt32& aDelta, nsIContent* aUpwardHint,
nsIContent* aDownwardHint, nsIContent** aResult)
nsIContent* aDownwardHint,
nsIContent** aResult)
{
// Init to nsnull.
*aResult = nsnull;
@@ -372,7 +373,7 @@ nsTreeRowGroupFrame::FindPreviousRowContent(PRInt32& aDelta, nsIContent* aUpward
// Hopeless. It ain't in there.
return;
}
else // We didn't find it here. We need to go up to our parent, using ourselves as a hint.
else if (!aDownwardHint) // We didn't find it here. We need to go up to our parent, using ourselves as a hint.
FindPreviousRowContent(aDelta, parentContent, nsnull, aResult);
// Bail. There's nothing else we can do.