From 20a29c53b232f64aafb6a66eb630e75422c8a943 Mon Sep 17 00:00:00 2001 From: "dcone%netscape.com" Date: Wed, 23 Sep 1998 22:09:52 +0000 Subject: [PATCH] fixed resizing problems --- widget/src/mac/nsRadioButton.cpp | 9 +++++++-- widget/src/mac/nsRadioButton.h | 2 +- widget/src/mac/nsScrollbar.cpp | 13 +++++++------ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/widget/src/mac/nsRadioButton.cpp b/widget/src/mac/nsRadioButton.cpp index 3b6997471adc..b2ad901fda30 100644 --- a/widget/src/mac/nsRadioButton.cpp +++ b/widget/src/mac/nsRadioButton.cpp @@ -206,7 +206,7 @@ PRBool nsRadioButton::OnResize(nsSizeEvent &aEvent) } - +#ifdef NOTNOW /* * @update gpk 08/27/98 * @param aX -- x offset in widget local coordinates @@ -225,6 +225,7 @@ nsRadioButton::PtInWindow(PRInt32 aX,PRInt32 aY) result = PR_TRUE; return(result); } +#endif PRBool nsRadioButton::DispatchMouseEvent(nsMouseEvent &aEvent) @@ -237,6 +238,7 @@ PRBool result; mMouseDownInButton = PR_TRUE; DrawWidget(PR_TRUE); result = nsWindow::DispatchMouseEvent(aEvent); + result = nsEventStatus_eConsumeDoDefault; break; case NS_MOUSE_LEFT_BUTTON_UP: mMouseDownInButton = PR_FALSE; @@ -272,6 +274,7 @@ void nsRadioButton::DrawWidget(PRBool aMouseInside) { PRInt16 width,x,y,buttonsize=14; +PRInt32 offx,offy; nsRect therect; Rect macrect,rb; GrafPtr theport; @@ -279,9 +282,10 @@ RGBColor blackcolor = {0,0,0}; RgnHandle thergn; Str255 tempstring; - + CalcOffset(offx,offy); GetPort(&theport); ::SetPort(mWindowPtr); + ::SetOrigin(-offx,-offy); GetBounds(therect); nsRectToMacRect(therect,macrect); thergn = ::NewRgn(); @@ -318,6 +322,7 @@ Str255 tempstring; ::PenSize(1,1); ::SetClip(thergn); + ::SetOrigin(0,0); ::SetPort(theport); } diff --git a/widget/src/mac/nsRadioButton.h b/widget/src/mac/nsRadioButton.h index b517e7f7a527..c8ee08d9dff2 100644 --- a/widget/src/mac/nsRadioButton.h +++ b/widget/src/mac/nsRadioButton.h @@ -66,7 +66,7 @@ public: void LocalToWindowCoordinate(nsRect& aRect); // Overriden from nsWindow - virtual PRBool PtInWindow(PRInt32 aX,PRInt32 aY); + //virtual PRBool PtInWindow(PRInt32 aX,PRInt32 aY); private: diff --git a/widget/src/mac/nsScrollbar.cpp b/widget/src/mac/nsScrollbar.cpp index 275edf91924e..8e716d02fb00 100644 --- a/widget/src/mac/nsScrollbar.cpp +++ b/widget/src/mac/nsScrollbar.cpp @@ -227,8 +227,7 @@ PRBool result; void nsScrollbar::DrawWidget() { -PRInt16 thumbwidth,thumbheight; -PRInt16 width,x,y,tw; +PRInt32 offx,offy; nsRect therect,tr; Rect macrect; GrafPtr theport; @@ -236,8 +235,10 @@ RGBColor blackcolor = {0,0,0}; RgnHandle thergn; + CalcOffset(offx,offy); GetPort(&theport); ::SetPort(mWindowPtr); + ::SetOrigin(-offx,-offy); GetBounds(therect); nsRectToMacRect(therect,macrect); thergn = ::NewRgn(); @@ -271,6 +272,7 @@ RgnHandle thergn; ::PenSize(1,1); ::SetClip(thergn); + ::SetOrigin(0,0); ::SetPort(theport); } @@ -433,10 +435,9 @@ PRBool nsScrollbar::OnResize(nsSizeEvent &aEvent) //------------------------------------------------------------------------- int nsScrollbar::AdjustScrollBarPosition(int aPosition) { - int maxRange; - int sliderSize; + int maxRange=0,cap,sliderSize=0; - int cap = maxRange - sliderSize; + cap = maxRange - sliderSize; return aPosition > cap ? cap : aPosition; } @@ -448,7 +449,7 @@ int nsScrollbar::AdjustScrollBarPosition(int aPosition) PRBool nsScrollbar::OnScroll(nsScrollbarEvent & aEvent, PRUint32 cPos) { PRBool result = PR_TRUE; -int newPosition; +int newPosition=0; int range; switch (aEvent.message)