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

/indra/newview/llpaneltopinfobar.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 178 lines | 67 code | 34 blank | 77 comment | 1 complexity | fdd2e136e4cd0fbb35deb090ed1d4763 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llpaneltopinfobar.h
  3. * @brief Coordinates and Parcel Settings information panel definition
  4. *
  5. * $LicenseInfo:firstyear=2010&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 LLPANELTOPINFOBAR_H_
  27. #define LLPANELTOPINFOBAR_H_
  28. #include "llpanel.h"
  29. class LLButton;
  30. class LLTextBox;
  31. class LLIconCtrl;
  32. class LLParcelChangeObserver;
  33. class LLPanelTopInfoBar : public LLPanel, public LLSingleton<LLPanelTopInfoBar>, private LLDestroyClass<LLPanelTopInfoBar>
  34. {
  35. LOG_CLASS(LLPanelTopInfoBar);
  36. friend class LLDestroyClass<LLPanelTopInfoBar>;
  37. public:
  38. typedef boost::signals2::signal<void ()> resize_signal_t;
  39. LLPanelTopInfoBar();
  40. ~LLPanelTopInfoBar();
  41. /*virtual*/ BOOL postBuild();
  42. /*virtual*/ void draw();
  43. /**
  44. * Updates location and parcel icons on login complete
  45. */
  46. void handleLoginComplete();
  47. /**
  48. * Called when the top info bar gets shown or hidden
  49. */
  50. void onVisibilityChange(const LLSD& show);
  51. boost::signals2::connection setResizeCallback( const resize_signal_t::slot_type& cb );
  52. private:
  53. class LLParcelChangeObserver;
  54. friend class LLParcelChangeObserver;
  55. enum EParcelIcon
  56. {
  57. VOICE_ICON = 0,
  58. FLY_ICON, // 1
  59. PUSH_ICON, // 2
  60. BUILD_ICON, // 3
  61. SCRIPTS_ICON, // 4
  62. DAMAGE_ICON, // 5
  63. SEE_AVATARS_ICON, // 6
  64. ICON_COUNT // 7 total
  65. };
  66. /**
  67. * Initializes parcel icons controls. Called from the constructor.
  68. */
  69. void initParcelIcons();
  70. BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
  71. /**
  72. * Handles clicks on the parcel icons.
  73. */
  74. void onParcelIconClick(EParcelIcon icon);
  75. /**
  76. * Handles clicks on the info buttons.
  77. */
  78. void onInfoButtonClicked();
  79. /**
  80. * Called when agent changes the parcel.
  81. */
  82. void onAgentParcelChange();
  83. /**
  84. * Called when context menu item is clicked.
  85. */
  86. void onContextMenuItemClicked(const LLSD::String& userdata);
  87. /**
  88. * Called when user checks/unchecks Show Coordinates menu item.
  89. */
  90. void onNavBarShowParcelPropertiesCtrlChanged();
  91. /**
  92. * Shorthand to call updateParcelInfoText() and updateParcelIcons().
  93. */
  94. void update();
  95. /**
  96. * Updates parcel info text (mParcelInfoText).
  97. */
  98. void updateParcelInfoText();
  99. /**
  100. * Updates parcel icons (mParcelIcon[]).
  101. */
  102. void updateParcelIcons();
  103. /**
  104. * Updates health information (mDamageText).
  105. */
  106. void updateHealth();
  107. /**
  108. * Lays out all parcel icons starting from right edge of the mParcelInfoText + 11px
  109. * (see screenshots in EXT-5808 for details).
  110. */
  111. void layoutParcelIcons();
  112. /**
  113. * Lays out a widget. Widget's rect mLeft becomes equal to the 'left' argument.
  114. */
  115. S32 layoutWidget(LLUICtrl* ctrl, S32 left);
  116. /**
  117. * Generates location string and returns it in the loc_str parameter.
  118. */
  119. void buildLocationString(std::string& loc_str, bool show_coords);
  120. /**
  121. * Sets new value to the mParcelInfoText and updates the size of the top bar.
  122. */
  123. void setParcelInfoText(const std::string& new_text);
  124. /**
  125. * Implementation of LLDestroyClass<T>
  126. */
  127. static void destroyClass()
  128. {
  129. if (LLPanelTopInfoBar::instanceExists())
  130. {
  131. LLPanelTopInfoBar::getInstance()->setEnabled(FALSE);
  132. }
  133. }
  134. LLButton* mInfoBtn;
  135. LLTextBox* mParcelInfoText;
  136. LLTextBox* mDamageText;
  137. LLIconCtrl* mParcelIcon[ICON_COUNT];
  138. LLParcelChangeObserver* mParcelChangedObserver;
  139. boost::signals2::connection mParcelPropsCtrlConnection;
  140. boost::signals2::connection mShowCoordsCtrlConnection;
  141. boost::signals2::connection mParcelMgrConnection;
  142. resize_signal_t mResizeSignal;
  143. };
  144. #endif /* LLPANELTOPINFOBAR_H_ */