lloverlaybar.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /**
  2. * @file lloverlaybar.h
  3. * @brief LLOverlayBar class definition
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewergpl$
  6. *
  7. * Copyright (c) 2002-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_LLOVERLAYBAR_H
  33. #define LL_LLOVERLAYBAR_H
  34. #include "boost/signals2.hpp"
  35. #include "llcontrol.h"
  36. #include "llframetimer.h"
  37. #include "llpanel.h"
  38. #include "llpathfindingmanager.h"
  39. constexpr S32 OVERLAY_BAR_HEIGHT = 20;
  40. class LLButton;
  41. class LLMediaRemoteCtrl;
  42. class LLVoiceRemoteCtrl;
  43. class LLOverlayBar final : public LLPanel
  44. {
  45. protected:
  46. LOG_CLASS(LLOverlayBar);
  47. private:
  48. // Navmesh rebaking stuff
  49. typedef enum
  50. {
  51. kRebakeNavMesh_Available,
  52. kRebakeNavMesh_RequestSent,
  53. kRebakeNavMesh_InProgress,
  54. kRebakeNavMesh_NotAvailable,
  55. kRebakeNavMesh_Default = kRebakeNavMesh_NotAvailable
  56. } ERebakeNavMeshMode;
  57. public:
  58. LLOverlayBar(const LLRect& rect);
  59. ~LLOverlayBar() override;
  60. void refresh() override;
  61. void draw() override;
  62. void reshape(S32 width, S32 height, bool call_from_parent = true) override;
  63. void setVisible(bool visible) override;
  64. LL_INLINE void setDirty() { mDirty = true; }
  65. // Callback functions used by llmediaremotectrl.cpp:
  66. static void toggleAudioVolumeFloater(void*);
  67. // Navmesh rebaking stuff (used by llstatusbar.cpp and
  68. // hbviewerautomation.cpp).
  69. LL_INLINE bool isNavmeshDirty() const
  70. {
  71. return mRebakeNavMeshMode == kRebakeNavMesh_Available;
  72. }
  73. LL_INLINE bool isNavmeshRebaking() const
  74. {
  75. return mRebakeNavMeshMode == kRebakeNavMesh_RequestSent ||
  76. mRebakeNavMeshMode == kRebakeNavMesh_InProgress;
  77. }
  78. LL_INLINE bool canRebakeRegion() const { return mCanRebakeRegion; }
  79. // Lua status bar icon action
  80. void setLuaFunctionButton(const std::string& label,
  81. const std::string& command,
  82. const std::string& tooltip);
  83. private:
  84. void layoutButtons();
  85. // Navmesh rebaking stuff
  86. void setRebakeMode(ERebakeNavMeshMode mode);
  87. void handleAgentState(bool can_rebake_region);
  88. void handleRebakeNavMeshResponse(bool status_response);
  89. void handleNavMeshStatus(const LLPathfindingNavMeshStatus& statusp);
  90. void handleRegionBoundaryCrossed();
  91. void createNavMeshStatusListenerForCurrentRegion();
  92. static void* createMasterRemote(void* userdata);
  93. static void* createParcelMusicRemote(void* userdata);
  94. static void* createParcelMediaRemote(void* userdata);
  95. static void* createSharedMediaRemote(void* userdata);
  96. static void* createVoiceRemote(void* userdata);
  97. static void onClickIMReceived(void* data);
  98. static void onClickSetNotBusy(void* data);
  99. static void onClickPublicBaking(void* data);
  100. static void onClickMouselook(void* data);
  101. static void onClickStandUp(void* data);
  102. static void onClickResetView(void* data);
  103. static void onClickFlycam(void* data);
  104. static void onClickRebakeRegion(void* data);
  105. static void onClickLuaFunction(void* data);
  106. private:
  107. LLVoiceRemoteCtrl* mVoiceRemote;
  108. LLMediaRemoteCtrl* mSharedMediaRemote;
  109. LLMediaRemoteCtrl* mParcelMediaRemote;
  110. LLMediaRemoteCtrl* mParcelMusicRemote;
  111. LLMediaRemoteCtrl* mMasterRemote;
  112. LLButton* mBtnIMReceiced;
  113. LLButton* mBtnSetNotBusy;
  114. LLButton* mBtnFlyCam;
  115. LLButton* mBtnMouseLook;
  116. LLButton* mBtnStandUp;
  117. LLButton* mBtnPublicBaking;
  118. LLButton* mBtnRebakeRegion;
  119. LLButton* mBtnLuaFunction;
  120. LLCachedControl<S32> mStatusBarPad;
  121. S32 mVoiceRemoteWidth;
  122. S32 mParcelMediaRemoteWidth;
  123. S32 mSharedMediaRemoteWidth;
  124. S32 mParcelMusicRemoteWidth;
  125. S32 mMasterRemoteWidth;
  126. U32 mLastIMsCount;
  127. std::string mIMReceivedlabel;
  128. std::string mLuaCommand;
  129. LLFrameTimer mUpdateTimer;
  130. // Navmesh rebaking stuff
  131. ERebakeNavMeshMode mRebakeNavMeshMode;
  132. LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot;
  133. boost::signals2::connection mRegionCrossingSlot;
  134. LLPathfindingManager::agent_state_slot_t mAgentStateSlot;
  135. LLUUID mRebakingNotificationID;
  136. bool mCanRebakeRegion;
  137. bool mBuilt;
  138. bool mDirty;
  139. };
  140. extern LLOverlayBar* gOverlayBarp;
  141. #endif