PageRenderTime 50ms CodeModel.GetById 33ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llui/lltextbox.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 84 lines | 39 code | 18 blank | 27 comment | 0 complexity | 2039764b2ddf069c168ce498cda9e8d7 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file lltextbox.h
  3. * @brief A single text item display
  4. *
  5. * $LicenseInfo:firstyear=2001&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_LLTEXTBOX_H
  27. #define LL_LLTEXTBOX_H
  28. #include "lluistring.h"
  29. #include "lltextbase.h"
  30. class LLTextBox :
  31. public LLTextBase
  32. {
  33. public:
  34. // *TODO: Add callback to Params
  35. typedef boost::function<void (void)> callback_t;
  36. struct Params : public LLInitParam::Block<Params, LLTextBase::Params>
  37. {};
  38. protected:
  39. LLTextBox(const Params&);
  40. friend class LLUICtrlFactory;
  41. public:
  42. virtual ~LLTextBox();
  43. /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
  44. /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
  45. /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
  46. /*virtual*/ void setEnabled(BOOL enabled);
  47. /*virtual*/ void setText( const LLStringExplicit& text, const LLStyle::Params& input_params = LLStyle::Params() );
  48. void setRightAlign() { mHAlign = LLFontGL::RIGHT; }
  49. void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; }
  50. void setClickedCallback( boost::function<void (void*)> cb, void* userdata = NULL );
  51. void reshapeToFitText();
  52. S32 getTextPixelWidth();
  53. S32 getTextPixelHeight();
  54. /*virtual*/ LLSD getValue() const;
  55. /*virtual*/ BOOL setTextArg( const std::string& key, const LLStringExplicit& text );
  56. protected:
  57. void onUrlLabelUpdated(const std::string &url, const std::string &label);
  58. LLUIString mText;
  59. callback_t mClickedCallback;
  60. };
  61. // Build time optimization, generate once in .cpp file
  62. #ifndef LLTEXTBOX_CPP
  63. extern template class LLTextBox* LLView::getChild<class LLTextBox>(
  64. const std::string& name, BOOL recurse) const;
  65. #endif
  66. #endif