1*01aa44aaSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*01aa44aaSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*01aa44aaSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*01aa44aaSAndrew Rist  * distributed with this work for additional information
6*01aa44aaSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*01aa44aaSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*01aa44aaSAndrew Rist  * "License"); you may not use this file except in compliance
9*01aa44aaSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*01aa44aaSAndrew Rist  *
11*01aa44aaSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*01aa44aaSAndrew Rist  *
13*01aa44aaSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*01aa44aaSAndrew Rist  * software distributed under the License is distributed on an
15*01aa44aaSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*01aa44aaSAndrew Rist  * KIND, either express or implied.  See the License for the
17*01aa44aaSAndrew Rist  * specific language governing permissions and limitations
18*01aa44aaSAndrew Rist  * under the License.
19*01aa44aaSAndrew Rist  *
20*01aa44aaSAndrew Rist  *************************************************************/
21*01aa44aaSAndrew Rist 
22*01aa44aaSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _IPWIN_HXX
25cdf0e10cSrcweir #define _IPWIN_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <tools/gen.hxx>
28cdf0e10cSrcweir #include <vcl/window.hxx>
29cdf0e10cSrcweir #include <tools/svborder.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir /********************** SvResizeHelper ***********************************
32cdf0e10cSrcweir *************************************************************************/
33cdf0e10cSrcweir class SvResizeHelper
34cdf0e10cSrcweir {
35cdf0e10cSrcweir 	Size        aBorder;
36cdf0e10cSrcweir 	Rectangle   aOuter;
37cdf0e10cSrcweir 	short       nGrab; // -1 kein Grab,  0 - 7, 8 = Move, siehe FillHandle...
38cdf0e10cSrcweir 	Point       aSelPos;
39cdf0e10cSrcweir 	sal_Bool		bResizeable;
40cdf0e10cSrcweir public:
41cdf0e10cSrcweir 				SvResizeHelper();
42cdf0e10cSrcweir 
SetResizeable(sal_Bool b)43cdf0e10cSrcweir 	void		SetResizeable( sal_Bool b ) { bResizeable = b; }
GetGrab() const44cdf0e10cSrcweir 	short       GetGrab() const { return nGrab; }
SetBorderPixel(const Size & rBorderP)45cdf0e10cSrcweir 	void        SetBorderPixel( const Size & rBorderP )
46cdf0e10cSrcweir 				{ aBorder = rBorderP; }
GetBorderPixel() const47cdf0e10cSrcweir 	const Size & GetBorderPixel() const { return aBorder; }
GetOuterRectPixel() const48cdf0e10cSrcweir 	const Rectangle & GetOuterRectPixel() const
49cdf0e10cSrcweir 				{ return aOuter; }
SetOuterRectPixel(const Rectangle & rRect)50cdf0e10cSrcweir 	void        SetOuterRectPixel( const Rectangle & rRect )
51cdf0e10cSrcweir 				{ aOuter = rRect; }
GetInnerRectPixel() const52cdf0e10cSrcweir 	Rectangle   GetInnerRectPixel() const
53cdf0e10cSrcweir 				{
54cdf0e10cSrcweir 					Rectangle aRect( aOuter );
55cdf0e10cSrcweir 					aRect.Top()    += aBorder.Height();
56cdf0e10cSrcweir 					aRect.Left()   += aBorder.Width();
57cdf0e10cSrcweir 					aRect.Bottom() -= aBorder.Height();
58cdf0e10cSrcweir 					aRect.Right()  -= aBorder.Width();
59cdf0e10cSrcweir 					return aRect;
60cdf0e10cSrcweir 				}
61cdf0e10cSrcweir 				// Im Uhrzeigersinn, beginnend bei Linksoben
62cdf0e10cSrcweir 	void        FillHandleRectsPixel( Rectangle aRects[ 8 ] ) const;
63cdf0e10cSrcweir 	void        FillMoveRectsPixel( Rectangle aRects[ 4 ] ) const;
64cdf0e10cSrcweir 	void        Draw( OutputDevice * );
65cdf0e10cSrcweir 	void        InvalidateBorder( Window * );
66cdf0e10cSrcweir 	sal_Bool        SelectBegin( Window *, const Point & rPos );
67cdf0e10cSrcweir 	short       SelectMove( Window * pWin, const Point & rPos );
68cdf0e10cSrcweir 	Point       GetTrackPosPixel( const Rectangle & rRect ) const;
69cdf0e10cSrcweir 	Rectangle	GetTrackRectPixel( const Point & rTrackPos ) const;
70cdf0e10cSrcweir 	void        ValidateRect( Rectangle & rValidate ) const;
71cdf0e10cSrcweir 	sal_Bool        SelectRelease( Window *, const Point & rPos, Rectangle & rOutPosSize );
72cdf0e10cSrcweir 	void        Release( Window * pWin );
73cdf0e10cSrcweir };
74cdf0e10cSrcweir 
75cdf0e10cSrcweir /********************** SvResizeWindow ***********************************
76cdf0e10cSrcweir *************************************************************************/
77cdf0e10cSrcweir class VCLXHatchWindow;
78cdf0e10cSrcweir class SvResizeWindow : public Window
79cdf0e10cSrcweir {
80cdf0e10cSrcweir 	Pointer         m_aOldPointer;
81cdf0e10cSrcweir 	short           m_nMoveGrab;  // Letzer Pointertyp
82cdf0e10cSrcweir 	SvResizeHelper  m_aResizer;
83cdf0e10cSrcweir     sal_Bool        m_bActive;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	VCLXHatchWindow* m_pWrapper;
86cdf0e10cSrcweir public:
87cdf0e10cSrcweir 	SvResizeWindow( Window* pParent, VCLXHatchWindow* pWrapper );
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	void    SetHatchBorderPixel( const Size & rSize );
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	void    SelectMouse( const Point & rPos );
92cdf0e10cSrcweir 	virtual void    MouseButtonUp( const MouseEvent & rEvt );
93cdf0e10cSrcweir 	virtual void    MouseMove( const MouseEvent & rEvt );
94cdf0e10cSrcweir 	virtual void    MouseButtonDown( const MouseEvent & rEvt );
95cdf0e10cSrcweir 	virtual void    KeyInput( const KeyEvent & rEvt );
96cdf0e10cSrcweir 	virtual void    Resize();
97cdf0e10cSrcweir 	virtual void    Paint( const Rectangle & );
98cdf0e10cSrcweir     virtual long    Notify( NotifyEvent& rNEvt );
99cdf0e10cSrcweir     virtual long    PreNotify( NotifyEvent& rNEvt );
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 	void	QueryObjAreaPixel( Rectangle & );
102cdf0e10cSrcweir 	void    RequestObjAreaPixel( const Rectangle & );
103cdf0e10cSrcweir };
104cdf0e10cSrcweir 
105cdf0e10cSrcweir #endif // _IPWIN_HXX
106cdf0e10cSrcweir 
107