зеркало из https://github.com/mozilla/pjs.git
fixed client versus non-client get bounds problems.
This commit is contained in:
Родитель
fe978c2d9d
Коммит
0b4c100e80
|
@ -139,3 +139,15 @@ DWORD nsButton::WindowExStyle()
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// get position/dimensions
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void nsButton::GetBounds(nsRect &aRect)
|
||||
{
|
||||
nsWindow::GetBounds(aRect);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ public:
|
|||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
virtual void GetBounds(nsRect &aRect);
|
||||
|
||||
protected:
|
||||
virtual LPCTSTR WindowClass();
|
||||
|
|
|
@ -173,3 +173,15 @@ DWORD nsCheckButton::WindowExStyle()
|
|||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// get position/dimensions
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void nsCheckButton::GetBounds(nsRect &aRect)
|
||||
{
|
||||
nsWindow::GetBounds(aRect);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ public:
|
|||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
virtual void GetBounds(nsRect &aRect);
|
||||
|
||||
virtual void SetState(PRBool aState);
|
||||
virtual PRBool GetState();
|
||||
|
|
|
@ -260,3 +260,15 @@ PRInt32 nsComboBox::GetHeight(PRInt32 aProposedHeight)
|
|||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// get position/dimensions
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void nsComboBox::GetBounds(nsRect &aRect)
|
||||
{
|
||||
nsWindow::GetNonClientBounds(aRect);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
virtual void GetBounds(nsRect &aRect);
|
||||
|
||||
// nsIWidget interface
|
||||
BASE_IWIDGET_IMPL
|
||||
|
|
|
@ -308,3 +308,15 @@ PRBool nsListBox::AutoErase()
|
|||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// get position/dimensions
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void nsListBox::GetBounds(nsRect &aRect)
|
||||
{
|
||||
nsWindow::GetNonClientBounds(aRect);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
virtual void GetBounds(nsRect &aRect);
|
||||
|
||||
// nsIWidget interface
|
||||
BASE_IWIDGET_IMPL
|
||||
|
|
|
@ -167,3 +167,15 @@ DWORD nsRadioButton::WindowExStyle()
|
|||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// get position/dimensions
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void nsRadioButton::GetBounds(nsRect &aRect)
|
||||
{
|
||||
nsWindow::GetBounds(aRect);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ public:
|
|||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
virtual void GetBounds(nsRect &aRect);
|
||||
|
||||
virtual void SetState(PRBool aState);
|
||||
virtual PRBool GetState();
|
||||
|
|
|
@ -450,3 +450,15 @@ DWORD nsScrollbar::WindowExStyle()
|
|||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// get position/dimensions
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void nsScrollbar::GetBounds(nsRect &aRect)
|
||||
{
|
||||
nsWindow::GetBounds(aRect);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ public:
|
|||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnScroll(UINT scrollCode, int cPos);
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
virtual void GetBounds(nsRect &aRect);
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -141,3 +141,15 @@ DWORD nsTabWidget::WindowExStyle()
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// get position/dimensions
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void nsTabWidget::GetBounds(nsRect &aRect)
|
||||
{
|
||||
nsWindow::GetBounds(aRect);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ public:
|
|||
virtual PRUint32 GetSelectedTab();
|
||||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
virtual void GetBounds(nsRect &aRect);
|
||||
|
||||
protected:
|
||||
virtual LPCTSTR WindowClass();
|
||||
|
|
|
@ -176,4 +176,16 @@ DWORD nsTextAreaWidget::WindowExStyle()
|
|||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// get position/dimensions
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void nsTextAreaWidget::GetBounds(nsRect &aRect)
|
||||
{
|
||||
nsWindow::GetNonClientBounds(aRect);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
virtual void GetBounds(nsRect &aRect);
|
||||
|
||||
// nsIWidget interface
|
||||
BASE_IWIDGET_IMPL
|
||||
|
|
|
@ -116,3 +116,15 @@ DWORD nsTextWidget::WindowExStyle()
|
|||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// get position/dimensions
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void nsTextWidget::GetBounds(nsRect &aRect)
|
||||
{
|
||||
nsWindow::GetNonClientBounds(aRect);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
virtual void GetBounds(nsRect &aRect);
|
||||
|
||||
// nsIWidget interface
|
||||
BASE_IWIDGET_IMPL
|
||||
|
|
|
@ -141,4 +141,16 @@ PRBool nsTooltipWidget::AutoErase()
|
|||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// get position/dimensions
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
void nsTooltipWidget::GetBounds(nsRect &aRect)
|
||||
{
|
||||
nsWindow::GetBounds(aRect);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ public:
|
|||
virtual PRBool OnPaint();
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
virtual PRBool AutoErase();
|
||||
virtual void GetBounds(nsRect &aRect);
|
||||
|
||||
protected:
|
||||
virtual LPCTSTR WindowClass();
|
||||
|
|
|
@ -743,17 +743,19 @@ void nsWindow::Move(PRUint32 aX, PRUint32 aY)
|
|||
|
||||
if (nsnull != par) {
|
||||
deferrer = ((nsWindow *)par)->mDeferredPositioner;
|
||||
NS_RELEASE(par);
|
||||
}
|
||||
|
||||
if (NULL != deferrer) {
|
||||
VERIFY(::DeferWindowPos(deferrer, mWnd, NULL, aX, aY, 0, 0,
|
||||
VERIFY(((nsWindow *)par)->mDeferredPositioner = ::DeferWindowPos(deferrer,
|
||||
mWnd, NULL, aX, aY, 0, 0,
|
||||
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE));
|
||||
}
|
||||
else {
|
||||
VERIFY(::SetWindowPos(mWnd, NULL, aX, aY, 0, 0,
|
||||
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE));
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(par);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -770,7 +772,6 @@ void nsWindow::Resize(PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint)
|
|||
|
||||
if (nsnull != par) {
|
||||
deferrer = ((nsWindow *)par)->mDeferredPositioner;
|
||||
NS_RELEASE(par);
|
||||
}
|
||||
|
||||
UINT flags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE;
|
||||
|
@ -779,13 +780,15 @@ void nsWindow::Resize(PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint)
|
|||
}
|
||||
|
||||
if (NULL != deferrer) {
|
||||
VERIFY(::DeferWindowPos(deferrer, mWnd, NULL, 0, 0, aWidth, GetHeight(aHeight),
|
||||
flags));
|
||||
VERIFY(((nsWindow *)par)->mDeferredPositioner = ::DeferWindowPos(deferrer,
|
||||
mWnd, NULL, 0, 0, aWidth, GetHeight(aHeight), flags));
|
||||
}
|
||||
else {
|
||||
VERIFY(::SetWindowPos(mWnd, NULL, 0, 0, aWidth, GetHeight(aHeight),
|
||||
flags));
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(par);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -807,7 +810,6 @@ void nsWindow::Resize(PRUint32 aX,
|
|||
|
||||
if (nsnull != par) {
|
||||
deferrer = ((nsWindow *)par)->mDeferredPositioner;
|
||||
NS_RELEASE(par);
|
||||
}
|
||||
|
||||
UINT flags = SWP_NOZORDER | SWP_NOACTIVATE;
|
||||
|
@ -816,13 +818,16 @@ void nsWindow::Resize(PRUint32 aX,
|
|||
}
|
||||
|
||||
if (NULL != deferrer) {
|
||||
VERIFY(::DeferWindowPos(deferrer, mWnd, NULL, aX, aY, aWidth, GetHeight(aHeight),
|
||||
VERIFY(((nsWindow *)par)->mDeferredPositioner = ::DeferWindowPos(deferrer,
|
||||
mWnd, NULL, aX, aY, aWidth, GetHeight(aHeight),
|
||||
flags));
|
||||
}
|
||||
else {
|
||||
VERIFY(::SetWindowPos(mWnd, NULL, aX, aY, aWidth, GetHeight(aHeight),
|
||||
flags));
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(par);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -881,7 +886,37 @@ void nsWindow::GetBounds(nsRect &aRect)
|
|||
// convert coordinates if parent exists
|
||||
HWND parent = ::GetParent(mWnd);
|
||||
if (parent) {
|
||||
::ScreenToClient(parent, (LPPOINT)&r);
|
||||
RECT pr;
|
||||
VERIFY(::GetClientRect(parent, &pr));
|
||||
VERIFY(::ClientToScreen(mWnd, (LPPOINT)&r));
|
||||
VERIFY(::ClientToScreen(parent, (LPPOINT)&pr));
|
||||
r.left -= pr.left;
|
||||
r.top -= pr.top;
|
||||
}
|
||||
aRect.x = r.left;
|
||||
aRect.y = r.top;
|
||||
}
|
||||
}
|
||||
|
||||
//get the bounds, but don't take into account the client size
|
||||
|
||||
void nsWindow::GetNonClientBounds(nsRect &aRect)
|
||||
{
|
||||
if (mWnd) {
|
||||
RECT r;
|
||||
VERIFY(::GetWindowRect(mWnd, &r));
|
||||
|
||||
// assign size
|
||||
aRect.width = r.right - r.left;
|
||||
aRect.height = r.bottom - r.top;
|
||||
|
||||
// convert coordinates if parent exists
|
||||
HWND parent = ::GetParent(mWnd);
|
||||
if (parent) {
|
||||
RECT pr;
|
||||
VERIFY(::GetWindowRect(parent, &pr));
|
||||
r.left -= pr.left;
|
||||
r.top -= pr.top;
|
||||
}
|
||||
aRect.x = r.left;
|
||||
aRect.y = r.top;
|
||||
|
|
|
@ -159,6 +159,8 @@ protected:
|
|||
void AddTooltip(HWND hwndOwner, nsRect* aRect, int aId);
|
||||
void RelayMouseEvent(UINT aMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
void GetNonClientBounds(nsRect &aRect);
|
||||
|
||||
protected:
|
||||
static nsWindow* gCurrentWindow;
|
||||
nsPoint mLastPoint;
|
||||
|
@ -312,10 +314,6 @@ protected:
|
|||
{ \
|
||||
nsWindow::SetFocus(); \
|
||||
} \
|
||||
void GetBounds(nsRect &aRect) \
|
||||
{ \
|
||||
nsWindow::GetBounds(aRect); \
|
||||
} \
|
||||
nscolor GetForegroundColor(void) \
|
||||
{ \
|
||||
return nsWindow::GetForegroundColor(); \
|
||||
|
|
Загрузка…
Ссылка в новой задаче