/indra/newview/llsidetraypanelcontainer.cpp

https://bitbucket.org/lindenlab/viewer-beta/ · C++ · 93 lines · 44 code · 12 blank · 37 comment · 2 complexity · 6face892c6c2b72e4632d2d4e516f96b MD5 · raw file

  1. /**
  2. * @file llsidetraypanelcontainer.cpp
  3. * @brief LLSideTrayPanelContainer implementation
  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. #include "llviewerprecompiledheaders.h"
  27. #include "llsidetraypanelcontainer.h"
  28. static LLDefaultChildRegistry::Register<LLSideTrayPanelContainer> r2("panel_container");
  29. std::string LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME = "sub_panel_name";
  30. LLSideTrayPanelContainer::Params::Params()
  31. : default_panel_name("default_panel_name")
  32. {
  33. // Always hide tabs.
  34. changeDefault(hide_tabs, true);
  35. }
  36. LLSideTrayPanelContainer::LLSideTrayPanelContainer(const Params& p)
  37. : LLTabContainer(p)
  38. , mDefaultPanelName(p.default_panel_name)
  39. {
  40. }
  41. void LLSideTrayPanelContainer::onOpen(const LLSD& key)
  42. {
  43. // Select specified panel and save navigation history.
  44. if(key.has(PARAM_SUB_PANEL_NAME))
  45. {
  46. //*NOTE dzaporozhan
  47. // Navigation history is not used after fix for EXT-3186,
  48. // openPreviousPanel() always opens default panel
  49. // Save panel navigation history
  50. std::string panel_name = key[PARAM_SUB_PANEL_NAME];
  51. selectTabByName(panel_name);
  52. }
  53. // Will reopen current panel if no panel name was passed.
  54. getCurrentPanel()->onOpen(key);
  55. }
  56. void LLSideTrayPanelContainer::openPanel(const std::string& panel_name, const LLSD& key)
  57. {
  58. LLSD combined_key = key;
  59. combined_key[PARAM_SUB_PANEL_NAME] = panel_name;
  60. onOpen(combined_key);
  61. }
  62. void LLSideTrayPanelContainer::openPreviousPanel()
  63. {
  64. if(!mDefaultPanelName.empty())
  65. {
  66. selectTabByName(mDefaultPanelName);
  67. }
  68. else
  69. {
  70. selectTab(0);
  71. }
  72. }
  73. BOOL LLSideTrayPanelContainer::handleKeyHere(KEY key, MASK mask)
  74. {
  75. // No key press handling code for Panel Container - this disables
  76. // Tab Container's Alt + Left/Right Button tab switching.
  77. // Let default handler process key presses, don't simply return TRUE or FALSE
  78. // as this may brake some functionality as it did with Copy/Paste for
  79. // text_editor (ticket EXT-642).
  80. return LLPanel::handleKeyHere(key, mask);
  81. }