From e94d00e1737ca7b623f8b65620aa9fa41307dd75 Mon Sep 17 00:00:00 2001 From: "dcone%netscape.com" Date: Fri, 23 Oct 1998 18:00:54 +0000 Subject: [PATCH] Fixed the resize problem, now breaks out of the infinite loop. git-svn-id: svn://10.0.0.236/trunk@13386 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/mac/nsButton.cpp | 57 ++++++++++++++++++++++++ mozilla/widget/src/mac/nsButton.h | 3 ++ mozilla/widget/src/mac/nsCheckButton.cpp | 56 +++++++++++++++++++++++ mozilla/widget/src/mac/nsCheckButton.h | 2 + mozilla/widget/src/mac/nsRadioButton.cpp | 56 +++++++++++++++++++++++ mozilla/widget/src/mac/nsRadioButton.h | 2 + mozilla/widget/src/mac/nsScrollbar.cpp | 57 ++++++++++++++++++++++++ mozilla/widget/src/mac/nsScrollbar.h | 2 + mozilla/widget/src/mac/nsTextWidget.cpp | 6 +-- 9 files changed, 238 insertions(+), 3 deletions(-) diff --git a/mozilla/widget/src/mac/nsButton.cpp b/mozilla/widget/src/mac/nsButton.cpp index 1af4e09ecf0..8737fb55e2d 100644 --- a/mozilla/widget/src/mac/nsButton.cpp +++ b/mozilla/widget/src/mac/nsButton.cpp @@ -181,6 +181,63 @@ PRBool nsButton::OnResize(nsSizeEvent &aEvent) return PR_FALSE; } +/**------------------------------------------------------------------------------- + * Resizes the Resizes the bounds + * @update dc 10/23/98 + * @Param aWidth -- The new width + * @Param aHeight -- The new width + * @Param aRepaint -- a boolean which tells if we need to repaint + * @return -- True if the event was handled, NS_OK is always return for now + */ +NS_IMETHODIMP nsButton::Resize(PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint) +{ + + mBounds.width = aWidth; + mBounds.height = aHeight; + + if(nsnull!=mWindowRegion) + ::DisposeRgn(mWindowRegion); + mWindowRegion = NewRgn(); + SetRectRgn(mWindowRegion,mBounds.x,mBounds.y,mBounds.x+mBounds.width,mBounds.y+mBounds.height); + + if (aRepaint){ + UpdateVisibilityFlag(); + UpdateDisplay(); + } + return(NS_OK); +} + + +/**------------------------------------------------------------------------------- + * Resizes the Resizes the bounds + * @update dc 10/23/98 + * @Param aX -- the left position of the bounds + * @Param aY -- the top position of the bounds + * @Param aWidth -- The new width + * @Param aHeight -- The new width + * @Param aRepaint -- a boolean which tells if we need to repaint + * @return -- True if the event was handled, NS_OK is always return for now + */ +NS_IMETHODIMP nsButton::Resize(PRUint32 aX, PRUint32 aY, PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint) +{ +nsSizeEvent event; + + mBounds.x = aX; + mBounds.y = aY; + mBounds.width = aWidth; + mBounds.height = aHeight; + if(nsnull!=mWindowRegion) + ::DisposeRgn(mWindowRegion); + mWindowRegion = NewRgn(); + SetRectRgn(mWindowRegion,mBounds.x,mBounds.y,mBounds.x+mBounds.width,mBounds.y+mBounds.height); + + if (aRepaint){ + UpdateVisibilityFlag(); + UpdateDisplay(); + } + return(NS_OK); +} + /**------------------------------------------------------------------------------- * DispatchMouseEvent handle an event for this button * @update dc 08/31/98 diff --git a/mozilla/widget/src/mac/nsButton.h b/mozilla/widget/src/mac/nsButton.h index d4eced2371d..e91f9ee6a04 100644 --- a/mozilla/widget/src/mac/nsButton.h +++ b/mozilla/widget/src/mac/nsButton.h @@ -61,6 +61,9 @@ public: virtual PRBool OnPaint(nsPaintEvent & aEvent); virtual PRBool OnResize(nsSizeEvent &aEvent); virtual PRBool DispatchMouseEvent(nsMouseEvent &aEvent); + NS_IMETHOD Resize(PRUint32 aWidth,PRUint32 aHeight, PRBool aRepaint); + NS_IMETHOD Resize(PRUint32 aX, PRUint32 aY,PRUint32 aWidth,PRUint32 aHeight, PRBool aRepaint); + // Overriden from nsWindow diff --git a/mozilla/widget/src/mac/nsCheckButton.cpp b/mozilla/widget/src/mac/nsCheckButton.cpp index f251ff4a8d1..abeffa9fea0 100644 --- a/mozilla/widget/src/mac/nsCheckButton.cpp +++ b/mozilla/widget/src/mac/nsCheckButton.cpp @@ -178,6 +178,62 @@ PRBool nsCheckButton::OnResize(nsSizeEvent &aEvent) return PR_FALSE; } +/**------------------------------------------------------------------------------- + * Resizes the Resizes the bounds + * @update dc 10/23/98 + * @Param aWidth -- The new width + * @Param aHeight -- The new width + * @Param aRepaint -- a boolean which tells if we need to repaint + * @return -- True if the event was handled, NS_OK is always return for now + */ +NS_IMETHODIMP nsCheckButton::Resize(PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint) +{ + + mBounds.width = aWidth; + mBounds.height = aHeight; + + if(nsnull!=mWindowRegion) + ::DisposeRgn(mWindowRegion); + mWindowRegion = NewRgn(); + SetRectRgn(mWindowRegion,mBounds.x,mBounds.y,mBounds.x+mBounds.width,mBounds.y+mBounds.height); + + if (aRepaint){ + UpdateVisibilityFlag(); + UpdateDisplay(); + } + return(NS_OK); +} + +/**------------------------------------------------------------------------------- + * Resizes the Resizes the bounds + * @update dc 10/23/98 + * @Param aX -- the left position of the bounds + * @Param aY -- the top position of the bounds + * @Param aWidth -- The new width + * @Param aHeight -- The new width + * @Param aRepaint -- a boolean which tells if we need to repaint + * @return -- True if the event was handled, NS_OK is always return for now + */ +NS_IMETHODIMP nsCheckButton::Resize(PRUint32 aX, PRUint32 aY, PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint) +{ +nsSizeEvent event; + + mBounds.x = aX; + mBounds.y = aY; + mBounds.width = aWidth; + mBounds.height = aHeight; + if(nsnull!=mWindowRegion) + ::DisposeRgn(mWindowRegion); + mWindowRegion = NewRgn(); + SetRectRgn(mWindowRegion,mBounds.x,mBounds.y,mBounds.x+mBounds.width,mBounds.y+mBounds.height); + + if (aRepaint){ + UpdateVisibilityFlag(); + UpdateDisplay(); + } + return(NS_OK); +} + /**------------------------------------------------------------------------------- * DispatchMouseEvent handle an event for this checkbutton * @Param aEvent -- The mouse event to respond to for this button diff --git a/mozilla/widget/src/mac/nsCheckButton.h b/mozilla/widget/src/mac/nsCheckButton.h index 1be15ef9113..25e15cb9916 100644 --- a/mozilla/widget/src/mac/nsCheckButton.h +++ b/mozilla/widget/src/mac/nsCheckButton.h @@ -60,6 +60,8 @@ public: NS_IMETHOD GetLabel(nsString& aBuffer); NS_IMETHOD SetState(const PRBool aState); NS_IMETHOD GetState(PRBool& aState); + NS_IMETHOD Resize(PRUint32 aWidth,PRUint32 aHeight, PRBool aRepaint); + NS_IMETHOD Resize(PRUint32 aX, PRUint32 aY,PRUint32 aWidth,PRUint32 aHeight, PRBool aRepaint); // event handling virtual PRBool OnPaint(nsPaintEvent & aEvent); diff --git a/mozilla/widget/src/mac/nsRadioButton.cpp b/mozilla/widget/src/mac/nsRadioButton.cpp index df1cf4c53b7..5997829fcc1 100644 --- a/mozilla/widget/src/mac/nsRadioButton.cpp +++ b/mozilla/widget/src/mac/nsRadioButton.cpp @@ -195,6 +195,62 @@ PRBool nsRadioButton::OnResize(nsSizeEvent &aEvent) return PR_FALSE; } +/**------------------------------------------------------------------------------- + * Resizes the Resizes the bounds + * @update dc 10/23/98 + * @Param aWidth -- The new width + * @Param aHeight -- The new width + * @Param aRepaint -- a boolean which tells if we need to repaint + * @return -- True if the event was handled, NS_OK is always return for now + */ +NS_IMETHODIMP nsRadioButton::Resize(PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint) +{ + + mBounds.width = aWidth; + mBounds.height = aHeight; + + if(nsnull!=mWindowRegion) + ::DisposeRgn(mWindowRegion); + mWindowRegion = NewRgn(); + SetRectRgn(mWindowRegion,mBounds.x,mBounds.y,mBounds.x+mBounds.width,mBounds.y+mBounds.height); + + if (aRepaint){ + UpdateVisibilityFlag(); + UpdateDisplay(); + } + return(NS_OK); +} + + +/**------------------------------------------------------------------------------- + * Resizes the Resizes the bounds + * @update dc 10/23/98 + * @Param aX -- the left position of the bounds + * @Param aY -- the top position of the bounds + * @Param aWidth -- The new width + * @Param aHeight -- The new width + * @Param aRepaint -- a boolean which tells if we need to repaint + * @return -- True if the event was handled, NS_OK is always return for now + */ +NS_IMETHODIMP nsRadioButton::Resize(PRUint32 aX, PRUint32 aY, PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint) +{ +nsSizeEvent event; + + mBounds.x = aX; + mBounds.y = aY; + mBounds.width = aWidth; + mBounds.height = aHeight; + if(nsnull!=mWindowRegion) + ::DisposeRgn(mWindowRegion); + mWindowRegion = NewRgn(); + SetRectRgn(mWindowRegion,mBounds.x,mBounds.y,mBounds.x+mBounds.width,mBounds.y+mBounds.height); + + if (aRepaint){ + UpdateVisibilityFlag(); + UpdateDisplay(); + } + return(NS_OK); +} /**------------------------------------------------------------------------------- * DispatchMouseEvent handle an event for this button diff --git a/mozilla/widget/src/mac/nsRadioButton.h b/mozilla/widget/src/mac/nsRadioButton.h index 152bbade506..cdeb798ed44 100644 --- a/mozilla/widget/src/mac/nsRadioButton.h +++ b/mozilla/widget/src/mac/nsRadioButton.h @@ -56,6 +56,8 @@ public: NS_IMETHOD GetLabel(nsString& aBuffer); NS_IMETHOD SetState(const PRBool aState); NS_IMETHOD GetState(PRBool& aState); + NS_IMETHOD Resize(PRUint32 aWidth,PRUint32 aHeight, PRBool aRepaint); + NS_IMETHOD Resize(PRUint32 aX, PRUint32 aY,PRUint32 aWidth,PRUint32 aHeight, PRBool aRepaint); virtual PRBool OnPaint(nsPaintEvent & aEvent); virtual PRBool OnResize(nsSizeEvent &aEvent); diff --git a/mozilla/widget/src/mac/nsScrollbar.cpp b/mozilla/widget/src/mac/nsScrollbar.cpp index 98591ccea06..7bef66470cd 100644 --- a/mozilla/widget/src/mac/nsScrollbar.cpp +++ b/mozilla/widget/src/mac/nsScrollbar.cpp @@ -501,6 +501,63 @@ PRBool nsScrollbar::OnResize(nsSizeEvent &aEvent) return nsWindow::OnResize(aEvent); } +/**------------------------------------------------------------------------------- + * Resizes the Resizes the bounds + * @update dc 10/23/98 + * @Param aWidth -- The new width + * @Param aHeight -- The new width + * @Param aRepaint -- a boolean which tells if we need to repaint + * @return -- True if the event was handled, NS_OK is always return for now + */ +NS_IMETHODIMP nsScrollbar::Resize(PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint) +{ + + mBounds.width = aWidth; + mBounds.height = aHeight; + + if(nsnull!=mWindowRegion) + ::DisposeRgn(mWindowRegion); + mWindowRegion = NewRgn(); + SetRectRgn(mWindowRegion,mBounds.x,mBounds.y,mBounds.x+mBounds.width,mBounds.y+mBounds.height); + + if (aRepaint){ + UpdateVisibilityFlag(); + UpdateDisplay(); + } + return(NS_OK); +} + + +/**------------------------------------------------------------------------------- + * Resizes the Resizes the bounds + * @update dc 10/23/98 + * @Param aX -- the left position of the bounds + * @Param aY -- the top position of the bounds + * @Param aWidth -- The new width + * @Param aHeight -- The new width + * @Param aRepaint -- a boolean which tells if we need to repaint + * @return -- True if the event was handled, NS_OK is always return for now + */ +NS_IMETHODIMP nsScrollbar::Resize(PRUint32 aX, PRUint32 aY, PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint) +{ +nsSizeEvent event; + + mBounds.x = aX; + mBounds.y = aY; + mBounds.width = aWidth; + mBounds.height = aHeight; + if(nsnull!=mWindowRegion) + ::DisposeRgn(mWindowRegion); + mWindowRegion = NewRgn(); + SetRectRgn(mWindowRegion,mBounds.x,mBounds.y,mBounds.x+mBounds.width,mBounds.y+mBounds.height); + + if (aRepaint){ + UpdateVisibilityFlag(); + UpdateDisplay(); + } + return(NS_OK); +} + /**------------------------------------------------------------------------------- * Set the scrollbar position * @update dc 10/31/98 diff --git a/mozilla/widget/src/mac/nsScrollbar.h b/mozilla/widget/src/mac/nsScrollbar.h index 77268d0cca2..be8a03789ce 100644 --- a/mozilla/widget/src/mac/nsScrollbar.h +++ b/mozilla/widget/src/mac/nsScrollbar.h @@ -68,6 +68,8 @@ public: NS_IMETHOD GetLineIncrement(PRUint32& aSize); NS_IMETHOD SetParameters(PRUint32 aMaxRange, PRUint32 aThumbSize, PRUint32 aPosition, PRUint32 aLineIncrement); + NS_IMETHOD Resize(PRUint32 aWidth,PRUint32 aHeight, PRBool aRepaint); + NS_IMETHOD Resize(PRUint32 aX, PRUint32 aY,PRUint32 aWidth,PRUint32 aHeight, PRBool aRepaint); virtual PRBool OnPaint(nsPaintEvent & aEvent); virtual PRBool OnScroll(nsScrollbarEvent & aEvent, PRUint32 cPos); diff --git a/mozilla/widget/src/mac/nsTextWidget.cpp b/mozilla/widget/src/mac/nsTextWidget.cpp index 1169e7e1f45..106d1b4373f 100644 --- a/mozilla/widget/src/mac/nsTextWidget.cpp +++ b/mozilla/widget/src/mac/nsTextWidget.cpp @@ -292,7 +292,7 @@ GrafPtr theport; } /**------------------------------------------------------------------------------- - * Resizes the button, currently handles by nsWindow + * Resizes the TEXT, currently handles by nsWindow * @update dc 08/31/98 * @Param aEvent -- The event for this resize * @return -- True if the event was handled, PR_FALSE is always return for now @@ -418,7 +418,7 @@ LongRect macRect; event.windowSize = &mBounds; event.eventStructType = NS_SIZE_EVENT; event.widget = this; - this->DispatchEvent(&event, eventStatus); + //this->DispatchEvent(&event, eventStatus); return NS_OK; } @@ -467,7 +467,7 @@ LongRect macRect; event.windowSize = &mBounds; event.widget = this; event.eventStructType = NS_SIZE_EVENT; - this->DispatchEvent(&event, eventStatus); + //this->DispatchEvent(&event, eventStatus); return NS_OK; }