/indra/newview/llsidetraypanelcontainer.h

https://bitbucket.org/lindenlab/viewer-beta/ · C++ Header · 96 lines · 24 code · 13 blank · 59 comment · 0 complexity · 04c787c0f3be6ac1bfba5bc7a6670ac1 MD5 · raw file

  1. /**
  2. * @file llsidetraypanelcontainer.h
  3. * @brief LLSideTrayPanelContainer class declaration
  4. *
  5. * $LicenseInfo:firstyear=2009&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_LLSIDETRAY_PANEL_CONTAINER_H
  27. #define LL_LLSIDETRAY_PANEL_CONTAINER_H
  28. #include "lltabcontainer.h"
  29. /**
  30. * LLSideTrayPanelContainer class acts like LLTabContainer with invisible tabs.
  31. * It is designed to make panel switching easier, avoid setVisible(TRUE) setVisible(FALSE)
  32. * calls and related workarounds.
  33. * use onOpen to open sub panel, pass the name of panel to open
  34. * in key[PARAM_SUB_PANEL_NAME].
  35. * LLSideTrayPanelContainer also implements panel navigation history - it allows to
  36. * open previous or next panel if navigation history is available(after user
  37. * has opened two or more panels). *NOTE - only back navigation is implemented so far.
  38. */
  39. class LLSideTrayPanelContainer : public LLTabContainer
  40. {
  41. public:
  42. struct Params : public LLInitParam::Block<Params, LLTabContainer::Params>
  43. {
  44. Optional<std::string> default_panel_name;
  45. Params();
  46. };
  47. /**
  48. * Opens sub panel
  49. * @param key - params to be passed to panel, use key[PARAM_SUB_PANEL_NAME]
  50. * to specify panel name to be opened.
  51. */
  52. /*virtual*/ void onOpen(const LLSD& key);
  53. /**
  54. * Opens given subpanel.
  55. */
  56. void openPanel(const std::string& panel_name, const LLSD& key = LLSD::emptyMap());
  57. /**
  58. * Opens previous panel from panel navigation history.
  59. */
  60. void openPreviousPanel();
  61. /**
  62. * Overrides LLTabContainer::handleKeyHere to disable panel switch on
  63. * Alt + Left/Right button press.
  64. */
  65. BOOL handleKeyHere(KEY key, MASK mask);
  66. /**
  67. * Name of parameter that stores panel name to open.
  68. */
  69. static std::string PARAM_SUB_PANEL_NAME;
  70. protected:
  71. LLSideTrayPanelContainer(const Params& p);
  72. friend class LLUICtrlFactory;
  73. /**
  74. * std::string - name of panel
  75. * S32 - index of previous panel
  76. * *NOTE - no forward navigation implemented yet
  77. */
  78. typedef std::map<std::string, S32> panel_navigation_history_t;
  79. // Navigation history
  80. panel_navigation_history_t mPanelHistory;
  81. std::string mDefaultPanelName;
  82. };
  83. #endif //LL_LLSIDETRAY_PANEL_CONTAINER_H