mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 09:03:25 +00:00
* Create a branch for USB experiments.
svn path=/branches/usb-experiments/; revision=72629
This commit is contained in:
parent
28d8ba0d3e
commit
0ee830d7a4
23049 changed files with 0 additions and 1313991 deletions
94
base/applications/charmap_new/Cell.cpp
Normal file
94
base/applications/charmap_new/Cell.cpp
Normal file
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* PROJECT: ReactOS Character Map
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: base/applications/charmap/cell.cpp
|
||||
* PURPOSE: Class for each individual cell
|
||||
* COPYRIGHT: Copyright 2015 Ged Murphy <gedmurphy@reactos.org>
|
||||
*/
|
||||
|
||||
|
||||
#include "precomp.h"
|
||||
#include "Cell.h"
|
||||
|
||||
|
||||
/* DATA *****************************************************/
|
||||
|
||||
|
||||
/* PUBLIC METHODS **********************************************/
|
||||
|
||||
CCell::CCell(
|
||||
_In_ HWND hParent
|
||||
) :
|
||||
CCell(hParent, RECT{0})
|
||||
{
|
||||
}
|
||||
|
||||
CCell::CCell(
|
||||
_In_ HWND hParent,
|
||||
_In_ RECT& CellCoordinates
|
||||
) :
|
||||
m_hParent(hParent),
|
||||
m_CellCoordinates(CellCoordinates),
|
||||
m_Char(L'*'),
|
||||
m_bHasFocus(false),
|
||||
m_bIsLarge(false)
|
||||
{
|
||||
}
|
||||
|
||||
CCell::~CCell()
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
CCell::OnPaint(_In_ PAINTSTRUCT &PaintStruct)
|
||||
{
|
||||
// Check if this cell is in our paint region
|
||||
BOOL NeedsPaint; RECT rect;
|
||||
NeedsPaint = IntersectRect(&rect,
|
||||
&PaintStruct.rcPaint,
|
||||
&m_CellCoordinates);
|
||||
if (NeedsPaint == FALSE)
|
||||
return false;
|
||||
|
||||
|
||||
|
||||
// Draw the cell border
|
||||
BOOL b = Rectangle(PaintStruct.hdc,
|
||||
m_CellCoordinates.left,
|
||||
m_CellCoordinates.top,
|
||||
m_CellCoordinates.right,
|
||||
m_CellCoordinates.bottom);
|
||||
|
||||
// Calculate an internal drawing canvas for the cell
|
||||
RECT Internal;
|
||||
CopyRect(&Internal, &m_CellCoordinates);
|
||||
InflateRect(&Internal, -1, -1);
|
||||
|
||||
// Check if this cell has focus
|
||||
if (m_bHasFocus)
|
||||
{
|
||||
// Draw the smaller cell to make it look selected
|
||||
Rectangle(PaintStruct.hdc,
|
||||
Internal.left,
|
||||
Internal.top,
|
||||
Internal.right,
|
||||
Internal.bottom);
|
||||
}
|
||||
|
||||
int Success;
|
||||
Success = DrawTextW(PaintStruct.hdc,
|
||||
&m_Char,
|
||||
1,
|
||||
&Internal,
|
||||
DT_CENTER | DT_VCENTER | DT_SINGLELINE);
|
||||
|
||||
return (Success != 0);
|
||||
}
|
||||
|
||||
void
|
||||
CCell::SetCellCoordinates(
|
||||
_In_ RECT& Coordinates
|
||||
)
|
||||
{
|
||||
m_CellCoordinates = Coordinates;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue