summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-31 18:11:03 +0000
committerrubidium <rubidium@openttd.org>2009-12-31 18:11:03 +0000
commitde3cff9e1a4ad7982c6de512fd043dd6d3acf52c (patch)
tree8bc23aa2f81dad3b971e6dd2284ce6796f183f68 /src/window.cpp
parent739aea3e1afb150100c06362d098b6e19ef2342e (diff)
downloadopenttd-de3cff9e1a4ad7982c6de512fd043dd6d3acf52c.tar.xz
(svn r18675) -Add [FS#3256]: function to remove focus from all widgets in a window
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/window.cpp b/src/window.cpp
index ea3b0bb98..82d286d5a 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -133,6 +133,18 @@ bool EditBoxInGlobalFocus()
}
/**
+ * Makes no widget on this window have focus. The function however doesn't change which window has focus.
+ */
+void Window::UnfocusFocusedWidget()
+{
+ if (this->nested_focus != NULL) {
+ /* Repaint the widget that lost focus. A focused edit box may else leave the caret on the screen. */
+ this->nested_focus->SetDirty(this);
+ this->nested_focus = NULL;
+ }
+}
+
+/**
* Set focus within this window to the given widget. The function however doesn't change which window has focus.
* @param widget_index Index of the widget in the window to set the focus to.
* @return Focus has changed.