summaryrefslogtreecommitdiff
path: root/Plugins/skins/SkinLib/FieldState.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Plugins/skins/SkinLib/FieldState.cpp')
-rw-r--r--Plugins/skins/SkinLib/FieldState.cpp58
1 files changed, 36 insertions, 22 deletions
diff --git a/Plugins/skins/SkinLib/FieldState.cpp b/Plugins/skins/SkinLib/FieldState.cpp
index 1d112cc..6851005 100644
--- a/Plugins/skins/SkinLib/FieldState.cpp
+++ b/Plugins/skins/SkinLib/FieldState.cpp
@@ -234,7 +234,15 @@ static inline int beetween(int val, int minVal, int maxVal)
return max(minVal, min(maxVal, val));
}
-RECT FieldState::getRect() const
+static inline void intersection(RECT &main, const RECT &other)
+{
+ main.left = beetween(main.left, other.left, other.right);
+ main.right = beetween(main.right, other.left, other.right);
+ main.top = beetween(main.top, other.top, other.bottom);
+ main.bottom = beetween(main.bottom, other.top, other.bottom);
+}
+
+RECT FieldState::getRect(bool raw) const
{
RECT ret = {0};
@@ -243,10 +251,33 @@ RECT FieldState::getRect() const
RECT inside = dialog->getInsideRect();
- ret.left = beetween(getLeft() + inside.left, inside.left, inside.right);
- ret.right = beetween(getRight() + inside.left, inside.left, inside.right);
- ret.top = beetween(getTop() + inside.top, inside.top, inside.bottom);
- ret.bottom = beetween(getBottom() + inside.top, inside.top, inside.bottom);
+ ret.left = getLeft() + inside.left;
+ ret.right = getRight() + inside.left;
+ ret.top = getTop() + inside.top;
+ ret.bottom = getBottom() + inside.top;
+
+ if (!raw)
+ intersection(ret, inside);
+
+ return ret;
+}
+
+RECT FieldState::getInsideRect(bool raw) const
+{
+ RECT ret = {0};
+
+ if (!visible)
+ return ret;
+
+ RECT inside = dialog->getInsideRect();
+
+ ret.left = getLeft() + borders.getLeft() + inside.left;
+ ret.right = getRight() - borders.getRight() + inside.left;
+ ret.top = getTop() + borders.getTop() + inside.top;
+ ret.bottom = getBottom() - borders.getBottom() + inside.top;
+
+ if (!raw)
+ intersection(ret, inside);
return ret;
}
@@ -270,20 +301,3 @@ void FieldState::setVAlign(VERTICAL_ALIGN valign)
{
this->valign = valign;
}
-
-RECT FieldState::getInsideRect() const
-{
- RECT ret = {0};
-
- if (!visible)
- return ret;
-
- RECT inside = dialog->getInsideRect();
-
- ret.left = beetween(getLeft() + borders.getLeft() + inside.left, inside.left, inside.right);
- ret.right = beetween(getRight() - borders.getRight() + inside.left, inside.left, inside.right);
- ret.top = beetween(getTop() + borders.getTop() + inside.top, inside.top, inside.bottom);
- ret.bottom = beetween(getBottom() - borders.getBottom() + inside.top, inside.top, inside.bottom);
-
- return ret;
-}