summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 522a10a6f..2805301f0 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -323,6 +323,20 @@ QueryString *Window::GetQueryString(uint widnum)
return query != this->querystrings.End() ? query->second : NULL;
}
+/**
+ * Get the current caret position if an edit box has the focus.
+ * @return Top-left location of the caret, relative to the window.
+ */
+/* virtual */ Point Window::GetCaretPosition() const
+{
+ if (this->nested_focus != NULL && this->nested_focus->type == WWT_EDITBOX) {
+ return this->GetQueryString(this->nested_focus->index)->GetCaretPosition(this, this->nested_focus->index);
+ }
+
+ Point pt = {0, 0};
+ return pt;
+}
+
/**
* Set the window that has the focus