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 */ 8 9 #pragma once 10 11 /* DEFINES **********************************************************/ 12 13 #define ACTION_MOVE 0 14 #define ACTION_RESIZE_TOP_LEFT 1 15 #define ACTION_RESIZE_TOP 2 16 #define ACTION_RESIZE_TOP_RIGHT 3 17 #define ACTION_RESIZE_LEFT 4 18 #define ACTION_RESIZE_RIGHT 5 19 #define ACTION_RESIZE_BOTTOM_LEFT 6 20 #define ACTION_RESIZE_BOTTOM 7 21 #define ACTION_RESIZE_BOTTOM_RIGHT 8 22 23 /* CLASSES **********************************************************/ 24 25 class SelectionModel 26 { 27 private: 28 HDC m_hDC; 29 RECT m_rcSrc; 30 RECT m_rcDest; 31 HBITMAP m_hBm; 32 HBITMAP m_hMask; 33 POINT *m_ptStack; 34 int m_iPtSP; 35 36 // void NotifySelectionChanging(); 37 // void NotifySelectionChanged(); 38 void NotifyRefreshNeeded(); 39 40 public: 41 SelectionModel(); 42 void ResetPtStack(); 43 void PushToPtStack(LONG x, LONG y); 44 void CalculateBoundingBoxAndContents(HDC hDCImage); 45 void CalculateContents(HDC hDCImage); 46 void DrawBackgroundPoly(HDC hDCImage, COLORREF crBg); 47 void DrawBackgroundRect(HDC hDCImage, COLORREF crBg); 48 void DrawSelection(HDC hDCImage, COLORREF crBg = 0, BOOL bBgTransparent = FALSE); 49 void DrawSelectionStretched(HDC hDCImage); 50 void ScaleContentsToFit(); 51 void InsertFromHBITMAP(HBITMAP hBm); 52 void FlipHorizontally(); 53 void FlipVertically(); 54 void RotateNTimes90Degrees(int iN); 55 HBITMAP GetBitmap(); 56 int PtStackSize(); 57 void DrawFramePoly(HDC hDCImage); 58 void SetSrcAndDestRectFromPoints(POINT& ptFrom, POINT& ptTo); 59 void SetSrcRectSizeToZero(); 60 BOOL IsSrcRectSizeNonzero(); 61 void ModifyDestRect(POINT& ptDelta, int iAction); 62 LONG GetDestRectWidth(); 63 LONG GetDestRectHeight(); 64 LONG GetDestRectLeft(); 65 LONG GetDestRectTop(); 66 void DrawTextToolText(HDC hDCImage, COLORREF crFg, COLORREF crBg, BOOL bBgTransparent = FALSE); 67 }; 68