PageRenderTime 32ms CodeModel.GetById 17ms RepoModel.GetById 1ms 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
Possible License(s): LGPL-2.1
  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. #ifndef LL_LLLISTCONTEXTMENU_H
  27. #define LL_LLLISTCONTEXTMENU_H
  28. #include "llhandle.h"
  29. #include "lluuid.h"
  30. #include "llview.h"
  31. class LLView;
  32. class LLContextMenu;
  33. /**
  34. * Context menu for single or multiple list items.
  35. *
  36. * Derived classes must implement contextMenu().
  37. *
  38. * Typical usage:
  39. * <code>
  40. * my_context_menu->show(parent_view, selected_list_items_ids, x, y);
  41. * </code>
  42. */
  43. class LLListContextMenu
  44. {
  45. public:
  46. LLListContextMenu();
  47. virtual ~LLListContextMenu();
  48. /**
  49. * Show the menu at specified coordinates.
  50. *
  51. * @param spawning_view View to spawn at.
  52. * @param uuids An array of list items ids.
  53. * @param x Horizontal coordinate in the spawn_view's coordinate frame.
  54. * @param y Vertical coordinate in the spawn_view's coordinate frame.
  55. */
  56. virtual void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y);
  57. virtual void hide();
  58. protected:
  59. typedef boost::function<void (const LLUUID& id)> functor_t;
  60. virtual LLContextMenu* createMenu() = 0;
  61. static LLContextMenu* createFromFile(const std::string& filename);
  62. static void handleMultiple(functor_t functor, const uuid_vec_t& ids);
  63. uuid_vec_t mUUIDs;
  64. LLHandle<LLContextMenu> mMenuHandle;
  65. };
  66. #endif // LL_LLLISTCONTEXTMENU_H