ReactOS 0.4.15-dev-7918-g2a2556c
lrgcell.c
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/lrgcell.c
5 * PURPOSE: large cell window implementation
6 * COPYRIGHT: Copyright 2007 Ged Murphy <gedmurphy@reactos.org>
7 *
8 */
9
10#include "precomp.h"
11
12static
15{
16 LOGFONTW lf;
18 HDC hdc;
19 HWND hCombo;
20 LPWSTR lpFontName;
21 INT Len;
22
23 hCombo = GetDlgItem(infoPtr->hParent,
25
26 Len = GetWindowTextLengthW(hCombo);
27
28 if (Len != 0)
29 {
30 lpFontName = HeapAlloc(GetProcessHeap(),
31 0,
32 (Len + 1) * sizeof(WCHAR));
33
34 if (lpFontName)
35 {
36 SendMessageW(hCombo,
38 Len + 1,
39 (LPARAM)lpFontName);
40
41 ZeroMemory(&lf,
42 sizeof(lf));
43
44 hdc = GetDC(infoPtr->hLrgWnd);
46 LOGPIXELSY) / 2;
47 ReleaseDC(infoPtr->hLrgWnd,
48 hdc);
49
52 lpFontName,
53 sizeof(lf.lfFaceName) / sizeof(lf.lfFaceName[0]));
54
56
58 0,
59 lpFontName);
60 }
61 }
62
63 return hFont;
64}
65
66
69 UINT uMsg,
72{
73 PMAP infoPtr;
74 LRESULT Ret = 0;
75 static INT cxClient, cyClient;
76 static RECT rc;
77 static HFONT hFont = NULL;
78
79 infoPtr = (PMAP)GetWindowLongPtrW(hwnd,
81
82 if (infoPtr == NULL && uMsg != WM_CREATE)
83 {
84 goto HandleDefaultMessage;
85 }
86
87 switch (uMsg)
88 {
89 case WM_CREATE:
90 {
91 infoPtr = (PMAP)(((LPCREATESTRUCTW)lParam)->lpCreateParams);
92
95 (LONG_PTR)infoPtr);
96
97 hFont = SetLrgFont(infoPtr);
98
99 break;
100 }
101
102 case WM_SIZE:
103 {
104 cxClient = LOWORD(lParam);
105 cyClient = HIWORD(lParam);
106
107 rc.left = 0;
108 rc.top = 0;
109 rc.right = cxClient;
110 rc.bottom = cyClient;
111
112 break;
113 }
114
115 case WM_PAINT:
116 {
117 PAINTSTRUCT ps;
118 HDC hdc;
119 HFONT hOldFont;
120
122 &ps);
123
125 0,
126 0,
127 cxClient,
128 cyClient);
129
130 hOldFont = SelectObject(hdc, hFont);
131
133 &infoPtr->pActiveCell->ch,
134 1,
135 &rc,
137
138 SelectObject(hdc, hOldFont);
139
141 &ps);
142
143 UpdateStatusBar(infoPtr->pActiveCell->ch);
144 break;
145 }
146
147 case WM_DESTROY:
148 {
150
151 break;
152 }
153
154 default:
155 {
156HandleDefaultMessage:
157 Ret = DefWindowProcW(hwnd,
158 uMsg,
159 wParam,
160 lParam);
161 break;
162 }
163 }
164
165 return Ret;
166}
struct _MAP * PMAP
#define IDC_FONTCOMBO
Definition: resource.h:12
HFONT hFont
Definition: main.c:53
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define Len
Definition: deflate.h:82
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
pKey DeleteObject()
LRESULT CALLBACK LrgCellWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: lrgcell.c:68
static HFONT SetLrgFont(PMAP infoPtr)
Definition: lrgcell.c:14
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
#define LOWORD(l)
Definition: pedump.c:82
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
void UpdateStatusBar(void)
Definition: solitaire.cpp:150
LONG lfHeight
Definition: dimm.idl:59
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
BYTE lfCharSet
Definition: dimm.idl:67
WCHAR ch
Definition: precomp.h:40
Definition: precomp.h:44
HWND hLrgWnd
Definition: precomp.h:47
HWND hParent
Definition: precomp.h:46
PCELL pActiveCell
Definition: precomp.h:51
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define GWLP_USERDATA
Definition: treelist.c:63
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
#define ZeroMemory
Definition: winbase.h:1712
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define LOGPIXELSY
Definition: wingdi.h:719
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define DEFAULT_CHARSET
Definition: wingdi.h:384
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
#define WM_PAINT
Definition: winuser.h:1620
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define GetWindowLongPtrW
Definition: winuser.h:4829
#define DT_CENTER
Definition: winuser.h:527
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_CREATE
Definition: winuser.h:1608
#define WM_SIZE
Definition: winuser.h:1611
#define DT_SINGLELINE
Definition: winuser.h:540
#define WM_GETTEXT
Definition: winuser.h:1618
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
HDC WINAPI GetDC(_In_opt_ HWND)
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define DT_VCENTER
Definition: winuser.h:543
#define WM_DESTROY
Definition: winuser.h:1609
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define SetWindowLongPtrW
Definition: winuser.h:5346
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184