PageRenderTime 160ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llui/llstyle.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 104 lines | 63 code | 16 blank | 25 comment | 0 complexity | 815abd3ea33a8dce5a81ab3e62e6ebf1 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llstyle.cpp
  3. * @brief Text style class
  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. #include "linden_common.h"
  27. #include "llstyle.h"
  28. #include "llfontgl.h"
  29. #include "llstring.h"
  30. #include "llui.h"
  31. LLStyle::Params::Params()
  32. : visible("visible", true),
  33. drop_shadow("drop_shadow", LLFontGL::NO_SHADOW),
  34. color("color", LLColor4::black),
  35. readonly_color("readonly_color", LLColor4::black),
  36. selected_color("selected_color", LLColor4::black),
  37. font("font", LLFontGL::getFontMonospace()),
  38. image("image"),
  39. link_href("href"),
  40. is_link("is_link")
  41. {}
  42. LLStyle::LLStyle(const LLStyle::Params& p)
  43. : mVisible(p.visible),
  44. mColor(p.color),
  45. mReadOnlyColor(p.readonly_color),
  46. mSelectedColor(p.selected_color),
  47. mFont(p.font()),
  48. mLink(p.link_href),
  49. mIsLink(p.is_link.isProvided() ? p.is_link : !p.link_href().empty()),
  50. mDropShadow(p.drop_shadow),
  51. mImagep(p.image())
  52. {}
  53. void LLStyle::setFont(const LLFontGL* font)
  54. {
  55. mFont = font;
  56. }
  57. const LLFontGL* LLStyle::getFont() const
  58. {
  59. return mFont;
  60. }
  61. void LLStyle::setLinkHREF(const std::string& href)
  62. {
  63. mLink = href;
  64. }
  65. BOOL LLStyle::isLink() const
  66. {
  67. return mIsLink;
  68. }
  69. BOOL LLStyle::isVisible() const
  70. {
  71. return mVisible;
  72. }
  73. void LLStyle::setVisible(BOOL is_visible)
  74. {
  75. mVisible = is_visible;
  76. }
  77. LLPointer<LLUIImage> LLStyle::getImage() const
  78. {
  79. return mImagep;
  80. }
  81. void LLStyle::setImage(const LLUUID& src)
  82. {
  83. mImagep = LLUI::getUIImageByID(src);
  84. }
  85. void LLStyle::setImage(const std::string& name)
  86. {
  87. mImagep = LLUI::getUIImage(name);
  88. }