Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
2.9 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1998.
  5. //
  6. // File: lcidpick.cpp
  7. //
  8. // Contents: locale picker dialog
  9. //
  10. // Classes: CLcidPick
  11. //
  12. // History: 03-14-1998 stevebl Commented
  13. //
  14. //---------------------------------------------------------------------------
  15. #include "precomp.hxx"
  16. #ifdef _DEBUG
  17. #define new DEBUG_NEW
  18. #undef THIS_FILE
  19. static char THIS_FILE[] = __FILE__;
  20. #endif
  21. /////////////////////////////////////////////////////////////////////////////
  22. // CLcidPick dialog
  23. CLcidPick::CLcidPick(CWnd* pParent /*=NULL*/)
  24. : CDialog(CLcidPick::IDD, pParent)
  25. {
  26. //{{AFX_DATA_INIT(CLcidPick)
  27. // NOTE: the ClassWizard will add member initialization here
  28. //}}AFX_DATA_INIT
  29. }
  30. void CLcidPick::DoDataExchange(CDataExchange* pDX)
  31. {
  32. CDialog::DoDataExchange(pDX);
  33. //{{AFX_DATA_MAP(CLcidPick)
  34. // NOTE: the ClassWizard will add DDX and DDV calls here
  35. //}}AFX_DATA_MAP
  36. }
  37. BEGIN_MESSAGE_MAP(CLcidPick, CDialog)
  38. //{{AFX_MSG_MAP(CLcidPick)
  39. ON_BN_CLICKED(IDC_BUTTON1, OnRemove)
  40. ON_WM_CONTEXTMENU()
  41. //}}AFX_MSG_MAP
  42. END_MESSAGE_MAP()
  43. /////////////////////////////////////////////////////////////////////////////
  44. // CLcidPick message handlers
  45. void CLcidPick::OnRemove()
  46. {
  47. CListBox * pList = (CListBox *)GetDlgItem(IDC_LIST1);
  48. int iSel = pList->GetCurSel();
  49. if (iSel != LB_ERR)
  50. {
  51. pList->DeleteString(iSel);
  52. set<LCID>::iterator i = m_psLocales->begin();
  53. while (iSel--)
  54. {
  55. i++;
  56. }
  57. m_psLocales->erase(*i);
  58. }
  59. }
  60. BOOL CLcidPick::OnInitDialog()
  61. {
  62. CListBox * pList = (CListBox *)GetDlgItem(IDC_LIST1);
  63. TCHAR szBuffer[256];
  64. // for every item in m_psLocales
  65. set<LCID>::iterator i;
  66. for (i = m_psLocales->begin(); i != m_psLocales->end(); i++)
  67. {
  68. // UNDONE - convert to a human readable string (not a number)
  69. CString sz;
  70. GetLocaleInfo(*i, LOCALE_SLANGUAGE, szBuffer, 256);
  71. sz += szBuffer;
  72. #ifdef SHOWCOUNTRY
  73. sz += _T(" - ");
  74. GetLocaleInfo(*i, LOCALE_SCOUNTRY, szBuffer, 256);
  75. sz += szBuffer;
  76. #endif
  77. pList->AddString(sz);
  78. }
  79. CDialog::OnInitDialog();
  80. return TRUE; // return TRUE unless you set the focus to a control
  81. // EXCEPTION: OCX Property Pages should return FALSE
  82. }
  83. LRESULT CLcidPick::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
  84. {
  85. switch (message)
  86. {
  87. case WM_HELP:
  88. StandardHelp((HWND)((LPHELPINFO) lParam)->hItemHandle, IDD);
  89. return 0;
  90. default:
  91. return CDialog::WindowProc(message, wParam, lParam);
  92. }
  93. }
  94. void CLcidPick::OnContextMenu(CWnd* pWnd, CPoint point)
  95. {
  96. StandardContextMenu(pWnd->m_hWnd, IDD_LOCALE_PICKER);
  97. }