PageRenderTime 116ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llui/llstyle.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 118 lines | 74 code | 19 blank | 25 comment | 16 complexity | e624c333fe8f1f1ee5f3ef611e73b750 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llstyle.h
  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. #ifndef LL_LLSTYLE_H
  27. #define LL_LLSTYLE_H
  28. #include "v4color.h"
  29. #include "llui.h"
  30. #include "llinitparam.h"
  31. #include "lluiimage.h"
  32. class LLFontGL;
  33. class LLStyle : public LLRefCount
  34. {
  35. public:
  36. struct Params : public LLInitParam::Block<Params>
  37. {
  38. Optional<bool> visible;
  39. Optional<LLFontGL::ShadowType> drop_shadow;
  40. Optional<LLUIColor> color,
  41. readonly_color,
  42. selected_color;
  43. Optional<const LLFontGL*> font;
  44. Optional<LLUIImage*> image;
  45. Optional<std::string> link_href;
  46. Optional<bool> is_link;
  47. Params();
  48. };
  49. LLStyle(const Params& p = Params());
  50. public:
  51. const LLUIColor& getColor() const { return mColor; }
  52. void setColor(const LLUIColor &color) { mColor = color; }
  53. const LLUIColor& getReadOnlyColor() const { return mReadOnlyColor; }
  54. void setReadOnlyColor(const LLUIColor& color) { mReadOnlyColor = color; }
  55. const LLUIColor& getSelectedColor() const { return mSelectedColor; }
  56. void setSelectedColor(const LLUIColor& color) { mSelectedColor = color; }
  57. BOOL isVisible() const;
  58. void setVisible(BOOL is_visible);
  59. LLFontGL::ShadowType getShadowType() const { return mDropShadow; }
  60. void setFont(const LLFontGL* font);
  61. const LLFontGL* getFont() const;
  62. const std::string& getLinkHREF() const { return mLink; }
  63. void setLinkHREF(const std::string& href);
  64. BOOL isLink() const;
  65. LLPointer<LLUIImage> getImage() const;
  66. void setImage(const LLUUID& src);
  67. void setImage(const std::string& name);
  68. BOOL isImage() const { return mImagep.notNull(); }
  69. bool operator==(const LLStyle &rhs) const
  70. {
  71. return
  72. mVisible == rhs.mVisible
  73. && mColor == rhs.mColor
  74. && mReadOnlyColor == rhs.mReadOnlyColor
  75. && mSelectedColor == rhs.mSelectedColor
  76. && mFont == rhs.mFont
  77. && mLink == rhs.mLink
  78. && mImagep == rhs.mImagep
  79. && mDropShadow == rhs.mDropShadow;
  80. }
  81. bool operator!=(const LLStyle& rhs) const { return !(*this == rhs); }
  82. public:
  83. LLFontGL::ShadowType mDropShadow;
  84. protected:
  85. ~LLStyle() { }
  86. private:
  87. BOOL mVisible;
  88. LLUIColor mColor;
  89. LLUIColor mReadOnlyColor;
  90. LLUIColor mSelectedColor;
  91. std::string mFontName;
  92. const LLFontGL* mFont;
  93. std::string mLink;
  94. bool mIsLink;
  95. LLPointer<LLUIImage> mImagep;
  96. };
  97. typedef LLPointer<LLStyle> LLStyleSP;
  98. typedef LLPointer<const LLStyle> LLStyleConstSP;
  99. #endif // LL_LLSTYLE_H