llhoverview.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /**
  2. * @file llhoverview.h
  3. * @brief LLHoverView class definition
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewergpl$
  6. *
  7. * Copyright (c) 2001-2009, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_LLHOVERVIEW_H
  33. #define LL_LLHOVERVIEW_H
  34. #include <list>
  35. #include <string>
  36. #include "llframetimer.h"
  37. #include "llview.h"
  38. #include "llviewerobject.h"
  39. #include "llviewerwindow.h" // For LLPickInfo
  40. class LLFontGL;
  41. class LLParcel;
  42. class LLTool;
  43. class LLHoverView final : public LLView
  44. {
  45. public:
  46. LLHoverView(const LLRect& rect);
  47. ~LLHoverView() override;
  48. void draw() override;
  49. void updateHover(LLTool* current_tool);
  50. void cancelHover();
  51. // The last hovered object is retained even after the hover is cancelled,
  52. // so allow it to be specifically reset. JC
  53. void resetLastHoverObject();
  54. void setHoverActive(bool active);
  55. // We do not do hover picks while the user is typing. In fact, we stop
  56. // until the mouse is moved.
  57. LL_INLINE void setTyping(bool b) { mTyping = b; }
  58. LL_INLINE bool isHoveringObject() const { return mLastHoverObject.notNull() && !mLastHoverObject->isDead(); }
  59. LL_INLINE bool isHoveringLand() const { return !mHoverLandGlobal.isExactlyZero(); }
  60. LL_INLINE bool isHovering() const { return isHoveringLand() || isHoveringObject(); }
  61. LLViewerObject* getLastHoverObject() const;
  62. LL_INLINE LLPickInfo getPickInfo() { return mLastPickInfo; }
  63. static void pickCallback(const LLPickInfo& info);
  64. protected:
  65. void updateText();
  66. protected:
  67. // If not null and not dead, we're over an object.
  68. LLPointer<LLViewerObject> mLastHoverObject;
  69. LLViewerObject* mLastObjectWithFullText;
  70. LLParcel* mLastParcelWithFullText;
  71. LLPickInfo mLastPickInfo;
  72. LLCoordGL mHoverPos;
  73. // If not LLVector3d::ZERO, we are over land.
  74. LLVector3d mHoverLandGlobal;
  75. LLVector3 mHoverOffset;
  76. LLUIImagePtr mShadowImage;
  77. const LLFontGL* mFont;
  78. // How long has the hover popup been visible ?
  79. LLFrameTimer mHoverTimer;
  80. LLFrameTimer mStartHoverTimer;
  81. bool mStartHoverPickTimer;
  82. bool mDoneHoverPick;
  83. bool mHoverActive;
  84. bool mUseHover;
  85. bool mTyping;
  86. std::string mRetrievingData;
  87. std::string mTooltipPerson;
  88. std::string mTooltipNoName;
  89. std::string mTooltipOwner;
  90. std::string mTooltipPublic;
  91. std::string mTooltipIsGroup;
  92. std::string mTooltipFlagScript;
  93. std::string mTooltipFlagCharacter;
  94. std::string mTooltipFlagPhysics;
  95. std::string mTooltipFlagPermanent;
  96. std::string mTooltipFlagTouch;
  97. std::string mTooltipFlagMoney;
  98. std::string mTooltipFlagDropInventory;
  99. std::string mTooltipFlagPhantom;
  100. std::string mTooltipFlagTemporary;
  101. std::string mTooltipFlagRightClickMenu;
  102. std::string mTooltipFreeToCopy;
  103. std::string mTooltipForSaleMsg;
  104. std::string mTooltipLand;
  105. std::string mTooltipFlagGroupBuild;
  106. std::string mTooltipFlagNoBuild;
  107. std::string mTooltipFlagNoEdit;
  108. std::string mTooltipFlagNotSafe;
  109. std::string mTooltipFlagNoFly;
  110. std::string mTooltipFlagGroupScripts;
  111. std::string mTooltipFlagNoScripts;
  112. typedef std::list<std::string> text_list_t;
  113. text_list_t mText;
  114. public:
  115. // Show in-world hover tips. Allow to turn off for movie making, game
  116. // playing. Public so menu can directly toggle.
  117. static bool sShowHoverTips;
  118. };
  119. extern LLHoverView* gHoverViewp;
  120. #endif