aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2003-04-06 00:00:52 +0000
committernyamatongwe <devnull@localhost>2003-04-06 00:00:52 +0000
commitd7f9c8751b050faf033dfb6da2226a6c429e30e5 (patch)
treea9bd40f0adfe163f4803d05d1de296a707ccf51f
parent4cc6ae7447fbcc263d344d1151f78be6b9e7c4e6 (diff)
downloadscintilla-mirror-d7f9c8751b050faf033dfb6da2226a6c429e30e5.tar.gz
Move method for Rectangle class.
Ensure windows that are moved are not moved off screen to the top or left.
-rw-r--r--include/Platform.h6
-rw-r--r--win32/PlatWin.cxx11
2 files changed, 13 insertions, 4 deletions
diff --git a/include/Platform.h b/include/Platform.h
index 5ad782c03..db3cd6c7d 100644
--- a/include/Platform.h
+++ b/include/Platform.h
@@ -104,6 +104,12 @@ public:
return (right > other.left) && (left < other.right) &&
(bottom > other.top) && (top < other.bottom);
}
+ void Move(int xDelta, int yDelta) {
+ left += xDelta;
+ top += yDelta;
+ right += xDelta;
+ bottom += yDelta;
+ }
int Width() { return right - left; }
int Height() { return bottom - top; }
};
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 09bf83ded..d2b88bda3 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -769,10 +769,13 @@ void Window::SetPositionRelative(PRectangle rc, Window w) {
if (style & WS_POPUP) {
RECT rcOther;
::GetWindowRect(reinterpret_cast<HWND>(w.GetID()), &rcOther);
- rc.top += rcOther.top;
- rc.left += rcOther.left;
- rc.bottom += rcOther.top;
- rc.right += rcOther.left;
+ rc.Move(rcOther.left, rcOther.top);
+ if (rc.left < 0) {
+ rc.Move(-rc.left,0);
+ }
+ if (rc.top < 0) {
+ rc.Move(0,-rc.top);
+ }
}
SetPosition(rc);
}