PageRenderTime 22ms CodeModel.GetById 13ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/indra/newview/lllistcontextmenu.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 77 lines | 23 code | 11 blank | 43 comment | 0 complexity | c678048ec84b1bbe45148a1a47e1886e MD5 | raw file
 1/** 
 2 * @file lllistcontextmenu.h
 3 * @brief Base class of misc lists' context menus
 4 *
 5 * $LicenseInfo:firstyear=2010&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_LLLISTCONTEXTMENU_H
28#define LL_LLLISTCONTEXTMENU_H
29
30#include "llhandle.h"
31#include "lluuid.h"
32#include "llview.h"
33
34class LLView;
35class LLContextMenu;
36
37/**
38 * Context menu for single or multiple list items.
39 * 
40 * Derived classes must implement contextMenu().
41 * 
42 * Typical usage:
43 * <code>
44 * my_context_menu->show(parent_view, selected_list_items_ids, x, y);
45 * </code>
46 */
47class LLListContextMenu
48{
49public:
50	LLListContextMenu();
51	virtual ~LLListContextMenu();
52
53	/**
54	 * Show the menu at specified coordinates.
55	 *
56	 * @param spawning_view View to spawn at.
57	 * @param uuids An array of list items ids.
58	 * @param x Horizontal coordinate in the spawn_view's coordinate frame.
59	 * @param y Vertical coordinate in the spawn_view's coordinate frame.
60	 */
61	virtual void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y);
62
63	virtual void hide();
64
65protected:
66	typedef boost::function<void (const LLUUID& id)> functor_t;
67
68	virtual LLContextMenu* createMenu() = 0;
69
70	static LLContextMenu* createFromFile(const std::string& filename);
71	static void handleMultiple(functor_t functor, const uuid_vec_t& ids);
72
73	uuid_vec_t			mUUIDs;
74	LLHandle<LLContextMenu>	mMenuHandle;
75};
76
77#endif // LL_LLLISTCONTEXTMENU_H