ReactOS  0.4.15-dev-3163-gf17c2c0
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
HWND m_hStatusBar
Definition: MainWindow.h:7
HMODULE m_hRichEd
Definition: MainWindow.h:9
#define NULL
Definition: types.h:112
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 517 of file MainWindow.cpp.

519 {
520  HWND hCombo;
522 
523  INT Length;
524  Length = GetWindowTextLengthW(hCombo);
525  if (!Length) return false;
526 
527  CAtlStringW FontName;
528  FontName.Preallocate(Length);
529 
530  SendMessageW(hCombo,
531  WM_GETTEXT,
532  FontName.GetAllocLength(),
533  (LPARAM)FontName.GetBuffer());
534 
535  return m_GridView->SetFont(FontName);
536 }
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define WM_GETTEXT
Definition: winuser.h:1601
bool SetFont(_In_ CAtlString &FontName)
Definition: GridView.cpp:67
HWND m_hMainWnd
Definition: MainWindow.h:6
int32_t INT
Definition: typedefs.h:58
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)
#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:17
HINSTANCE hInst
Definition: dxdiag.c:13

Referenced by wWinMain().

◆ CreateFontComboBox()

bool CCharMapWindow::CreateFontComboBox ( )
private

Definition at line 460 of file MainWindow.cpp.

461 {
462  HWND hCombo;
464 
465  NONCLIENTMETRICSW NonClientMetrics;
466  NonClientMetrics.cbSize = sizeof(NONCLIENTMETRICSW);
467  SystemParametersInfoW(SPI_GETNONCLIENTMETRICS,
468  sizeof(NONCLIENTMETRICSW),
469  &NonClientMetrics,
470  0);
471 
472  // Get a handle to the font
473  HFONT GuiFont;
474  GuiFont = CreateFontIndirectW(&NonClientMetrics.lfMessageFont);
475 
476  // Set the font used in the combo box
477  SendMessageW(hCombo,
478  WM_SETFONT,
479  (WPARAM)GuiFont,
480  0);
481 
482  // Set the fonts which we want to enumerate
483  LOGFONTW FontsToEnum;
484  ZeroMemory(&FontsToEnum, sizeof(LOGFONTW));
485  FontsToEnum.lfCharSet = DEFAULT_CHARSET;
486 
487  // Set the params we want to pass to the callback
489  Params.This = this;
490  Params.hCombo = hCombo;
491 
492  // Get a DC for combo box
493  HDC hdc;
494  hdc = GetDC(hCombo);
495 
496  // Enumerate all the fonts
497  int ret;
499  &FontsToEnum,
501  (LPARAM)&Params,
502  0);
503 
504  ReleaseDC(hCombo, hdc);
505  DeleteObject(GuiFont);
506 
507  // Select the first item in the list
508  SendMessageW(hCombo,
509  CB_SETCURSEL,
510  0,
511  0);
512 
513  return (ret == 1);
514 }
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:306
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:1664
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
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:1944
static int CALLBACK EnumDisplayFont(ENUMLOGFONTEXW *lpelfe, NEWTEXTMETRICEXW *lpntme, DWORD FontType, LPARAM lParam)
Definition: MainWindow.cpp:421
#define IDC_FONTCOMBO
Definition: resource.h:12
FARPROC FONTENUMPROCW
Definition: wingdi.h:2896
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETFONT
Definition: winuser.h:1633
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:1939
#define FALSE
Definition: types.h:117
#define IDD_STATUSBAR
Definition: resource.h:9
#define SB_SIMPLE
Definition: commctrl.h:1958
LONG_PTR LPARAM
Definition: windef.h:208
#define SBARS_SIZEGRIP
Definition: commctrl.h:1923
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 NULL
Definition: types.h:112
#define SB_SETPARTS
Definition: commctrl.h:1954
#define SendMessage
Definition: winuser.h:5819
#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  MessageBoxW(This->m_hMainWnd,
377  L"ReactOS Character Map\nCopyright Ged Murphy 2015",
378  L"About",
379  MB_OK | MB_APPLMODAL);
380  break;
381  }
382  break;
383 
384  case WM_ENTERMENULOOP:
385  {
386  This->UpdateStatusBar(true);
387  return TRUE;
388  }
389 
390  case WM_EXITMENULOOP:
391  {
392  This->UpdateStatusBar(false);
393  return TRUE;
394  }
395 
396  case WM_CLOSE:
397  {
398  // Destroy the main window
399  return DestroyWindow(hwndDlg);
400  }
401 
402 
403  case WM_DESTROY:
404  {
405  // Call the destroy handler
406  return This->OnDestroy();
407  }
408  }
409 
410  return FALSE;
411 }
#define MB_APPLMODAL
Definition: winuser.h:786
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define TRUE
Definition: types.h:120
BOOL WINAPI DestroyWindow(_In_ HWND)
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
#define WM_ENTERMENULOOP
Definition: winuser.h:1787
#define GWLP_USERDATA
Definition: treelist.c:63
#define WM_EXITMENULOOP
Definition: winuser.h:1788
#define WM_DESTROY
Definition: winuser.h:1592
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define WM_SIZE
Definition: winuser.h:1594
#define WM_CLOSE
Definition: winuser.h:1604
struct @1586 Msg[]
static const WCHAR L[]
Definition: oid.c:1250
#define WM_COMMAND
Definition: winuser.h:1723
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
#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:1724
#define WM_INITDIALOG
Definition: winuser.h:1722
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 421 of file MainWindow.cpp.

425 {
427  LPWSTR pszName = lpelfe->elfLogFont.lfFaceName;
428 
429  /* Skip rotated font */
430  if (pszName[0] == L'@') return 1;
431 
432  /* make sure font doesn't already exist in our list */
433  if (SendMessageW(Params->hCombo,
435  0,
436  (LPARAM)pszName) == CB_ERR)
437  {
438  INT idx;
439  idx = (INT)SendMessageW(Params->hCombo,
440  CB_ADDSTRING,
441  0,
442  (LPARAM)pszName);
443 
444  /* record the font's attributes (Fixedwidth and Truetype) */
445  BOOL fFixed = (lpelfe->elfLogFont.lfPitchAndFamily & FIXED_PITCH) ? TRUE : FALSE;
446  BOOL fTrueType = (lpelfe->elfLogFont.lfOutPrecision == OUT_STROKE_PRECIS) ? TRUE : FALSE;
447 
448  /* store this information in the list-item's userdata area */
449  SendMessageW(Params->hCombo,
451  idx,
452  MAKEWPARAM(fFixed, fTrueType));
453  }
454 
455  return 1;
456 }
#define CB_SETITEMDATA
Definition: winuser.h:1949
#define MAKEWPARAM(l, h)
Definition: winuser.h:3985
BYTE lfPitchAndFamily
Definition: dimm.idl:71
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:306
#define TRUE
Definition: types.h:120
#define INT
Definition: polytest.cpp:20
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
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:1919
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_ERR
Definition: winuser.h:2411
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:2701
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:1923

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:606
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
#define NULL
Definition: types.h:112
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 @1586 Msg[]
#define IDC_FONTCOMBO
Definition: resource.h:12
#define CBN_SELCHANGE
Definition: winuser.h:1962
#define HIWORD(l)
Definition: typedefs.h:247
LONG_PTR LRESULT
Definition: windef.h:209
bool ChangeMapFont()
Definition: MainWindow.cpp:517
#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 list
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 }
bool Create(_In_ HWND hParent)
Definition: GridView.cpp:36
#define EM_GETEVENTMASK
Definition: richedit.h:92
#define IDC_TEXTBOX
Definition: resource.h:15
#define TRUE
Definition: types.h:120
#define MF_STRING
Definition: winuser.h:138
HWND m_hMainWnd
Definition: MainWindow.h:6
#define SendDlgItemMessage
Definition: winuser.h:5818
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
#define FALSE
Definition: types.h:117
HMENU WINAPI GetSystemMenu(_In_ HWND, _In_ BOOL)
#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:460
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ENM_CHANGE
Definition: richedit.h:468
#define NULL
Definition: types.h:112
bool CreateStatusBar(void)
Definition: MainWindow.cpp:122
CGridView * m_GridView
Definition: MainWindow.h:11
bool ChangeMapFont()
Definition: MainWindow.cpp:517
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:3135
#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:307
HWND m_hMainWnd
Definition: MainWindow.h:6
int32_t INT
Definition: typedefs.h:58
WPARAM wParam
Definition: combotst.c:138
#define WM_SIZE
Definition: winuser.h:1594
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:5819
CGridView * m_GridView
Definition: MainWindow.h:11
LONG bottom
Definition: windef.h:309
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 *)
struct @1586 Msg[]
#define NULL
Definition: types.h:112
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:1949
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:607
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:1958
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: