PageRenderTime 50ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llui/llresizebar.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 91 lines | 52 code | 13 blank | 26 comment | 1 complexity | c7548be047552904fef8545d1b068666 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llresizebar.h
  3. * @brief LLResizeBar base 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_RESIZEBAR_H
  27. #define LL_RESIZEBAR_H
  28. #include "llview.h"
  29. #include "llcoord.h"
  30. class LLResizeBar : public LLView
  31. {
  32. public:
  33. enum Side { LEFT, TOP, RIGHT, BOTTOM };
  34. struct Params : public LLInitParam::Block<Params, LLView::Params>
  35. {
  36. Mandatory<LLView*> resizing_view;
  37. Mandatory<Side> side;
  38. Optional<S32> min_size;
  39. Optional<S32> max_size;
  40. Optional<bool> snapping_enabled;
  41. Optional<bool> allow_double_click_snapping;
  42. Params()
  43. : max_size("max_size", S32_MAX),
  44. snapping_enabled("snapping_enabled", true),
  45. resizing_view("resizing_view"),
  46. side("side"),
  47. allow_double_click_snapping("allow_double_click_snapping", true)
  48. {
  49. name = "resize_bar";
  50. }
  51. };
  52. protected:
  53. LLResizeBar(const LLResizeBar::Params& p);
  54. friend class LLUICtrlFactory;
  55. public:
  56. // virtual void draw(); No appearance
  57. virtual BOOL handleHover(S32 x, S32 y, MASK mask);
  58. virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
  59. virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
  60. virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
  61. void setResizeLimits( S32 min_size, S32 max_size ) { mMinSize = min_size; mMaxSize = max_size; }
  62. void setEnableSnapping(BOOL enable) { mSnappingEnabled = enable; }
  63. void setAllowDoubleClickSnapping(BOOL allow) { mAllowDoubleClickSnapping = allow; }
  64. bool canResize() { return getEnabled() && mMaxSize > mMinSize; }
  65. private:
  66. S32 mDragLastScreenX;
  67. S32 mDragLastScreenY;
  68. S32 mLastMouseScreenX;
  69. S32 mLastMouseScreenY;
  70. LLCoordGL mLastMouseDir;
  71. S32 mMinSize;
  72. S32 mMaxSize;
  73. const Side mSide;
  74. BOOL mSnappingEnabled;
  75. BOOL mAllowDoubleClickSnapping;
  76. LLView* mResizingView;
  77. };
  78. #endif // LL_RESIZEBAR_H