/indra/newview/lltransientdockablefloater.cpp

https://bitbucket.org/lindenlab/viewer-beta/ · C++ · 99 lines · 65 code · 9 blank · 25 comment · 13 complexity · 8cb69de208ecd10faad5fa9c571fb3c2 MD5 · raw file

  1. /**
  2. * @file lltransientdockablefloater.cpp
  3. * @brief Creates a panel of a specific kind for a toast
  4. *
  5. * $LicenseInfo:firstyear=2000&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 "lltransientfloatermgr.h"
  28. #include "lltransientdockablefloater.h"
  29. #include "llfloaterreg.h"
  30. LLTransientDockableFloater::LLTransientDockableFloater(LLDockControl* dockControl, bool uniqueDocking,
  31. const LLSD& key, const Params& params) :
  32. LLDockableFloater(dockControl, uniqueDocking, key, params)
  33. {
  34. LLTransientFloaterMgr::getInstance()->registerTransientFloater(this);
  35. LLTransientFloater::init(this);
  36. }
  37. LLTransientDockableFloater::~LLTransientDockableFloater()
  38. {
  39. LLTransientFloaterMgr::getInstance()->unregisterTransientFloater(this);
  40. LLView* dock = getDockWidget();
  41. LLTransientFloaterMgr::getInstance()->removeControlView(
  42. LLTransientFloaterMgr::DOCKED, this);
  43. if (dock != NULL)
  44. {
  45. LLTransientFloaterMgr::getInstance()->removeControlView(
  46. LLTransientFloaterMgr::DOCKED, dock);
  47. }
  48. }
  49. void LLTransientDockableFloater::setVisible(BOOL visible)
  50. {
  51. LLView* dock = getDockWidget();
  52. if(visible && isDocked())
  53. {
  54. LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::DOCKED, this);
  55. if (dock != NULL)
  56. {
  57. LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::DOCKED, dock);
  58. }
  59. }
  60. else
  61. {
  62. LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::DOCKED, this);
  63. if (dock != NULL)
  64. {
  65. LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::DOCKED, dock);
  66. }
  67. }
  68. LLDockableFloater::setVisible(visible);
  69. }
  70. void LLTransientDockableFloater::setDocked(bool docked, bool pop_on_undock)
  71. {
  72. LLView* dock = getDockWidget();
  73. if(docked)
  74. {
  75. LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::DOCKED, this);
  76. if (dock != NULL)
  77. {
  78. LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::DOCKED, dock);
  79. }
  80. }
  81. else
  82. {
  83. LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::DOCKED, this);
  84. if (dock != NULL)
  85. {
  86. LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::DOCKED, dock);
  87. }
  88. }
  89. LLDockableFloater::setDocked(docked, pop_on_undock);
  90. }