PageRenderTime 39ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llfloatersidepanelcontainer.h

https://bitbucket.org/lindenlab/viewer-beta/
C Header | 81 lines | 27 code | 11 blank | 43 comment | 1 complexity | 4f2ab5cd106d9b0406b87ee2f2a28418 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llfloatersidepanelcontainer.h
  3. * @brief LLFloaterSidePanelContainer class
  4. *
  5. *
  6. * $LicenseInfo:firstyear=2011&license=viewerlgpl$
  7. * Second Life Viewer Source Code
  8. * Copyright (C) 2011, Linden Research, Inc.
  9. *
  10. * This library is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU Lesser General Public
  12. * License as published by the Free Software Foundation;
  13. * version 2.1 of the License only.
  14. *
  15. * This library is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * Lesser General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public
  21. * License along with this library; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. *
  24. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  25. * $/LicenseInfo$
  26. */
  27. #ifndef LL_LLFLOATERSIDEPANELCONTAINER_H
  28. #define LL_LLFLOATERSIDEPANELCONTAINER_H
  29. #include "llfloater.h"
  30. /**
  31. * Class LLFloaterSidePanelContainer
  32. *
  33. * Provides an interface for all former Side Tray panels.
  34. *
  35. * This class helps to make sure that clicking a floater containing the side panel
  36. * doesn't make transient floaters (e.g. IM windows) hide, so that it's possible to
  37. * drag an inventory item from My Inventory window to a docked IM window,
  38. * i.e. share the item (see VWR-22891).
  39. */
  40. class LLFloaterSidePanelContainer : public LLFloater
  41. {
  42. private:
  43. static const std::string sMainPanelName;
  44. public:
  45. LLFloaterSidePanelContainer(const LLSD& key, const Params& params = getDefaultParams());
  46. ~LLFloaterSidePanelContainer();
  47. /*virtual*/ void onOpen(const LLSD& key);
  48. LLPanel* openChildPanel(const std::string& panel_name, const LLSD& params);
  49. static void showPanel(const std::string& floater_name, const LLSD& key);
  50. static void showPanel(const std::string& floater_name, const std::string& panel_name, const LLSD& key);
  51. static LLPanel* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName);
  52. /**
  53. * Gets the panel of given type T (doesn't show it or do anything else with it).
  54. *
  55. * @param floater_name a string specifying the floater to be searched for a child panel.
  56. * @param panel_name a string specifying the child panel to get.
  57. * @returns a pointer to the panel of given type T.
  58. */
  59. template <typename T>
  60. static T* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName)
  61. {
  62. T* panel = dynamic_cast<T*>(getPanel(floater_name, panel_name));
  63. if (!panel)
  64. {
  65. llwarns << "Child named \"" << panel_name << "\" of type " << typeid(T*).name() << " not found" << llendl;
  66. }
  67. return panel;
  68. }
  69. };
  70. #endif // LL_LLFLOATERSIDEPANELCONTAINER_H