PageRenderTime 22ms CodeModel.GetById 17ms app.highlight 3ms RepoModel.GetById 1ms 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
 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
27#ifndef LL_RESIZEHANDLE_H
28#define LL_RESIZEHANDLE_H
29
30#include "stdtypes.h"
31#include "llview.h"
32#include "llcoord.h"
33
34
35class LLResizeHandle : public LLView
36{
37public:
38	enum ECorner { LEFT_TOP, LEFT_BOTTOM, RIGHT_TOP, RIGHT_BOTTOM };
39
40	struct Params : public LLInitParam::Block<Params, LLView::Params>
41	{
42		Mandatory<ECorner>	corner;
43		Optional<S32>		min_width;
44		Optional<S32>		min_height;
45		Params();
46	};
47
48protected:
49	LLResizeHandle(const LLResizeHandle::Params&);
50	friend class LLUICtrlFactory;
51public:
52	virtual void	draw();
53	virtual BOOL	handleHover(S32 x, S32 y, MASK mask);
54	virtual BOOL	handleMouseDown(S32 x, S32 y, MASK mask);
55	virtual BOOL	handleMouseUp(S32 x, S32 y, MASK mask);
56
57	void			setResizeLimits( S32 min_width, S32 min_height ) { mMinWidth = min_width; mMinHeight = min_height; }
58	
59private:
60	BOOL			pointInHandle( S32 x, S32 y );
61
62	S32				mDragLastScreenX;
63	S32				mDragLastScreenY;
64	S32				mLastMouseScreenX;
65	S32				mLastMouseScreenY;
66	LLCoordGL		mLastMouseDir;
67	LLPointer<LLUIImage>	mImage;
68	S32				mMinWidth;
69	S32				mMinHeight;
70	const ECorner	mCorner;
71};
72
73const S32 RESIZE_HANDLE_HEIGHT = 11;
74const S32 RESIZE_HANDLE_WIDTH = 11;
75
76#endif  // LL_RESIZEHANDLE_H
77
78