Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_SVTOOLS_SOURCE_HATCHWINDOW_IPWIN_HXX
21 : #define INCLUDED_SVTOOLS_SOURCE_HATCHWINDOW_IPWIN_HXX
22 :
23 : #include <tools/gen.hxx>
24 : #include <vcl/window.hxx>
25 :
26 : /********************** SvResizeHelper ***********************************
27 : *************************************************************************/
28 : class SvResizeHelper
29 : {
30 : Size aBorder;
31 : Rectangle aOuter;
32 : short nGrab; // -1 no Grab, 0 - 7, 8 = Move, see FillHandle...
33 : Point aSelPos;
34 : bool bResizeable;
35 : public:
36 : SvResizeHelper();
37 :
38 : void SetResizeable(bool b)
39 : {
40 : bResizeable = b;
41 : }
42 0 : short GetGrab() const
43 : {
44 0 : return nGrab;
45 : }
46 3 : void SetBorderPixel(const Size & rBorderP)
47 : {
48 3 : aBorder = rBorderP;
49 3 : }
50 : const Size& GetBorderPixel() const
51 : {
52 : return aBorder;
53 : }
54 : const Rectangle& GetOuterRectPixel() const
55 : {
56 : return aOuter;
57 : }
58 2 : void SetOuterRectPixel(const Rectangle& rRect)
59 : {
60 2 : aOuter = rRect;
61 2 : }
62 : Rectangle GetInnerRectPixel() const
63 : {
64 : Rectangle aRect( aOuter );
65 : aRect.Top() += aBorder.Height();
66 : aRect.Left() += aBorder.Width();
67 : aRect.Bottom() -= aBorder.Height();
68 : aRect.Right() -= aBorder.Width();
69 : return aRect;
70 : }
71 : // Clockwise, start at upper left
72 :
73 : void FillHandleRectsPixel( Rectangle aRects[ 8 ] ) const;
74 : void FillMoveRectsPixel( Rectangle aRects[ 4 ] ) const;
75 : void Draw(vcl::RenderContext& rRenderContext);
76 : void InvalidateBorder( vcl::Window * );
77 : bool SelectBegin( vcl::Window *, const Point & rPos );
78 : short SelectMove( vcl::Window * pWin, const Point & rPos );
79 : Point GetTrackPosPixel( const Rectangle & rRect ) const;
80 : Rectangle GetTrackRectPixel( const Point & rTrackPos ) const;
81 : void ValidateRect( Rectangle & rValidate ) const;
82 : bool SelectRelease( vcl::Window *, const Point & rPos, Rectangle & rOutPosSize );
83 : void Release( vcl::Window * pWin );
84 : };
85 :
86 : /********************** SvResizeWindow ***********************************
87 : *************************************************************************/
88 : class VCLXHatchWindow;
89 2 : class SvResizeWindow : public vcl::Window
90 : {
91 : Pointer m_aOldPointer;
92 : short m_nMoveGrab; // last pointer type
93 : SvResizeHelper m_aResizer;
94 : bool m_bActive;
95 :
96 : VCLXHatchWindow* m_pWrapper;
97 : public:
98 : SvResizeWindow( vcl::Window* pParent, VCLXHatchWindow* pWrapper );
99 :
100 : void SetHatchBorderPixel( const Size & rSize );
101 :
102 : void SelectMouse( const Point & rPos );
103 : virtual void MouseButtonUp( const MouseEvent & rEvt ) SAL_OVERRIDE;
104 : virtual void MouseMove( const MouseEvent & rEvt ) SAL_OVERRIDE;
105 : virtual void MouseButtonDown( const MouseEvent & rEvt ) SAL_OVERRIDE;
106 : virtual void KeyInput( const KeyEvent & rEvt ) SAL_OVERRIDE;
107 : virtual void Resize() SAL_OVERRIDE;
108 : virtual void Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle & ) SAL_OVERRIDE;
109 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
110 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
111 :
112 : void QueryObjAreaPixel( Rectangle & );
113 : void RequestObjAreaPixel( const Rectangle & );
114 : };
115 :
116 : #endif // INCLUDED_SVTOOLS_SOURCE_HATCHWINDOW_IPWIN_HXX
117 :
118 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|