зеркало из https://github.com/mozilla/pjs.git
WIP: API change on OnResize for ViewManager support.
This commit is contained in:
Родитель
56048c21b0
Коммит
cb8af6e9dd
|
@ -190,18 +190,21 @@ nsresult nsCalendarContainer::Init(nsIWidget * aParent,
|
||||||
if (res != NS_OK)
|
if (res != NS_OK)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
static NS_DEFINE_IID(kCWidgetCID, NS_CHILD_CID);
|
||||||
|
|
||||||
view->Init(mViewManager,
|
view->Init(mViewManager,
|
||||||
aBounds,
|
aBounds,
|
||||||
nsnull,
|
nsnull,
|
||||||
|
nsnull,//&kCWidgetCID,
|
||||||
nsnull,
|
nsnull,
|
||||||
nsnull,
|
aParent->GetNativeData(NS_NATIVE_WIDGET));
|
||||||
widget_parent->GetNativeData(NS_NATIVE_WIDGET));
|
|
||||||
|
|
||||||
mViewManager->SetRootView(view);
|
mViewManager->SetRootView(view);
|
||||||
|
|
||||||
mViewManager->DisableRefresh();
|
|
||||||
mViewManager->SetWindowDimensions(aBounds.width, aBounds.height);
|
mViewManager->SetWindowDimensions(aBounds.width, aBounds.height);
|
||||||
|
|
||||||
|
//view->GetWidget(widget_parent);
|
||||||
|
|
||||||
gXPFCToolkit->GetCanvasManager()->Register(mRootUI,view);
|
gXPFCToolkit->GetCanvasManager()->Register(mRootUI,view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,13 +534,14 @@ nsEventStatus nsCalendarContainer::HandleEvent(nsGUIEvent *aEvent)
|
||||||
/*
|
/*
|
||||||
* find the canvas this event is associated with!
|
* find the canvas this event is associated with!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
res = aEvent->widget->QueryInterface(kIXPFCCanvasIID,(void**)&canvas);
|
res = aEvent->widget->QueryInterface(kIXPFCCanvasIID,(void**)&canvas);
|
||||||
|
|
||||||
if (res == NS_OK)
|
if (res == NS_OK)
|
||||||
{
|
{
|
||||||
es = canvas->HandleEvent(aEvent);
|
es = canvas->HandleEvent(aEvent);
|
||||||
|
|
||||||
|
//mViewManager->DispatchEvent(aEvent, es);
|
||||||
|
|
||||||
NS_RELEASE(canvas);
|
NS_RELEASE(canvas);
|
||||||
|
|
||||||
return es;
|
return es;
|
||||||
|
@ -545,13 +549,6 @@ nsEventStatus nsCalendarContainer::HandleEvent(nsGUIEvent *aEvent)
|
||||||
|
|
||||||
if (aEvent->message == NS_SIZE)
|
if (aEvent->message == NS_SIZE)
|
||||||
mRootUI->SetBounds(*(((nsSizeEvent*)aEvent)->windowSize));
|
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));
|
return (mRootUI->HandleEvent(aEvent));
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent);
|
NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent);
|
||||||
NS_IMETHOD_(nsEventStatus) OnPaint(nsIRenderingContext& aRenderingContext,
|
NS_IMETHOD_(nsEventStatus) OnPaint(nsIRenderingContext& aRenderingContext,
|
||||||
const nsRect& aDirtyRect);
|
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);
|
NS_IMETHOD GetClassPreferredSize(nsSize& aSize);
|
||||||
|
|
||||||
|
|
|
@ -190,10 +190,11 @@ nsEventStatus PR_CALLBACK HandleEventTextField(nsGUIEvent *aEvent)
|
||||||
return nsEventStatus_eIgnore;
|
return nsEventStatus_eIgnore;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsEventStatus nsCalCommandCanvas :: OnResize(nsGUIEvent *aEvent)
|
nsEventStatus nsCalCommandCanvas :: OnResize(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||||
{
|
{
|
||||||
SetBounds(*((nsSizeEvent*)aEvent)->windowSize);
|
nsRect rect(aX, aY, aWidth, aHeight);
|
||||||
return (nsXPFCCanvas::OnResize(aEvent));
|
SetBounds(rect);
|
||||||
|
return (nsXPFCCanvas::OnResize(aX, aY, aWidth, aHeight));
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsCalCommandCanvas :: SetBounds(const nsRect &aBounds)
|
nsresult nsCalCommandCanvas :: SetBounds(const nsRect &aBounds)
|
||||||
|
|
|
@ -238,7 +238,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
NS_IMETHOD_(nsEventStatus) OnPaint(nsIRenderingContext& aRenderingContext,
|
NS_IMETHOD_(nsEventStatus) OnPaint(nsIRenderingContext& aRenderingContext,
|
||||||
const nsRect& aDirtyRect);
|
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) OnLeftButtonDown(nsGUIEvent *aEvent);
|
||||||
NS_IMETHOD_(nsEventStatus) OnLeftButtonUp(nsGUIEvent *aEvent);
|
NS_IMETHOD_(nsEventStatus) OnLeftButtonUp(nsGUIEvent *aEvent);
|
||||||
NS_IMETHOD_(nsEventStatus) OnMouseMove(nsGUIEvent *aEvent);
|
NS_IMETHOD_(nsEventStatus) OnMouseMove(nsGUIEvent *aEvent);
|
||||||
|
|
|
@ -1628,9 +1628,9 @@ nsEventStatus nsCalMonthContextController :: OnPaint(nsIRenderingContext& aRende
|
||||||
return nsEventStatus_eConsumeNoDefault;
|
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;
|
return nsEventStatus_eConsumeNoDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ public:
|
||||||
NS_IMETHOD_(nsEventStatus) OnPaint(nsIRenderingContext& aRenderingContext,
|
NS_IMETHOD_(nsEventStatus) OnPaint(nsIRenderingContext& aRenderingContext,
|
||||||
const nsRect& aDirtyRect);
|
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) OnMove(nsGUIEvent *aEvent);
|
||||||
|
|
||||||
NS_IMETHOD_(nsEventStatus) OnGotFocus(nsGUIEvent *aEvent);
|
NS_IMETHOD_(nsEventStatus) OnGotFocus(nsGUIEvent *aEvent);
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
NS_IMETHOD_(nsEventStatus) OnPaint(nsIRenderingContext& aRenderingContext,
|
NS_IMETHOD_(nsEventStatus) OnPaint(nsIRenderingContext& aRenderingContext,
|
||||||
const nsRect& aDirtyRect);
|
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);
|
NS_IMETHOD GetClassPreferredSize(nsSize& aSize);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -136,7 +136,7 @@ public:
|
||||||
* @param aEvent The GUI Event to be handled
|
* @param aEvent The GUI Event to be handled
|
||||||
* @result nsEventStatus, status of OnResize event processing
|
* @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
|
* 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);
|
//SetBounds(*((nsSizeEvent*)aEvent)->windowSize);
|
||||||
|
|
||||||
|
@ -844,15 +844,15 @@ nsEventStatus nsXPFCCanvas :: OnResize(nsGUIEvent *aEvent)
|
||||||
mBounds.x = 0 ;
|
mBounds.x = 0 ;
|
||||||
mBounds.y = 0 ;
|
mBounds.y = 0 ;
|
||||||
} else {
|
} else {
|
||||||
mBounds.x = ((nsSizeEvent*)aEvent)->windowSize->x ;
|
mBounds.x = aX ;
|
||||||
mBounds.y = ((nsSizeEvent*)aEvent)->windowSize->y ;
|
mBounds.y = aY ;
|
||||||
}
|
}
|
||||||
mBounds.width = ((nsSizeEvent*)aEvent)->windowSize->width ;
|
mBounds.width = aWidth ;
|
||||||
mBounds.height = ((nsSizeEvent*)aEvent)->windowSize->height ;
|
mBounds.height = aHeight ;
|
||||||
|
|
||||||
mLayout->Layout();
|
mLayout->Layout();
|
||||||
|
|
||||||
return (DefaultProcessing(aEvent));
|
return (DefaultProcessing(nsnull));
|
||||||
}
|
}
|
||||||
|
|
||||||
nsEventStatus nsXPFCCanvas :: OnLeftButtonDown(nsGUIEvent *aEvent)
|
nsEventStatus nsXPFCCanvas :: OnLeftButtonDown(nsGUIEvent *aEvent)
|
||||||
|
@ -1228,7 +1228,12 @@ nsEventStatus nsXPFCCanvas :: ResizeChildWidgets(nsGUIEvent *aEvent)
|
||||||
{
|
{
|
||||||
widget = (nsIXPFCCanvas *) iterator->CurrentItem();
|
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();
|
iterator->Next();
|
||||||
}
|
}
|
||||||
|
@ -1290,7 +1295,7 @@ nsEventStatus nsXPFCCanvas :: HandleEvent(nsGUIEvent *aEvent)
|
||||||
canvas = (nsXPFCCanvas *) iterator->CurrentItem();
|
canvas = (nsXPFCCanvas *) iterator->CurrentItem();
|
||||||
|
|
||||||
if (canvas->mWidget != nsnull)
|
if (canvas->mWidget != nsnull)
|
||||||
mWidget->Invalidate(PR_FALSE);
|
canvas->mWidget->Invalidate(PR_FALSE);
|
||||||
|
|
||||||
iterator->Next();
|
iterator->Next();
|
||||||
}
|
}
|
||||||
|
@ -1306,7 +1311,12 @@ nsEventStatus nsXPFCCanvas :: HandleEvent(nsGUIEvent *aEvent)
|
||||||
|
|
||||||
case NS_SIZE:
|
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;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -246,6 +246,8 @@ nsresult nsXPFCCanvasManager::HandleEvent(nsIView * aView,
|
||||||
if (canvas == nsnull)
|
if (canvas == nsnull)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
|
aEventStatus = canvas->HandleEvent(aEvent);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,6 +270,8 @@ nsresult nsXPFCCanvasManager::ResizeReflow(nsIView * aView,
|
||||||
if (canvas == nsnull)
|
if (canvas == nsnull)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
|
canvas->OnResize(0,0,aWidth,aHeight);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,9 +98,9 @@ nsresult nsXPFCHTMLCanvas :: Init()
|
||||||
return NS_OK;
|
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)
|
nsresult nsXPFCHTMLCanvas :: SetBounds(const nsRect &aBounds)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче