aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/PlatWin.cxx23
1 files changed, 5 insertions, 18 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 8e06b7f4c..170d8988b 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -44,6 +44,7 @@
#include "Platform.h"
#include "StringCopy.h"
+#include "Position.h"
#include "XPM.h"
#include "UniConversion.h"
#include "DBCS.h"
@@ -2441,20 +2442,6 @@ void ListBoxX::SetRedraw(bool on) {
::InvalidateRect(lb, NULL, TRUE);
}
-static XYPOSITION XYMinimum(XYPOSITION a, XYPOSITION b) {
- if (a < b)
- return a;
- else
- return b;
-}
-
-static XYPOSITION XYMaximum(XYPOSITION a, XYPOSITION b) {
- if (a > b)
- return a;
- else
- return b;
-}
-
void ListBoxX::ResizeToCursor() {
PRectangle rc = GetPosition();
POINT ptw;
@@ -2497,10 +2484,10 @@ void ListBoxX::ResizeToCursor() {
POINT ptMin = MinTrackSize();
POINT ptMax = MaxTrackSize();
// We don't allow the left edge to move at present, but just in case
- rc.left = XYMaximum(XYMinimum(rc.left, rcPreSize.right - ptMin.x), rcPreSize.right - ptMax.x);
- rc.top = XYMaximum(XYMinimum(rc.top, rcPreSize.bottom - ptMin.y), rcPreSize.bottom - ptMax.y);
- rc.right = XYMaximum(XYMinimum(rc.right, rcPreSize.left + ptMax.x), rcPreSize.left + ptMin.x);
- rc.bottom = XYMaximum(XYMinimum(rc.bottom, rcPreSize.top + ptMax.y), rcPreSize.top + ptMin.y);
+ rc.left = Sci::clamp(rc.left, rcPreSize.right - ptMax.x, rcPreSize.right - ptMin.x);
+ rc.top = Sci::clamp(rc.top, rcPreSize.bottom - ptMax.y, rcPreSize.bottom - ptMin.y);
+ rc.right = Sci::clamp(rc.right, rcPreSize.left + ptMin.x, rcPreSize.left + ptMax.x);
+ rc.bottom = Sci::clamp(rc.bottom, rcPreSize.top + ptMin.y, rcPreSize.top + ptMax.y);
SetPosition(rc);
}