ReactOS  0.4.15-dev-4872-g8a3db97
CFontsDialog Class Reference

#include <dialogs.h>

Inheritance diagram for CFontsDialog:
Collaboration diagram for CFontsDialog:

Public Types

enum  { IDD = IDD_FONTS }
 

Public Member Functions

 CFontsDialog ()
 
void InitFontNames ()
 
void InitFontSizes ()
 
void InitToolbar ()
 

Protected Member Functions

LRESULT OnInitDialog (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnClose (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnCommand (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnMove (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnNotify (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnToolsModelToolChanged (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnMeasureItem (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnDrawItem (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
void OnFontSize (UINT codeNotify)
 
void OnFontName (UINT codeNotify)
 

Detailed Description

Definition at line 90 of file dialogs.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
IDD 

Definition at line 93 of file dialogs.h.

93 { IDD = IDD_FONTS };
#define IDD_FONTS
Definition: resource.h:174

Constructor & Destructor Documentation

◆ CFontsDialog()

CFontsDialog::CFontsDialog ( )

Definition at line 283 of file dialogs.cpp.

284 {
285 }

Member Function Documentation

◆ InitFontNames()

void CFontsDialog::InitFontNames ( )

Definition at line 287 of file dialogs.cpp.

288 {
289  // List the fonts
290  CSimpleArray<CString> arrFontNames;
292  if (hDC)
293  {
295  reinterpret_cast<LPARAM>(&arrFontNames));
296  DeleteDC(hDC);
297  }
298 
299  // Actually add them to the combobox
300  HWND hwndNames = GetDlgItem(IDD_FONTSNAMES);
301  SendMessage(hwndNames, CB_RESETCONTENT, 0, 0);
302  for (INT i = 0; i < arrFontNames.GetSize(); ++i)
303  {
304  ComboBox_AddString(hwndNames, arrFontNames[i]);
305  }
306 
308 }
#define ComboBox_AddString(hwndCtl, lpsz)
Definition: windowsx.h:16
static HDC
Definition: imagelist.c:92
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
CString strFontName
Definition: registry.h:35
#define IDD_FONTSNAMES
Definition: resource.h:175
int32_t INT
Definition: typedefs.h:58
static INT CALLBACK EnumFontFamProc(ENUMLOGFONT *lpelf, NEWTEXTMETRIC *lpntm, INT FontType, LPARAM lParam)
Definition: dialogs.cpp:264
#define CB_RESETCONTENT
Definition: winuser.h:1946
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define EnumFontFamilies
Definition: wingdi.h:4450
static HDC hDC
Definition: 3dtext.c:33
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
BOOL WINAPI DeleteDC(_In_ HDC)
#define SetWindowText
Definition: winuser.h:5837
#define NULL
Definition: types.h:112
FONTENUMPROCA FONTENUMPROC
Definition: wingdi.h:2902
#define SendMessage
Definition: winuser.h:5823
RegistrySettings registrySettings
Definition: main.cpp:30

Referenced by OnInitDialog().

◆ InitFontSizes()

void CFontsDialog::InitFontSizes ( )

Definition at line 310 of file dialogs.cpp.

311 {
312  static const INT s_sizes[] =
313  {
314  8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72
315  };
316 
317  HWND hwndSizes = GetDlgItem(IDD_FONTSSIZES);
318  ComboBox_ResetContent(hwndSizes);
319 
320  TCHAR szText[16];
321  for (UINT i = 0; i < _countof(s_sizes); ++i)
322  {
323  wsprintf(szText, TEXT("%d"), s_sizes[i]);
324  INT iItem = ComboBox_AddString(hwndSizes, szText);
325  if (s_sizes[i] == (INT)registrySettings.PointSize)
326  ComboBox_SetCurSel(hwndSizes, iItem);
327  }
328 
329  if (ComboBox_GetCurSel(hwndSizes) == CB_ERR)
330  {
331  wsprintf(szText, TEXT("%d"), (INT)registrySettings.PointSize);
332  ::SetWindowText(hwndSizes, szText);
333  }
334 }
#define ComboBox_AddString(hwndCtl, lpsz)
Definition: windowsx.h:16
#define ComboBox_GetCurSel(hwndCtl)
Definition: windowsx.h:24
int32_t INT
Definition: typedefs.h:58
#define CB_ERR
Definition: winuser.h:2415
char TCHAR
Definition: xmlstorage.h:189
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define _countof(array)
Definition: sndvol32.h:68
DWORD PointSize
Definition: registry.h:36
#define ComboBox_SetCurSel(hwndCtl, index)
Definition: windowsx.h:41
#define TEXT(s)
Definition: k32.h:26
#define ComboBox_ResetContent(hwndCtl)
Definition: windowsx.h:38
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define SetWindowText
Definition: winuser.h:5837
unsigned int UINT
Definition: ndis.h:50
#define IDD_FONTSSIZES
Definition: resource.h:176
RegistrySettings registrySettings
Definition: main.cpp:30
#define wsprintf
Definition: winuser.h:5845

Referenced by OnInitDialog().

◆ InitToolbar()

void CFontsDialog::InitToolbar ( )

Definition at line 336 of file dialogs.cpp.

337 {
338  HWND hwndToolbar = GetDlgItem(IDD_FONTSTOOLBAR);
339  SendMessage(hwndToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
340  SendMessage(hwndToolbar, TB_SETBITMAPSIZE, 0, MAKELPARAM(16, 16));
341  SendMessage(hwndToolbar, TB_SETBUTTONWIDTH, 0, MAKELPARAM(20, 20));
342 
344  AddBitmap.hInst = hProgInstance;
346  SendMessage(hwndToolbar, TB_ADDBITMAP, 4, (LPARAM)&AddBitmap);
347 
349  16, 8, RGB(255, 0, 255), IMAGE_BITMAP,
351  SendMessage(hwndToolbar, TB_SETIMAGELIST, 0, (LPARAM)himl);
352 
353  TBBUTTON buttons[] =
354  {
358  { 3, IDM_VERTICAL, 0, TBSTYLE_CHECK }, // TODO:
359  };
361 
365 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define TB_BUTTONSTRUCTSIZE
Definition: commctrl.h:1134
#define RGB(r, g, b)
Definition: precomp.h:62
#define MAKELPARAM(l, h)
Definition: winuser.h:3988
#define ImageList_LoadImage
Definition: commctrl.h:508
HIMAGELIST himl
#define IDM_UNDERLINE
Definition: resource.h:102
LONG_PTR LPARAM
Definition: windef.h:208
#define TB_SETIMAGELIST
Definition: commctrl.h:1150
#define IDM_BOLD
Definition: resource.h:100
NTSTATUS AddBitmap(PNTFS_VCB Vcb, PFILE_RECORD_HEADER FileRecord, PNTFS_ATTR_RECORD AttributeAddress, PCWSTR Name, USHORT NameLength)
Definition: attrib.c:72
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define _countof(array)
Definition: sndvol32.h:68
#define TB_ADDBITMAP
Definition: commctrl.h:1056
DWORD Underline
Definition: registry.h:39
#define IDM_VERTICAL
Definition: resource.h:103
#define TB_ADDBUTTONS
Definition: commctrl.h:1271
#define TB_CHECKBUTTON
Definition: commctrl.h:1043
#define TB_SETBITMAPSIZE
Definition: commctrl.h:1136
#define TB_SETBUTTONWIDTH
Definition: commctrl.h:1161
#define IDB_FONTSTOOLBAR
Definition: resource.h:16
HINSTANCE hProgInstance
Definition: main.cpp:50
HWND buttons[5]
Definition: sndrec32.cpp:40
#define IDD_FONTSTOOLBAR
Definition: resource.h:177
#define LR_CREATEDIBSECTION
Definition: winuser.h:1092
#define IMAGE_BITMAP
Definition: winuser.h:211
#define SendMessage
Definition: winuser.h:5823
#define TBSTATE_ENABLED
Definition: commctrl.h:974
#define IDM_ITALIC
Definition: resource.h:101
#define TBSTYLE_CHECK
Definition: commctrl.h:983
RegistrySettings registrySettings
Definition: main.cpp:30

Referenced by OnInitDialog().

◆ OnClose()

LRESULT CFontsDialog::OnClose ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
protected

Definition at line 389 of file dialogs.cpp.

390 {
391  ShowWindow(SW_HIDE); // Just hide. Recycle for optimization
392  return 0;
393 }
#define SW_HIDE
Definition: winuser.h:762
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)

◆ OnCommand()

LRESULT CFontsDialog::OnCommand ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
protected

Definition at line 458 of file dialogs.cpp.

459 {
460  UINT id = LOWORD(wParam);
461  UINT codeNotify = HIWORD(wParam);
462  HWND hwndToolbar = GetDlgItem(IDD_FONTSTOOLBAR);
463  BOOL bChecked = ::SendMessage(hwndToolbar, TB_ISBUTTONCHECKED, id, 0);
464 
465  switch (id)
466  {
467  case IDCANCEL:
470  break;
471 
472  case IDD_FONTSNAMES:
473  OnFontName(codeNotify);
474  break;
475 
476  case IDD_FONTSSIZES:
477  OnFontSize(codeNotify);
478  break;
479 
480  case IDM_BOLD:
481  registrySettings.Bold = bChecked;
483  break;
484 
485  case IDM_ITALIC:
486  registrySettings.Italic = bChecked;
488  break;
489 
490  case IDM_UNDERLINE:
491  registrySettings.Underline = bChecked;
493  break;
494 
495  case IDM_VERTICAL:
496  // TODO:
497  break;
498  }
499  return 0;
500 }
ToolsModel toolsModel
Definition: main.cpp:18
#define SW_HIDE
Definition: winuser.h:762
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDD_FONTSNAMES
Definition: resource.h:175
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDM_UNDERLINE
Definition: resource.h:102
DWORD ShowTextTool
Definition: registry.h:43
#define IDM_BOLD
Definition: resource.h:100
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
void NotifyToolChanged()
Definition: toolsmodel.cpp:159
void OnFontSize(UINT codeNotify)
Definition: dialogs.cpp:426
DWORD Underline
Definition: registry.h:39
#define IDM_VERTICAL
Definition: resource.h:103
#define IDD_FONTSTOOLBAR
Definition: resource.h:177
unsigned int UINT
Definition: ndis.h:50
#define SendMessage
Definition: winuser.h:5823
#define HIWORD(l)
Definition: typedefs.h:247
#define IDM_ITALIC
Definition: resource.h:101
#define IDD_FONTSSIZES
Definition: resource.h:176
#define TB_ISBUTTONCHECKED
Definition: commctrl.h:1049
#define IDCANCEL
Definition: winuser.h:825
RegistrySettings registrySettings
Definition: main.cpp:30
void OnFontName(UINT codeNotify)
Definition: dialogs.cpp:395
#define LOWORD(l)
Definition: pedump.c:82

◆ OnDrawItem()

LRESULT CFontsDialog::OnDrawItem ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
protected

Definition at line 554 of file dialogs.cpp.

555 {
556  // TODO: Owner-draw the font types
557  if (wParam == IDD_FONTSNAMES)
558  {
559  LPDRAWITEMSTRUCT pDrawItem = reinterpret_cast<LPDRAWITEMSTRUCT>(lParam);
560  if (pDrawItem->itemID == (UINT)-1)
561  return TRUE;
562 
563  SetBkMode(pDrawItem->hDC, TRANSPARENT);
564 
565  HWND hwndItem = pDrawItem->hwndItem;
566  RECT rcItem = pDrawItem->rcItem;
567  if (pDrawItem->itemState & ODS_SELECTED)
568  {
569  FillRect(pDrawItem->hDC, &rcItem, GetSysColorBrush(COLOR_HIGHLIGHT));
571  }
572  else
573  {
574  FillRect(pDrawItem->hDC, &rcItem, GetSysColorBrush(COLOR_WINDOW));
576  }
577 
578  TCHAR szText[LF_FACESIZE];
579  if ((UINT)ComboBox_GetLBTextLen(hwndItem, pDrawItem->itemID) < _countof(szText))
580  {
581  szText[0] = 0;
582  ComboBox_GetLBText(hwndItem, pDrawItem->itemID, szText);
583 
584  rcItem.left += 24;
585  DrawText(pDrawItem->hDC, szText, -1, &rcItem, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
586  }
587 
588  if (pDrawItem->itemState & ODS_FOCUS)
589  ::DrawFocusRect(pDrawItem->hDC, &pDrawItem->rcItem);
590 
591  return TRUE;
592  }
593  return 0;
594 }
#define COLOR_HIGHLIGHT
Definition: winuser.h:920
#define LF_FACESIZE
Definition: dimm.idl:39
#define ComboBox_GetLBText(hwndCtl, index, lpszBuffer)
Definition: windowsx.h:31
#define TRUE
Definition: types.h:120
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)
#define ODS_FOCUS
Definition: winuser.h:2529
LONG left
Definition: windef.h:306
#define IDD_FONTSNAMES
Definition: resource.h:175
#define COLOR_WINDOW
Definition: winuser.h:912
DWORD WINAPI GetSysColor(_In_ int)
WPARAM wParam
Definition: combotst.c:138
#define DrawText
Definition: winuser.h:5751
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
#define DT_LEFT
Definition: winuser.h:534
#define TRANSPARENT
Definition: wingdi.h:950
#define DT_VCENTER
Definition: winuser.h:543
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:921
char TCHAR
Definition: xmlstorage.h:189
#define COLOR_WINDOWTEXT
Definition: winuser.h:915
#define _countof(array)
Definition: sndvol32.h:68
#define ComboBox_GetLBTextLen(hwndCtl, index)
Definition: windowsx.h:32
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:911
#define DT_SINGLELINE
Definition: winuser.h:540
unsigned int UINT
Definition: ndis.h:50
#define ODS_SELECTED
Definition: winuser.h:2525
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI GetSysColorBrush(_In_ int)
LPARAM lParam
Definition: combotst.c:139

◆ OnFontName()

void CFontsDialog::OnFontName ( UINT  codeNotify)
protected

Definition at line 395 of file dialogs.cpp.

396 {
397  HWND hwndNames = GetDlgItem(IDD_FONTSNAMES);
398  INT iItem = CB_ERR;
399  UINT cch;
400  TCHAR szText[LF_FACESIZE];
401 
402  switch (codeNotify)
403  {
404  case CBN_SELCHANGE:
405  iItem = ComboBox_GetCurSel(hwndNames);
406  cch = ComboBox_GetLBTextLen(hwndNames, iItem);
407  if (iItem != CB_ERR && 0 < cch && cch < _countof(szText))
408  {
409  ComboBox_GetLBText(hwndNames, iItem, szText);
410  }
411  break;
412 
413  case CBN_EDITCHANGE:
414  GetDlgItemText(IDD_FONTSNAMES, szText, _countof(szText));
415  iItem = ComboBox_FindStringExact(hwndNames, -1, szText);
416  break;
417  }
418 
419  if (iItem != CB_ERR && registrySettings.strFontName.CompareNoCase(szText) != 0)
420  {
421  registrySettings.strFontName = szText;
423  }
424 }
ToolsModel toolsModel
Definition: main.cpp:18
#define LF_FACESIZE
Definition: dimm.idl:39
#define ComboBox_GetLBText(hwndCtl, index, lpszBuffer)
Definition: windowsx.h:31
int CompareNoCase(_In_z_ PCXSTR psz) const
Definition: cstringt.h:695
#define ComboBox_GetCurSel(hwndCtl)
Definition: windowsx.h:24
CString strFontName
Definition: registry.h:35
#define IDD_FONTSNAMES
Definition: resource.h:175
int32_t INT
Definition: typedefs.h:58
#define ComboBox_FindStringExact(hwndCtl, indexStart, lpszFind)
Definition: windowsx.h:22
#define CB_ERR
Definition: winuser.h:2415
char TCHAR
Definition: xmlstorage.h:189
#define GetDlgItemText
Definition: winuser.h:5765
#define CBN_EDITCHANGE
Definition: winuser.h:1962
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define _countof(array)
Definition: sndvol32.h:68
void NotifyToolChanged()
Definition: toolsmodel.cpp:159
#define ComboBox_GetLBTextLen(hwndCtl, index)
Definition: windowsx.h:32
unsigned int UINT
Definition: ndis.h:50
#define CBN_SELCHANGE
Definition: winuser.h:1966
RegistrySettings registrySettings
Definition: main.cpp:30
IN PCTCH IN DWORD cch
Definition: pager.h:36

Referenced by OnCommand().

◆ OnFontSize()

void CFontsDialog::OnFontSize ( UINT  codeNotify)
protected

Definition at line 426 of file dialogs.cpp.

427 {
428  HWND hwndSizes = GetDlgItem(IDD_FONTSSIZES);
429  WCHAR szText[8];
430  INT iItem, PointSize = 0;
431  UINT cch;
432 
433  switch (codeNotify)
434  {
435  case CBN_SELCHANGE:
436  iItem = ComboBox_GetCurSel(hwndSizes);
437  cch = ComboBox_GetLBTextLen(hwndSizes, iItem);
438  if (iItem != CB_ERR && 0 < cch && cch < _countof(szText))
439  {
440  ComboBox_GetLBText(hwndSizes, iItem, szText);
441  PointSize = _ttoi(szText);
442  }
443  break;
444 
445  case CBN_EDITCHANGE:
446  ::GetWindowText(hwndSizes, szText, _countof(szText));
447  PointSize = _ttoi(szText);
448  break;
449  }
450 
451  if (PointSize > 0)
452  {
453  registrySettings.PointSize = PointSize;
455  }
456 }
ToolsModel toolsModel
Definition: main.cpp:18
#define ComboBox_GetLBText(hwndCtl, index, lpszBuffer)
Definition: windowsx.h:31
#define ComboBox_GetCurSel(hwndCtl)
Definition: windowsx.h:24
int32_t INT
Definition: typedefs.h:58
#define GetWindowText
Definition: winuser.h:5778
#define CB_ERR
Definition: winuser.h:2415
#define CBN_EDITCHANGE
Definition: winuser.h:1962
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
void NotifyToolChanged()
Definition: toolsmodel.cpp:159
DWORD PointSize
Definition: registry.h:36
#define ComboBox_GetLBTextLen(hwndCtl, index)
Definition: windowsx.h:32
int CDECL _ttoi(const _TCHAR *str)
Definition: atoi.c:10
unsigned int UINT
Definition: ndis.h:50
#define CBN_SELCHANGE
Definition: winuser.h:1966
#define IDD_FONTSSIZES
Definition: resource.h:176
RegistrySettings registrySettings
Definition: main.cpp:30
IN PCTCH IN DWORD cch
Definition: pager.h:36

Referenced by OnCommand().

◆ OnInitDialog()

LRESULT CFontsDialog::OnInitDialog ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
protected

Definition at line 367 of file dialogs.cpp.

368 {
369  // TODO: Tooltips
370  InitFontNames();
371  InitFontSizes();
372  InitToolbar();
373 
375  {
378  0, 0,
380  SendMessage(DM_REPOSITION, 0, 0);
381  }
382 
385 
386  return TRUE;
387 }
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
#define SWP_NOZORDER
Definition: winuser.h:1237
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
void InitFontNames()
Definition: dialogs.cpp:287
DWORD ShowTextTool
Definition: registry.h:43
DWORD FontsPositionY
Definition: registry.h:42
#define SWP_NOACTIVATE
Definition: winuser.h:1232
#define DM_REPOSITION
Definition: winuser.h:2087
DWORD FontsPositionX
Definition: registry.h:41
#define SWP_NOSIZE
Definition: winuser.h:1235
#define NULL
Definition: types.h:112
#define SendMessage
Definition: winuser.h:5823
void InitToolbar()
Definition: dialogs.cpp:336
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
RegistrySettings registrySettings
Definition: main.cpp:30
void InitFontSizes()
Definition: dialogs.cpp:310

◆ OnMeasureItem()

LRESULT CFontsDialog::OnMeasureItem ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
protected

Definition at line 540 of file dialogs.cpp.

541 {
542  if (wParam == IDD_FONTSNAMES)
543  {
544  LPMEASUREITEMSTRUCT pMeasureItem = reinterpret_cast<LPMEASUREITEMSTRUCT>(lParam);
545  RECT rc;
547  pMeasureItem->itemWidth = rc.right - rc.left;
548  pMeasureItem->itemHeight = GetSystemMetrics(SM_CYVSCROLL);
549  return TRUE;
550  }
551  return 0;
552 }
#define TRUE
Definition: types.h:120
#define SM_CYVSCROLL
Definition: winuser.h:975
LONG left
Definition: windef.h:306
#define IDD_FONTSNAMES
Definition: resource.h:175
LONG right
Definition: windef.h:308
WPARAM wParam
Definition: combotst.c:138
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
LPARAM lParam
Definition: combotst.c:139

◆ OnMove()

LRESULT CFontsDialog::OnMove ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
protected

Definition at line 523 of file dialogs.cpp.

524 {
525  RECT rc;
526  GetWindowRect(&rc);
529  return 0;
530 }
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
DWORD FontsPositionY
Definition: registry.h:42
DWORD FontsPositionX
Definition: registry.h:41
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
RegistrySettings registrySettings
Definition: main.cpp:30

◆ OnNotify()

LRESULT CFontsDialog::OnNotify ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
protected

Definition at line 502 of file dialogs.cpp.

503 {
504  NMHDR *pnmhdr = reinterpret_cast<NMHDR *>(lParam);
505  if (pnmhdr->code == TTN_NEEDTEXT)
506  {
507  LPTOOLTIPTEXT pToolTip = reinterpret_cast<LPTOOLTIPTEXT>(lParam);
508  pToolTip->hinst = hProgInstance;
509  switch (pnmhdr->idFrom)
510  {
511  case IDM_BOLD: pToolTip->lpszText = MAKEINTRESOURCE(IDS_BOLD); break;
512  case IDM_ITALIC: pToolTip->lpszText = MAKEINTRESOURCE(IDS_ITALIC); break;
513  case IDM_UNDERLINE: pToolTip->lpszText = MAKEINTRESOURCE(IDS_UNDERLINE); break;
514  case IDM_VERTICAL: pToolTip->lpszText = MAKEINTRESOURCE(IDS_VERTICAL); break;
515 
516  default:
517  break;
518  }
519  }
520  return 0;
521 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
UINT code
Definition: winuser.h:3139
UINT_PTR idFrom
Definition: winuser.h:3138
#define IDS_UNDERLINE
Definition: resource.h:219
#define IDM_UNDERLINE
Definition: resource.h:102
#define TTN_NEEDTEXT
Definition: commctrl.h:1880
#define LPTOOLTIPTEXT
Definition: commctrl.h:1890
#define IDM_BOLD
Definition: resource.h:100
#define IDS_VERTICAL
Definition: resource.h:220
#define IDS_ITALIC
Definition: resource.h:218
#define IDM_VERTICAL
Definition: resource.h:103
HINSTANCE hProgInstance
Definition: main.cpp:50
#define IDS_BOLD
Definition: resource.h:217
#define IDM_ITALIC
Definition: resource.h:101
LPARAM lParam
Definition: combotst.c:139

◆ OnToolsModelToolChanged()

LRESULT CFontsDialog::OnToolsModelToolChanged ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
protected

Definition at line 532 of file dialogs.cpp.

533 {
534  if (wParam != TOOL_TEXT)
536 
537  return 0;
538 }
#define SW_HIDE
Definition: winuser.h:762
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
WPARAM wParam
Definition: combotst.c:138

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