1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #if !defined WIN32_LEAN_AND_MEAN
23 # define WIN32_LEAN_AND_MEAN
28 ** CWindow: Our basic window class.
38 void TransformRect(LPRECT rect
,HWND pWnd
,HWND pWndClipTo
);
41 LRESULT APIENTRY
HatchWndProc(
43 , WPARAM wParam
, LPARAM lParam
);
46 BOOL
HatchWindowRegister(HINSTANCE hInst
);
51 HINSTANCE m_hInst
; //Task instance
52 HWND m_hWnd
; //Window handle of the window
55 //Standard Class Functions
59 //Just returns members. No need to modify
69 Tracker(LPCRECT lpSrcRect
, UINT nStyle
);
74 solidLine
= 1, dottedLine
= 2, hatchedBorder
= 4,
75 resizeInside
= 8, resizeOutside
= 16, hatchInside
= 32,
82 hitTopLeft
= 0, hitTopRight
= 1,
83 hitBottomRight
= 2, hitBottomLeft
= 3,
84 hitTop
= 4, hitRight
= 5, hitBottom
= 6,
85 hitLeft
= 7, hitMiddle
= 8
89 UINT m_nStyle
; // current state
90 RECT m_rect
; // current position (always in pixels)
91 SIZE m_sizeMin
; // minimum X and Y size during track operation
92 int m_nHandleSize
; // size of resize handles (default from WIN.INI)
95 void Draw(HDC hDC
) const;
96 void GetTrueRect(LPRECT lpTrueRect
) const;
97 BOOL
SetCursor(HWND hWnd
,UINT nHitTest
) const;
98 BOOL
Track(HWND hWnd
,POINT point
,BOOL bAllowInvert
= FALSE
,
99 HWND hWndClipTo
= nullptr);
100 // BOOL TrackRubberBand(HWND hWnd,POINT point,BOOL bAllowInvert = TRUE);
101 int HitTest(POINT point
) const;
102 int NormalizeHit(int nHandle
) const;
105 virtual void DrawTrackerRect(
106 LPRECT lpRect
, HWND hWndClipTo
,
108 virtual void AdjustRect(int nHandle
, LPRECT lpRect
);
109 virtual void OnChangedRect(const RECT
& rectOld
);
110 virtual UINT
GetHandleMask() const;
117 BOOL m_bAllowInvert
; // flag passed to Track or TrackRubberBand
120 BOOL m_bErase
; // TRUE if DrawTrackerRect is called for erasing
121 BOOL m_bFinalErase
; // TRUE if DragTrackerRect called for final erase
123 // implementation helpers
124 int HitTestHandles(POINT point
) const;
125 void GetHandleRect(int nHandle
,RECT
* pHandleRect
) const;
126 void GetModifyPointers(
127 int nHandle
,int**ppx
, int**ppy
, int* px
, int*py
);
128 virtual int GetHandleSize(LPRECT lpRect
= nullptr) const;
129 BOOL
TrackHandle(int nHandle
,HWND hWnd
,POINT point
,HWND hWndClipTo
);
134 //Width of the border
135 #define HATCHWIN_BORDERWIDTHDEFAULT 4
138 class CHatchWin
: public CWindow
140 friend LRESULT APIENTRY
HatchWndProc(HWND
, UINT
, WPARAM
, LPARAM
);
144 const DocumentHolder
* m_pDocHolder
;
152 HWND m_hWndAssociate
;
157 CHatchWin(HINSTANCE
,const DocumentHolder
*);
160 BOOL
Init(HWND
, WORD
, HWND
);
162 HWND
HwndAssociateSet(HWND
);
163 HWND
HwndAssociateGet();
165 void RectsSet(LPRECT
, LPRECT
);
167 void ShowHatch(BOOL
);
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */