Added ScrollWidgets method to nsIWidget. Added stub for ScrollWidgets to nsBaseWidget. Implemented nsScrollWidgets and nsScrollRect on WIN32. bug 22067; r=rods@netscape.com

This commit is contained in:
kmcclusk%netscape.com 2000-01-15 01:38:50 +00:00
Родитель 0aeaa0cd52
Коммит c989755350
5 изменённых файлов: 55 добавлений и 5 удалений

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

@ -555,7 +555,8 @@ class nsIWidget : public nsISupports {
NS_IMETHOD SetColorMap(nsColorMap *aColorMap) = 0;
/**
* Scroll this widget.
* XXX (This is obsolete and will be removed soon, Use ScrollWidgets instead)
* Scroll this widget.
*
* @param aDx amount to scroll along the x-axis
* @param aDy amount to scroll along the y-axis.
@ -566,11 +567,24 @@ class nsIWidget : public nsISupports {
NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect) = 0;
/**
* Scroll an area of this widget.
* Scroll the contents of the widget.
* All child widgets are also scrolled by offsetting their coordinates.
* A NS_PAINT message is synchronously dispatched for the newly exposed rectangle.
*
* @param aRect source rectangle to scroll in the widget
* @param aDx x offset from the source
* @param aDy y offset from the source
* @param aDx amount to scroll along the x-axis in pixels
* @param aDy amount to scroll along the y-axis in pixels
*
*/
NS_IMETHOD ScrollWidgets(PRInt32 aDx, PRInt32 aDy) = 0;
/**
* Scroll an area of this widget. Child widgets are not scrolled.
* A NS_PAINT message is synchronously dispatched for the newly exposed rectangle.
*
* @param aRect source rectangle to scroll in the widget in pixels
* @param aDx x offset from the source in pixels
* @param aDy y offset from the source in pixels
*
*/

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

@ -1706,6 +1706,7 @@ NS_METHOD nsWindow::SetColorMap(nsColorMap *aColorMap)
// Scroll the bits of a window
//
//-------------------------------------------------------------------------
//XXX Scroll is obsolete and should go away soon
NS_METHOD nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
{
RECT trect;
@ -1724,6 +1725,32 @@ NS_METHOD nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
return NS_OK;
}
NS_IMETHODIMP nsWindow::ScrollWidgets(PRInt32 aDx, PRInt32 aDy)
{
// Scroll the entire contents of the window + change the offset of any child windows
::ScrollWindowEx(mWnd, aDx, aDy, NULL, NULL, NULL,
NULL, SW_INVALIDATE | SW_SCROLLCHILDREN);
::UpdateWindow(mWnd); // Force synchronous generation of NS_PAINT
return NS_OK;
}
NS_IMETHODIMP nsWindow::ScrollRect(nsRect &aRect, PRInt32 aDx, PRInt32 aDy)
{
RECT trect;
trect.left = aRect.x;
trect.top = aRect.y;
trect.right = aRect.XMost();
trect.bottom = aRect.YMost();
// Scroll the bits in the window defined by trect.
// Child windows are not scrolled.
::ScrollWindowEx(mWnd, aDx, aDy, &trect, NULL, NULL,
NULL, SW_INVALIDATE);
::UpdateWindow(mWnd); // Force synchronous generation of NS_PAINT
return NS_OK;
}
//-------------------------------------------------------------------------
//

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

@ -125,7 +125,10 @@ public:
virtual void* GetNativeData(PRUint32 aDataType);
virtual void FreeNativeData(void * data, PRUint32 aDataType);//~~~
NS_IMETHOD SetColorMap(nsColorMap *aColorMap);
//XXX-Scroll is obsolete it is going away soon
NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect);
NS_IMETHOD ScrollWidgets(PRInt32 aDx, PRInt32 aDy);
NS_IMETHOD ScrollRect(nsRect &aRect, PRInt32 aDx, PRInt32 aDy);
NS_IMETHOD SetTitle(const nsString& aTitle);
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar);
NS_IMETHOD ShowMenuBar(PRBool aShow);

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

@ -687,6 +687,11 @@ NS_METHOD nsBaseWidget::Paint(nsIRenderingContext& aRenderingContext,
return NS_OK;
}
NS_IMETHODIMP nsBaseWidget::ScrollWidgets(PRInt32 aDx, PRInt32 aDy)
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsBaseWidget::ScrollRect(nsRect &aRect, PRInt32 aDx, PRInt32 aDy)
{
return NS_ERROR_FAILURE;

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

@ -95,6 +95,7 @@ public:
NS_IMETHOD GetBorderSize(PRInt32 &aWidth, PRInt32 &aHeight);
NS_IMETHOD Paint(nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect);
NS_IMETHOD ScrollRect(nsRect &aRect, PRInt32 aDx, PRInt32 aDy);
NS_IMETHOD ScrollWidgets(PRInt32 aDx, PRInt32 aDy);
NS_IMETHOD EnableDragDrop(PRBool aEnable);
NS_IMETHOD GetAttention();
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) {}