summaryrefslogtreecommitdiff
path: root/src/interface/Label.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-06-26 20:05:57 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-06-26 20:05:57 (GMT)
commit7c259c01238d91d41a778003e2529f5c06e09139 (patch)
tree4725f7f6df3eaa99865df630e41aa0d23369efbe /src/interface/Label.cpp
parentab6fed71d74371e2d38372eae71ee26a7ef214df (diff)
downloadpowder-7c259c01238d91d41a778003e2529f5c06e09139.zip
powder-7c259c01238d91d41a778003e2529f5c06e09139.tar.gz
Release selection when the label component loses focus
Diffstat (limited to 'src/interface/Label.cpp')
-rw-r--r--src/interface/Label.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/interface/Label.cpp b/src/interface/Label.cpp
index 755e3ce..a513878 100644
--- a/src/interface/Label.cpp
+++ b/src/interface/Label.cpp
@@ -121,6 +121,17 @@ void Label::OnMouseMoved(int localx, int localy, int dx, int dy)
}
}
+void Label::Tick(float dt)
+{
+ if(!this->IsFocused() && (selecting || (selectionIndex0 != -1 && selectionIndex1 != -1)))
+ {
+ selecting = false;
+ selectionIndex0 = -1;
+ selectionIndex1 = -1;
+ updateSelection();
+ }
+}
+
void Label::updateSelection()
{
std::string currentText;