ReactOS  0.4.12-dev-18-gf469aca
lrgcell.c File Reference
#include "precomp.h"
Include dependency graph for lrgcell.c:

Go to the source code of this file.

Functions

static HFONT SetLrgFont (PMAP infoPtr)
 
LRESULT CALLBACK LrgCellWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Function Documentation

◆ LrgCellWndProc()

LRESULT CALLBACK LrgCellWndProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 68 of file lrgcell.c.

Referenced by RegisterMapClasses().

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 
93  SetWindowLongPtrW(hwnd,
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 
121  hdc = BeginPaint(hwnd,
122  &ps);
123 
124  Rectangle(hdc,
125  0,
126  0,
127  cxClient,
128  cyClient);
129 
130  hOldFont = SelectObject(hdc, hFont);
131 
132  DrawTextW(hdc,
133  &infoPtr->pActiveCell->ch,
134  1,
135  &rc,
137 
138  SelectObject(hdc, hOldFont);
139 
140  EndPaint(hwnd,
141  &ps);
142 
143  UpdateStatusBar(infoPtr->pActiveCell->ch);
144  break;
145  }
146 
147  case WM_DESTROY:
148  {
149  DeleteObject(hFont);
150 
151  break;
152  }
153 
154  default:
155  {
156 HandleDefaultMessage:
157  Ret = DefWindowProcW(hwnd,
158  uMsg,
159  wParam,
160  lParam);
161  break;
162  }
163  }
164 
165  return Ret;
166 }
#define HDC
Definition: msvc.h:22
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
struct _MAP * PMAP
LONG top
Definition: windef.h:297
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define GetWindowLongPtrW
Definition: winuser.h:4698
LONG left
Definition: windef.h:296
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
LONG right
Definition: windef.h:298
int32_t INT
Definition: typedefs.h:56
WPARAM wParam
Definition: combotst.c:138
HFONT hFont
Definition: main.c:53
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Definition: precomp.h:38
PCELL pActiveCell
Definition: precomp.h:46
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define GWLP_USERDATA
Definition: treelist.c:63
HDC hdc
Definition: msvc.h:53
smooth NULL
Definition: ftsmooth.c:416
#define DT_VCENTER
Definition: winuser.h:543
#define WM_DESTROY
Definition: winuser.h:1591
#define WM_SIZE
Definition: winuser.h:1593
#define WM_PAINT
Definition: winuser.h:1602
WCHAR ch
Definition: precomp.h:35
#define DT_SINGLELINE
Definition: winuser.h:540
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
VOID UpdateStatusBar(WCHAR wch)
Definition: charmap.c:262
#define WM_CREATE
Definition: winuser.h:1590
#define HIWORD(l)
Definition: typedefs.h:246
static HFONT SetLrgFont(PMAP infoPtr)
Definition: lrgcell.c:14
LONG bottom
Definition: windef.h:299
#define DT_CENTER
Definition: winuser.h:527
#define SetWindowLongPtrW
Definition: winuser.h:5215
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17

◆ SetLrgFont()

static HFONT SetLrgFont ( PMAP  infoPtr)
static

Definition at line 14 of file lrgcell.c.

Referenced by LrgCellWndProc().

15 {
16  LOGFONTW lf;
17  HFONT hFont = NULL;
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,
37  WM_GETTEXT,
38  Len + 1,
39  (LPARAM)lpFontName);
40 
41  ZeroMemory(&lf,
42  sizeof(lf));
43 
44  hdc = GetDC(infoPtr->hLrgWnd);
45  lf.lfHeight = GetDeviceCaps(hdc,
46  LOGPIXELSY) / 2;
47  ReleaseDC(infoPtr->hLrgWnd,
48  hdc);
49 
52  lpFontName,
53  sizeof(lf.lfFaceName) / sizeof(lf.lfFaceName[0]));
54 
55  hFont = CreateFontIndirectW(&lf);
56 
58  0,
59  lpFontName);
60  }
61  }
62 
63  return hFont;
64 }
#define HDC
Definition: msvc.h:22
HWND hParent
Definition: precomp.h:41
HDC WINAPI GetDC(_In_opt_ HWND)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_GETTEXT
Definition: winuser.h:1600
LONG lfHeight
Definition: dimm.idl:59
BYTE lfCharSet
Definition: dimm.idl:67
#define ZeroMemory
Definition: winbase.h:1635
#define DEFAULT_CHARSET
Definition: wingdi.h:382
int32_t INT
Definition: typedefs.h:56
HFONT hFont
Definition: main.c:53
LONG_PTR LPARAM
Definition: windef.h:208
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC hdc
Definition: msvc.h:53
smooth NULL
Definition: ftsmooth.c:416
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define Len
Definition: deflate.h:82
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
HWND hLrgWnd
Definition: precomp.h:42
#define IDC_FONTCOMBO
Definition: resource.h:12
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
#define LOGPIXELSY
Definition: wingdi.h:717
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394