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

/indra/llui/llviewborder.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 110 lines | 65 code | 19 blank | 26 comment | 0 complexity | 8b8f20eaf10a834594829d55f5f7610f MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llviewborder.h
  3. * @brief A customizable decorative border. Does not interact with mouse events.
  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_LLVIEWBORDER_H
  27. #define LL_LLVIEWBORDER_H
  28. #include "llview.h"
  29. class LLViewBorder : public LLView
  30. {
  31. public:
  32. typedef enum e_bevel { BEVEL_IN, BEVEL_OUT, BEVEL_BRIGHT, BEVEL_NONE } EBevel ;
  33. typedef enum e_style { STYLE_LINE, STYLE_TEXTURE } EStyle;
  34. struct BevelValues
  35. : public LLInitParam::TypeValuesHelper<LLViewBorder::EBevel, BevelValues>
  36. {
  37. static void declareValues();
  38. };
  39. struct StyleValues
  40. : public LLInitParam::TypeValuesHelper<LLViewBorder::EStyle, StyleValues>
  41. {
  42. static void declareValues();
  43. };
  44. struct Params : public LLInitParam::Block<Params, LLView::Params>
  45. {
  46. Optional<EBevel, BevelValues> bevel_style;
  47. Optional<EStyle, StyleValues> render_style;
  48. Optional<S32> border_thickness;
  49. Optional<LLUIColor> highlight_light_color,
  50. highlight_dark_color,
  51. shadow_light_color,
  52. shadow_dark_color;
  53. Params();
  54. };
  55. protected:
  56. LLViewBorder(const Params&);
  57. friend class LLUICtrlFactory;
  58. public:
  59. virtual void setValue(const LLSD& val) { setRect(LLRect(val)); }
  60. virtual BOOL isCtrl() const { return FALSE; }
  61. // llview functionality
  62. virtual void draw();
  63. static BOOL getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style);
  64. void setBorderWidth(S32 width) { mBorderWidth = width; }
  65. S32 getBorderWidth() const { return mBorderWidth; }
  66. void setBevel(EBevel bevel) { mBevel = bevel; }
  67. EBevel getBevel() const { return mBevel; }
  68. void setColors( const LLColor4& shadow_dark, const LLColor4& highlight_light );
  69. void setColorsExtended( const LLColor4& shadow_light, const LLColor4& shadow_dark,
  70. const LLColor4& highlight_light, const LLColor4& highlight_dark );
  71. void setTexture( const class LLUUID &image_id );
  72. LLColor4 getHighlightLight() {return mHighlightLight.get();}
  73. LLColor4 getShadowDark() {return mHighlightDark.get();}
  74. EStyle getStyle() const { return mStyle; }
  75. void setKeyboardFocusHighlight( BOOL b ) { mHasKeyboardFocus = b; }
  76. private:
  77. void drawOnePixelLines();
  78. void drawTwoPixelLines();
  79. void drawTextures();
  80. EBevel mBevel;
  81. EStyle mStyle;
  82. LLUIColor mHighlightLight;
  83. LLUIColor mHighlightDark;
  84. LLUIColor mShadowLight;
  85. LLUIColor mShadowDark;
  86. LLUIColor mBackgroundColor;
  87. S32 mBorderWidth;
  88. LLPointer<LLUIImage> mTexture;
  89. BOOL mHasKeyboardFocus;
  90. };
  91. #endif // LL_LLVIEWBORDER_H