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