PageRenderTime 58ms CodeModel.GetById 50ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/lltoolpipette.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 70 lines | 30 code | 10 blank | 30 comment | 0 complexity | 0b05f1a65b818e05bf802418c875cc39 MD5 | raw file
 1/** 
 2 * @file lltoolpipette.h
 3 * @brief LLToolPipette class header file
 4 *
 5 * $LicenseInfo:firstyear=2006&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// A tool to pick texture entry infro from objects in world (color/texture)
28// This tool assumes it is transient in the codebase and must be used
29// accordingly. We should probably restructure the way tools are
30// managed so that this is handled automatically.
31
32#ifndef LL_LLTOOLPIPETTE_H
33#define LL_LLTOOLPIPETTE_H
34
35#include "lltool.h"
36#include "lltextureentry.h"
37#include <boost/function.hpp>
38#include <boost/signals2.hpp>
39
40class LLViewerObject;
41class LLPickInfo;
42
43class LLToolPipette
44:	public LLTool, public LLSingleton<LLToolPipette>
45{
46public:
47	LLToolPipette();
48	virtual ~LLToolPipette();
49
50	virtual BOOL	handleMouseDown(S32 x, S32 y, MASK mask);
51	virtual BOOL	handleMouseUp(S32 x, S32 y, MASK mask);
52	virtual BOOL	handleHover(S32 x, S32 y, MASK mask);
53	virtual BOOL	handleToolTip(S32 x, S32 y, MASK mask);
54
55	// Note: Don't return connection; use boost::bind + boost::signals2::trackable to disconnect slots
56	typedef boost::signals2::signal<void (const LLTextureEntry& te)> signal_t;
57	void setToolSelectCallback(const signal_t::slot_type& cb) { mSignal.connect(cb); }
58	void setResult(BOOL success, const std::string& msg);
59	
60	void setTextureEntry(const LLTextureEntry* entry);
61	static void pickCallback(const LLPickInfo& pick_info);
62
63protected:
64	LLTextureEntry	mTextureEntry;
65	signal_t		mSignal;
66	BOOL			mSuccess;
67	std::string		mTooltipMsg;
68};
69
70#endif //LL_LLTOOLPIPETTE_H