ReactOS 0.4.16-dev-117-g38f21f9
Cell.cpp
Go to the documentation of this file.
1/*
2* PROJECT: ReactOS Character Map
3* LICENSE: GPL - See COPYING in the top level directory
4* FILE: base/applications/charmap/cell.cpp
5* PURPOSE: Class for each individual cell
6* COPYRIGHT: Copyright 2015 Ged Murphy <gedmurphy@reactos.org>
7*/
8
9
10#include "precomp.h"
11#include "Cell.h"
12
13
14/* DATA *****************************************************/
15
16
17/* PUBLIC METHODS **********************************************/
18
20 _In_ HWND hParent
21 ) :
22 CCell(hParent, RECT{0})
23{
24}
25
27 _In_ HWND hParent,
28 _In_ RECT& CellCoordinates
29 ) :
30 m_hParent(hParent),
31 m_CellCoordinates(CellCoordinates),
32 m_Char(L'*'),
33 m_bHasFocus(false),
34 m_bIsLarge(false)
35{
36}
37
39{
40}
41
42bool
44{
45 // Check if this cell is in our paint region
46 BOOL NeedsPaint; RECT rect;
47 NeedsPaint = IntersectRect(&rect,
48 &PaintStruct.rcPaint,
50 if (NeedsPaint == FALSE)
51 return false;
52
53
54
55 // Draw the cell border
56 BOOL b = Rectangle(PaintStruct.hdc,
61
62 // Calculate an internal drawing canvas for the cell
65 InflateRect(&Internal, -1, -1);
66
67 // Check if this cell has focus
68 if (m_bHasFocus)
69 {
70 // Draw the smaller cell to make it look selected
71 Rectangle(PaintStruct.hdc,
72 Internal.left,
73 Internal.top,
74 Internal.right,
75 Internal.bottom);
76 }
77
78 int Success;
79 Success = DrawTextW(PaintStruct.hdc,
80 &m_Char,
81 1,
82 &Internal,
84
85 return (Success != 0);
86}
87
88void
90 _In_ RECT& Coordinates
91 )
92{
93 m_CellCoordinates = Coordinates;
94}
Definition: Cell.h:3
bool OnPaint(_In_ PAINTSTRUCT &PaintStruct)
Definition: Cell.cpp:43
~CCell()
Definition: Cell.cpp:38
WCHAR m_Char
Definition: Cell.h:10
void SetCellCoordinates(_In_ RECT &Coordinates)
Definition: Cell.cpp:89
bool m_bHasFocus
Definition: Cell.h:8
RECT m_CellCoordinates
Definition: Cell.h:6
CCell(_In_ HWND hParent)
Definition: Cell.cpp:19
#define FALSE
Definition: types.h:117
@ Success
Definition: eventcreate.c:712
unsigned int BOOL
Definition: ntddk_ex.h:94
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
@ Internal
Definition: hwresource.cpp:137
#define _In_
Definition: ms_sal.h:308
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
#define L(x)
Definition: ntvdm.h:50
& rect
Definition: startmenu.cpp:1413
#define false
Definition: stdbool.h:37
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI CopyRect(_Out_ LPRECT, _In_ LPCRECT)
#define DT_CENTER
Definition: winuser.h:527
#define DT_SINGLELINE
Definition: winuser.h:540
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
#define DT_VCENTER
Definition: winuser.h:543
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)