llxyvector.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /**
  2. * @file llxyvector.h
  3. * @brief LLXYVector class declaration
  4. *
  5. * $LicenseInfo:firstyear=2018&license=viewergpl$
  6. *
  7. * Copyright (c) 2018, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_LLXYVECTOR_H
  33. #define LL_LLXYVECTOR_H
  34. #include "llcolor4.h"
  35. #include "lluictrl.h"
  36. class LLLineEditor;
  37. class LLPanel;
  38. class LLTextBox;
  39. class LLUICtrlFactory;
  40. class LLViewBorder;
  41. class LLXYVector : public LLUICtrl
  42. {
  43. protected:
  44. LOG_CLASS(LLXYVector);
  45. public:
  46. LLXYVector(const std::string& name, const LLRect& rect,
  47. void (*commit_cb)(LLUICtrl*, void*), void* userdata);
  48. // New method
  49. bool postBuild();
  50. void draw() override;
  51. void setValue(F32 x, F32 y);
  52. void setValue(const LLSD& value) override;
  53. LLSD getValue() const override;
  54. bool handleMouseDown(S32 x, S32 y, MASK mask) override;
  55. bool handleMouseUp(S32 x, S32 y, MASK mask) override;
  56. bool handleHover(S32 x, S32 y, MASK mask) override;
  57. const std::string& getTag() const override;
  58. LLXMLNodePtr getXML(bool save_children = true) const override;
  59. static LLView* fromXML(LLXMLNodePtr node, LLView* parent,
  60. LLUICtrlFactory* factory);
  61. LL_INLINE void setArrowColor(const LLColor4& c) { mArrowColor = c; }
  62. LL_INLINE void setAreaColor(const LLColor4& c) { mAreaColor = c; }
  63. LL_INLINE void setGridColor(const LLColor4& c) { mGridColor = c; }
  64. LL_INLINE void setGhostColor(const LLColor4& c) { mGhostColor = c; }
  65. private:
  66. void update();
  67. void setValueAndCommit(F32 x, F32 y);
  68. static void onEditChange(LLUICtrl*, void* userdata);
  69. private:
  70. LLPanel* mTouchArea;
  71. LLViewBorder* mBorder;
  72. LLTextBox* mXLabel;
  73. LLTextBox* mYLabel;
  74. LLLineEditor* mXEntry;
  75. LLLineEditor* mYEntry;
  76. U32 mGhostX;
  77. U32 mGhostY;
  78. F32 mValueX;
  79. F32 mValueY;
  80. F32 mMinValueX;
  81. F32 mMaxValueX;
  82. F32 mLogScaleX;
  83. F32 mIncrementX;
  84. F32 mMinValueY;
  85. F32 mMaxValueY;
  86. F32 mIncrementY;
  87. F32 mLogScaleY;
  88. LLColor4 mArrowColor;
  89. LLColor4 mAreaColor;
  90. LLColor4 mGridColor;
  91. LLColor4 mGhostColor;
  92. bool mLogarithmic;
  93. };
  94. #endif // LL_LLXYVECTOR_H