PageRenderTime 13ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llui/lldockcontrol.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 96 lines | 55 code | 10 blank | 31 comment | 0 complexity | f8720db7fb490d7062b2f683d344fa6a MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file lldockcontrol.h
  3. * @brief Creates a panel of a specific kind for a toast.
  4. *
  5. * $LicenseInfo:firstyear=2003&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_DOCKCONTROL_H
  27. #define LL_DOCKCONTROL_H
  28. #include "llerror.h"
  29. #include "llview.h"
  30. #include "llfloater.h"
  31. #include "lluiimage.h"
  32. /**
  33. * Provides services for docking of specified floater.
  34. * This class should be used in case impossibility deriving from LLDockableFloater.
  35. */
  36. class LLDockControl
  37. {
  38. public:
  39. enum DocAt
  40. {
  41. TOP,
  42. LEFT,
  43. RIGHT,
  44. BOTTOM
  45. };
  46. public:
  47. // callback for a function getting a rect valid for control's position
  48. typedef boost::function<void (LLRect& )> get_allowed_rect_callback_t;
  49. LOG_CLASS(LLDockControl);
  50. LLDockControl(LLView* dockWidget, LLFloater* dockableFloater,
  51. const LLUIImagePtr& dockTongue, DocAt dockAt, get_allowed_rect_callback_t get_rect_callback = NULL);
  52. virtual ~LLDockControl();
  53. public:
  54. void on();
  55. void off();
  56. void forceRecalculatePosition();
  57. void setDock(LLView* dockWidget);
  58. LLView* getDock()
  59. {
  60. return mDockWidget;
  61. }
  62. void repositionDockable();
  63. void drawToungue();
  64. bool isDockVisible();
  65. // gets a rect that bounds possible positions for a dockable control (EXT-1111)
  66. void getAllowedRect(LLRect& rect);
  67. S32 getTongueWidth() { return mDockTongue->getWidth(); }
  68. S32 getTongueHeight() { return mDockTongue->getHeight(); }
  69. private:
  70. virtual void moveDockable();
  71. private:
  72. get_allowed_rect_callback_t mGetAllowedRectCallback;
  73. bool mEnabled;
  74. bool mRecalculateDockablePosition;
  75. bool mDockWidgetVisible;
  76. DocAt mDockAt;
  77. LLView* mDockWidget;
  78. LLRect mPrevDockRect;
  79. LLRect mRootRect;
  80. LLRect mFloaterRect;
  81. LLFloater* mDockableFloater;
  82. LLUIImagePtr mDockTongue;
  83. S32 mDockTongueX;
  84. S32 mDockTongueY;
  85. };
  86. #endif /* LL_DOCKCONTROL_H */