WIP: API change on OnResize for ViewManager support.

This commit is contained in:
spider%netscape.com 1998-09-09 16:12:03 +00:00
Родитель 56048c21b0
Коммит cb8af6e9dd
11 изменённых файлов: 45 добавлений и 33 удалений

Просмотреть файл

@ -173,7 +173,7 @@ nsresult nsCalendarContainer::Init(nsIWidget * aParent,
mRootUI->Init();
}
mRootUI->Init(aParent, aBounds,(((nsCalendarShell *)aCalendarShell)->mShellInstance->GetShellEventCallback()));
mRootUI->Init(aParent, aBounds,(((nsCalendarShell *)aCalendarShell)->mShellInstance->GetShellEventCallback()));
widget_parent = mRootUI->GetWidget();
@ -190,18 +190,21 @@ nsresult nsCalendarContainer::Init(nsIWidget * aParent,
if (res != NS_OK)
return res;
static NS_DEFINE_IID(kCWidgetCID, NS_CHILD_CID);
view->Init(mViewManager,
aBounds,
nsnull,
nsnull,//&kCWidgetCID,
nsnull,
nsnull,
widget_parent->GetNativeData(NS_NATIVE_WIDGET));
aParent->GetNativeData(NS_NATIVE_WIDGET));
mViewManager->SetRootView(view);
mViewManager->DisableRefresh();
mViewManager->SetWindowDimensions(aBounds.width, aBounds.height);
//view->GetWidget(widget_parent);
gXPFCToolkit->GetCanvasManager()->Register(mRootUI,view);
}
@ -531,12 +534,13 @@ nsEventStatus nsCalendarContainer::HandleEvent(nsGUIEvent *aEvent)
/*
* find the canvas this event is associated with!
*/
res = aEvent->widget->QueryInterface(kIXPFCCanvasIID,(void**)&canvas);
if (res == NS_OK)
{
es = canvas->HandleEvent(aEvent);
//mViewManager->DispatchEvent(aEvent, es);
NS_RELEASE(canvas);
@ -545,13 +549,6 @@ nsEventStatus nsCalendarContainer::HandleEvent(nsGUIEvent *aEvent)
if (aEvent->message == NS_SIZE)
mRootUI->SetBounds(*(((nsSizeEvent*)aEvent)->windowSize));
#if 0
mRootUI->GetWidget()->Resize(((nsSizeEvent*)aEvent)->windowSize->x,
((nsSizeEvent*)aEvent)->windowSize->y,
((nsSizeEvent*)aEvent)->windowSize->width,
((nsSizeEvent*)aEvent)->windowSize->height,
PR_FALSE);
#endif
return (mRootUI->HandleEvent(aEvent));
}

Просмотреть файл

@ -40,7 +40,7 @@ public:
NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent);
NS_IMETHOD_(nsEventStatus) OnPaint(nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect);
NS_IMETHOD_(nsEventStatus) OnResize(nsGUIEvent *aEvent);
NS_IMETHOD_(nsEventStatus) OnResize(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
NS_IMETHOD GetClassPreferredSize(nsSize& aSize);

Просмотреть файл

@ -190,10 +190,11 @@ nsEventStatus PR_CALLBACK HandleEventTextField(nsGUIEvent *aEvent)
return nsEventStatus_eIgnore;
}
nsEventStatus nsCalCommandCanvas :: OnResize(nsGUIEvent *aEvent)
nsEventStatus nsCalCommandCanvas :: OnResize(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
{
SetBounds(*((nsSizeEvent*)aEvent)->windowSize);
return (nsXPFCCanvas::OnResize(aEvent));
nsRect rect(aX, aY, aWidth, aHeight);
SetBounds(rect);
return (nsXPFCCanvas::OnResize(aX, aY, aWidth, aHeight));
}
nsresult nsCalCommandCanvas :: SetBounds(const nsRect &aBounds)

Просмотреть файл

@ -238,7 +238,7 @@ protected:
public:
NS_IMETHOD_(nsEventStatus) OnPaint(nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect);
NS_IMETHOD_(nsEventStatus) OnResize(nsGUIEvent *aEvent);
NS_IMETHOD_(nsEventStatus) OnResize(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
NS_IMETHOD_(nsEventStatus) OnLeftButtonDown(nsGUIEvent *aEvent);
NS_IMETHOD_(nsEventStatus) OnLeftButtonUp(nsGUIEvent *aEvent);
NS_IMETHOD_(nsEventStatus) OnMouseMove(nsGUIEvent *aEvent);

Просмотреть файл

@ -1628,9 +1628,9 @@ nsEventStatus nsCalMonthContextController :: OnPaint(nsIRenderingContext& aRende
return nsEventStatus_eConsumeNoDefault;
}
nsEventStatus nsCalMonthContextController::OnResize(nsGUIEvent *aEvent)
nsEventStatus nsCalMonthContextController :: OnResize(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
{
GetWidget()->Resize(0,0,((nsSizeEvent*)aEvent)->windowSize->width,((nsSizeEvent*)aEvent)->windowSize->height, PR_TRUE);
GetWidget()->Resize(0,0,aWidth,aHeight, PR_TRUE);
return nsEventStatus_eConsumeNoDefault;
}

Просмотреть файл

@ -77,7 +77,7 @@ public:
NS_IMETHOD_(nsEventStatus) OnPaint(nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect);
NS_IMETHOD_(nsEventStatus) OnResize(nsGUIEvent *aEvent);
NS_IMETHOD_(nsEventStatus) OnResize(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
NS_IMETHOD_(nsEventStatus) OnMove(nsGUIEvent *aEvent);
NS_IMETHOD_(nsEventStatus) OnGotFocus(nsGUIEvent *aEvent);

Просмотреть файл

@ -41,7 +41,7 @@ public:
NS_IMETHOD_(nsEventStatus) OnPaint(nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect);
NS_IMETHOD_(nsEventStatus) OnResize(nsGUIEvent *aEvent);
NS_IMETHOD_(nsEventStatus) OnResize(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
NS_IMETHOD GetClassPreferredSize(nsSize& aSize);
protected:

Просмотреть файл

@ -136,7 +136,7 @@ public:
* @param aEvent The GUI Event to be handled
* @result nsEventStatus, status of OnResize event processing
*/
NS_IMETHOD_(nsEventStatus) OnResize(nsGUIEvent *aEvent) = 0;
NS_IMETHOD_(nsEventStatus) OnResize(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) = 0;
/**
* Handle an OnMove Message

Просмотреть файл

@ -834,7 +834,7 @@ nsEventStatus nsXPFCCanvas :: OnPaint(nsIRenderingContext& aRenderingContext,
}
nsEventStatus nsXPFCCanvas :: OnResize(nsGUIEvent *aEvent)
nsEventStatus nsXPFCCanvas :: OnResize(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
{
//SetBounds(*((nsSizeEvent*)aEvent)->windowSize);
@ -844,15 +844,15 @@ nsEventStatus nsXPFCCanvas :: OnResize(nsGUIEvent *aEvent)
mBounds.x = 0 ;
mBounds.y = 0 ;
} else {
mBounds.x = ((nsSizeEvent*)aEvent)->windowSize->x ;
mBounds.y = ((nsSizeEvent*)aEvent)->windowSize->y ;
mBounds.x = aX ;
mBounds.y = aY ;
}
mBounds.width = ((nsSizeEvent*)aEvent)->windowSize->width ;
mBounds.height = ((nsSizeEvent*)aEvent)->windowSize->height ;
mBounds.width = aWidth ;
mBounds.height = aHeight ;
mLayout->Layout();
return (DefaultProcessing(aEvent));
return (DefaultProcessing(nsnull));
}
nsEventStatus nsXPFCCanvas :: OnLeftButtonDown(nsGUIEvent *aEvent)
@ -1228,7 +1228,12 @@ nsEventStatus nsXPFCCanvas :: ResizeChildWidgets(nsGUIEvent *aEvent)
{
widget = (nsIXPFCCanvas *) iterator->CurrentItem();
widget->OnResize(aEvent);
nscoord x = ((nsSizeEvent*)aEvent)->windowSize->x;
nscoord y = ((nsSizeEvent*)aEvent)->windowSize->y;
nscoord w = ((nsSizeEvent*)aEvent)->windowSize->width;
nscoord h = ((nsSizeEvent*)aEvent)->windowSize->height;
widget->OnResize(x,y,w,h);
iterator->Next();
}
@ -1290,7 +1295,7 @@ nsEventStatus nsXPFCCanvas :: HandleEvent(nsGUIEvent *aEvent)
canvas = (nsXPFCCanvas *) iterator->CurrentItem();
if (canvas->mWidget != nsnull)
mWidget->Invalidate(PR_FALSE);
canvas->mWidget->Invalidate(PR_FALSE);
iterator->Next();
}
@ -1306,7 +1311,12 @@ nsEventStatus nsXPFCCanvas :: HandleEvent(nsGUIEvent *aEvent)
case NS_SIZE:
{
OnResize(aEvent);
nscoord x = ((nsSizeEvent*)aEvent)->windowSize->x;
nscoord y = ((nsSizeEvent*)aEvent)->windowSize->y;
nscoord w = ((nsSizeEvent*)aEvent)->windowSize->width;
nscoord h = ((nsSizeEvent*)aEvent)->windowSize->height;
OnResize(x,y,w,h);
}
break;

Просмотреть файл

@ -246,6 +246,8 @@ nsresult nsXPFCCanvasManager::HandleEvent(nsIView * aView,
if (canvas == nsnull)
return NS_OK;
aEventStatus = canvas->HandleEvent(aEvent);
return NS_OK;
}
@ -268,6 +270,8 @@ nsresult nsXPFCCanvasManager::ResizeReflow(nsIView * aView,
if (canvas == nsnull)
return NS_OK;
canvas->OnResize(0,0,aWidth,aHeight);
return NS_OK;
}

Просмотреть файл

@ -98,9 +98,9 @@ nsresult nsXPFCHTMLCanvas :: Init()
return NS_OK;
}
nsEventStatus nsXPFCHTMLCanvas :: OnResize(nsGUIEvent *aEvent)
nsEventStatus nsXPFCHTMLCanvas :: OnResize(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
{
return (nsXPFCCanvas::OnResize(aEvent));
return (nsXPFCCanvas::OnResize(aX, aY, aWidth, aHeight));
}
nsresult nsXPFCHTMLCanvas :: SetBounds(const nsRect &aBounds)