ReactOS 0.4.15-dev-8119-g4fb2fdb
sizebox.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

BOOL setCursorOnSizeBox (HITTEST hit)
 
BOOL getSizeBoxRect (LPRECT prc, HITTEST hit, LPCRECT prcBase)
 
HITTEST getSizeBoxHitTest (POINT pt, LPCRECT prcBase)
 
VOID drawSizeBoxes (HDC hdc, LPCRECT prcBase, BOOL bDrawFrame=FALSE, LPCRECT prcPaint=NULL)
 

Function Documentation

◆ drawSizeBoxes()

VOID drawSizeBoxes ( HDC  hdc,
LPCRECT  prcBase,
BOOL  bDrawFrame = FALSE,
LPCRECT  prcPaint = NULL 
)

Definition at line 103 of file sizebox.cpp.

104{
105 CRect rc, rcIntersect;
106
107 if (prcPaint && !::IntersectRect(&rcIntersect, prcPaint, prcBase))
108 return;
109
110 if (bDrawFrame)
111 {
112 rc = *prcBase;
113 rc.InflateRect(-GRIP_SIZE / 2, -GRIP_SIZE / 2);
114
115 LOGBRUSH logBrush = { BS_HOLLOW, 0, 0 };
116 COLORREF rgbHighlight = ::GetSysColor(COLOR_HIGHLIGHT);
117 HGDIOBJ oldPen = ::SelectObject(hdc, ::CreatePen(PS_DOT, 1, rgbHighlight));
118 HGDIOBJ oldBrush = ::SelectObject(hdc, ::CreateBrushIndirect(&logBrush));
119 ::Rectangle(hdc, rc.left, rc.top, rc.right, rc.bottom);
122 }
123
124 for (INT i = HIT_UPPER_LEFT; i <= HIT_LOWER_RIGHT; ++i)
125 {
126 getSizeBoxRect(&rc, (HITTEST)i, prcBase);
127 if (!prcPaint || ::IntersectRect(&rcIntersect, &rc, prcPaint))
128 ::FillRect(hdc, &rc, (HBRUSH)(COLOR_HIGHLIGHT + 1));
129 }
130}
#define GRIP_SIZE
Definition: precomp.h:43
HITTEST
Definition: precomp.h:55
@ HIT_LOWER_RIGHT
Definition: precomp.h:64
@ HIT_UPPER_LEFT
Definition: precomp.h:57
void InflateRect(int x, int y) noexcept
Definition: atltypes.h:323
pKey DeleteObject()
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HDC hdc
Definition: main.c:9
BOOL getSizeBoxRect(LPRECT prc, HITTEST hit, LPCRECT prcBase)
Definition: sizebox.cpp:30
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int32_t INT
Definition: typedefs.h:58
DWORD COLORREF
Definition: windef.h:300
HBRUSH WINAPI CreateBrushIndirect(_In_ const LOGBRUSH *plb)
#define PS_DOT
Definition: wingdi.h:588
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define BS_HOLLOW
Definition: wingdi.h:1088
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
DWORD WINAPI GetSysColor(_In_ int)
#define COLOR_HIGHLIGHT
Definition: winuser.h:926
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)

Referenced by CCanvasWindow::DoDraw(), SelectionModel::drawFrameOnCanvas(), and CTextEditWindow::DrawGrip().

◆ getSizeBoxHitTest()

HITTEST getSizeBoxHitTest ( POINT  pt,
LPCRECT  prcBase 
)

Definition at line 80 of file sizebox.cpp.

81{
82 CRect rc;
83
84 if (!::PtInRect(prcBase, pt))
85 return HIT_NONE;
86
87 rc = *prcBase;
89 if (rc.PtInRect(pt))
90 return HIT_INNER;
91
92 for (INT i = HIT_UPPER_LEFT; i <= HIT_LOWER_RIGHT; ++i)
93 {
94 HITTEST hit = (HITTEST)i;
95 getSizeBoxRect(&rc, hit, prcBase);
96 if (rc.PtInRect(pt))
97 return hit;
98 }
99
100 return HIT_BORDER;
101}
@ HIT_NONE
Definition: precomp.h:56
@ HIT_BORDER
Definition: precomp.h:65
@ HIT_INNER
Definition: precomp.h:66
BOOL PtInRect(POINT point) const noexcept
Definition: atltypes.h:418
#define pt(x, y)
Definition: drawing.c:79
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)

Referenced by CCanvasWindow::CanvasHitTest(), CTextEditWindow::DoHitTest(), and SelectionModel::hitTest().

◆ getSizeBoxRect()

BOOL getSizeBoxRect ( LPRECT  prc,
HITTEST  hit,
LPCRECT  prcBase 
)

Definition at line 30 of file sizebox.cpp.

31{
32 switch (hit)
33 {
34 case HIT_UPPER_LEFT:
35 prc->left = prcBase->left;
36 prc->top = prcBase->top;
37 break;
39 prc->left = (prcBase->left + prcBase->right - GRIP_SIZE) / 2;
40 prc->top = prcBase->top;
41 break;
42 case HIT_UPPER_RIGHT:
43 prc->left = prcBase->right - GRIP_SIZE;
44 prc->top = prcBase->top;
45 break;
46 case HIT_MIDDLE_LEFT:
47 prc->left = prcBase->left;
48 prc->top = (prcBase->top + prcBase->bottom - GRIP_SIZE) / 2;
49 break;
51 prc->left = prcBase->right - GRIP_SIZE;
52 prc->top = (prcBase->top + prcBase->bottom - GRIP_SIZE) / 2;
53 break;
54 case HIT_LOWER_LEFT:
55 prc->left = prcBase->left;
56 prc->top = prcBase->bottom - GRIP_SIZE;
57 break;
59 prc->left = (prcBase->left + prcBase->right - GRIP_SIZE) / 2;
60 prc->top = prcBase->bottom - GRIP_SIZE;
61 break;
62 case HIT_LOWER_RIGHT:
63 prc->left = prcBase->right - GRIP_SIZE;
64 prc->top = prcBase->bottom - GRIP_SIZE;
65 break;
66 case HIT_INNER:
67 *prc = *prcBase;
69 return TRUE;
70 default:
72 return FALSE;
73 }
74
77 return TRUE;
78}
@ HIT_LOWER_CENTER
Definition: precomp.h:63
@ HIT_LOWER_LEFT
Definition: precomp.h:62
@ HIT_UPPER_CENTER
Definition: precomp.h:58
@ HIT_UPPER_RIGHT
Definition: precomp.h:59
@ HIT_MIDDLE_RIGHT
Definition: precomp.h:61
@ HIT_MIDDLE_LEFT
Definition: precomp.h:60
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
_Out_ LPRECT prc
Definition: ntgdi.h:1658
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)

Referenced by drawSizeBoxes(), and getSizeBoxHitTest().

◆ setCursorOnSizeBox()

BOOL setCursorOnSizeBox ( HITTEST  hit)

Definition at line 20 of file sizebox.cpp.

21{
22 if (HIT_UPPER_LEFT <= hit && hit <= HIT_LOWER_RIGHT)
23 {
25 return TRUE;
26 }
27 return FALSE;
28}
#define NULL
Definition: types.h:112
static LPCWSTR s_cursor_shapes[]
Definition: sizebox.cpp:11
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2136

Referenced by CCanvasWindow::OnSetCursor().