PageRenderTime 13ms CodeModel.GetById 1ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 1ms

/indra/newview/lltool.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 108 lines | 56 code | 20 blank | 32 comment | 1 complexity | c5d9960ed48541b949cf8df5813bca2d MD5 | raw file
  1/** 
  2 * @file lltool.h
  3 * @brief LLTool class header file
  4 *
  5 * $LicenseInfo:firstyear=2001&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_LLTOOL_H
 28#define LL_LLTOOL_H
 29
 30#include "llkeyboard.h"
 31#include "llmousehandler.h"
 32#include "llcoord.h"
 33#include "v3math.h"
 34#include "v3dmath.h"
 35
 36class LLViewerObject;
 37class LLToolComposite;
 38class LLView;
 39class LLPanel;
 40
 41class LLTool
 42:	public LLMouseHandler
 43{
 44public:
 45	LLTool( const std::string& name, LLToolComposite* composite = NULL );
 46	virtual ~LLTool();
 47
 48	// Hack to support LLFocusMgr
 49	virtual BOOL isView() const { return FALSE; }
 50
 51	// Virtual functions inherited from LLMouseHandler
 52	virtual BOOL	handleAnyMouseClick(S32 x, S32 y, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down);
 53	virtual BOOL	handleMouseDown(S32 x, S32 y, MASK mask);
 54	virtual BOOL	handleMouseUp(S32 x, S32 y, MASK mask);
 55	virtual BOOL	handleMiddleMouseDown(S32 x, S32 y, MASK mask);
 56	virtual BOOL	handleMiddleMouseUp(S32 x, S32 y, MASK mask);
 57
 58	virtual BOOL	handleHover(S32 x, S32 y, MASK mask);
 59	virtual BOOL	handleScrollWheel(S32 x, S32 y, S32 clicks);
 60	virtual BOOL	handleDoubleClick(S32 x, S32 y, MASK mask);
 61	virtual BOOL	handleRightMouseDown(S32 x, S32 y, MASK mask);
 62	virtual BOOL	handleRightMouseUp(S32 x, S32 y, MASK mask);
 63	virtual BOOL	handleToolTip(S32 x, S32 y, MASK mask);
 64
 65		// Return FALSE to allow context menu to be shown.
 66	virtual void	screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const
 67							{ *local_x = screen_x; *local_y = screen_y;	}
 68	virtual void	localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const
 69							{ *screen_x = local_x; *screen_y = local_y;	}
 70
 71	virtual const std::string& getName() const	{ return mName; }
 72
 73	// New virtual functions
 74	virtual LLViewerObject*	getEditingObject()		{ return NULL; }
 75	virtual LLVector3d		getEditingPointGlobal()	{ return LLVector3d(); }
 76	virtual BOOL			isEditing()				{ return (getEditingObject() != NULL); }
 77	virtual void			stopEditing()			{}
 78
 79	virtual BOOL			clipMouseWhenDown()		{ return TRUE; }
 80
 81	virtual void			handleSelect()			{ }	// do stuff when your tool is selected
 82	virtual void			handleDeselect()		{ }	// clean up when your tool is deselected
 83
 84	virtual LLTool*			getOverrideTool(MASK mask);
 85
 86	// isAlwaysRendered() - return true if this is a tool that should
 87	// always be rendered regardless of selection.
 88	virtual BOOL isAlwaysRendered() { return FALSE; }
 89
 90	virtual void			render() {}				// draw tool specific 3D content in world
 91	virtual void			draw();					// draw tool specific 2D overlay
 92
 93	virtual BOOL			handleKey(KEY key, MASK mask);
 94
 95	// Note: NOT virtual.  Subclasses should call this version.
 96	void					setMouseCapture(BOOL b);
 97	BOOL					hasMouseCapture();
 98	virtual void			onMouseCaptureLost() {}  // override this one as needed.
 99
100protected:
101	LLToolComposite*	mComposite;  // Composite will handle mouse captures.
102	std::string			mName;
103	
104public:
105	static const std::string sNameNull;
106};
107
108#endif