diff options
-rw-r--r-- | include/tools/gen.hxx | 2 | ||||
-rw-r--r-- | tools/source/generic/gen.cxx | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index 63d13e146336..9dea74be4caa 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -455,7 +455,7 @@ public: long getX() const { return nLeft; } long getY() const { return nTop; } /// Returns the difference between right and left, assuming the range includes one end, but not the other. - long getWidth() const { return nRight - nLeft; } + long getWidth() const; /// Returns the difference between bottom and top, assuming the range includes one end, but not the other. long getHeight() const { return nBottom - nTop; } /// Set the left edge of the rectangle to x, preserving the width diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index 3783fa347c55..5755929bd502 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -303,4 +303,9 @@ long tools::Rectangle::Bottom() const return nBottom == RECT_EMPTY ? nTop : nBottom; } +/// Returns the difference between right and left, assuming the range includes one end, but not the other. +long tools::Rectangle::getWidth() const +{ + return nRight == RECT_EMPTY ? 0 : nRight - nLeft; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |