Bug 1005619 - Part 1: Add nsIWidget::GetRestoredBounds(). r=roc

This commit is contained in:
Masatoshi Kimura 2014-05-20 16:32:17 +09:00
parent c50f847a24
commit 83ad579d4c
3 changed files with 25 additions and 2 deletions

View File

@ -100,8 +100,8 @@ typedef void* nsNativeWidget;
#endif
#define NS_IWIDGET_IID \
{ 0x87d80888, 0x9917, 0x4bfb, \
{ 0x81, 0xa9, 0x1c, 0x5e, 0x30, 0x9c, 0x78, 0xb4 } }
{ 0x91944a4b, 0xbc29, 0x44aa, \
{ 0x99, 0x21, 0x42, 0xeb, 0x1f, 0xbb, 0xa6, 0x89 } }
/*
* Window shadow styles
@ -1087,6 +1087,20 @@ class nsIWidget : public nsISupports {
*/
NS_IMETHOD GetScreenBounds(nsIntRect &aRect) = 0;
/**
* Similar to GetScreenBounds except that this function will always
* get the size when the widget is in the nsSizeMode_Normal size mode
* even if the current size mode is not nsSizeMode_Normal.
* This method will fail if the size mode is not nsSizeMode_Normal and
* the platform doesn't have the ability.
* This method will always succeed if the current size mode is
* nsSizeMode_Normal.
*
* @param aRect On return it holds the x, y, width and height of
* this widget.
*/
NS_IMETHOD GetRestoredBounds(nsIntRect &aRect) = 0;
/**
* Get this widget's client area bounds, if the window has a 3D border
* appearance this returns the area inside the border. The position is the

View File

@ -1133,6 +1133,14 @@ NS_METHOD nsBaseWidget::GetScreenBounds(nsIntRect &aRect)
return GetBounds(aRect);
}
NS_METHOD nsBaseWidget::GetRestoredBounds(nsIntRect &aRect)
{
if (SizeMode() != nsSizeMode_Normal) {
return NS_ERROR_FAILURE;
}
return GetScreenBounds(aRect);
}
nsIntPoint nsBaseWidget::GetClientOffset()
{
return nsIntPoint(0, 0);

View File

@ -163,6 +163,7 @@ public:
NS_IMETHOD GetBounds(nsIntRect &aRect);
NS_IMETHOD GetClientBounds(nsIntRect &aRect);
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
NS_IMETHOD GetRestoredBounds(nsIntRect &aRect) MOZ_OVERRIDE;
NS_IMETHOD GetNonClientMargins(nsIntMargin &margins);
NS_IMETHOD SetNonClientMargins(nsIntMargin &margins);
virtual nsIntPoint GetClientOffset();