1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef nsResizerFrame_h___
6 #define nsResizerFrame_h___
8 #include "mozilla/Attributes.h"
9 #include "mozilla/EventForwards.h"
10 #include "nsTitleBarFrame.h"
13 class nsMenuPopupFrame
;
15 class nsResizerFrame
: public nsTitleBarFrame
24 NS_DECL_FRAMEARENA_HELPERS
26 friend nsIFrame
* NS_NewResizerFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
);
28 explicit nsResizerFrame(nsStyleContext
* aContext
);
30 virtual nsresult
HandleEvent(nsPresContext
* aPresContext
,
31 mozilla::WidgetGUIEvent
* aEvent
,
32 nsEventStatus
* aEventStatus
) MOZ_OVERRIDE
;
34 virtual void MouseClicked(nsPresContext
* aPresContext
,
35 mozilla::WidgetMouseEvent
* aEvent
) MOZ_OVERRIDE
;
38 nsIContent
* GetContentToResize(nsIPresShell
* aPresShell
, nsIBaseWindow
** aWindow
);
40 Direction
GetDirection();
43 * Adjust the window position and size in a direction according to the mouse
44 * movement and the resizer direction. The minimum and maximum size is used
45 * to constrain the size.
47 * @param aPos left or top position
48 * @param aSize width or height
49 * @param aMinSize minimum width or height
50 * @param aMacSize maximum width or height
51 * @param aMovement the amount the mouse was moved
52 * @param aResizerDirection resizer direction returned by GetDirection
54 static void AdjustDimensions(int32_t* aPos
, int32_t* aSize
,
55 int32_t aMinSize
, int32_t aMaxSize
,
56 int32_t aMovement
, int8_t aResizerDirection
);
59 nsString width
, height
;
61 static void SizeInfoDtorFunc(void *aObject
, nsIAtom
*aPropertyName
,
62 void *aPropertyValue
, void *aData
);
63 static void ResizeContent(nsIContent
* aContent
, const Direction
& aDirection
,
64 const SizeInfo
& aSizeInfo
, SizeInfo
* aOriginalSizeInfo
);
65 static void MaybePersistOriginalSize(nsIContent
* aContent
, const SizeInfo
& aSizeInfo
);
66 static void RestoreOriginalSize(nsIContent
* aContent
);
69 nsIntRect mMouseDownRect
;
70 nsIntPoint mMouseDownPoint
;
71 }; // class nsResizerFrame
73 #endif /* nsResizerFrame_h___ */