fixed resizing problems

This commit is contained in:
dcone%netscape.com 1998-09-23 22:09:52 +00:00
parent bb6e438879
commit 20a29c53b2
3 changed files with 15 additions and 9 deletions

View File

@ -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);
}

View File

@ -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:

View File

@ -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)