summaryrefslogtreecommitdiff
path: root/indra/llui/llviewinject.h
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2011-10-13 08:11:23 -0400
committerOz Linden <oz@lindenlab.com>2011-10-13 08:11:23 -0400
commit2e26a75215bb2d708671d71c5c66e2996c11495f (patch)
treec2cdcbf4758462b11f296c9ab200237aa33e5c71 /indra/llui/llviewinject.h
parenta69ae967243e19bdc5969c34f0b1e94be794919d (diff)
parentaabdbeadf53b3a20b4db563a23535af74fd7d4b7 (diff)
merge changes for vwr-27090
Diffstat (limited to 'indra/llui/llviewinject.h')
-rw-r--r--indra/llui/llviewinject.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/indra/llui/llviewinject.h b/indra/llui/llviewinject.h
new file mode 100644
index 0000000000..0de3d155c4
--- /dev/null
+++ b/indra/llui/llviewinject.h
@@ -0,0 +1,56 @@
+/**
+ * @file llviewinject.h
+ * @author Nat Goodspeed
+ * @date 2011-08-16
+ * @brief Supplemental LLView functionality used for simulating UI events.
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Copyright (c) 2011, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+#if ! defined(LL_LLVIEWINJECT_H)
+#define LL_LLVIEWINJECT_H
+
+#include "llview.h"
+#include <map>
+
+namespace llview
+{
+
+ /**
+ * TargetEvent is a callable with state, specifically intended for use as
+ * an LLView::TemporaryDrilldownFunc. Instantiate it with the desired
+ * target LLView*; pass it to a TemporaryDrilldownFunc instance;
+ * TargetEvent::operator() will then attempt to direct subsequent mouse
+ * events to the desired target LLView*. (This is an "attempt" because
+ * LLView will still balk unless the target LLView and every parent are
+ * visible and enabled.)
+ */
+ class TargetEvent
+ {
+ public:
+ /**
+ * Construct TargetEvent with the desired target LLView*. (See
+ * LLUI::resolvePath() to obtain an LLView* given a string pathname.)
+ * This sets up for operator().
+ */
+ TargetEvent(LLView* view);
+
+ /**
+ * This signature must match LLView::DrilldownFunc. When you install
+ * this TargetEvent instance using LLView::TemporaryDrilldownFunc,
+ * LLView will call this method to decide whether to propagate an
+ * incoming mouse event to the passed child LLView*.
+ */
+ bool operator()(const LLView*, S32 x, S32 y) const;
+
+ private:
+ // For a given parent LLView, identify which child to select.
+ typedef std::map<LLView*, LLView*> ChildMap;
+ ChildMap mChildMap;
+ };
+
+} // llview namespace
+
+#endif /* ! defined(LL_LLVIEWINJECT_H) */