/indra/llui/llviewinject.h

https://bitbucket.org/lindenlab/viewer-beta/ · C++ Header · 56 lines · 17 code · 8 blank · 31 comment · 0 complexity · c99e42515fca98e0de3a6ac5a7929afd MD5 · raw file

  1. /**
  2. * @file llviewinject.h
  3. * @author Nat Goodspeed
  4. * @date 2011-08-16
  5. * @brief Supplemental LLView functionality used for simulating UI events.
  6. *
  7. * $LicenseInfo:firstyear=2011&license=viewerlgpl$
  8. * Copyright (c) 2011, Linden Research, Inc.
  9. * $/LicenseInfo$
  10. */
  11. #if ! defined(LL_LLVIEWINJECT_H)
  12. #define LL_LLVIEWINJECT_H
  13. #include "llview.h"
  14. #include <map>
  15. namespace llview
  16. {
  17. /**
  18. * TargetEvent is a callable with state, specifically intended for use as
  19. * an LLView::TemporaryDrilldownFunc. Instantiate it with the desired
  20. * target LLView*; pass it to a TemporaryDrilldownFunc instance;
  21. * TargetEvent::operator() will then attempt to direct subsequent mouse
  22. * events to the desired target LLView*. (This is an "attempt" because
  23. * LLView will still balk unless the target LLView and every parent are
  24. * visible and enabled.)
  25. */
  26. class TargetEvent
  27. {
  28. public:
  29. /**
  30. * Construct TargetEvent with the desired target LLView*. (See
  31. * LLUI::resolvePath() to obtain an LLView* given a string pathname.)
  32. * This sets up for operator().
  33. */
  34. TargetEvent(LLView* view);
  35. /**
  36. * This signature must match LLView::DrilldownFunc. When you install
  37. * this TargetEvent instance using LLView::TemporaryDrilldownFunc,
  38. * LLView will call this method to decide whether to propagate an
  39. * incoming mouse event to the passed child LLView*.
  40. */
  41. bool operator()(const LLView*, S32 x, S32 y) const;
  42. private:
  43. // For a given parent LLView, identify which child to select.
  44. typedef std::map<LLView*, LLView*> ChildMap;
  45. ChildMap mChildMap;
  46. };
  47. } // llview namespace
  48. #endif /* ! defined(LL_LLVIEWINJECT_H) */