ReactOS  0.4.14-dev-98-gb0d4763
CCharMapWindow Class Reference

#include <MainWindow.h>

Collaboration diagram for CCharMapWindow:

Public Member Functions

 CCharMapWindow (void)
 
 ~CCharMapWindow (void)
 
bool Create (_In_ HINSTANCE hInst, _In_ int nCmdShow)
 

Private Member Functions

bool Initialize (_In_z_ LPCTSTR lpCaption, _In_ int nCmdShow)
 
int Run ()
 
void Uninitialize (void)
 
BOOL OnCreate (_In_ HWND hwnd)
 
BOOL OnDestroy (void)
 
BOOL OnSize (void)
 
BOOL OnNotify (_In_ LPARAM lParam)
 
BOOL OnContext (_In_ LPARAM lParam)
 
BOOL OnCommand (_In_ WPARAM wParam, LPARAM lParam)
 
bool CreateStatusBar (void)
 
bool StatusBarLoadString (_In_ HWND hStatusBar, _In_ INT PartId, _In_ HINSTANCE hInstance, _In_ UINT uID)
 
void UpdateStatusBar (_In_ bool InMenuLoop)
 
bool CreateFontComboBox ()
 
bool ChangeMapFont ()
 

Static Private Member Functions

static INT_PTR CALLBACK DialogProc (_In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
 
static int CALLBACK EnumDisplayFont (ENUMLOGFONTEXW *lpelfe, NEWTEXTMETRICEXW *lpntme, DWORD FontType, LPARAM lParam)
 

Private Attributes

HWND m_hMainWnd
 
HWND m_hStatusBar
 
int m_CmdShow
 
HMODULE m_hRichEd
 
CGridViewm_GridView
 

Detailed Description

Definition at line 4 of file MainWindow.h.

Constructor & Destructor Documentation

◆ CCharMapWindow()

CCharMapWindow::CCharMapWindow ( void  )

Definition at line 23 of file MainWindow.cpp.

23  :
26  m_CmdShow(0),
27  m_hRichEd(NULL),
28  m_GridView(nullptr)
29 {
30  m_GridView = new CGridView();
31 }
HWND m_hMainWnd
Definition: MainWindow.h:6
smooth NULL
Definition: ftsmooth.c:416
HWND m_hStatusBar
Definition: MainWindow.h:7
HMODULE m_hRichEd
Definition: MainWindow.h:9
CGridView * m_GridView
Definition: MainWindow.h:11

◆ ~CCharMapWindow()

CCharMapWindow::~CCharMapWindow ( void  )

Definition at line 33 of file MainWindow.cpp.

34 {
35 }

Member Function Documentation

◆ ChangeMapFont()

bool CCharMapWindow::ChangeMapFont ( )
private

Definition at line 518 of file MainWindow.cpp.

520 {
521  HWND hCombo;
523 
524  INT Length;
525  Length = GetWindowTextLengthW(hCombo);
526  if (!Length) return false;
527 
528  CAtlStringW FontName;
529  FontName.Preallocate(Length);
530 
531  SendMessageW(hCombo,
532  WM_GETTEXT,
533  FontName.GetAllocLength(),
534  (LPARAM)FontName.GetBuffer());
535 
536  return m_GridView->SetFont(FontName);
537 }
#define WM_GETTEXT
Definition: winuser.h:1600
bool SetFont(_In_ CAtlString &FontName)
Definition: GridView.cpp:67
HWND m_hMainWnd
Definition: MainWindow.h:6
int32_t INT
Definition: typedefs.h:56
LONG_PTR LPARAM
Definition: windef.h:208
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
int GetAllocLength() const
Definition: atlsimpstr.h:351
int WINAPI GetWindowTextLengthW(_In_ HWND)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define IDC_FONTCOMBO
Definition: resource.h:12
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
CGridView * m_GridView
Definition: MainWindow.h:11

Referenced by OnCommand(), and OnCreate().

◆ Create()

bool CCharMapWindow::Create ( _In_ HINSTANCE  hInst,
_In_ int  nCmdShow 
)

Definition at line 38 of file MainWindow.cpp.

40 {
43  int Ret = 1;
44 
45  // Store the instance
47  m_CmdShow = nCmdShow;
48 
49  // Initialize common controls
50  icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
52  InitCommonControlsEx(&icex);
53 
54  // Load the application name
55  if (szAppName.LoadStringW(g_hInstance, IDS_TITLE))
56  {
57  // Initialize the main window
58  if (Initialize(szAppName, nCmdShow))
59  {
60  // Run the application
61  Ret = Run();
62 
63  // Uninitialize the main window
64  Uninitialize();
65  }
66  }
67 
68  return (Ret == 0);
69 }
HINSTANCE g_hInstance
Definition: MainWindow.cpp:18
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
#define ICC_COOL_CLASSES
Definition: commctrl.h:69
#define ICC_BAR_CLASSES
Definition: commctrl.h:60
#define IDS_TITLE
Definition: resource.h:30
void Uninitialize(void)
Definition: MainWindow.cpp:91
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
bool Initialize(_In_z_ LPCTSTR lpCaption, _In_ int nCmdShow)
Definition: MainWindow.cpp:76
TCHAR szAppName[128]
Definition: solitaire.cpp:16
HINSTANCE hInst
Definition: dxdiag.c:13

Referenced by wWinMain().

◆ CreateFontComboBox()

bool CCharMapWindow::CreateFontComboBox ( )
private

Definition at line 461 of file MainWindow.cpp.

462 {
463  HWND hCombo;
465 
466  NONCLIENTMETRICSW NonClientMetrics;
467  NonClientMetrics.cbSize = sizeof(NONCLIENTMETRICSW);
468  SystemParametersInfoW(SPI_GETNONCLIENTMETRICS,
469  sizeof(NONCLIENTMETRICSW),
470  &NonClientMetrics,
471  0);
472 
473  // Get a handle to the font
474  HFONT GuiFont;
475  GuiFont = CreateFontIndirectW(&NonClientMetrics.lfMessageFont);
476 
477  // Set the font used in the combo box
478  SendMessageW(hCombo,
479  WM_SETFONT,
480  (WPARAM)GuiFont,
481  0);
482 
483  // Set the fonts which we want to enumerate
484  LOGFONTW FontsToEnum;
485  ZeroMemory(&FontsToEnum, sizeof(LOGFONTW));
486  FontsToEnum.lfCharSet = DEFAULT_CHARSET;
487 
488  // Set the params we want to pass to the callback
489  EnumFontParams Params;
490  Params.This = this;
491  Params.hCombo = hCombo;
492 
493  // Get a DC for combo box
494  HDC hdc;
495  hdc = GetDC(hCombo);
496 
497  // Enumerate all the fonts
498  int ret;
500  &FontsToEnum,
502  (LPARAM)&Params,
503  0);
504 
505  ReleaseDC(hCombo, hdc);
506  DeleteObject(GuiFont);
507 
508  // Select the first item in the list
509  SendMessageW(hCombo,
510  CB_SETCURSEL,
511  0,
512  0);
513 
514  return (ret == 1);
515 }
HDC WINAPI GetDC(_In_opt_ HWND)
int WINAPI EnumFontFamiliesExW(_In_ HDC, _In_ PLOGFONTW, _In_ FONTENUMPROCW, _In_ LPARAM, _In_ DWORD)
BYTE lfCharSet
Definition: dimm.idl:67
static HDC
Definition: imagelist.c:92
#define ZeroMemory
Definition: winbase.h:1642
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HWND m_hMainWnd
Definition: MainWindow.h:6
UINT_PTR WPARAM
Definition: windef.h:207
#define DEFAULT_CHARSET
Definition: wingdi.h:383
CCharMapWindow * This
Definition: MainWindow.cpp:416
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
int ret
HDC hdc
Definition: main.c:9
#define CB_SETCURSEL
Definition: winuser.h:1943
static int CALLBACK EnumDisplayFont(ENUMLOGFONTEXW *lpelfe, NEWTEXTMETRICEXW *lpntme, DWORD FontType, LPARAM lParam)
Definition: MainWindow.cpp:422
#define IDC_FONTCOMBO
Definition: resource.h:12
FARPROC FONTENUMPROCW
Definition: wingdi.h:2892
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETFONT
Definition: winuser.h:1632
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)

Referenced by OnCreate().

◆ CreateStatusBar()

bool CCharMapWindow::CreateStatusBar ( void  )
private

Definition at line 122 of file MainWindow.cpp.

123 {
124  int StatWidths[] = { 110, -1 }; // widths of status bar
125  bool bRet = FALSE;
126 
127  // Create the status bar
130  NULL,
132  0, 0, 0, 0,
133  m_hMainWnd,
135  g_hInstance,
136  NULL);
137  if (m_hStatusBar)
138  {
139  // Create the sections
140  bRet = (SendMessageW(m_hStatusBar,
141  SB_SETPARTS,
142  sizeof(StatWidths) / sizeof(int),
143  (LPARAM)StatWidths) != 0);
144 
145  // Set the status bar for multiple parts output
147  }
148 
149  return bRet;
150 }
HINSTANCE g_hInstance
Definition: MainWindow.cpp:18
HWND m_hMainWnd
Definition: MainWindow.h:6
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
#define STATUSCLASSNAME
Definition: commctrl.h:1911
#define IDD_STATUSBAR
Definition: resource.h:9
#define SB_SIMPLE
Definition: commctrl.h:1930
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define SBARS_SIZEGRIP
Definition: commctrl.h:1895
HWND m_hStatusBar
Definition: MainWindow.h:7
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SB_SETPARTS
Definition: commctrl.h:1926
#define SendMessage
Definition: winuser.h:5744
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

Referenced by OnCreate().

◆ DialogProc()

INT_PTR CALLBACK CCharMapWindow::DialogProc ( _In_ HWND  hwndDlg,
_In_ UINT  uMsg,
_In_ WPARAM  wParam,
_In_ LPARAM  lParam 
)
staticprivate

Definition at line 316 of file MainWindow.cpp.

322 {
324  LRESULT RetCode = 0;
325 
326  // Get the object pointer from window context
328  if (This == NULL)
329  {
330  // Check that this isn't a create message
331  if (Msg != WM_INITDIALOG)
332  {
333  // Don't handle null info pointer
334  return FALSE;
335  }
336  }
337 
338  switch (Msg)
339  {
340  case WM_INITDIALOG:
341  {
342  // Get the object pointer from the create param
344 
345  // Store the pointer in the window's global user data
347 
348  // Call the create handler
349  return This->OnCreate(hwndDlg);
350  }
351 
352  case WM_SIZE:
353  {
354  return This->OnSize(wParam);
355  }
356 
357  case WM_NOTIFY:
358  {
359  return This->OnNotify(lParam);
360  }
361 
362  case WM_CONTEXTMENU:
363  {
364  return This->OnContext(lParam);
365  }
366 
367  case WM_COMMAND:
368  {
369  return This->OnCommand(wParam, lParam);
370  }
371 
372  case WM_SYSCOMMAND:
373  switch (wParam)
374  {
375  case ID_ABOUT:
376  // Apportion blame
377  MessageBoxW(This->m_hMainWnd,
378  L"ReactOS Character Map\r\nCopyright Ged Murphy 2015",
379  L"About",
380  MB_OK | MB_APPLMODAL);
381  break;
382  }
383  break;
384 
385  case WM_ENTERMENULOOP:
386  {
387  This->UpdateStatusBar(true);
388  return TRUE;
389  }
390 
391  case WM_EXITMENULOOP:
392  {
393  This->UpdateStatusBar(false);
394  return TRUE;
395  }
396 
397  case WM_CLOSE:
398  {
399  // Destroy the main window
400  return DestroyWindow(hwndDlg);
401  }
402 
403 
404  case WM_DESTROY:
405  {
406  // Call the destroy handler
407  return This->OnDestroy();
408  }
409  }
410 
411  return FALSE;
412 }
#define TRUE
Definition: types.h:120
#define MB_APPLMODAL
Definition: winuser.h:786
#define WM_CONTEXTMENU
Definition: richedit.h:64
BOOL WINAPI DestroyWindow(_In_ HWND)
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define WM_ENTERMENULOOP
Definition: winuser.h:1786
#define GWLP_USERDATA
Definition: treelist.c:63
#define WM_EXITMENULOOP
Definition: winuser.h:1787
smooth NULL
Definition: ftsmooth.c:416
#define WM_DESTROY
Definition: winuser.h:1591
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define WM_SIZE
Definition: winuser.h:1593
#define WM_CLOSE
Definition: winuser.h:1603
static const WCHAR L[]
Definition: oid.c:1250
struct @1580 Msg[]
#define WM_COMMAND
Definition: winuser.h:1722
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define MB_OK
Definition: winuser.h:784
#define GetWindowLongPtr
Definition: treelist.c:73
LONG_PTR LRESULT
Definition: windef.h:209
#define WM_SYSCOMMAND
Definition: winuser.h:1723
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61
#define ID_ABOUT
Definition: MainWindow.cpp:16

Referenced by Initialize().

◆ EnumDisplayFont()

int CALLBACK CCharMapWindow::EnumDisplayFont ( ENUMLOGFONTEXW lpelfe,
NEWTEXTMETRICEXW lpntme,
DWORD  FontType,
LPARAM  lParam 
)
staticprivate

Definition at line 422 of file MainWindow.cpp.

426 {
427  EnumFontParams *Params = (EnumFontParams *)lParam;
428  LPWSTR pszName = lpelfe->elfLogFont.lfFaceName;
429 
430  /* Skip rotated font */
431  if (pszName[0] == L'@') return 1;
432 
433  /* make sure font doesn't already exist in our list */
434  if (SendMessageW(Params->hCombo,
436  0,
437  (LPARAM)pszName) == CB_ERR)
438  {
439  INT idx;
440  idx = (INT)SendMessageW(Params->hCombo,
441  CB_ADDSTRING,
442  0,
443  (LPARAM)pszName);
444 
445  /* record the font's attributes (Fixedwidth and Truetype) */
446  BOOL fFixed = (lpelfe->elfLogFont.lfPitchAndFamily & FIXED_PITCH) ? TRUE : FALSE;
447  BOOL fTrueType = (lpelfe->elfLogFont.lfOutPrecision == OUT_STROKE_PRECIS) ? TRUE : FALSE;
448 
449  /* store this information in the list-item's userdata area */
450  SendMessageW(Params->hCombo,
452  idx,
453  MAKEWPARAM(fFixed, fTrueType));
454  }
455 
456  return 1;
457 }
#define CB_SETITEMDATA
Definition: winuser.h:1948
#define TRUE
Definition: types.h:120
#define MAKEWPARAM(l, h)
Definition: winuser.h:3948
BYTE lfPitchAndFamily
Definition: dimm.idl:71
#define INT
Definition: polytest.cpp:20
int32_t INT
Definition: typedefs.h:56
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXED_PITCH
Definition: wingdi.h:443
unsigned int idx
Definition: utils.c:41
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_ERR
Definition: winuser.h:2410
BYTE lfOutPrecision
Definition: dimm.idl:68
#define OUT_STROKE_PRECIS
Definition: wingdi.h:417
static const WCHAR L[]
Definition: oid.c:1250
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LOGFONTW elfLogFont
Definition: wingdi.h:2697
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPARAM lParam
Definition: combotst.c:139
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1922

Referenced by CreateFontComboBox().

◆ Initialize()

bool CCharMapWindow::Initialize ( _In_z_ LPCTSTR  lpCaption,
_In_ int  nCmdShow 
)
private

Definition at line 76 of file MainWindow.cpp.

78 {
79  // The dialog has a rich edit text box
80  m_hRichEd = LoadLibraryW(L"riched20.DLL");
81  if (m_hRichEd == NULL) return false;
82 
85  NULL,
86  DialogProc,
87  (LPARAM)this));
88 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
HINSTANCE g_hInstance
Definition: MainWindow.cpp:18
static INT_PTR CALLBACK DialogProc(_In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: MainWindow.cpp:316
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
HMODULE m_hRichEd
Definition: MainWindow.h:9
static const WCHAR L[]
Definition: oid.c:1250
#define IDD_CHARMAP
Definition: resource.h:7
HWND WINAPI CreateDialogParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by Create().

◆ OnCommand()

BOOL CCharMapWindow::OnCommand ( _In_ WPARAM  wParam,
LPARAM  lParam 
)
private

Definition at line 273 of file MainWindow.cpp.

275 {
276  LRESULT RetCode = 0;
277  WORD Msg;
278 
279  // Get the message
280  Msg = LOWORD(wParam);
281 
282  switch (Msg)
283  {
284  case IDC_CHECK_ADVANCED:
285  break;
286 
287  case IDC_FONTCOMBO:
288  if (HIWORD(wParam) == CBN_SELCHANGE)
289  {
290  ChangeMapFont();
291  }
292  break;
293 
294  default:
295  // We didn't handle it
296  RetCode = -1;
297  break;
298  }
299 
300  return RetCode;
301 }
#define IDC_CHECK_ADVANCED
Definition: resource.h:26
WPARAM wParam
Definition: combotst.c:138
unsigned short WORD
Definition: ntddk_ex.h:93
struct @1580 Msg[]
#define IDC_FONTCOMBO
Definition: resource.h:12
#define CBN_SELCHANGE
Definition: winuser.h:1961
#define HIWORD(l)
Definition: typedefs.h:246
LONG_PTR LRESULT
Definition: windef.h:209
bool ChangeMapFont()
Definition: MainWindow.cpp:518
#define LOWORD(l)
Definition: pedump.c:82

◆ OnContext()

BOOL CCharMapWindow::OnContext ( _In_ LPARAM  lParam)
private

Definition at line 267 of file MainWindow.cpp.

268 {
269  return 0;// m_GridView->OnContextMenu(lParam);
270 }

◆ OnCreate()

BOOL CCharMapWindow::OnCreate ( _In_ HWND  hwnd)
private

Definition at line 175 of file MainWindow.cpp.

176 {
177  m_hMainWnd = hDlg;
178 
179  if (!CreateStatusBar())
180  return FALSE;
181 
182  if (!m_GridView->Create(hDlg))
183  return FALSE;
184 
185  // Load an 'about' option into the system menu
186  HMENU hSysMenu;
187  hSysMenu = GetSystemMenu(m_hMainWnd, FALSE);
188  if (hSysMenu != NULL)
189  {
190  CAtlStringW AboutText;
191  if (AboutText.LoadStringW(IDS_ABOUT))
192  {
193  AppendMenuW(hSysMenu, MF_SEPARATOR, 0, NULL);
194  AppendMenuW(hSysMenu, MF_STRING, ID_ABOUT, AboutText);
195  }
196  }
197 
198  // Add all the fonts to the
199  if (!CreateFontComboBox())
200  return FALSE;
201 
202  ChangeMapFont();
203 
204  // Configure Richedit control for sending notification changes.
205  DWORD evMask;
206  evMask = SendDlgItemMessage(hDlg, IDC_TEXTBOX, EM_GETEVENTMASK, 0, 0);
207  evMask |= ENM_CHANGE;
209 
210  // Display the window according to the user request
212 
213  return TRUE;
214 }
#define TRUE
Definition: types.h:120
bool Create(_In_ HWND hParent)
Definition: GridView.cpp:36
#define EM_GETEVENTMASK
Definition: richedit.h:92
#define IDC_TEXTBOX
Definition: resource.h:15
#define MF_STRING
Definition: winuser.h:138
HWND m_hMainWnd
Definition: MainWindow.h:6
#define SendDlgItemMessage
Definition: winuser.h:5743
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI AppendMenuW(_In_ HMENU, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
#define IDS_ABOUT
Definition: resource.h:29
HMENU WINAPI GetSystemMenu(_In_ HWND, _In_ BOOL)
smooth NULL
Definition: ftsmooth.c:416
#define MF_SEPARATOR
Definition: winuser.h:137
LONG_PTR LPARAM
Definition: windef.h:208
#define EM_SETEVENTMASK
Definition: richedit.h:102
bool CreateFontComboBox()
Definition: MainWindow.cpp:461
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ENM_CHANGE
Definition: richedit.h:468
bool CreateStatusBar(void)
Definition: MainWindow.cpp:122
CGridView * m_GridView
Definition: MainWindow.h:11
bool ChangeMapFont()
Definition: MainWindow.cpp:518
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define ID_ABOUT
Definition: MainWindow.cpp:16

◆ OnDestroy()

BOOL CCharMapWindow::OnDestroy ( void  )
private

Definition at line 304 of file MainWindow.cpp.

305 {
306  // Clear the user data pointer
308 
309  // Break the message loop
310  PostQuitMessage(0);
311 
312  return TRUE;
313 }
#define TRUE
Definition: types.h:120
HWND m_hMainWnd
Definition: MainWindow.h:6
#define SetWindowLongPtr
Definition: treelist.c:70
#define GWLP_USERDATA
Definition: treelist.c:63
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

◆ OnNotify()

BOOL CCharMapWindow::OnNotify ( _In_ LPARAM  lParam)
private

Definition at line 244 of file MainWindow.cpp.

245 {
246  LPNMHDR NmHdr = (LPNMHDR)lParam;
247  LRESULT Ret = 0;
248 
249  switch (NmHdr->code)
250  {
251  case NM_RCLICK:
252  {
253  break;
254  }
255 
256  case NM_DBLCLK:
257  case NM_RETURN:
258  {
259  break;
260  }
261  }
262 
263  return Ret;
264 }
struct tagNMHDR * LPNMHDR
UINT code
Definition: winuser.h:3133
#define NM_RETURN
Definition: commctrl.h:132
#define NM_DBLCLK
Definition: commctrl.h:131
#define NM_RCLICK
Definition: commctrl.h:133
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139

◆ OnSize()

BOOL CCharMapWindow::OnSize ( void  )
private

Definition at line 217 of file MainWindow.cpp.

220 {
221  RECT rcClient, rcStatus;
222  INT lvHeight, iStatusHeight;
223 
224  // Resize the status bar
226 
227  // Get the statusbar rect and save the height
228  GetWindowRect(m_hStatusBar, &rcStatus);
229  iStatusHeight = rcStatus.bottom - rcStatus.top;
230 
231  // Get the full client rect
232  GetClientRect(m_hMainWnd, &rcClient);
233 
234  // Calculate the remaining height for the gridview
235  lvHeight = rcClient.bottom - iStatusHeight;
236 
237  // Resize the grid view
239 
240  return TRUE;
241 }
#define TRUE
Definition: types.h:120
LONG top
Definition: windef.h:292
HWND m_hMainWnd
Definition: MainWindow.h:6
int32_t INT
Definition: typedefs.h:56
WPARAM wParam
Definition: combotst.c:138
#define WM_SIZE
Definition: winuser.h:1593
HWND m_hStatusBar
Definition: MainWindow.h:7
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SendMessage
Definition: winuser.h:5744
CGridView * m_GridView
Definition: MainWindow.h:11
LONG bottom
Definition: windef.h:294
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
HWND GetHwnd()
Definition: GridView.h:49

◆ Run()

int CCharMapWindow::Run ( void  )
private

Definition at line 98 of file MainWindow.cpp.

99 {
100  MSG Msg;
101 
102  // Pump the message queue
103  while (GetMessageW(&Msg, NULL, 0, 0) != 0)
104  {
107  }
108 
109  return 0;
110 }
BOOL WINAPI TranslateMessage(_In_ const MSG *)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
smooth NULL
Definition: ftsmooth.c:416
struct @1580 Msg[]
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)

Referenced by Create().

◆ StatusBarLoadString()

bool CCharMapWindow::StatusBarLoadString ( _In_ HWND  hStatusBar,
_In_ INT  PartId,
_In_ HINSTANCE  hInstance,
_In_ UINT  uID 
)
private

Definition at line 153 of file MainWindow.cpp.

157 {
158  CAtlStringW szMessage;
159  bool bRet = false;
160 
161  // Load the string from the resource
162  if (szMessage.LoadStringW(hInstance, uID))
163  {
164  // Display it on the status bar
165  bRet = (SendMessageW(hStatusBar,
166  SB_SETTEXT,
167  (WPARAM)PartId,
168  (LPARAM)szMessage.GetBuffer()) != 0);
169  }
170 
171  return bRet;
172 }
UINT_PTR WPARAM
Definition: windef.h:207
HINSTANCE hInstance
Definition: charmap.c:20
LONG_PTR LPARAM
Definition: windef.h:208
HWND hStatusBar
Definition: main.cpp:35
#define SB_SETTEXT
Definition: commctrl.h:1921
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

◆ Uninitialize()

void CCharMapWindow::Uninitialize ( void  )
private

Definition at line 91 of file MainWindow.cpp.

92 {
93  if (m_hRichEd)
95 }
#define FreeLibrary(x)
Definition: compat.h:405
HMODULE m_hRichEd
Definition: MainWindow.h:9

Referenced by Create().

◆ UpdateStatusBar()

void CCharMapWindow::UpdateStatusBar ( _In_ bool  InMenuLoop)
private

Definition at line 113 of file MainWindow.cpp.

114 {
116  SB_SIMPLE,
117  (WPARAM)InMenuLoop,
118  0);
119 }
UINT_PTR WPARAM
Definition: windef.h:207
#define SB_SIMPLE
Definition: commctrl.h:1930
HWND m_hStatusBar
Definition: MainWindow.h:7
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Member Data Documentation

◆ m_CmdShow

int CCharMapWindow::m_CmdShow
private

Definition at line 8 of file MainWindow.h.

Referenced by Create(), and OnCreate().

◆ m_GridView

CGridView* CCharMapWindow::m_GridView
private

Definition at line 11 of file MainWindow.h.

Referenced by CCharMapWindow(), ChangeMapFont(), OnCreate(), and OnSize().

◆ m_hMainWnd

HWND CCharMapWindow::m_hMainWnd
private

◆ m_hRichEd

HMODULE CCharMapWindow::m_hRichEd
private

Definition at line 9 of file MainWindow.h.

Referenced by Initialize(), and Uninitialize().

◆ m_hStatusBar

HWND CCharMapWindow::m_hStatusBar
private

Definition at line 7 of file MainWindow.h.

Referenced by CreateStatusBar(), OnSize(), and UpdateStatusBar().


The documentation for this class was generated from the following files: