[CHARMAP_NEW]
[reactos.git] / reactos / base / applications / charmap_new / MainWindow.cpp
index 82f0796..6bf1be8 100644 (file)
@@ -199,6 +199,8 @@ CCharMapWindow::OnCreate(_In_ HWND hDlg)
     if (!CreateFontComboBox())
         return FALSE;
 
+    ChangeMapFont();
+
     // Configure Richedit control for sending notification changes.
     DWORD evMask;
     evMask = SendDlgItemMessage(hDlg, IDC_TEXTBOX, EM_GETEVENTMASK, 0, 0);
@@ -283,6 +285,13 @@ CCharMapWindow::OnCommand(_In_ WPARAM wParam,
     case IDC_CHECK_ADVANCED:
         break;
 
+    case IDC_FONTCOMBO:
+        if (HIWORD(wParam) == CBN_SELCHANGE)
+        {
+            ChangeMapFont();
+        }
+        break;
+
     default:
         // We didn't handle it
         RetCode = -1;
@@ -504,4 +513,26 @@ CCharMapWindow::CreateFontComboBox()
                  0);
 
     return (ret == 1);
-}
\ No newline at end of file
+}
+
+bool
+CCharMapWindow::ChangeMapFont(
+    )
+{
+    HWND hCombo;
+    hCombo = GetDlgItem(m_hMainWnd, IDC_FONTCOMBO);
+
+    INT Length;
+    Length = GetWindowTextLengthW(hCombo);
+    if (!Length) return false;
+
+    CAtlStringW FontName;// = L"hahaha";
+    FontName.Preallocate(Length);
+
+    SendMessageW(hCombo,
+                 WM_GETTEXT,
+                 FontName.GetAllocLength(),
+                 (LPARAM)FontName.GetBuffer());
+
+    return m_GridView->SetFont(FontName);
+}