summaryrefslogtreecommitdiff
path: root/indra/llui/llviewinject.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2012-04-11 11:06:06 -0400
committerNat Goodspeed <nat@lindenlab.com>2012-04-11 11:06:06 -0400
commit4743a2dac6af23a602c7ce8c5b5b0d351ae340e7 (patch)
tree8290203934beeb1ea5e37945a4749cf0e7eaca27 /indra/llui/llviewinject.cpp
parent4574a9a008690c64158abd6d792d6d485bf0e235 (diff)
parent46a7cdd2866c4219bb690974d9d6266e6994b431 (diff)
Automated merge with file:///home/nat/linden/viewer-leap-temp
Diffstat (limited to 'indra/llui/llviewinject.cpp')
-rw-r--r--indra/llui/llviewinject.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/indra/llui/llviewinject.cpp b/indra/llui/llviewinject.cpp
new file mode 100644
index 0000000000..46c5839f8e
--- /dev/null
+++ b/indra/llui/llviewinject.cpp
@@ -0,0 +1,49 @@
+/**
+ * @file llviewinject.cpp
+ * @author Nat Goodspeed
+ * @date 2011-08-16
+ * @brief Implementation for llviewinject.
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Copyright (c) 2011, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+// Precompiled header
+#include "linden_common.h"
+// associated header
+#include "llviewinject.h"
+// STL headers
+// std headers
+// external library headers
+// other Linden headers
+
+llview::TargetEvent::TargetEvent(LLView* view)
+{
+ // Walk up the view tree from target LLView to the root (NULL). If
+ // passed NULL, iterate 0 times.
+ for (; view; view = view->getParent())
+ {
+ // At each level, operator() is going to ask: for a particular parent
+ // LLView*, which of its children should I select? So for this view's
+ // parent, select this view.
+ mChildMap[view->getParent()] = view;
+ }
+}
+
+bool llview::TargetEvent::operator()(const LLView* view, S32 /*x*/, S32 /*y*/) const
+{
+ // We are being called to decide whether to direct an incoming mouse event
+ // to this child view. (Normal LLView processing is to check whether the
+ // incoming (x, y) is within the view.) Look up the parent to decide
+ // whether, for that parent, this is the previously-selected child.
+ ChildMap::const_iterator found(mChildMap.find(view->getParent()));
+ // If we're looking at a child whose parent isn't even in the map, never
+ // mind.
+ if (found == mChildMap.end())
+ {
+ return false;
+ }
+ // So, is this the predestined child for this parent?
+ return (view == found->second);
+}