PageRenderTime 149ms CodeModel.GetById 48ms RepoModel.GetById 5ms app.codeStats 0ms

/indra/llui/llresizehandle.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 78 lines | 40 code | 13 blank | 25 comment | 0 complexity | 63d8c5efe476f524fc1f8807ae479db9 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llresizehandle.h
  3. * @brief LLResizeHandle 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_RESIZEHANDLE_H
  27. #define LL_RESIZEHANDLE_H
  28. #include "stdtypes.h"
  29. #include "llview.h"
  30. #include "llcoord.h"
  31. class LLResizeHandle : public LLView
  32. {
  33. public:
  34. enum ECorner { LEFT_TOP, LEFT_BOTTOM, RIGHT_TOP, RIGHT_BOTTOM };
  35. struct Params : public LLInitParam::Block<Params, LLView::Params>
  36. {
  37. Mandatory<ECorner> corner;
  38. Optional<S32> min_width;
  39. Optional<S32> min_height;
  40. Params();
  41. };
  42. protected:
  43. LLResizeHandle(const LLResizeHandle::Params&);
  44. friend class LLUICtrlFactory;
  45. public:
  46. virtual void draw();
  47. virtual BOOL handleHover(S32 x, S32 y, MASK mask);
  48. virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
  49. virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
  50. void setResizeLimits( S32 min_width, S32 min_height ) { mMinWidth = min_width; mMinHeight = min_height; }
  51. private:
  52. BOOL pointInHandle( S32 x, S32 y );
  53. S32 mDragLastScreenX;
  54. S32 mDragLastScreenY;
  55. S32 mLastMouseScreenX;
  56. S32 mLastMouseScreenY;
  57. LLCoordGL mLastMouseDir;
  58. LLPointer<LLUIImage> mImage;
  59. S32 mMinWidth;
  60. S32 mMinHeight;
  61. const ECorner mCorner;
  62. };
  63. const S32 RESIZE_HANDLE_HEIGHT = 11;
  64. const S32 RESIZE_HANDLE_WIDTH = 11;
  65. #endif // LL_RESIZEHANDLE_H