зеркало из https://github.com/mozilla/pjs.git
killed Set/GetRootWindow() methods in viewmanager. this is now inferred from
the root view. added ability to select painting in view resizing.
This commit is contained in:
Родитель
f435a2ca5d
Коммит
eab3862f9e
|
@ -189,7 +189,7 @@ public:
|
|||
* @param width new width
|
||||
* @param height new height
|
||||
*/
|
||||
virtual void SetDimensions(nscoord width, nscoord height) = 0;
|
||||
virtual void SetDimensions(nscoord width, nscoord height, PRBool aPaint = PR_TRUE) = 0;
|
||||
virtual void GetDimensions(nscoord *width, nscoord *height) = 0;
|
||||
|
||||
/**
|
||||
|
@ -197,7 +197,7 @@ public:
|
|||
* been changed.
|
||||
* @param aBounds new bounds
|
||||
*/
|
||||
virtual void SetBounds(const nsRect &aBounds) = 0;
|
||||
virtual void SetBounds(const nsRect &aBounds, PRBool aPaint = PR_TRUE) = 0;
|
||||
|
||||
/**
|
||||
* Called to indicate that the dimensions and position of the view have
|
||||
|
@ -207,7 +207,9 @@ public:
|
|||
* @param aWidth new width
|
||||
* @param aHeight new height
|
||||
*/
|
||||
virtual void SetBounds(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight) = 0;
|
||||
virtual void SetBounds(nscoord aX, nscoord aY,
|
||||
nscoord aWidth, nscoord aHeight,
|
||||
PRBool aPaint = PR_TRUE) = 0;
|
||||
|
||||
/**
|
||||
* Called to get the dimensions and position of the view.
|
||||
|
|
|
@ -54,18 +54,6 @@ public:
|
|||
*/
|
||||
virtual nsresult Init(nsIPresContext* aPresContext) = 0;
|
||||
|
||||
/**
|
||||
* Set the window for which the manager is responsible.
|
||||
* @param aRootWindow window to set as root
|
||||
*/
|
||||
virtual void SetRootWindow(nsIWidget *aRootWindow) = 0;
|
||||
|
||||
/**
|
||||
* Get the window for which the manager is responsible.
|
||||
* @result the root window
|
||||
*/
|
||||
virtual nsIWidget *GetRootWindow() = 0;
|
||||
|
||||
/**
|
||||
* Get the root of the view tree.
|
||||
* @result the root view
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
~ScrollBarView();
|
||||
nsEventStatus HandleEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags);
|
||||
void SetPosition(nscoord x, nscoord y);
|
||||
void SetDimensions(nscoord width, nscoord height);
|
||||
void SetDimensions(nscoord width, nscoord height, PRBool aPaint = PR_TRUE);
|
||||
|
||||
public:
|
||||
nsScrollingView *mScrollingView;
|
||||
|
@ -100,7 +100,7 @@ void ScrollBarView :: SetPosition(nscoord x, nscoord y)
|
|||
}
|
||||
}
|
||||
|
||||
void ScrollBarView :: SetDimensions(nscoord width, nscoord height)
|
||||
void ScrollBarView :: SetDimensions(nscoord width, nscoord height, PRBool aPaint)
|
||||
{
|
||||
mBounds.SizeTo(width, height);
|
||||
|
||||
|
@ -110,7 +110,7 @@ void ScrollBarView :: SetDimensions(nscoord width, nscoord height)
|
|||
float t2p = px->GetTwipsToPixels();
|
||||
|
||||
mWindow->Resize(NSTwipsToIntPixels(width, t2p), NSTwipsToIntPixels(height, t2p),
|
||||
PR_TRUE);
|
||||
aPaint);
|
||||
|
||||
NS_RELEASE(px);
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ nsresult nsScrollingView :: Init(nsIViewManager* aManager,
|
|||
return rv;
|
||||
}
|
||||
|
||||
void nsScrollingView :: SetDimensions(nscoord width, nscoord height)
|
||||
void nsScrollingView :: SetDimensions(nscoord width, nscoord height, PRBool aPaint)
|
||||
{
|
||||
nsRect trect;
|
||||
nsIPresContext *cx = mViewManager->GetPresContext();
|
||||
|
@ -478,7 +478,7 @@ void nsScrollingView :: SetDimensions(nscoord width, nscoord height)
|
|||
trect.y = height - scrollHeight;
|
||||
trect.x = width - scrollWidth;
|
||||
|
||||
mCornerView->SetBounds(trect);
|
||||
mCornerView->SetBounds(trect, aPaint);
|
||||
}
|
||||
|
||||
if (mHScrollBarView && (mHScrollBarView->GetVisibility() == nsViewVisibility_kShow))
|
||||
|
@ -487,7 +487,7 @@ void nsScrollingView :: SetDimensions(nscoord width, nscoord height)
|
|||
if (mVScrollBarView && (mVScrollBarView->GetVisibility() == nsViewVisibility_kShow))
|
||||
showVert = scrollWidth;
|
||||
|
||||
// nsView :: SetDimensions(width, height);
|
||||
// nsView :: SetDimensions(width, height, aPaint);
|
||||
|
||||
mBounds.SizeTo(width, height);
|
||||
|
||||
|
@ -500,7 +500,7 @@ void nsScrollingView :: SetDimensions(nscoord width, nscoord height)
|
|||
|
||||
mWindow->Resize(NSTwipsToIntPixels((width - showVert), t2p),
|
||||
NSTwipsToIntPixels((height - showHorz), t2p),
|
||||
PR_TRUE);
|
||||
aPaint);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -520,7 +520,7 @@ void nsScrollingView :: SetDimensions(nscoord width, nscoord height)
|
|||
trect.x = width - scrollWidth;
|
||||
trect.y = 0;
|
||||
|
||||
mVScrollBarView->SetBounds(trect);
|
||||
mVScrollBarView->SetBounds(trect, aPaint);
|
||||
}
|
||||
|
||||
if (nsnull != mHScrollBarView)
|
||||
|
@ -535,7 +535,7 @@ void nsScrollingView :: SetDimensions(nscoord width, nscoord height)
|
|||
trect.y = height - scrollHeight;
|
||||
trect.x = 0;
|
||||
|
||||
mHScrollBarView->SetBounds(trect);
|
||||
mHScrollBarView->SetBounds(trect, aPaint);
|
||||
}
|
||||
|
||||
//this will fix the size of the thumb when we resize the root window,
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow);
|
||||
|
||||
//overrides
|
||||
virtual void SetDimensions(nscoord width, nscoord height);
|
||||
virtual void SetDimensions(nscoord width, nscoord height, PRBool aPaint = PR_TRUE);
|
||||
virtual void SetPosition(nscoord aX, nscoord aY);
|
||||
virtual void HandleScrollEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags);
|
||||
virtual nsEventStatus HandleEvent(nsGUIEvent *aEvent, PRUint32 aEventFlags);
|
||||
|
|
|
@ -583,7 +583,7 @@ void nsView :: GetPosition(nscoord *x, nscoord *y)
|
|||
}
|
||||
}
|
||||
|
||||
void nsView :: SetDimensions(nscoord width, nscoord height)
|
||||
void nsView :: SetDimensions(nscoord width, nscoord height, PRBool aPaint)
|
||||
{
|
||||
mBounds.SizeTo(width, height);
|
||||
|
||||
|
@ -605,7 +605,7 @@ void nsView :: SetDimensions(nscoord width, nscoord height)
|
|||
float t2p = px->GetTwipsToPixels();
|
||||
|
||||
mWindow->Resize(NSTwipsToIntPixels(width, t2p), NSTwipsToIntPixels(height, t2p),
|
||||
PR_TRUE);
|
||||
aPaint);
|
||||
|
||||
NS_RELEASE(px);
|
||||
}
|
||||
|
@ -617,16 +617,16 @@ void nsView :: GetDimensions(nscoord *width, nscoord *height)
|
|||
*height = mBounds.height;
|
||||
}
|
||||
|
||||
void nsView :: SetBounds(const nsRect &aBounds)
|
||||
void nsView :: SetBounds(const nsRect &aBounds, PRBool aPaint)
|
||||
{
|
||||
SetPosition(aBounds.x, aBounds.y);
|
||||
SetDimensions(aBounds.width, aBounds.height);
|
||||
SetDimensions(aBounds.width, aBounds.height, aPaint);
|
||||
}
|
||||
|
||||
void nsView :: SetBounds(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||
void nsView :: SetBounds(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight, PRBool aPaint)
|
||||
{
|
||||
SetPosition(aX, aY);
|
||||
SetDimensions(aWidth, aHeight);
|
||||
SetDimensions(aWidth, aHeight, aPaint);
|
||||
}
|
||||
|
||||
void nsView :: GetBounds(nsRect &aBounds) const
|
||||
|
|
|
@ -64,10 +64,10 @@ public:
|
|||
virtual nsEventStatus HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags);
|
||||
virtual void SetPosition(nscoord x, nscoord y);
|
||||
virtual void GetPosition(nscoord *x, nscoord *y);
|
||||
virtual void SetDimensions(nscoord width, nscoord height);
|
||||
virtual void SetDimensions(nscoord width, nscoord height, PRBool aPaint = PR_TRUE);
|
||||
virtual void GetDimensions(nscoord *width, nscoord *height);
|
||||
virtual void SetBounds(const nsRect &aBounds);
|
||||
virtual void SetBounds(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
virtual void SetBounds(const nsRect &aBounds, PRBool aPaint = PR_TRUE);
|
||||
virtual void SetBounds(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight, PRBool aPaint = PR_TRUE);
|
||||
virtual void GetBounds(nsRect &aBounds) const;
|
||||
virtual void SetClip(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);
|
||||
virtual PRBool GetClip(nscoord *aLeft, nscoord *aTop, nscoord *aRight, nscoord *aBottom);
|
||||
|
|
|
@ -154,19 +154,6 @@ nsresult nsViewManager::Init(nsIPresContext* aPresContext)
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsIWidget * nsViewManager :: GetRootWindow()
|
||||
{
|
||||
NS_IF_ADDREF(mRootWindow);
|
||||
return mRootWindow;
|
||||
}
|
||||
|
||||
void nsViewManager :: SetRootWindow(nsIWidget *aRootWindow)
|
||||
{
|
||||
NS_IF_RELEASE(mRootWindow);
|
||||
mRootWindow = aRootWindow;
|
||||
NS_IF_ADDREF(mRootWindow);
|
||||
}
|
||||
|
||||
nsIView * nsViewManager :: GetRootView()
|
||||
{
|
||||
return mRootView;
|
||||
|
@ -178,6 +165,12 @@ void nsViewManager :: SetRootView(nsIView *aView)
|
|||
// Do NOT destroy the current root view. It's the caller's responsibility
|
||||
// to destroy it
|
||||
mRootView = aView;
|
||||
|
||||
//now get the window too.
|
||||
NS_IF_RELEASE(mRootWindow);
|
||||
|
||||
if (nsnull != mRootView)
|
||||
mRootWindow = mRootView->GetWidget();
|
||||
}
|
||||
|
||||
PRUint32 nsViewManager :: GetFrameRate()
|
||||
|
|
|
@ -41,9 +41,6 @@ public:
|
|||
|
||||
virtual nsresult Init(nsIPresContext* aPresContext);
|
||||
|
||||
virtual void SetRootWindow(nsIWidget *aRootWindow);
|
||||
virtual nsIWidget *GetRootWindow();
|
||||
|
||||
virtual nsIView *GetRootView();
|
||||
virtual void SetRootView(nsIView *aView);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче