PageRenderTime 43ms CodeModel.GetById 32ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/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
  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
 27#ifndef LL_VIEWERMEDIAFOCUS_H
 28#define LL_VIEWERMEDIAFOCUS_H
 29
 30// includes for LLViewerMediaFocus
 31#include "llfocusmgr.h"
 32#include "llviewermedia.h"
 33#include "llviewerobject.h"
 34#include "llviewerwindow.h"
 35#include "llselectmgr.h"
 36
 37class LLViewerMediaImpl;
 38class LLPanelPrimMediaControls;
 39
 40class LLViewerMediaFocus : 
 41	public LLFocusableElement, 
 42	public LLSingleton<LLViewerMediaFocus>
 43{
 44public:
 45	LLViewerMediaFocus();
 46	~LLViewerMediaFocus();
 47	
 48	// Set/clear the face that has media focus (takes keyboard input and has the full set of controls)
 49	void setFocusFace(LLPointer<LLViewerObject> objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal = LLVector3::zero);
 50	void clearFocus();
 51	
 52	// Set/clear the face that has "media hover" (has the mimimal set of controls to zoom in or pop out into a media browser).
 53	// If a media face has focus, the media hover will be ignored.
 54	void setHoverFace(LLPointer<LLViewerObject> objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal = LLVector3::zero);
 55	void clearHover();
 56	
 57	/*virtual*/ bool	getFocus();
 58	/*virtual*/ BOOL	handleKey(KEY key, MASK mask, BOOL called_from_parent);
 59	/*virtual*/ BOOL	handleUnicodeChar(llwchar uni_char, BOOL called_from_parent);
 60	BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
 61
 62	void update();
 63	
 64	static void setCameraZoom(LLViewerObject* object, LLVector3 normal, F32 padding_factor, bool zoom_in_only = false);
 65	static F32 getBBoxAspectRatio(const LLBBox& bbox, const LLVector3& normal, F32* height, F32* width, F32* depth);
 66
 67	bool isFocusedOnFace(LLPointer<LLViewerObject> objectp, S32 face);
 68	bool isHoveringOverFace(LLPointer<LLViewerObject> objectp, S32 face);
 69	
 70	// These look up (by uuid) and return the values that were set with setFocusFace.  They will return null if the objects have been destroyed.
 71	LLViewerMediaImpl* getFocusedMediaImpl();
 72	LLViewerObject* getFocusedObject();
 73	S32 getFocusedFace() { return mFocusedObjectFace; }
 74	LLUUID getFocusedObjectID() { return mFocusedObjectID; }
 75	
 76	// These look up (by uuid) and return the values that were set with setHoverFace.  They will return null if the objects have been destroyed.
 77	LLViewerMediaImpl* getHoverMediaImpl();
 78	LLViewerObject* getHoverObject();
 79	S32 getHoverFace() { return mHoverObjectFace; }
 80	
 81	// Try to focus/zoom on the specified media (if it's on an object in world).
 82	void focusZoomOnMedia(LLUUID media_id);
 83	// Are we zoomed in?
 84	bool isZoomed() const;
 85	void unZoom();
 86	
 87	// Return the ID of the media instance the controls are currently attached to (either focus or hover).
 88	LLUUID getControlsMediaID();
 89
 90protected:
 91	/*virtual*/ void	onFocusReceived();
 92	/*virtual*/ void	onFocusLost();
 93
 94private:
 95	
 96	LLHandle<LLPanelPrimMediaControls> mMediaControls;
 97	LLObjectSelectionHandle mSelection;
 98	
 99	LLUUID mFocusedObjectID;
100	S32 mFocusedObjectFace;
101	LLUUID mFocusedImplID;
102	LLVector3 mFocusedObjectNormal;
103	
104	LLUUID mHoverObjectID;
105	S32 mHoverObjectFace;
106	LLUUID mHoverImplID;
107	LLVector3 mHoverObjectNormal;
108};
109
110
111#endif // LL_VIEWERMEDIAFOCUS_H