summaryrefslogtreecommitdiff
path: root/indra/llui/llview.h
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2011-09-06 13:58:47 -0400
committerNat Goodspeed <nat@lindenlab.com>2011-09-06 13:58:47 -0400
commitb59c0a668009e696295a194e118b91469b09d32e (patch)
tree4ffc7e9f547e941b254a67d5b07ab22c0dfd1346 /indra/llui/llview.h
parent0ab6eee0996c78d32b722157140cea5a21a5e460 (diff)
parentecba41419f6470cc3d85bbb277ef88ebbf266feb (diff)
Automated merge with http://hg.secondlife.com/viewer-development
Diffstat (limited to 'indra/llui/llview.h')
-rw-r--r--indra/llui/llview.h52
1 files changed, 51 insertions, 1 deletions
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 594a5eec6b..fcae75c447 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -50,6 +50,8 @@
#include "llfocusmgr.h"
#include <list>
+#include <boost/function.hpp>
+#include <boost/noncopyable.hpp>
class LLSD;
@@ -437,12 +439,15 @@ public:
/*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const;
/*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const;
- virtual LLView* childFromPoint(S32 x, S32 y);
+ virtual LLView* childFromPoint(S32 x, S32 y, bool recur=false);
// view-specific handlers
virtual void onMouseEnter(S32 x, S32 y, MASK mask);
virtual void onMouseLeave(S32 x, S32 y, MASK mask);
+ std::string getPathname() const;
+ // static method handles NULL pointer too
+ static std::string getPathname(const LLView*);
template <class T> T* findChild(const std::string& name, BOOL recurse = TRUE) const
{
@@ -516,6 +521,9 @@ protected:
void drawDebugRect();
void drawChild(LLView* childp, S32 x_offset = 0, S32 y_offset = 0, BOOL force_draw = FALSE);
void drawChildren();
+ bool visibleAndContains(S32 local_x, S32 local_Y);
+ bool visibleEnabledAndContains(S32 local_x, S32 local_y);
+ void logMouseEvent();
LLView* childrenHandleKey(KEY key, MASK mask);
LLView* childrenHandleUnicodeChar(llwchar uni_char);
@@ -541,6 +549,20 @@ protected:
private:
+ template <typename METHOD, typename XDATA>
+ LLView* childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDATA extra);
+
+ template <typename METHOD, typename CHARTYPE>
+ LLView* childrenHandleCharEvent(const std::string& desc, const METHOD& method,
+ CHARTYPE c, MASK mask);
+
+ // adapter to blur distinction between handleKey() and handleUnicodeChar()
+ // for childrenHandleCharEvent()
+ BOOL handleUnicodeCharWithDummyMask(llwchar uni_char, MASK /* dummy */, BOOL from_parent)
+ {
+ return handleUnicodeChar(uni_char, from_parent);
+ }
+
LLView* mParentView;
child_list_t mChildList;
@@ -582,7 +604,35 @@ private:
LLView& getDefaultWidgetContainer() const;
+ // This allows special mouse-event targeting logic for testing.
+ typedef boost::function<bool(const LLView*, S32 x, S32 y)> DrilldownFunc;
+ static DrilldownFunc sDrilldown;
+
public:
+ // This is the only public accessor to alter sDrilldown. This is not
+ // an accident. The intended usage pattern is like:
+ // {
+ // LLView::TemporaryDrilldownFunc scoped_func(myfunctor);
+ // // ... test with myfunctor ...
+ // } // exiting block restores original LLView::sDrilldown
+ class TemporaryDrilldownFunc: public boost::noncopyable
+ {
+ public:
+ TemporaryDrilldownFunc(const DrilldownFunc& func):
+ mOldDrilldown(sDrilldown)
+ {
+ sDrilldown = func;
+ }
+
+ ~TemporaryDrilldownFunc()
+ {
+ sDrilldown = mOldDrilldown;
+ }
+
+ private:
+ DrilldownFunc mOldDrilldown;
+ };
+
// Depth in view hierarchy during rendering
static S32 sDepth;