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

/indra/llui/llf32uictrl.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 77 lines | 39 code | 11 blank | 27 comment | 0 complexity | 3257da06d8a8efcdaf6ead3b09946a64 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llf32uictrl.h
  3. * @author Nat Goodspeed
  4. * @date 2008-09-08
  5. * @brief Base class for float-valued LLUICtrl widgets
  6. *
  7. * $LicenseInfo:firstyear=2008&license=viewerlgpl$
  8. * Second Life Viewer Source Code
  9. * Copyright (C) 2010, Linden Research, Inc.
  10. *
  11. * This library is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU Lesser General Public
  13. * License as published by the Free Software Foundation;
  14. * version 2.1 of the License only.
  15. *
  16. * This library is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * Lesser General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Lesser General Public
  22. * License along with this library; if not, write to the Free Software
  23. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  24. *
  25. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  26. * $/LicenseInfo$
  27. */
  28. #if ! defined(LL_LLF32UICTRL_H)
  29. #define LL_LLF32UICTRL_H
  30. #include "lluictrl.h"
  31. class LLF32UICtrl: public LLUICtrl
  32. {
  33. public:
  34. struct Params: public LLInitParam::Block<Params, LLUICtrl::Params>
  35. {
  36. Optional<F32> min_value,
  37. max_value,
  38. increment;
  39. Params()
  40. : min_value("min_val", 0.f),
  41. max_value("max_val", 1.f),
  42. increment("increment", 0.1f)
  43. {}
  44. };
  45. protected:
  46. LLF32UICtrl(const Params& p);
  47. public:
  48. virtual F32 getValueF32() const;
  49. virtual void setValue(const LLSD& value ) { mViewModel->setValue(value); }
  50. virtual LLSD getValue() const { return LLSD(getValueF32()); }
  51. virtual void setMinValue(const LLSD& min_value) { setMinValue((F32)min_value.asReal()); }
  52. virtual void setMaxValue(const LLSD& max_value) { setMaxValue((F32)max_value.asReal()); }
  53. virtual F32 getInitialValue() const { return mInitialValue; }
  54. virtual F32 getMinValue() const { return mMinValue; }
  55. virtual F32 getMaxValue() const { return mMaxValue; }
  56. virtual F32 getIncrement() const { return mIncrement; }
  57. virtual void setMinValue(F32 min_value) { mMinValue = min_value; }
  58. virtual void setMaxValue(F32 max_value) { mMaxValue = max_value; }
  59. virtual void setIncrement(F32 increment) { mIncrement = increment;}
  60. protected:
  61. F32 mInitialValue;
  62. F32 mMinValue;
  63. F32 mMaxValue;
  64. F32 mIncrement;
  65. };
  66. #endif /* ! defined(LL_LLF32UICTRL_H) */