[MSPAINT] Make selection window-less (#5208)
[reactos.git] / base / applications / mspaint / selectionmodel.h
1 /*
2 * PROJECT: PAINT for ReactOS
3 * LICENSE: LGPL
4 * FILE: base/applications/mspaint/selectionmodel.h
5 * PURPOSE: Keep track of selection parameters, notify listeners
6 * PROGRAMMERS: Benedikt Freisen
7 * Katayama Hirofumi MZ
8 */
9
10 #pragma once
11
12 class SelectionModel
13 {
14 private:
15 HBITMAP m_hbmColor;
16 HBITMAP m_hbmMask;
17 POINT *m_ptStack;
18 int m_iPtSP;
19
20 public:
21 BOOL m_bShow;
22 CRect m_rc; // in image pixel coordinates
23 POINT m_ptHit; // in image pixel coordinates
24
25 SelectionModel();
26 ~SelectionModel();
27
28 void ResetPtStack();
29 void PushToPtStack(POINT pt);
30 int PtStackSize() const;
31 void SetRectFromPoints(const POINT& ptFrom, const POINT& ptTo);
32 void BuildMaskFromPtStack();
33
34 BOOL TakeOff();
35 void Landing();
36
37 HBITMAP GetBitmap() const;
38 void GetSelectionContents(HDC hDCImage);
39 void DrawFramePoly(HDC hDCImage);
40 void DrawBackgroundPoly(HDC hDCImage, COLORREF crBg);
41 void DrawBackgroundRect(HDC hDCImage, COLORREF crBg);
42 void DrawSelection(HDC hDCImage, LPCRECT prc, COLORREF crBg = 0, BOOL bBgTransparent = FALSE);
43 void InsertFromHBITMAP(HBITMAP hBm, INT x = 0, INT y = 0);
44
45 // operation
46 void FlipHorizontally();
47 void FlipVertically();
48 void RotateNTimes90Degrees(int iN);
49 void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX, int nSkewDegY);
50
51 void CancelSelection();
52 void NotifyRefreshNeeded();
53 void Dragging(CANVAS_HITTEST hit, POINT pt);
54 void ClearMask();
55 void ClearColor();
56
57 private:
58 SelectionModel(const SelectionModel&);
59 SelectionModel& operator=(const SelectionModel&);
60
61 void ShiftPtStack(BOOL bPlus);
62 };