PageRenderTime 34ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 1ms

/indra/newview/llviewermediafocus.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 111 lines | 56 code | 21 blank | 34 comment | 0 complexity | 470b22d0a6080453c326b5be982d3822 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llpanelmsgs.h
  3. * @brief Message popup preferences panel
  4. *
  5. * $LicenseInfo:firstyear=2003&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_VIEWERMEDIAFOCUS_H
  27. #define LL_VIEWERMEDIAFOCUS_H
  28. // includes for LLViewerMediaFocus
  29. #include "llfocusmgr.h"
  30. #include "llviewermedia.h"
  31. #include "llviewerobject.h"
  32. #include "llviewerwindow.h"
  33. #include "llselectmgr.h"
  34. class LLViewerMediaImpl;
  35. class LLPanelPrimMediaControls;
  36. class LLViewerMediaFocus :
  37. public LLFocusableElement,
  38. public LLSingleton<LLViewerMediaFocus>
  39. {
  40. public:
  41. LLViewerMediaFocus();
  42. ~LLViewerMediaFocus();
  43. // Set/clear the face that has media focus (takes keyboard input and has the full set of controls)
  44. void setFocusFace(LLPointer<LLViewerObject> objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal = LLVector3::zero);
  45. void clearFocus();
  46. // Set/clear the face that has "media hover" (has the mimimal set of controls to zoom in or pop out into a media browser).
  47. // If a media face has focus, the media hover will be ignored.
  48. void setHoverFace(LLPointer<LLViewerObject> objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal = LLVector3::zero);
  49. void clearHover();
  50. /*virtual*/ bool getFocus();
  51. /*virtual*/ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
  52. /*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent);
  53. BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
  54. void update();
  55. static void setCameraZoom(LLViewerObject* object, LLVector3 normal, F32 padding_factor, bool zoom_in_only = false);
  56. static F32 getBBoxAspectRatio(const LLBBox& bbox, const LLVector3& normal, F32* height, F32* width, F32* depth);
  57. bool isFocusedOnFace(LLPointer<LLViewerObject> objectp, S32 face);
  58. bool isHoveringOverFace(LLPointer<LLViewerObject> objectp, S32 face);
  59. // These look up (by uuid) and return the values that were set with setFocusFace. They will return null if the objects have been destroyed.
  60. LLViewerMediaImpl* getFocusedMediaImpl();
  61. LLViewerObject* getFocusedObject();
  62. S32 getFocusedFace() { return mFocusedObjectFace; }
  63. LLUUID getFocusedObjectID() { return mFocusedObjectID; }
  64. // These look up (by uuid) and return the values that were set with setHoverFace. They will return null if the objects have been destroyed.
  65. LLViewerMediaImpl* getHoverMediaImpl();
  66. LLViewerObject* getHoverObject();
  67. S32 getHoverFace() { return mHoverObjectFace; }
  68. // Try to focus/zoom on the specified media (if it's on an object in world).
  69. void focusZoomOnMedia(LLUUID media_id);
  70. // Are we zoomed in?
  71. bool isZoomed() const;
  72. void unZoom();
  73. // Return the ID of the media instance the controls are currently attached to (either focus or hover).
  74. LLUUID getControlsMediaID();
  75. protected:
  76. /*virtual*/ void onFocusReceived();
  77. /*virtual*/ void onFocusLost();
  78. private:
  79. LLHandle<LLPanelPrimMediaControls> mMediaControls;
  80. LLObjectSelectionHandle mSelection;
  81. LLUUID mFocusedObjectID;
  82. S32 mFocusedObjectFace;
  83. LLUUID mFocusedImplID;
  84. LLVector3 mFocusedObjectNormal;
  85. LLUUID mHoverObjectID;
  86. S32 mHoverObjectFace;
  87. LLUUID mHoverImplID;
  88. LLVector3 mHoverObjectNormal;
  89. };
  90. #endif // LL_VIEWERMEDIAFOCUS_H