diff --git a/mozilla/layout/xul/base/src/nsTreeCellFrame.cpp b/mozilla/layout/xul/base/src/nsTreeCellFrame.cpp index 60a4e189690..2bcc4a28bf2 100644 --- a/mozilla/layout/xul/base/src/nsTreeCellFrame.cpp +++ b/mozilla/layout/xul/base/src/nsTreeCellFrame.cpp @@ -190,8 +190,7 @@ nsTreeCellFrame::HandleEvent(nsIPresContext& aPresContext, HandleMouseExitEvent(aPresContext, aEvent, aEventStatus); else if (aEvent->message == NS_MOUSE_LEFT_DOUBLECLICK) HandleDoubleClickEvent(aPresContext, aEvent, aEventStatus); - - + return NS_OK; } @@ -245,7 +244,6 @@ nsTreeCellFrame::HandleMouseExitEvent(nsIPresContext& aPresContext, { if (mIsHeader) { - // Nothing to do? } else { @@ -255,6 +253,49 @@ nsTreeCellFrame::HandleMouseExitEvent(nsIPresContext& aPresContext, return NS_OK; } +PRBool +nsTreeCellFrame::CanResize(nsPoint& aPoint) { + nsRect rect; + GetRect(rect); + PRInt32 diff = (rect.x + rect.width) - aPoint.x; + + nsCOMPtr parent; + mContent->GetParent(*getter_AddRefs(parent)); + PRInt32 index; + parent->IndexOf(mContent, index); + PRInt32 count; + parent->ChildCount(count); + count--; + + if ((index > 0 && diff <= 60) || ((rect.width - diff) <= 60 && index < count)) { + return PR_TRUE; + } + + return PR_FALSE; +} + +NS_IMETHODIMP +nsTreeCellFrame::GetCursor(nsIPresContext& aPresContext, + nsPoint& aPoint, + PRInt32& aCursor) +{ + if (mIsHeader) { + // Figure out if the point is over the resize stuff. + nsRect rect; + GetRect(rect); + PRInt32 diff = (rect.x + rect.width) - aPoint.x; + + if (CanResize(aPoint)) { + aCursor = NS_STYLE_CURSOR_W_RESIZE; + } + else { + aCursor = NS_STYLE_CURSOR_DEFAULT; + } + } + else aCursor = NS_STYLE_CURSOR_DEFAULT; + return NS_OK; +} + void nsTreeCellFrame::ToggleOpenClose() { diff --git a/mozilla/layout/xul/base/src/nsTreeCellFrame.h b/mozilla/layout/xul/base/src/nsTreeCellFrame.h index 255372b0435..5ac8c9b603f 100644 --- a/mozilla/layout/xul/base/src/nsTreeCellFrame.h +++ b/mozilla/layout/xul/base/src/nsTreeCellFrame.h @@ -46,6 +46,10 @@ public: NS_IMETHOD Destroy(nsIPresContext& aPresContext); + NS_IMETHOD GetCursor(nsIPresContext& aPresContext, + nsPoint& aPoint, + PRInt32& aCursor); + void Hover(nsIPresContext& presContext, PRBool isHover, PRBool notifyForReflow = PR_TRUE); nsTableFrame* GetTreeFrame(); @@ -76,10 +80,11 @@ protected: nsGUIEvent* aEvent, nsEventStatus& aEventStatus); + PRBool CanResize(nsPoint& aPoint); + protected: // Data members PRBool mIsHeader; // Whether or not we're a column header nsTreeFrame* mTreeFrame; // Our parent tree frame. PRBool mAllowEvents; // Whether we let events go through. - }; // class nsTableCellFrame