PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 2ms RepoModel.GetById 38ms app.codeStats 0ms

/indra/newview/llvoinventorylistener.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 66 lines | 21 code | 11 blank | 34 comment | 0 complexity | 773c837aba3e1fb039eeb5417641e388 MD5 | raw file
 1/** 
 2 * @file llvoinventorylistener.h
 3 * @brief Interface for classes that wish to receive updates about viewer object inventory
 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// Description of LLVOInventoryListener class, which is an interface
28// for windows that are interested in updates to a ViewerObject's inventory.
29
30#ifndef LL_LLVOINVENTORYLISTENER_H
31#define LL_LLVOINVENTORYLISTENER_H
32
33#include "llviewerobject.h"
34
35class LLVOInventoryListener
36{
37public:
38	virtual void inventoryChanged(LLViewerObject* object,
39								 LLInventoryObject::object_list_t* inventory,
40								 S32 serial_num,
41								 void* user_data) = 0;
42
43	// Remove the listener from the object and clear this listener
44	void removeVOInventoryListener();
45
46	// Just clear this listener, don't worry about the object.
47	void clearVOInventoryListener();
48
49protected:
50	LLVOInventoryListener() : mListenerVObject(NULL) { }
51	virtual ~LLVOInventoryListener() { removeVOInventoryListener(); }
52
53	void registerVOInventoryListener(LLViewerObject* object, void* user_data);
54	void requestVOInventory();
55
56private:
57	// LLViewerObject is normally wrapped by an LLPointer, but not in
58	// this case, because it's already sure to be kept alive by
59	// LLPointers held by other objects that have longer lifetimes
60	// than this one.  Plumbing correct LLPointer usage all the way
61	// down here has been deemed too much work for now.
62	LLViewerObject *mListenerVObject;
63};
64
65#endif
66