ReactOS 0.4.15-dev-5666-gc548b97
CSizeboxWindow Class Reference

#include <sizebox.h>

Inheritance diagram for CSizeboxWindow:
Collaboration diagram for CSizeboxWindow:

Public Member Functions

LRESULT OnSetCursor (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnLButtonDown (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnMouseMove (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnLButtonUp (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnCaptureChanged (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnKeyDown (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 

Detailed Description

Definition at line 12 of file sizebox.h.

Member Function Documentation

◆ OnCaptureChanged()

LRESULT CSizeboxWindow::OnCaptureChanged ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 107 of file sizebox.cpp.

108{
109 resizing = FALSE;
110 return 0;
111}
#define FALSE
Definition: types.h:117
static BOOL resizing
Definition: sizebox.cpp:16

◆ OnKeyDown()

LRESULT CSizeboxWindow::OnKeyDown ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 113 of file sizebox.cpp.

114{
115 if (wParam == VK_ESCAPE)
116 {
117 if (GetCapture() == m_hWnd)
118 {
120 }
121 }
122 return 0;
123}
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define VK_ESCAPE
Definition: winuser.h:2204

◆ OnLButtonDown()

LRESULT CSizeboxWindow::OnLButtonDown ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 33 of file sizebox.cpp.

34{
35 resizing = TRUE;
38 SetCapture();
39 return 0;
40}
LPARAM lParam
Definition: combotst.c:139
#define TRUE
Definition: types.h:120
static short yOrig
Definition: sizebox.cpp:18
static short xOrig
Definition: sizebox.cpp:17
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
HWND WINAPI SetCapture(_In_ HWND hWnd)

◆ OnLButtonUp()

LRESULT CSizeboxWindow::OnLButtonUp ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 74 of file sizebox.cpp.

75{
76 if (resizing)
77 {
78 short xRel;
79 short yRel;
80 int imgXRes = imageModel.GetWidth();
81 int imgYRes = imageModel.GetHeight();
82 xRel = (GET_X_LPARAM(lParam) - xOrig) * 1000 / toolsModel.GetZoom();
83 yRel = (GET_Y_LPARAM(lParam) - yOrig) * 1000 / toolsModel.GetZoom();
84 if (m_hWnd == sizeboxLeftTop)
85 imageModel.Crop(imgXRes - xRel, imgYRes - yRel, xRel, yRel);
86 if (m_hWnd == sizeboxCenterTop.m_hWnd)
87 imageModel.Crop(imgXRes, imgYRes - yRel, 0, yRel);
88 if (m_hWnd == sizeboxRightTop.m_hWnd)
89 imageModel.Crop(imgXRes + xRel, imgYRes - yRel, 0, yRel);
90 if (m_hWnd == sizeboxLeftCenter.m_hWnd)
91 imageModel.Crop(imgXRes - xRel, imgYRes, xRel, 0);
92 if (m_hWnd == sizeboxRightCenter.m_hWnd)
93 imageModel.Crop(imgXRes + xRel, imgYRes, 0, 0);
94 if (m_hWnd == sizeboxLeftBottom.m_hWnd)
95 imageModel.Crop(imgXRes - xRel, imgYRes + yRel, xRel, 0);
96 if (m_hWnd == sizeboxCenterBottom.m_hWnd)
97 imageModel.Crop(imgXRes, imgYRes + yRel, 0, 0);
98 if (m_hWnd == sizeboxRightBottom.m_hWnd)
99 imageModel.Crop(imgXRes + xRel, imgYRes + yRel, 0, 0);
101 }
102 resizing = FALSE;
104 return 0;
105}
int GetWidth() const
Definition: history.cpp:215
void Crop(int nWidth, int nHeight, int nOffsetX=0, int nOffsetY=0)
Definition: history.cpp:131
int GetHeight() const
Definition: history.cpp:220
int GetZoom() const
Definition: toolsmodel.cpp:148
CSizeboxWindow sizeboxLeftCenter
Definition: main.cpp:76
CSizeboxWindow sizeboxRightCenter
Definition: main.cpp:77
ToolsModel toolsModel
Definition: main.cpp:18
CSizeboxWindow sizeboxRightTop
Definition: main.cpp:75
ImageModel imageModel
Definition: main.cpp:32
CSizeboxWindow sizeboxCenterTop
Definition: main.cpp:74
CSizeboxWindow sizeboxLeftTop
Definition: main.cpp:73
CSizeboxWindow sizeboxLeftBottom
Definition: main.cpp:78
CSizeboxWindow sizeboxRightBottom
Definition: main.cpp:80
CSizeboxWindow sizeboxCenterBottom
Definition: main.cpp:79
HWND hStatusBar
Definition: main.cpp:35
#define SB_SETTEXT
Definition: commctrl.h:1949
#define _T(x)
Definition: vfdio.h:22
LONG_PTR LPARAM
Definition: windef.h:208
#define SendMessage
Definition: winuser.h:5833

◆ OnMouseMove()

LRESULT CSizeboxWindow::OnMouseMove ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 42 of file sizebox.cpp.

43{
44 if (resizing)
45 {
46 CString strSize;
47 short xRel;
48 short yRel;
49 int imgXRes = imageModel.GetWidth();
50 int imgYRes = imageModel.GetHeight();
53 if (m_hWnd == sizeboxLeftTop.m_hWnd)
54 strSize.Format(_T("%d x %d"), imgXRes - xRel, imgYRes - yRel);
55 if (m_hWnd == sizeboxCenterTop.m_hWnd)
56 strSize.Format(_T("%d x %d"), imgXRes, imgYRes - yRel);
57 if (m_hWnd == sizeboxRightTop.m_hWnd)
58 strSize.Format(_T("%d x %d"), imgXRes + xRel, imgYRes - yRel);
59 if (m_hWnd == sizeboxLeftCenter.m_hWnd)
60 strSize.Format(_T("%d x %d"), imgXRes - xRel, imgYRes);
61 if (m_hWnd == sizeboxRightCenter.m_hWnd)
62 strSize.Format(_T("%d x %d"), imgXRes + xRel, imgYRes);
63 if (m_hWnd == sizeboxLeftBottom.m_hWnd)
64 strSize.Format(_T("%d x %d"), imgXRes - xRel, imgYRes + yRel);
65 if (m_hWnd == sizeboxCenterBottom.m_hWnd)
66 strSize.Format(_T("%d x %d"), imgXRes, imgYRes + yRel);
67 if (m_hWnd == sizeboxRightBottom.m_hWnd)
68 strSize.Format(_T("%d x %d"), imgXRes + xRel, imgYRes + yRel);
70 }
71 return 0;
72}
static int UnZoomed(int xy)
Definition: common.h:42
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:753
const CHAR * LPCTSTR
Definition: xmlstorage.h:193

◆ OnSetCursor()

LRESULT CSizeboxWindow::OnSetCursor ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 20 of file sizebox.cpp.

21{
22 if ((m_hWnd == sizeboxLeftTop.m_hWnd) || (m_hWnd == sizeboxRightBottom.m_hWnd))
24 if ((m_hWnd == sizeboxLeftBottom.m_hWnd) || (m_hWnd == sizeboxRightTop.m_hWnd))
26 if ((m_hWnd == sizeboxLeftCenter.m_hWnd) || (m_hWnd == sizeboxRightCenter.m_hWnd))
28 if ((m_hWnd == sizeboxCenterTop.m_hWnd) || (m_hWnd == sizeboxCenterBottom.m_hWnd))
30 return 0;
31}
#define NULL
Definition: types.h:112
#define IDC_SIZENESW
Definition: winuser.h:688
#define IDC_SIZENWSE
Definition: winuser.h:687
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define IDC_SIZENS
Definition: winuser.h:690
#define LoadCursor
Definition: winuser.h:5802
#define IDC_SIZEWE
Definition: winuser.h:689

The documentation for this class was generated from the following files: