PageRenderTime 48ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/lllocationinputctrl.h

https://bitbucket.org/lindenlab/viewer-beta/
C Header | 196 lines | 130 code | 22 blank | 44 comment | 0 complexity | 11d60917263fac4285c6b457520e9a4e MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file lllocationinputctrl.h
  3. * @brief Combobox-like location input control
  4. *
  5. * $LicenseInfo:firstyear=2009&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_LLLOCATIONINPUTCTRL_H
  27. #define LL_LLLOCATIONINPUTCTRL_H
  28. #include "llcombobox.h"
  29. #include "lliconctrl.h" // Params
  30. #include "lltextbox.h" // Params
  31. #include "lllocationhistory.h"
  32. class LLLandmark;
  33. // internals
  34. class LLAddLandmarkObserver;
  35. class LLRemoveLandmarkObserver;
  36. class LLParcelChangeObserver;
  37. class LLMenuGL;
  38. class LLTeleportHistoryItem;
  39. /**
  40. * Location input control.
  41. *
  42. * @see LLNavigationBar
  43. */
  44. class LLLocationInputCtrl
  45. : public LLComboBox
  46. {
  47. LOG_CLASS(LLLocationInputCtrl);
  48. friend class LLAddLandmarkObserver;
  49. friend class LLRemoveLandmarkObserver;
  50. friend class LLParcelChangeObserver;
  51. public:
  52. struct Params
  53. : public LLInitParam::Block<Params, LLComboBox::Params>
  54. {
  55. Optional<LLUIImage*> icon_maturity_general,
  56. icon_maturity_adult,
  57. icon_maturity_moderate,
  58. add_landmark_image_enabled,
  59. add_landmark_image_disabled,
  60. add_landmark_image_hover,
  61. add_landmark_image_selected;
  62. Optional<std::string> maturity_help_topic;
  63. Optional<S32> icon_hpad,
  64. add_landmark_hpad;
  65. Optional<LLButton::Params> maturity_button,
  66. add_landmark_button,
  67. for_sale_button,
  68. info_button;
  69. Optional<LLIconCtrl::Params> voice_icon,
  70. fly_icon,
  71. push_icon,
  72. build_icon,
  73. scripts_icon,
  74. damage_icon,
  75. see_avatars_icon;
  76. Optional<LLTextBox::Params> damage_text;
  77. Params();
  78. };
  79. // LLView interface
  80. /*virtual*/ void setEnabled(BOOL enabled);
  81. /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask);
  82. /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
  83. /*virtual*/ void onFocusReceived();
  84. /*virtual*/ void onFocusLost();
  85. /*virtual*/ void draw();
  86. /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
  87. //========================================================================
  88. // LLUICtrl interface
  89. /*virtual*/ void setFocus(BOOL b);
  90. //========================================================================
  91. // LLComboBox interface
  92. void hideList();
  93. void onTextEntry(LLLineEditor* line_editor);
  94. //========================================================================
  95. LLLineEditor* getTextEntry() const { return mTextEntry; }
  96. void handleLoginComplete();
  97. private:
  98. enum EParcelIcon
  99. {
  100. VOICE_ICON = 0,
  101. FLY_ICON, // 1
  102. PUSH_ICON, // 2
  103. BUILD_ICON, // 3
  104. SCRIPTS_ICON, // 4
  105. DAMAGE_ICON, // 5
  106. SEE_AVATARS_ICON, // 6
  107. ICON_COUNT // 7 total
  108. };
  109. friend class LLUICtrlFactory;
  110. LLLocationInputCtrl(const Params&);
  111. virtual ~LLLocationInputCtrl();
  112. void focusTextEntry();
  113. /**
  114. * Changes the "Add landmark" button image
  115. * depending on whether current parcel has been landmarked.
  116. */
  117. void enableAddLandmarkButton(bool val);
  118. void refresh();
  119. void refreshLocation();
  120. void refreshParcelIcons();
  121. // Refresh the value in the health percentage text field
  122. void refreshHealth();
  123. void refreshMaturityButton();
  124. void positionMaturityButton();
  125. void rebuildLocationHistory(const std::string& filter = LLStringUtil::null);
  126. bool findTeleportItemsByTitle(const LLTeleportHistoryItem& item, const std::string& filter);
  127. void setText(const LLStringExplicit& text);
  128. void updateAddLandmarkButton();
  129. void updateAddLandmarkTooltip();
  130. void updateContextMenu();
  131. void updateWidgetlayout();
  132. void changeLocationPresentation();
  133. void onInfoButtonClicked();
  134. void onLocationHistoryChanged(LLLocationHistory::EChangeType event);
  135. void onLocationPrearrange(const LLSD& data);
  136. void onTextEditorRightClicked(S32 x, S32 y, MASK mask);
  137. void onLandmarkLoaded(LLLandmark* lm);
  138. void onForSaleButtonClicked();
  139. void onAddLandmarkButtonClicked();
  140. void onAgentParcelChange();
  141. void onMaturityButtonClicked();
  142. // callbacks
  143. bool onLocationContextMenuItemEnabled(const LLSD& userdata);
  144. void onLocationContextMenuItemClicked(const LLSD& userdata);
  145. void onParcelIconClick(EParcelIcon icon);
  146. LLMenuGL* mLocationContextMenu;
  147. LLButton* mAddLandmarkBtn;
  148. LLButton* mForSaleBtn;
  149. LLButton* mInfoBtn;
  150. S32 mIconHPad; // pad between all icons
  151. S32 mAddLandmarkHPad; // pad to left of landmark star
  152. LLButton* mMaturityButton;
  153. LLIconCtrl* mParcelIcon[ICON_COUNT];
  154. LLTextBox* mDamageText;
  155. LLAddLandmarkObserver* mAddLandmarkObserver;
  156. LLRemoveLandmarkObserver* mRemoveLandmarkObserver;
  157. LLParcelChangeObserver* mParcelChangeObserver;
  158. boost::signals2::connection mCoordinatesControlConnection;
  159. boost::signals2::connection mParcelPropertiesControlConnection;
  160. boost::signals2::connection mParcelMgrConnection;
  161. boost::signals2::connection mLocationHistoryConnection;
  162. LLUIImage* mLandmarkImageOn;
  163. LLUIImage* mLandmarkImageOff;
  164. LLPointer<LLUIImage> mIconMaturityGeneral;
  165. LLPointer<LLUIImage> mIconMaturityAdult;
  166. LLPointer<LLUIImage> mIconMaturityModerate;
  167. std::string mAddLandmarkTooltip;
  168. std::string mEditLandmarkTooltip;
  169. // this field holds a human-readable form of the location string, it is needed to be able to compare copy-pated value and real location
  170. std::string mHumanReadableLocation;
  171. bool isHumanReadableLocationVisible;
  172. std::string mMaturityHelpTopic;
  173. };
  174. #endif